ginuerzh/gost · error

UDP redirect is not available on the Windows platform

Error message

UDP redirect is not available on the Windows platform

What it means

On Windows the UDP transparent-redirect facilities (SO_ORIGINAL_DST equivalents) are not implemented, so UDPRedirectListener unconditionally returns this error instead of a listener. It is a platform-capability limitation, not a runtime failure.

Source

Thrown at redirect_other.go:56

type udpRedirectHandler struct{}

// UDPRedirectHandler creates a server Handler for UDP transparent server.
func UDPRedirectHandler(opts ...HandlerOption) Handler {
	return &udpRedirectHandler{}
}

func (h *udpRedirectHandler) Init(options ...HandlerOption) {
}

func (h *udpRedirectHandler) Handle(conn net.Conn) {
	log.Log("[red-udp] UDP redirect is not available on the Windows platform")
	conn.Close()
}

// UDPRedirectListener creates a Listener for UDP transparent proxy server.
func UDPRedirectListener(addr string, cfg *UDPListenConfig) (Listener, error) {
	return nil, errors.New("UDP redirect is not available on the Windows platform")
}

View on GitHub (pinned to a33fdbf4c9)

Solutions

  1. Run the UDP redirect service on Linux/BSD/macOS where it is supported
  2. Guard the feature by build tags or runtime GOOS check and disable UDP redirect on Windows
  3. Use a non-transparent UDP forwarder on Windows instead

Example fix

// before
l, err := redirect.UDPRedirectListener(addr, cfg) // fails on Windows
// after
if runtime.GOOS == "windows" {
    return errors.New("udp redirect requires a unix-like platform")
}
l, err := redirect.UDPRedirectListener(addr, cfg)
Defensive patterns

Strategy: fallback

Validate before calling

if runtime.GOOS == "windows" {
    // UDP redirect unsupported: use a plain UDP forwarder instead
    return nil, errors.New("udp redirect unsupported on this platform")
}

Try / catch

l, err := redirect.UDPRedirectListener(addr, cfg)
if err != nil {
    log.Log("udp redirect unavailable:", err)
    l = fallbackUDPForwarder(addr) // non-transparent alternative
}

Prevention

When it happens

Trigger: Calling UDPRedirectListener on a Windows build (file redirect_other.go) with any address/config.

Common situations: Deploying a transparent UDP proxy config to Windows; CI or a dev machine running the server on Windows.

Related errors


AI-assisted analysis of ginuerzh/gost@a33fdbf4c9 (2026-09-02). Data as JSON: /api/errors/36ec9eaa005012c8. Report an issue: GitHub.