mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
AWDL support for macOS/iOS
This commit is contained in:
parent
4f7e8856b8
commit
4622a85c34
6 changed files with 90 additions and 3 deletions
|
@ -15,6 +15,7 @@ package yggdrasil
|
|||
// See version.go for version metadata format
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
|
@ -88,7 +89,11 @@ func (iface *tcpInterface) init(core *Core, addr string, readTimeout int32) (err
|
|||
iface.tcp_timeout = default_tcp_timeout
|
||||
}
|
||||
|
||||
iface.serv, err = net.Listen("tcp", addr)
|
||||
ctx := context.Background()
|
||||
lc := net.ListenConfig{
|
||||
Control: iface.tcpContext,
|
||||
}
|
||||
iface.serv, err = lc.Listen(ctx, "tcp", addr)
|
||||
if err == nil {
|
||||
iface.calls = make(map[string]struct{})
|
||||
iface.conns = make(map[tcpInfo](chan struct{}))
|
||||
|
@ -164,7 +169,9 @@ func (iface *tcpInterface) call(saddr string, socksaddr *string, sintf string) {
|
|||
},
|
||||
}
|
||||
} else {
|
||||
dialer := net.Dialer{}
|
||||
dialer := net.Dialer{
|
||||
Control: iface.tcpContext,
|
||||
}
|
||||
if sintf != "" {
|
||||
ief, err := net.InterfaceByName(sintf)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue