You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Endpoint independent mapping slows down bandwidth #129
Which commit of hussainmohd-a/rethink-app can be built with the latest celzero/firestack? rethink on my phone is outdated.
Interesting. Would such an impl (essentially, half-duplex?) make #77 work better?
I don't know, but current firestack's Endpoint-Independent Mapping mode need optimization.
I tested rethink and my gvisor-playground with quic-go/perf, rethink's handling of UDP ( single flow ) seems slower. https://github.com/quic-go/perf
stack.Stack has a FindTransportEndpoint() method, it may be an alternative to muxer.route()
As setup, to netstack, remote addrs are locally bound. And so, when a new route appears (from a remote ip:port udpmux is seeing for the first time on a unconnected socket), FindTransportEndpoint is unlikely to find any existing route (as none would exist bound to that remote ip:port), no?
As setup, to netstack, remote addrs are locally bound. And so, when a new route appears (from a remote ip:port udpmux is seeing for the first time on a unconnected socket), FindTransportEndpoint is unlikely to find any existing route (as none would exist bound to that remote ip:port), no?
Yes. But you can construct UDP packets manually, creating an Endpoint may need longer code.
Lanius-collaris@510f04b improves both outbound and inbound throughput. Note that when settings.EndpointIndependentMapping == false, c439342 is even slower than aa87903 , I can't understand. 🙃
gonet.DialUDP() doesn't seem to behave like net.ListenUDP()…… If raddr is nil, laddr.IP can't be an unspecified address, and laddr.Port can't be 0, otherwise gonet.UDPConn.WriteTo() will become unusable, this means, currently users can't send UDP packets if settings.EndpointIndependentMapping == true and these packets are routed to a wireguard interface.
Note that when settings.EndpointIndependentMapping == false, c439342 is even slower than aa87903 , I can't understand.
Don't mind, the reason is some early versions of my CLI frontend can't change the log level.
True, but why won't gonet.DialUDP work 😭
So much simpler...
currently users can't send UDP packets if settings.EndpointIndependentMapping == true and these packets are routed to a wireguard interface
Hm, I kind of get what you're saying, but WireGuard doesn't use/rely on udpmux? udpmux via handler.ReverseProxy(tcp / udp) doesn't wire back any packets into WireGuard.
If raddr is nil, laddr.IP can't be an unspecified address, and laddr.Port can't be 0, otherwise gonet.UDPConn.WriteTo() will become unusable
I don't follow. gonet.DialUDP is used for ingress only when udpmux's raddr (to) (gonet's laddr) is already known (while gonet's raddr is fixed)?
currently users can't send UDP packets if settings.EndpointIndependentMapping == true and these packets are routed to a wireguard interface
Hm, I kind of get what you're saying, but WireGuard doesn't use/rely on udpmux? udpmux via handler.ReverseProxy(tcp / udp) doesn't wire back any packets into WireGuard.
You didn't get what I was saying, I mean Dialer().Announce("udp","0.0.0.0:0") or Dialer().Announce("udp","[::]:0") can't be convert into gonet.DialUDP() directly, you must choose local IP and port for it explicitly.
Gotcha. The comment in the code says, src will be assigned if left nil (which it is when listening on unspecified ip:port) iff Netstack's NIC addrs are set...
If raddr is nil, laddr.IP can't be an unspecified address, and laddr.Port can't be 0, otherwise gonet.UDPConn.WriteTo() will become unusable
Sorry, in fact gvisor can handle them, maybe I did something wrong when comparing the ipn module of firestack with the tun/netstack module of wireguard-go.
Activity
hussainmohd-a commentedon Feb 9, 2025
@Lanius-collaris, I'm currently cleaning up the code and will share the commit details with you in a day or two.
hussainmohd-a commentedon Feb 15, 2025
@Lanius-collaris You can use this(0a885cf) commit to get the latest.
Lanius-collaris commentedon Feb 19, 2025
Update 1: prevent a nil pointer dereference
This patch improves inbound throughput, but may cause new bugs:
Lanius-collaris commentedon Feb 20, 2025
Sorry, the patch I posted yesterday includes a serious DoS vulnerability.
Lanius-collaris commentedon Mar 21, 2025
stack.Stackhas aFindTransportEndpoint()method, it may be an alternative tomuxer.route(), becausetcpip.Endpointcreated byudp.ForwarderRequest.CreateEndpoint()has been registered instack.Stackhttps://github.com/google/gvisor/blob/738e1d995f64/pkg/tcpip/transport/udp/forwarder.go#L88
ignoramous commentedon Mar 25, 2025
As setup, to netstack, remote addrs are locally bound. And so, when a new route appears (from a remote ip:port udpmux is seeing for the first time on a unconnected socket), FindTransportEndpoint is unlikely to find any existing route (as none would exist bound to that remote ip:port), no?
Lanius-collaris commentedon Mar 27, 2025
Yes. But you can construct UDP packets manually, creating an Endpoint may need longer code.
ignoramous commentedon Mar 27, 2025
True, but why won't gonet.DialUDP work 😭
So much simpler...
ignoramous commentedon Jul 3, 2025
Lanius-collaris commentedon Jul 8, 2025
Lanius-collaris@510f04b improves both outbound and inbound throughput. Note that when
settings.EndpointIndependentMapping == false, c439342 is even slower than aa87903 , I can't understand. 🙃Lanius-collaris commentedon Oct 17, 2025
gonet.DialUDP()doesn't seem to behave likenet.ListenUDP()…… Ifraddris nil,laddr.IPcan't be an unspecified address, andladdr.Portcan't be 0, otherwisegonet.UDPConn.WriteTo()will become unusable, this means, currently users can't send UDP packets ifsettings.EndpointIndependentMapping == trueand these packets are routed to a wireguard interface.Don't mind, the reason is some early versions of my CLI frontend can't change the log level.
ignoramous commentedon Oct 17, 2025
Hm, I kind of get what you're saying, but WireGuard doesn't use/rely on udpmux? udpmux via
handler.ReverseProxy(tcp / udp) doesn't wire back any packets into WireGuard.I don't follow. gonet.DialUDP is used for ingress only when udpmux's raddr (
to) (gonet's laddr) is already known (while gonet's raddr is fixed)?Lanius-collaris commentedon Oct 17, 2025
You didn't get what I was saying, I meanDialer().Announce("udp","0.0.0.0:0")orDialer().Announce("udp","[::]:0")can't be convert intogonet.DialUDP()directly, you must choose local IP and port for it explicitly.firestack/intra/udp.go
Line 310 in ebf2895
firestack/intra/udpmux.go
Lines 616 to 628 in ebf2895
ignoramous commentedon Oct 18, 2025
Gotcha. The comment in the code says, src will be assigned if left
nil(which it is when listening on unspecified ip:port) iff Netstack's NIC addrs are set...firestack/intra/ipn/wgnet.go
Lines 253 to 256 in 5485aa5
Possible I was mistaken when I wrote that comment.
Lanius-collaris commentedon Oct 19, 2025
Sorry, in fact gvisor can handle them, maybe I did something wrong when comparing the
ipnmodule of firestack with thetun/netstackmodule of wireguard-go.ignoramous commentedon Oct 22, 2025
The default log level is Info, which shouldn't (ideally) hurt bandwidth measures that much.
Is the CLI you're talking about in this PR? #189
tcp,udp: impl missing Reset()