Skip to content

Commit

Permalink
nilaway: dialers/tunnel,dialers/desync
Browse files Browse the repository at this point in the history
  • Loading branch information
ignoramous committed Oct 24, 2024
1 parent 211c607 commit 4f43cdb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
17 changes: 9 additions & 8 deletions intra/dialers/ips.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ import (
)

const (
errNilConn = net.UnknownNetworkError("nil connection")
errNoConn = net.UnknownNetworkError("no connection")
errNoSysConn = net.UnknownNetworkError("no sys connection")
errNoIps = net.UnknownNetworkError("no ips")
errNoEch = net.UnknownNetworkError("no ech")
errNoDialer = net.UnknownNetworkError("no dialer")
errNoRetrier = net.UnknownNetworkError("no retrier")
errNoListener = net.UnknownNetworkError("no listener")
errNilConn = net.UnknownNetworkError("nil connection")
errNoConn = net.UnknownNetworkError("no connection")
errNoSysConn = net.UnknownNetworkError("no sys connection")
errNoDesyncConn = net.UnknownNetworkError("no desync connection")
errNoIps = net.UnknownNetworkError("no ips")
errNoEch = net.UnknownNetworkError("no ech")
errNoDialer = net.UnknownNetworkError("no dialer")
errNoRetrier = net.UnknownNetworkError("no retrier")
errNoListener = net.UnknownNetworkError("no listener")
)

var ipm ipmap.IPMap = ipmap.NewIPMap()
Expand Down
3 changes: 3 additions & 0 deletions intra/dialers/split_and_desync.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ func desyncWithTraceroute(d *protect.RDial, local, remote netip.AddrPort) (*over
if err != nil {
return nil, err
}
if oc == nil { // nilaway
return nil, errNoDesyncConn
}

var msgBuf [probeSize]byte

Expand Down
5 changes: 4 additions & 1 deletion tunnel/dialer.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,12 @@ func (t *gtunnel) DialBind(network, local, remote string) (protect.Conn, error)
laddr, _ := fulladdr(local) // stack must allow spoofing
switch network {
case "tcp", "tcp4", "tcp6":
if taddr == nil {
if taddr == nil { // todo: error?
taddr = &tcpip.FullAddress{}
}
if laddr == nil { // ok
laddr = &tcpip.FullAddress{}
}
return gonet.DialTCPWithBind(t.ctx, t.stack, *laddr, *taddr, proto)
case "udp", "udp4", "udp6":
return gonet.DialUDP(t.stack, laddr, taddr, proto)
Expand Down

0 comments on commit 4f43cdb

Please sign in to comment.