Skip to content

Commit 6e793da

Browse files
committed
vet: nil ptr auto.go
1 parent 5bed1f9 commit 6e793da

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

intra/ipn/auto.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,10 @@ func laddr(c net.Conn) (string, bool) {
580580
if c == nil || core.IsNil(c) {
581581
return "", false
582582
}
583-
return c.LocalAddr().String(), true
583+
if addr := c.LocalAddr(); addr != nil {
584+
return addr.String(), true
585+
}
586+
return "", false
584587
}
585588

586589
func maybeKeepAlive(c net.Conn) (keepingalive bool) {

intra/ipn/wgproxy.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ type wgtun struct {
123123

124124
// mutable fields
125125

126+
// atomic.Pointer over different Proxy impls will work go.dev/play/p/2ovWbpkWO1f
126127
via atomic.Pointer[core.WeakRef[Proxy]]
127128
viaUp atomic.Bool // using via?
128129
direct protect.RDialer

0 commit comments

Comments
 (0)