{"record":{"id":"85452b3a7ab73eba","repo":"ginuerzh/gost","slug":"s-unsupported","errorCode":null,"errorMessage":"%s unsupported","messagePattern":"(.+?) unsupported","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"http.go","lineNumber":39,"sourceCode":"\ntype httpConnector struct {\n\tUser *url.Userinfo\n}\n\n// HTTPConnector creates a Connector for HTTP proxy client.\n// It accepts an optional auth info for HTTP Basic Authentication.\nfunc HTTPConnector(user *url.Userinfo) Connector {\n\treturn &httpConnector{User: user}\n}\n\nfunc (c *httpConnector) Connect(conn net.Conn, address string, options ...ConnectOption) (net.Conn, error) {\n\treturn c.ConnectContext(context.Background(), conn, \"tcp\", address, options...)\n}\n\nfunc (c *httpConnector) ConnectContext(ctx context.Context, conn net.Conn, network, address string, options ...ConnectOption) (net.Conn, error) {\n\tswitch network {\n\tcase \"udp\", \"udp4\", \"udp6\":\n\t\treturn nil, fmt.Errorf(\"%s unsupported\", network)\n\t}\n\n\topts := &ConnectOptions{}\n\tfor _, option := range options {\n\t\toption(opts)\n\t}\n\n\ttimeout := opts.Timeout\n\tif timeout <= 0 {\n\t\ttimeout = ConnectTimeout\n\t}\n\tua := opts.UserAgent\n\tif ua == \"\" {\n\t\tua = DefaultUserAgent\n\t}\n\n\tconn.SetDeadline(time.Now().Add(timeout))\n\tdefer conn.SetDeadline(time.Time{})","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/ginuerzh/gost/blob/a33fdbf4c98034f4bfeeaea9868909822b9c526d/http.go#L21-L57","documentation":"Formed by httpConnector.ConnectContext with the requested network substituted for %s when that network is not TCP — the HTTP proxy connector can only relay TCP streams, so any other network value (e.g. udp) is rejected before any bytes are written. A caller-misuse guard, not a runtime proxy failure.","triggerScenarios":"Calling (httpConnector).Connect or ConnectContext with network set to \"udp\", \"udp4\", or \"udp6\" — e.g. configuring a gost chain hop with an HTTP connector for a UDP forwarder.","commonSituations":"Users configure an HTTP proxy node for UDP relay (e.g. udp over tunnel) and the chain picks the http connector; typos or generic connector selection code passing through the listener's network type.","solutions":["Use network \"tcp\" with the HTTP connector, or switch to a connector that supports UDP (e.g. socks5/relay/shadow connectors).","If UDP is required, use a UDP listener/forwarder with a UDP-capable node type instead of the http scheme.","Audit chain/forwarder config so HTTP nodes are only used for TCP traffic."],"exampleFix":"// before\nconn, err := httpConnector.Connect(conn, \"udp\", \"example.com:53\")\n// after\nconn, err := httpConnector.Connect(conn, \"tcp\", \"example.com:80\")","handlingStrategy":"validation","validationCode":"if network == \"udp\" || network == \"udp4\" || network == \"udp6\" {\n    return fmt.Errorf(\"http connector requires tcp, got %s\", network)\n}\n_ = connector.Connect(conn, network, addr)","typeGuard":"func supportsUDP(scheme string) bool {\n    switch scheme {\n    case \"http\", \"http2\":\n        return false\n    }\n    return true\n}","tryCatchPattern":null,"preventionTips":["Only use http scheme nodes for TCP traffic","Choose udp-capable node types for UDP forwarders","Validate chain configs at startup"],"tags":["network","http","udp","unsupported"],"backgroundTag":"unsupported-network-protocol","analyzedSha":"a33fdbf4c98034f4bfeeaea9868909822b9c526d","analyzedAt":"2026-09-02T22:15:54.506Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}