feat(listener/runix): support remote UDS forwarding (#102)

This commit is contained in:
Yuan Tong
2026-06-13 13:39:14 +08:00
committed by GitHub
parent 9f610fd163
commit 8b0806bad4
14 changed files with 247 additions and 34 deletions
+9 -4
View File
@@ -99,10 +99,15 @@ func (h *relayHandler) handleBind(ctx context.Context, conn net.Conn, network, a
return err
}
if network == "tcp" {
switch network {
case "tcp", "tcp4", "tcp6", "unix":
return h.bindTCP(ctx, conn, network, address, ro, log)
} else {
case "udp", "udp4", "udp6":
return h.bindUDP(ctx, conn, network, address, ro, log)
default:
resp.Status = relay.StatusBadRequest
resp.WriteTo(conn)
return fmt.Errorf("network %s is unsupported", network)
}
}
@@ -149,7 +154,7 @@ func (h *relayHandler) bindTCP(ctx context.Context, conn net.Conn, network, addr
serviceName := fmt.Sprintf("%s-ep-%s", h.options.Service, ln.Addr())
log = log.WithFields(map[string]any{
"service": serviceName,
"listener": "tcp",
"listener": network,
"handler": "ep-tcp",
"bind": fmt.Sprintf("%s/%s", ln.Addr(), ln.Addr().Network()),
"src": ln.Addr().String(),
@@ -288,4 +293,4 @@ func (h *relayHandler) bindUDP(ctx context.Context, conn net.Conn, network, addr
"duration": time.Since(t),
}).Debugf("%s >-< %s", conn.RemoteAddr(), pc.LocalAddr())
return nil
}
}