ginuerzh/gost · error

%s unsupported

Error message

%s unsupported

What it means

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.

Source

Thrown at http.go:39

type httpConnector struct {
	User *url.Userinfo
}

// HTTPConnector creates a Connector for HTTP proxy client.
// It accepts an optional auth info for HTTP Basic Authentication.
func HTTPConnector(user *url.Userinfo) Connector {
	return &httpConnector{User: user}
}

func (c *httpConnector) Connect(conn net.Conn, address string, options ...ConnectOption) (net.Conn, error) {
	return c.ConnectContext(context.Background(), conn, "tcp", address, options...)
}

func (c *httpConnector) ConnectContext(ctx context.Context, conn net.Conn, network, address string, options ...ConnectOption) (net.Conn, error) {
	switch network {
	case "udp", "udp4", "udp6":
		return nil, fmt.Errorf("%s unsupported", network)
	}

	opts := &ConnectOptions{}
	for _, option := range options {
		option(opts)
	}

	timeout := opts.Timeout
	if timeout <= 0 {
		timeout = ConnectTimeout
	}
	ua := opts.UserAgent
	if ua == "" {
		ua = DefaultUserAgent
	}

	conn.SetDeadline(time.Now().Add(timeout))
	defer conn.SetDeadline(time.Time{})

View on GitHub (pinned to a33fdbf4c9)

Solutions

  1. Use network "tcp" with the HTTP connector, or switch to a connector that supports UDP (e.g. socks5/relay/shadow connectors).
  2. If UDP is required, use a UDP listener/forwarder with a UDP-capable node type instead of the http scheme.
  3. Audit chain/forwarder config so HTTP nodes are only used for TCP traffic.

Example fix

// before
conn, err := httpConnector.Connect(conn, "udp", "example.com:53")
// after
conn, err := httpConnector.Connect(conn, "tcp", "example.com:80")
Defensive patterns

Strategy: validation

Validate before calling

if network == "udp" || network == "udp4" || network == "udp6" {
    return fmt.Errorf("http connector requires tcp, got %s", network)
}
_ = connector.Connect(conn, network, addr)

Type guard

func supportsUDP(scheme string) bool {
    switch scheme {
    case "http", "http2":
        return false
    }
    return true
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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