feat: add stateless UDP forwarding mode (#853)
Add stateless=true metadata option to UDP listener/handler for raw datagram forwarding without per-client session tracking, similar to NGINX Stream Module behavior. - udp.NewListener: add Stateless field to ListenConfig; branch in NewListener/Accept to skip connPool/listenLoop when stateless - datagramConn: lightweight net.Conn+PacketConn wrapping a single UDP datagram — no channels, mutexes, or pool logic - forward handler: add handleRawDatagram for single request-response cycle; extract dialTarget to share hop selection/dial/proxyproto preamble with handleRawForwarding Usage: gost -L "udp://:10000/127.0.0.1:2000?stateless=true"
This commit is contained in:
@@ -206,6 +206,10 @@ func (h *forwardHandler) Handle(ctx context.Context, conn net.Conn, opts ...hand
|
||||
return errRouterNotAvailable
|
||||
}
|
||||
|
||||
if h.md.stateless {
|
||||
return h.handleRawDatagram(ctx, conn, ro, log, network, "udp")
|
||||
}
|
||||
|
||||
var proto string
|
||||
if network == "tcp" && h.md.sniffing {
|
||||
if h.md.sniffingTimeout > 0 {
|
||||
|
||||
Reference in New Issue
Block a user