diff --git a/go.mod b/go.mod index a31b38d..3fd4d57 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/adrg/xdg v0.5.3 github.com/alphadose/haxmap v1.4.1 github.com/anatol/vmtest v0.0.0-20250318022921-2f32244e2f0f - github.com/apoxy-dev/icx v0.11.0 + github.com/apoxy-dev/icx v0.12.1 github.com/avast/retry-go/v4 v4.6.1 github.com/bramvdbogaerde/go-scp v1.5.0 github.com/buraksezer/olric v0.5.6 @@ -20,7 +20,7 @@ require ( github.com/dgraph-io/badger/v4 v4.5.0 github.com/docker/docker v28.2.2+incompatible github.com/dpeckett/contextio v0.5.1 - github.com/dpeckett/network v0.3.4 + github.com/dpeckett/network v0.5.0 github.com/envoyproxy/gateway v0.5.0-rc.1.0.20240618131507-bdff5d56b59d github.com/envoyproxy/go-control-plane v0.13.4 github.com/envoyproxy/go-control-plane/contrib v1.32.4 @@ -168,7 +168,6 @@ require ( github.com/docker/cli v24.0.6+incompatible // indirect github.com/docker/distribution v2.8.2+incompatible // indirect github.com/docker/docker-credential-helpers v0.7.0 // indirect - github.com/dpeckett/triemap v0.3.1 // indirect github.com/dunglas/httpsfv v1.0.2 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/emicklei/go-restful/v3 v3.12.2 // indirect diff --git a/go.sum b/go.sum index acb886c..46a9c6a 100644 --- a/go.sum +++ b/go.sum @@ -123,8 +123,8 @@ github.com/apoxy-dev/apiserver-runtime v0.0.0-20250420214109-979c605051d1 h1:sAS github.com/apoxy-dev/apiserver-runtime v0.0.0-20250420214109-979c605051d1/go.mod h1:zOVeivsnCWenmbgr6kiefIExoqlbuv2xyg9SXXfbs5U= github.com/apoxy-dev/connect-ip-go v0.0.0-20250530062404-603929a73f45 h1:SwPk1n/oSVX7YwlNpC9KNH9YaYkcL/k6OfqSGVnxyyI= github.com/apoxy-dev/connect-ip-go v0.0.0-20250530062404-603929a73f45/go.mod h1:z5rtgIizc+/K27UtB0occwZgqg/mz3IqgyUJW8aubbI= -github.com/apoxy-dev/icx v0.11.0 h1:/HFcCoPHyjBp2/+wZ09BM3hyQ4zh8mdIe/4CG61JWQk= -github.com/apoxy-dev/icx v0.11.0/go.mod h1:Muuk3bRXTp3YB5Xj+xHOGQ/T1xVxIKJuvmMfLBXhIN4= +github.com/apoxy-dev/icx v0.12.1 h1:VaczJSdujpsO8NjS0RvxiF55fco+iKZyurcZu4ddeP8= +github.com/apoxy-dev/icx v0.12.1/go.mod h1:QNPhLVUVbbSVSyERjmgGN4K8vzSC6bvZlN0tyflYf0U= github.com/apoxy-dev/quic-go v0.0.0-20250530165952-53cca597715e h1:10GIpiVyKoRgCyr0J2TvJtdn17bsFHN+ROWkeVJpcOU= github.com/apoxy-dev/quic-go v0.0.0-20250530165952-53cca597715e/go.mod h1:MFlGGpcpJqRAfmYi6NC2cptDPSxRWTOGNuP4wqrWmzQ= github.com/apoxy-dev/upgrade-cli v0.0.0-20240213232412-a56c3a52fa0e h1:FBNxMQD93z2ththupB/BYKLEaMWaEr+G+sJWJqU2wC4= @@ -309,10 +309,8 @@ github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZ github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/dpeckett/contextio v0.5.1 h1:w19s6EThbZuRpa2z/Lu06v6+o3rrZhbBzmkol6en/hA= github.com/dpeckett/contextio v0.5.1/go.mod h1:IY/CQ1ee6y4C5j/mU0X0M/D84s2FxNisggbNClTPndc= -github.com/dpeckett/network v0.3.4 h1:zOa5hIjOKtl13+FGde6Av4VrD+PmD03AadMKYrhkoOg= -github.com/dpeckett/network v0.3.4/go.mod h1:AyOdc+YGAT7zWoDDd/r8Pv4kGNlKrboVcug0FKaoqbA= -github.com/dpeckett/triemap v0.3.1 h1:jzxCyKs/ATw9uCdD2bd0xFTPLIP9uZwX0iZUOOOIDoc= -github.com/dpeckett/triemap v0.3.1/go.mod h1:pBxNH+K6m5I4lVo+W7u6JEanxP13adD4t2XYVMxfmTo= +github.com/dpeckett/network v0.5.0 h1:aGNcUG5LIULxxHz2r6s+FkY2iDkSV+MA3YiNE6J9aJg= +github.com/dpeckett/network v0.5.0/go.mod h1:QhgAxfIFDcsVrQ5AqDUY403TGwZhexm7bHf1ZldXV1I= github.com/dunglas/httpsfv v1.0.2 h1:iERDp/YAfnojSDJ7PW3dj1AReJz4MrwbECSSE59JWL0= github.com/dunglas/httpsfv v1.0.2/go.mod h1:zID2mqw9mFsnt7YC3vYQ9/cjq30q41W+1AnDwH8TiMg= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= diff --git a/pkg/netstack/icx_network.go b/pkg/netstack/icx_network.go index 2880360..1215272 100644 --- a/pkg/netstack/icx_network.go +++ b/pkg/netstack/icx_network.go @@ -193,7 +193,7 @@ func (net *ICXNetwork) Start() error { phyFrame := net.pktPool.Get().(*[]byte) *phyFrame = (*phyFrame)[:cap(*phyFrame)] - if n := net.handler.ScheduledToPhy(*phyFrame); n > 0 { + if n := net.handler.ToPhy(*phyFrame); n > 0 { if err := net.phy.WriteFrame((*phyFrame)[:n]); err != nil { net.pktPool.Put(phyFrame) return fmt.Errorf("writing scheduled phy frame failed: %w", err) diff --git a/pkg/tunnel/l2pc/l2pc.go b/pkg/tunnel/l2pc/l2pc.go index b2197f1..c7eca7e 100644 --- a/pkg/tunnel/l2pc/l2pc.go +++ b/pkg/tunnel/l2pc/l2pc.go @@ -20,7 +20,7 @@ var ErrInvalidFrame = errors.New("invalid frame") // L2PacketConn adapts a net.PacketConn (UDP) to read/write L2 Ethernet frames. type L2PacketConn struct { pc net.PacketConn - localAddrs addrselect.AddressList + localAddrs addrselect.List localMAC tcpip.LinkAddress peerMACCache sync.Map pktPool sync.Pool @@ -51,7 +51,7 @@ func NewL2PacketConn(pc net.PacketConn) (*L2PacketConn, error) { // Random locally-administered unicast MAC for "our" link address. localMAC := tcpip.GetRandMacAddr() - var localAddrs addrselect.AddressList + var localAddrs addrselect.List for _, ap := range localAddrPorts { la := &tcpip.FullAddress{ Addr: func() tcpip.Address { @@ -165,7 +165,7 @@ func (c *L2PacketConn) ReadFrame(dst []byte) (int, error) { // Build addresses for udp.Encode (note: for an inbound frame, // src = remote, dst = local). srcFA := toFullAddr(remote) - dstFA := c.localAddrs.Pick(srcFA) + dstFA := c.localAddrs.Select(srcFA) // Random-but-stable (per remote IP) src MAC. srcFA.LinkAddr = c.peerMACForIP(remote.IP) diff --git a/pkg/tunnel/router/icx_netlink_linux.go b/pkg/tunnel/router/icx_netlink_linux.go index 7cf7059..fa215bf 100644 --- a/pkg/tunnel/router/icx_netlink_linux.go +++ b/pkg/tunnel/router/icx_netlink_linux.go @@ -49,7 +49,7 @@ type ICXNetlinkRouter struct { pcapFile *os.File tun *tunnel.Tunnel iptV4, iptV6 utiliptables.Interface - extAddrs addrselect.AddressList + extAddrs addrselect.List closeOnce sync.Once } @@ -164,7 +164,7 @@ func NewICXNetlinkRouter(opts ...Option) (*ICXNetlinkRouter, error) { return nil, fmt.Errorf("failed to create tunnel: %w", err) } - var extAddrsList addrselect.AddressList + var extAddrsList addrselect.List for _, addr := range extAddrs { extAddrsList = append(extAddrsList, netstack.ToFullAddress(netip.MustParseAddrPort(addr.String()))) } @@ -312,7 +312,7 @@ func (r *ICXNetlinkRouter) DelRoute(dst netip.Prefix) error { func (r *ICXNetlinkRouter) ResolveMAC(ctx context.Context, peerAddr netip.AddrPort) (tcpip.LinkAddress, error) { peerFullAddr := netstack.ToFullAddress(peerAddr) - localFullAddr := r.extAddrs.Pick(peerFullAddr) + localFullAddr := r.extAddrs.Select(peerFullAddr) slog.Debug("Resolving MAC address", slog.String("local", localFullAddr.Addr.String()),