{"record":{"id":"0f9ba7421c6b7860","repo":"valyala/fasthttp","slug":"dont-support-the-network","errorCode":null,"errorMessage":"dont support the network: ","messagePattern":"dont support the network: ","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"fasthttpproxy/dialer.go","lineNumber":203,"sourceCode":"\t\treturn proxyDialer.Dial(network, addr)\n\t}, nil\n}\n\n// Dial is solely for implementing the proxy.Dialer interface.\nfunc (d *Dialer) Dial(network, addr string) (net.Conn, error) {\n\tif network == \"tcp4\" {\n\t\tif d.Timeout > 0 {\n\t\t\treturn d.DialTimeout(addr, d.Timeout)\n\t\t}\n\t\treturn d.TCPDialer.Dial(addr)\n\t}\n\tif network == \"tcp\" {\n\t\tif d.Timeout > 0 {\n\t\t\treturn d.DialDualStackTimeout(addr, d.Timeout)\n\t\t}\n\t\treturn d.TCPDialer.DialDualStack(addr)\n\t}\n\terr := errors.New(\"dont support the network: \" + network)\n\treturn nil, err\n}\n\nfunc (d *Dialer) connectTimeout() time.Duration {\n\treturn d.ConnectTimeout\n}\n\n// In the httpProxyDial function, the proxy.Dialer that implements\n// this interface can retrieve timeout information when sending the CONNECT\n// method to the HTTP proxy.\ntype httpProxyDialer interface {\n\tconnectTimeout() time.Duration\n}\n\n// DialerFunc Make a function of type func(network, addr string) (net.Conn, error)\n// implement the proxy.Dialer interface.\ntype DialerFunc func(network, addr string) (net.Conn, error)\n","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/valyala/fasthttp/blob/c96f600972c6f4a7a30d664257b340ebe9d60124/fasthttpproxy/dialer.go#L185-L221","documentation":"TCPDialer.Dial only supports the 'tcp' network; any other network value passed to Dial returns 'dont support the network: <network>'. The fasthttpproxy Dialer intentionally restricts dialing to TCP.","triggerScenarios":"Calling the fasthttpproxy Dialer's Dial (e.g. as a proxy.Dialer implementation) with network values like 'udp', 'unix', or 'tcp4'/'tcp6' variants — anything other than exactly \"tcp\". Also reached indirectly via httpProxyDial when the configured network differs.","commonSituations":"Wiring fasthttpproxy.Dialer into generic dial interfaces that pass the network string from a config file set to 'unix'; callers assuming tcp4/tcp6 are accepted; proxy frameworks invoking Dialer.Dial(network, addr) with non-tcp networks.","solutions":["Pass network=\"tcp\" to Dialer.Dial","Normalize/alias tcp4/tcp6 to \"tcp\" before calling, or use the raw net.Dialer for those cases","Use a unix-socket capable dialer (net.Dial) when 'unix' is needed instead of fasthttpproxy.Dialer"],"exampleFix":"// before\nconn, err := dialer.Dial(\"tcp4\", \"example.com:80\")\n// after\nnetwork := \"tcp\"\nconn, err := dialer.Dial(network, \"example.com:80\")","handlingStrategy":"validation","validationCode":"if network != \"tcp\" {\n    return fmt.Errorf(\"fasthttpproxy only supports tcp, got %q\", network)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Hardcode network=\"tcp\" when wiring fasthttpproxy dialers","Reject tcp4/tcp6/unix in config before dialing","Use net.Dial directly for non-tcp networks"],"tags":["fasthttp","proxy","dialer","network"],"backgroundTag":"unsupported-network-type","analyzedSha":"c96f600972c6f4a7a30d664257b340ebe9d60124","analyzedAt":"2026-08-31T22:48:28.265Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}