Skip to content

Commit e5a20ae

Browse files
committed
lint: ipn/rpn
1 parent 8a3cdce commit e5a20ae

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

intra/ipn/proxies.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"math/rand"
1414
"net"
1515
"net/netip"
16+
"slices"
1617
"strconv"
1718
"strings"
1819
"sync"
@@ -107,7 +108,7 @@ var (
107108
errProxyRoute = errors.New("proxy: no route to host")
108109
errProxyConfig = errors.New("proxy: invalid config")
109110
errProxyReadd = errors.New("proxy: cannot update; readd config")
110-
errNoProxyResponse = errors.New("proxy: no response from upstream")
111+
errNoProxyResponse = errors.New("proxy: blocked or no response")
111112
errNoSig = errors.New("proxy: auth missing sig")
112113
errNoMtu = errors.New("proxy: missing mtu")
113114
errNoOpts = errors.New("proxy: no opts")
@@ -885,7 +886,7 @@ func (px *proxifier) refreshHopOriginsIfAny(hop Proxy, why string) (n int) {
885886
}
886887

887888
px.hmu.RLock()
888-
origins := px.hp[hopID]
889+
origins := slices.Clone(px.hp[hopID]) // Create a copy to avoid race
889890
px.hmu.RUnlock()
890891

891892
if len(origins) <= 0 {

intra/ipn/rpn.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ func (r *rpnp) flattenKids() (ccs []string) {
270270
r.mu.RLock()
271271
defer r.mu.RUnlock()
272272

273-
ccs = make([]string, len(r.kids))
273+
ccs = make([]string, 0, len(r.kids))
274274
for cc := range r.kids {
275275
ccs = append(ccs, cc)
276276
}

0 commit comments

Comments
 (0)