Skip to content

Commit 0ad7532

Browse files
committed
Merge branch 'main' into mutable-groups
2 parents 89fd03b + b7ae595 commit 0ad7532

File tree

6 files changed

+53
-15
lines changed

6 files changed

+53
-15
lines changed

go.mod

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ go 1.23.6
44

55
toolchain go1.24.1
66

7-
replace github.com/sagernet/sing => github.com/getlantern/sing v0.6.13-0.20250806192132-5d1129b5c1cb
7+
replace github.com/sagernet/sing => github.com/getlantern/sing v0.6.13-0.20250812195008-c4468d0c7c42
88

99
replace github.com/sagernet/sing-box => github.com/getlantern/sing-box-minimal v1.11.15-lantern.0.20250820161012-d4dd96e95ed6
1010

1111
replace github.com/tetratelabs/wazero => github.com/refraction-networking/wazero v1.7.1-w
1212

13+
replace github.com/sagernet/wireguard-go => github.com/getlantern/wireguard-go v0.0.1-beta.5.0.20250310145906-45220d8aec77
14+
1315
// replace github.com/sagernet/sing-box => ../sing-box-minimal
1416

1517
require (
@@ -28,6 +30,7 @@ require (
2830
github.com/tetratelabs/wazero v1.7.3
2931
go.opentelemetry.io/otel v1.35.0
3032
go.opentelemetry.io/otel/metric v1.35.0
33+
go.opentelemetry.io/otel/trace v1.35.0
3134
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba
3235
gopkg.in/yaml.v3 v3.0.1
3336
)
@@ -148,14 +151,14 @@ require (
148151
github.com/sagernet/ws v0.0.0-20231204124109-acfe8907c854 // indirect
149152
github.com/shadowsocks/go-shadowsocks2 v0.1.5 // indirect
150153
github.com/stretchr/objx v0.5.2 // indirect
154+
github.com/tevino/abool/v2 v2.1.0 // indirect
151155
github.com/tidwall/btree v1.6.0 // indirect
152156
github.com/u-root/uio v0.0.0-20240118234441-a3c409a6018e // indirect
153157
github.com/vishvananda/netns v0.0.4 // indirect
154158
github.com/zeebo/blake3 v0.2.4 // indirect
155159
go.etcd.io/bbolt v1.3.6 // indirect
156160
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
157161
go.opentelemetry.io/otel/sdk/metric v1.35.0 // indirect
158-
go.opentelemetry.io/otel/trace v1.35.0 // indirect
159162
go.uber.org/mock v0.5.0 // indirect
160163
go.uber.org/multierr v1.11.0 // indirect
161164
go.uber.org/zap v1.27.0 // indirect

go.sum

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,12 @@ github.com/getlantern/lantern-water v0.0.0-20250331153903-07abebe611e8/go.mod h1
157157
github.com/getlantern/ops v0.0.0-20220713155959-1315d978fff7/go.mod h1:D5ao98qkA6pxftxoqzibIBBrLSUli+kYnJqrgBf9cIA=
158158
github.com/getlantern/ops v0.0.0-20231025133620-f368ab734534 h1:3BwvWj0JZzFEvNNiMhCu4bf60nqcIuQpTYb00Ezm1ag=
159159
github.com/getlantern/ops v0.0.0-20231025133620-f368ab734534/go.mod h1:ZsLfOY6gKQOTyEcPYNA9ws5/XHZQFroxqCOhHjGcs9Y=
160-
github.com/getlantern/sing v0.6.13-0.20250806192132-5d1129b5c1cb h1:YAPfg460pSKsVSRpwzri0Yxn6SY7xiMJSUM60FrEbBo=
161-
github.com/getlantern/sing v0.6.13-0.20250806192132-5d1129b5c1cb/go.mod h1:ARkL0gM13/Iv5VCZmci/NuoOlePoIsW0m7BWfln/Hak=
160+
github.com/getlantern/sing v0.6.13-0.20250812195008-c4468d0c7c42 h1:9mmkEsa5TlIheUyI4DfaW3+m4W01hMQprraSQzVg6mg=
161+
github.com/getlantern/sing v0.6.13-0.20250812195008-c4468d0c7c42/go.mod h1:ARkL0gM13/Iv5VCZmci/NuoOlePoIsW0m7BWfln/Hak=
162162
github.com/getlantern/sing-box-minimal v1.11.15-lantern.0.20250820161012-d4dd96e95ed6 h1:bvrvUwn96iUIkQl1HmvCETP6mtHGA0Ke3YCtxDj5jhM=
163163
github.com/getlantern/sing-box-minimal v1.11.15-lantern.0.20250820161012-d4dd96e95ed6/go.mod h1:E/V6629+bJOeU3HvW0IUCjF0x4UFyq+82jMZoHxxozw=
164+
github.com/getlantern/wireguard-go v0.0.1-beta.5.0.20250310145906-45220d8aec77 h1:BEYHpyQzW64Mof30bVolWi7D6gIEUJTyh8rcjHwJZnA=
165+
github.com/getlantern/wireguard-go v0.0.1-beta.5.0.20250310145906-45220d8aec77/go.mod h1:akc2Wh+rX9bFFNnHJGsQ8VIV3eJI1LXJYgx2Y+8lcW8=
164166
github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE=
165167
github.com/glycerine/go-unsnap-stream v0.0.0-20181221182339-f9677308dec2/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE=
166168
github.com/glycerine/go-unsnap-stream v0.0.0-20190901134440-81cf024a9e0a/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE=
@@ -463,8 +465,6 @@ github.com/sagernet/smux v1.5.34-mod.2 h1:gkmBjIjlJ2zQKpLigOkFur5kBKdV6bNRoFu2Wk
463465
github.com/sagernet/smux v1.5.34-mod.2/go.mod h1:0KW0+R+ycvA2INW4gbsd7BNyg+HEfLIAxa5N02/28Zc=
464466
github.com/sagernet/utls v1.6.7 h1:Ep3+aJ8FUGGta+II2IEVNUc3EDhaRCZINWkj/LloIA8=
465467
github.com/sagernet/utls v1.6.7/go.mod h1:Uua1TKO/FFuAhLr9rkaVnnrTmmiItzDjv1BUb2+ERwM=
466-
github.com/sagernet/wireguard-go v0.0.1-beta.7 h1:ltgBwYHfr+9Wz1eG59NiWnHrYEkDKHG7otNZvu85DXI=
467-
github.com/sagernet/wireguard-go v0.0.1-beta.7/go.mod h1:jGXij2Gn2wbrWuYNUmmNhf1dwcZtvyAvQoe8Xd8MbUo=
468468
github.com/sagernet/ws v0.0.0-20231204124109-acfe8907c854 h1:6uUiZcDRnZSAegryaUGwPC/Fj13JSHwiTftrXhMmYOc=
469469
github.com/sagernet/ws v0.0.0-20231204124109-acfe8907c854/go.mod h1:LtfoSK3+NG57tvnVEHgcuBW9ujgE8enPSgzgwStwCAA=
470470
github.com/sclevine/agouti v3.0.0+incompatible/go.mod h1:b4WX9W9L1sfQKXeJf1mUTLZKJ48R1S7H23Ji7oFO5Bw=
@@ -496,6 +496,8 @@ github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl
496496
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
497497
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
498498
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
499+
github.com/tevino/abool/v2 v2.1.0 h1:7w+Vf9f/5gmKT4m4qkayb33/92M+Um45F2BkHOR+L/c=
500+
github.com/tevino/abool/v2 v2.1.0/go.mod h1:+Lmlqk6bHDWHqN1cbxqhwEAwMPXgc8I1SDEamtseuXY=
499501
github.com/things-go/go-socks5 v0.0.5 h1:qvKaGcBkfDrUL33SchHN93srAmYGzb4CxSM2DPYufe8=
500502
github.com/things-go/go-socks5 v0.0.5/go.mod h1:mtzInf8v5xmsBpHZVbIw2YQYhc4K0jRwzfsH64Uh0IQ=
501503
github.com/tidwall/btree v1.6.0 h1:LDZfKfQIBHGHWSwckhXI0RPSXzlo+KYdjK7FWSqOzzg=

transport/amnezia/endpoint.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"github.com/sagernet/sing/service/pause"
2222
"github.com/sagernet/wireguard-go/conn"
2323
"github.com/sagernet/wireguard-go/device"
24-
"github.com/sagernet/wireguard-go/ipc"
2524

2625
"go4.org/netipx"
2726
)
@@ -152,7 +151,6 @@ func NewEndpoint(options EndpointOptions) (*Endpoint, error) {
152151
tunDevice: tunDevice,
153152
}, nil
154153
}
155-
156154
func (e *Endpoint) Start(resolve bool) error {
157155
if common.Any(e.peers, func(peer peerConfig) bool {
158156
return !peer.endpoint.IsValid() && peer.destination.IsFqdn()
@@ -174,11 +172,6 @@ func (e *Endpoint) Start(resolve bool) error {
174172
return nil
175173
}
176174

177-
fileUAPI, uapiErr := ipc.UAPIOpen(e.options.Name)
178-
if uapiErr != nil {
179-
return fmt.Errorf("failed to open uapi socket for %s: %w", e.options.Name, uapiErr)
180-
}
181-
182175
var bind conn.Bind
183176
wgListener, isWgListener := e.options.Dialer.(conn.Listener)
184177
if isWgListener {
@@ -217,9 +210,9 @@ func (e *Endpoint) Start(resolve bool) error {
217210
}
218211
wgDevice := device.NewDevice(e.options.Context, e.tunDevice, bind, logger, e.options.Workers)
219212

220-
uapi, err := ipc.UAPIListen(e.options.Name, fileUAPI)
213+
uapi, err := uapiListen(e.options.Name)
221214
if err != nil {
222-
return fmt.Errorf("failed to listen on uapi socket: %v", err)
215+
return err
223216
}
224217

225218
go func() {

transport/amnezia/endpoint_options.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package amnezia implements the amnezia transport endpoint
12
package amnezia
23

34
import (

transport/amnezia/uapi_other.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//go:build !windows
2+
3+
package amnezia
4+
5+
import (
6+
"fmt"
7+
"net"
8+
9+
"github.com/sagernet/wireguard-go/ipc"
10+
)
11+
12+
func uapiListen(name string) (net.Listener, error) {
13+
fileUAPI, uapiErr := ipc.UAPIOpen(name)
14+
if uapiErr != nil {
15+
return nil, fmt.Errorf("failed to open uapi socket for %s: %w", name, uapiErr)
16+
}
17+
18+
uapi, err := ipc.UAPIListen(name, fileUAPI)
19+
if err != nil {
20+
return nil, fmt.Errorf("failed to listen on uapi socket: %v", err)
21+
}
22+
return uapi, nil
23+
}

transport/amnezia/uapi_windows.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package amnezia
2+
3+
import (
4+
"fmt"
5+
"net"
6+
7+
"github.com/sagernet/wireguard-go/ipc"
8+
)
9+
10+
func uapiListen(name string) (net.Listener, error) {
11+
uapi, err := ipc.UAPIListen(name)
12+
if err != nil {
13+
return nil, fmt.Errorf("failed to listen on uapi socket: %v", err)
14+
}
15+
return uapi, nil
16+
}

0 commit comments

Comments
 (0)