ginuerzh/gost · error

Service unavailable

Error message

Service unavailable

What it means

Returned by the SOCKS5 bind connector's ConnectContext (socks.go) when the SOCKS5 server replies to the BIND request with a Rep code other than Succeeded. The error is client-side reporting of a server-side rejection: the proxy accepted the connection but refused or failed to set up the bind listener.

Solutions

  1. Inspect the SOCKS5 server logs to find why the BIND request was rejected
  2. Verify the target address/port passed in the bind request is reachable and permitted by the proxy's ACL
  3. Confirm the SOCKS5 server supports the BIND command at all
  4. Check that authentication succeeded — some servers report auth failures as a generic non-success Rep
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at socks.go:276 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


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

Appendix: source

Thrown at socks.go:276

	if err := req.Write(conn); err != nil {
		return nil, err
	}

	if Debug {
		log.Log("[socks5]", req)
	}

	reply, err := gosocks5.ReadReply(conn)
	if err != nil {
		return nil, err
	}

	if Debug {
		log.Log("[socks5]", reply)
	}

	if reply.Rep != gosocks5.Succeeded {
		return nil, errors.New("Service unavailable")
	}

	return conn, nil
}

type socks5BindConnector struct {
	User *url.Userinfo
}

// SOCKS5BindConnector creates a connector for SOCKS5 bind.
// It accepts an optional auth info for SOCKS5 Username/Password Authentication.
func SOCKS5BindConnector(user *url.Userinfo) Connector {
	return &socks5BindConnector{User: user}
}

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

View on GitHub (pinned to a33fdbf4c9)