V2 Netbird integration - UDP MIMO/SIMO, ICMPv6, DHCPv6 implementations (#106)

* begin adding udp.MuxHandler

* add udp MuxHandlerSIMO/MIMO

* add tcp rx shutdown

* icmpv6 client

* icmpv6 Client shared NDP/Echo preparation

* icmpv6 client ndp/echo split

* icmpv6 client ndp/echo split done

* icmpv6 adjustments

* add dhcpv6 stubs

* dhcpv4 preliminary revision

* add dns.NextLabel

* dns label name tweaks

* dns begin work on TCP client

* add dnstcp package

* apply gofmt changes

* add udp mux tests

* clean up, remove StackBig for now

* remove dnstcp so as to merged confident parts and we continue dnstcp work elsewhere
This commit is contained in:
Pat Whittingslow
2026-05-10 12:16:30 -03:00
committed by GitHub
parent bdbd38ab44
commit 7d5830d7ab
22 changed files with 2785 additions and 75 deletions
+15 -3
View File
@@ -28,8 +28,9 @@ type Handler struct {
// connection is established via Open calls. This disambiguates whether
// Read and Write calls belong to the current connection.
optcodec OptionCodec
closing bool
optcodec OptionCodec
closing bool
shutdownRx bool
// nRetransmit stores the number of times the oldest packet was retransmit.
nRetransmit uint8
}
@@ -128,6 +129,7 @@ func (h *Handler) reset(localPort, remotePort uint16, iss Value) {
validator: h.validator,
logger: h.logger,
closing: false,
shutdownRx: false,
}
h.bufTx.ResetOrReuse(nil, 0, iss)
h.bufRx.Reset()
@@ -185,7 +187,7 @@ func (h *Handler) Recv(incomingPacket []byte) error {
if prevState != h.scb.State() {
h.info("tcp.Handler:rx-statechange", slog.Uint64("port", uint64(h.localPort)), slog.String("old", prevState.String()), slog.String("new", h.scb.State().String()), slog.String("rxflags", segIncoming.Flags.String()))
}
if segIncoming.DATALEN != 0 {
if segIncoming.DATALEN != 0 && !h.shutdownRx {
_, err = h.bufRx.Write(payload)
if err != nil {
return err
@@ -229,6 +231,13 @@ func (h *Handler) Recv(incomingPacket []byte) error {
return nil
}
// ShutdownRead activates local discard mode: incoming payload bytes are dropped
// (ACK/SEQ still advance normally) and Read returns io.EOF immediately.
// Not reversible within the lifetime of a connection; reset clears it.
func (h *Handler) ShutdownRead() {
h.shutdownRx = true
}
func (h *Handler) Close() error {
h.trace("tcp.Handler.Close")
if h.closing {
@@ -338,6 +347,9 @@ func (h *Handler) Write(b []byte) (int, error) {
// Read implements [io.Reader] by reading received data from remote peer in internal buffer.
func (h *Handler) Read(b []byte) (n int, err error) {
if h.shutdownRx {
return 0, io.EOF
}
if h.bufRx.Buffered() > 0 {
n, err = h.bufRx.Read(b)
}