@@ -936,7 +936,7 @@ func (a *agent) run() (retErr error) {
936
936
connMan .startAgentAPI ("send logs" ,gracefulShutdownBehaviorRemain ,
937
937
func (ctx context.Context ,aAPI proto.DRPCAgentClient24 )error {
938
938
err := a .logSender .SendLoop (ctx ,aAPI )
939
- if xerrors .Is (err ,agentsdk .LogLimitExceededError ) {
939
+ if xerrors .Is (err ,agentsdk .ErrLogLimitExceeded ) {
940
940
// we don't want this error to tear down the API connection and propagate to the
941
941
// other routines that use the API. The LogSender has already dropped a warning
942
942
// log, so just return nil here.
@@ -1564,9 +1564,13 @@ func (a *agent) Collect(ctx context.Context, networkStats map[netlogtype.Connect
1564
1564
}
1565
1565
for conn ,counts := range networkStats {
1566
1566
stats .ConnectionsByProto [conn .Proto .String ()]++
1567
+ // #nosec G115 - Safe conversions for network statistics which we expect to be within int64 range
1567
1568
stats .RxBytes += int64 (counts .RxBytes )
1569
+ // #nosec G115 - Safe conversions for network statistics which we expect to be within int64 range
1568
1570
stats .RxPackets += int64 (counts .RxPackets )
1571
+ // #nosec G115 - Safe conversions for network statistics which we expect to be within int64 range
1569
1572
stats .TxBytes += int64 (counts .TxBytes )
1573
+ // #nosec G115 - Safe conversions for network statistics which we expect to be within int64 range
1570
1574
stats .TxPackets += int64 (counts .TxPackets )
1571
1575
}
1572
1576
@@ -1730,7 +1734,7 @@ func (a *agent) HTTPDebug() http.Handler {
1730
1734
r .Get ("/debug/magicsock" ,a .HandleHTTPDebugMagicsock )
1731
1735
r .Get ("/debug/magicsock/debug-logging/{state}" ,a .HandleHTTPMagicsockDebugLoggingState )
1732
1736
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 ) {
1734
1738
w .WriteHeader (http .StatusNotFound )
1735
1739
_ ,_ = w .Write ([]byte ("404 not found" ))
1736
1740
})
@@ -2016,7 +2020,7 @@ func (a *apiConnRoutineManager) wait() error {
2016
2020
}
2017
2021
2018
2022
func PrometheusMetricsHandler (prometheusRegistry * prometheus.Registry ,logger slog.Logger ) http.Handler {
2019
- return http .HandlerFunc (func (w http.ResponseWriter ,r * http.Request ) {
2023
+ return http .HandlerFunc (func (w http.ResponseWriter ,_ * http.Request ) {
2020
2024
w .Header ().Set ("Content-Type" ,"text/plain" )
2021
2025
2022
2026
// 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) {
2052
2056
return 42 ,err
2053
2057
}
2054
2058
2059
+ // #nosec G115 - Safe conversion to generate int64 hash from Sum64, data loss acceptable
2055
2060
return int64 (h .Sum64 ()),nil
2056
2061
}