{"record":{"id":"f6fd004868a06e6a","repo":"ginuerzh/gost","slug":"s-unsupported-f6fd00","errorCode":null,"errorMessage":"%s unsupported","messagePattern":"(.+?) unsupported","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"http2.go","lineNumber":43,"sourceCode":"\ntype http2Connector struct {\n\tUser *url.Userinfo\n}\n\n// HTTP2Connector creates a Connector for HTTP2 proxy client.\n// It accepts an optional auth info for HTTP Basic Authentication.\nfunc HTTP2Connector(user *url.Userinfo) Connector {\n\treturn &http2Connector{User: user}\n}\n\nfunc (c *http2Connector) 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 *http2Connector) 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\tua := opts.UserAgent\n\tif ua == \"\" {\n\t\tua = DefaultUserAgent\n\t}\n\n\tcc, ok := conn.(*http2ClientConn)\n\tif !ok {\n\t\treturn nil, errors.New(\"wrong connection type\")\n\t}\n\n\tpr, pw := io.Pipe()\n\treq := &http.Request{","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/ginuerzh/gost/blob/a33fdbf4c98034f4bfeeaea9868909822b9c526d/http2.go#L25-L61","documentation":"Formed by http2Connector.ConnectContext with the requested network substituted for %s when that network is not TCP — HTTP/2 proxying here only supports stream-oriented TCP connections, so values like udp are rejected up front. A caller-misuse guard, not a runtime proxy failure.","triggerScenarios":"Calling (http2Connector).Connect/ConnectContext with network \"udp\"/\"udp4\"/\"udp6\", e.g. wiring an http2 hop into a UDP forwarder or relay chain.","commonSituations":"Configuring UDP-over-HTTP2 tunnels by mistake; reusing the same node definition for both TCP and UDP forwarding; generic forwarding code propagating the listener's network type into the dialer.","solutions":["Use \"tcp\" as the network for http2 nodes.","For UDP, pick a UDP-capable node type (socks5, relay, ss, ku, etc.) or tunnel UDP over a TCP-based transport that supports it.","Separate TCP and UDP forwarder configs so the http2 scheme is never selected for UDP traffic."],"exampleFix":"// before\nforwarder: udp://:53 -> http2://relay:443\n// after\nforwarder: udp://:53 -> relay+ws://relay:443","handlingStrategy":"validation","validationCode":"if network != \"tcp\" {\n    return fmt.Errorf(\"http2 connector supports tcp only, got %s\", network)\n}\n_ = h2Connector.Connect(conn, network, addr)","typeGuard":"func isTCPOnly(scheme string) bool { return scheme == \"http\" || scheme == \"http2\" }","tryCatchPattern":null,"preventionTips":["Map UDP traffic to udp-capable schemes in config generation","Lint forwarder configs for scheme/network compatibility","Keep separate node definitions for TCP and UDP"],"tags":["network","http2","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"}