fix: handle empty host in relay AddrFeature ParseFrom for bind addresses
When rtcp listener calls Router.Bind with ":8000" (port-only address), the relay AddrFeature.ParseFrom fails because net.SplitHostPort returns an empty host. This leaves AType at default 0, causing AddrFeature.Encode to return ErrBadAddrType. Fix by normalizing port-only addresses to "0.0.0.0:<port>" in both tunnel and relay connectors before ParseFrom. Also fix error check on resp.WriteTo in the tunnel handler's handleBind to prevent silent protocol desync.
This commit is contained in:
@@ -57,9 +57,12 @@ func (h *tunnelHandler) handleBind(ctx context.Context, conn net.Conn, network,
|
||||
ID: connectorID,
|
||||
},
|
||||
)
|
||||
resp.WriteTo(conn)
|
||||
if _, err = resp.WriteTo(conn); err != nil {
|
||||
log.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
// Upgrade connection to multiplex session.
|
||||
// Upgrade connection to multiplex session.
|
||||
session, err := mux.ClientSession(conn, h.md.muxCfg)
|
||||
if err != nil {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user