{"record":{"id":"36ec9eaa005012c8","repo":"ginuerzh/gost","slug":"udp-redirect-is-not-available-on-the-windows-platf","errorCode":null,"errorMessage":"UDP redirect is not available on the Windows platform","messagePattern":"UDP redirect is not available on the Windows platform","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"redirect_other.go","lineNumber":56,"sourceCode":"\ntype udpRedirectHandler struct{}\n\n// UDPRedirectHandler creates a server Handler for UDP transparent server.\nfunc UDPRedirectHandler(opts ...HandlerOption) Handler {\n\treturn &udpRedirectHandler{}\n}\n\nfunc (h *udpRedirectHandler) Init(options ...HandlerOption) {\n}\n\nfunc (h *udpRedirectHandler) Handle(conn net.Conn) {\n\tlog.Log(\"[red-udp] UDP redirect is not available on the Windows platform\")\n\tconn.Close()\n}\n\n// UDPRedirectListener creates a Listener for UDP transparent proxy server.\nfunc UDPRedirectListener(addr string, cfg *UDPListenConfig) (Listener, error) {\n\treturn nil, errors.New(\"UDP redirect is not available on the Windows platform\")\n}\n","sourceCodeStart":38,"sourceCodeEnd":58,"githubUrl":"https://github.com/ginuerzh/gost/blob/a33fdbf4c98034f4bfeeaea9868909822b9c526d/redirect_other.go#L38-L58","documentation":"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.","triggerScenarios":"Calling UDPRedirectListener on a Windows build (file redirect_other.go) with any address/config.","commonSituations":"Deploying a transparent UDP proxy config to Windows; CI or a dev machine running the server on Windows.","solutions":["Run the UDP redirect service on Linux/BSD/macOS where it is supported","Guard the feature by build tags or runtime GOOS check and disable UDP redirect on Windows","Use a non-transparent UDP forwarder on Windows instead"],"exampleFix":"// before\nl, err := redirect.UDPRedirectListener(addr, cfg) // fails on Windows\n// after\nif runtime.GOOS == \"windows\" {\n    return errors.New(\"udp redirect requires a unix-like platform\")\n}\nl, err := redirect.UDPRedirectListener(addr, cfg)","handlingStrategy":"fallback","validationCode":"if runtime.GOOS == \"windows\" {\n    // UDP redirect unsupported: use a plain UDP forwarder instead\n    return nil, errors.New(\"udp redirect unsupported on this platform\")\n}","typeGuard":null,"tryCatchPattern":"l, err := redirect.UDPRedirectListener(addr, cfg)\nif err != nil {\n    log.Log(\"udp redirect unavailable:\", err)\n    l = fallbackUDPForwarder(addr) // non-transparent alternative\n}","preventionTips":["Check runtime.GOOS before enabling transparent UDP features","Document platform requirements in deployment configs","Test deployment targets in CI"],"tags":["windows","platform-support","udp","transparent-proxy"],"backgroundTag":"feature-not-supported-on-platform","analyzedSha":"a33fdbf4c98034f4bfeeaea9868909822b9c526d","analyzedAt":"2026-09-02T22:15:54.506Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}