remove NodeARP in favor of arp.Handler; fix bug in IP stack node handling; use registerNode where applicable

This commit is contained in:
soypat
2025-07-14 19:48:29 -03:00
parent 1549e563e9
commit 61c66a2e58
9 changed files with 29 additions and 32 deletions
+9 -15
View File
@@ -200,25 +200,19 @@ func (sb *StackIP) Register(h StackNode) error {
if proto > 255 {
return errInvalidProto
}
sb.handlers = append(sb.handlers, node{
connID := h.ConnectionID()
var currConnID uint64
if connID != nil {
currConnID = *connID
}
return registerNode(&sb.handlers, node{
demux: h.Demux,
encapsulate: h.Encapsulate,
proto: uint16(proto),
port: h.LocalPort(),
currConnID: currConnID,
connID: connID,
})
return nil
}
func (sb *StackIP) RegisterTCPConn(conn *tcp.Conn) error {
if conn.LocalPort() == 0 {
return errZeroPort
}
sb.handlers = append(sb.handlers, node{
demux: conn.Demux,
encapsulate: conn.Encapsulate,
proto: uint16(lneto.IPProtoTCP),
port: conn.LocalPort(),
})
return nil
}
type logger struct {