Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1530bfb

Browse files
committed
fix agent
1 parent7e0ceec commit1530bfb

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

‎agent/agent.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,7 @@ func (a *agent) run() (retErr error) {
936936
connMan.startAgentAPI("send logs",gracefulShutdownBehaviorRemain,
937937
func(ctx context.Context,aAPI proto.DRPCAgentClient24)error {
938938
err:=a.logSender.SendLoop(ctx,aAPI)
939-
ifxerrors.Is(err,agentsdk.LogLimitExceededError) {
939+
ifxerrors.Is(err,agentsdk.ErrLogLimitExceeded) {
940940
// we don't want this error to tear down the API connection and propagate to the
941941
// other routines that use the API. The LogSender has already dropped a warning
942942
// log, so just return nil here.
@@ -1564,9 +1564,13 @@ func (a *agent) Collect(ctx context.Context, networkStats map[netlogtype.Connect
15641564
}
15651565
forconn,counts:=rangenetworkStats {
15661566
stats.ConnectionsByProto[conn.Proto.String()]++
1567+
// #nosec G115 - Safe conversions for network statistics which we expect to be within int64 range
15671568
stats.RxBytes+=int64(counts.RxBytes)
1569+
// #nosec G115 - Safe conversions for network statistics which we expect to be within int64 range
15681570
stats.RxPackets+=int64(counts.RxPackets)
1571+
// #nosec G115 - Safe conversions for network statistics which we expect to be within int64 range
15691572
stats.TxBytes+=int64(counts.TxBytes)
1573+
// #nosec G115 - Safe conversions for network statistics which we expect to be within int64 range
15701574
stats.TxPackets+=int64(counts.TxPackets)
15711575
}
15721576

@@ -1730,7 +1734,7 @@ func (a *agent) HTTPDebug() http.Handler {
17301734
r.Get("/debug/magicsock",a.HandleHTTPDebugMagicsock)
17311735
r.Get("/debug/magicsock/debug-logging/{state}",a.HandleHTTPMagicsockDebugLoggingState)
17321736
r.Get("/debug/manifest",a.HandleHTTPDebugManifest)
1733-
r.NotFound(func(w http.ResponseWriter,r*http.Request) {
1737+
r.NotFound(func(w http.ResponseWriter,_*http.Request) {
17341738
w.WriteHeader(http.StatusNotFound)
17351739
_,_=w.Write([]byte("404 not found"))
17361740
})
@@ -2016,7 +2020,7 @@ func (a *apiConnRoutineManager) wait() error {
20162020
}
20172021

20182022
funcPrometheusMetricsHandler(prometheusRegistry*prometheus.Registry,logger slog.Logger) http.Handler {
2019-
returnhttp.HandlerFunc(func(w http.ResponseWriter,r*http.Request) {
2023+
returnhttp.HandlerFunc(func(w http.ResponseWriter,_*http.Request) {
20202024
w.Header().Set("Content-Type","text/plain")
20212025

20222026
// Based on: https://github.com/tailscale/tailscale/blob/280255acae604796a1113861f5a84e6fa2dc6121/ipn/localapi/localapi.go#L489
@@ -2052,5 +2056,6 @@ func WorkspaceKeySeed(workspaceID uuid.UUID, agentName string) (int64, error) {
20522056
return42,err
20532057
}
20542058

2059+
// #nosec G115 - Safe conversion to generate int64 hash from Sum64, data loss acceptable
20552060
returnint64(h.Sum64()),nil
20562061
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp