Skip to content

Commit dd7eba6

Browse files
committed
netstack: use go's atomic
1 parent 5b218bb commit dd7eba6

2 files changed

Lines changed: 26 additions & 5 deletions

File tree

go.mod

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ require (
2323
go4.org/unsafe/assume-no-moving-gc v0.0.0-20231121144256-b99613f794b6
2424
golang.org/x/mobile v0.0.0-20250506005352-78cd7a343bde
2525
golang.org/x/net v0.40.0
26-
golang.zx2c4.com/wireguard v0.0.0-20231211153847-12269c276173
27-
gvisor.dev/gvisor v0.0.0-20250816195534-fc2f4df6597a
26+
golang.zx2c4.com/wireguard v0.0.0-20250521234502-f333402bd9cb
27+
gvisor.dev/gvisor v0.0.0-20250816201027-ba3b9ca85f20
2828
nhooyr.io/websocket v1.8.7
2929
)
3030

@@ -36,15 +36,36 @@ require (
3636
github.com/cisco/go-hpke v0.0.0-20210215210317-01c430f1f302 // indirect
3737
github.com/cisco/go-tls-syntax v0.0.0-20200617162716-46b0cfb76b9b // indirect
3838
github.com/cloudflare/circl v1.6.1 // indirect
39+
github.com/davecgh/go-spew v1.1.1 // indirect
40+
github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2 // indirect
41+
github.com/gin-contrib/sse v0.1.0 // indirect
42+
github.com/gin-gonic/gin v1.6.3 // indirect
43+
github.com/go-playground/locales v0.13.0 // indirect
44+
github.com/go-playground/universal-translator v0.17.0 // indirect
45+
github.com/go-playground/validator/v10 v10.2.0 // indirect
46+
github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee // indirect
47+
github.com/gobwas/pool v0.2.0 // indirect
48+
github.com/gobwas/ws v1.0.2 // indirect
49+
github.com/golang/protobuf v1.5.4 // indirect
3950
github.com/google/btree v1.1.2 // indirect
51+
github.com/google/go-cmp v0.6.0 // indirect
52+
github.com/gorilla/websocket v1.4.1 // indirect
4053
github.com/klauspost/compress v1.17.4 // indirect
54+
github.com/leodido/go-urn v1.2.0 // indirect
55+
github.com/mattn/go-isatty v0.0.12 // indirect
4156
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
4257
github.com/pkg/diff v0.0.0-20200914180035-5b29258ca4f7 // indirect
58+
github.com/pmezard/go-difflib v1.0.0 // indirect
59+
github.com/stretchr/testify v1.6.1 // indirect
4360
github.com/txthinking/runnergroup v0.0.0-20210608031112-152c7c4432bf // indirect
61+
github.com/ugorji/go/codec v1.1.7 // indirect
4462
golang.org/x/mod v0.25.0 // indirect
4563
golang.org/x/sync v0.15.0 // indirect
4664
golang.org/x/text v0.26.0 // indirect
4765
golang.org/x/time v0.7.0 // indirect
4866
golang.org/x/tools v0.33.0 // indirect
4967
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 // indirect
68+
google.golang.org/protobuf v1.33.0 // indirect
69+
gopkg.in/yaml.v2 v2.4.0 // indirect
70+
gopkg.in/yaml.v3 v3.0.1 // indirect
5071
)

intra/netstack/snooper.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ import (
2727
"encoding/binary"
2828
"fmt"
2929
"io"
30+
"sync/atomic"
3031
"time"
3132

3233
"github.com/celzero/firestack/intra/core"
33-
"gvisor.dev/gvisor/pkg/atomicbitops"
3434
"gvisor.dev/gvisor/pkg/log"
3535
"gvisor.dev/gvisor/pkg/tcpip"
3636
"gvisor.dev/gvisor/pkg/tcpip/header"
@@ -40,8 +40,8 @@ import (
4040

4141
// from: github.com/google/gvisor/blob/596e8d22/pkg/tcpip/link/sniffer/sniffer.go
4242

43-
var logPackets atomicbitops.Uint32 = atomicbitops.FromUint32(0)
44-
var writePCAP atomicbitops.Uint32 = atomicbitops.FromUint32(0)
43+
var logPackets atomic.Uint32
44+
var writePCAP atomic.Uint32
4545

4646
const logPrefix = ""
4747

0 commit comments

Comments
 (0)