Documentation ¶
Index ¶
Constants ¶
const ( ErrGeneralServerFailure = ReplyCode(0x01) ErrConnectionNotAllowedByRuleset = ReplyCode(0x02) ErrNetworkUnreachable = ReplyCode(0x03) ErrHostUnreachable = ReplyCode(0x04) ErrConnectionRefused = ReplyCode(0x05) ErrTTLExpired = ReplyCode(0x06) ErrCommandNotSupported = ReplyCode(0x07) ErrAddressTypeNotSupported = ReplyCode(0x08) )
SOCKS reply codes, as enumerated in https://datatracker.ietf.org/doc/html/rfc1928#section-6.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ReplyCode ¶ added in v0.0.5
type ReplyCode byte
ReplyCode is a byte-unsigned number that represents a SOCKS error as indicated in the REP field of the server response.
type StreamDialer ¶
type StreamDialer struct {
// contains filtered or unexported fields
}
func NewStreamDialer ¶
func NewStreamDialer(endpoint transport.StreamEndpoint) (*StreamDialer, error)
NewStreamDialer creates a transport.StreamDialer that routes connections to a SOCKS5 proxy listening at the given transport.StreamEndpoint.
func (*StreamDialer) DialStream ¶ added in v0.0.15
func (c *StreamDialer) DialStream(ctx context.Context, remoteAddr string) (transport.StreamConn, error)
DialStream implements transport.StreamDialer.DialStream using SOCKS5. It will send the auth method, auth credentials (if auth is chosen), and the connect requests in one packet, to avoid an additional roundtrip. The returned [error] will be of type ReplyCode if the server sends a SOCKS error reply code, which you can check against the error constants in this package using errors.Is.
func (*StreamDialer) SetCredentials ¶ added in v0.0.15
func (c *StreamDialer) SetCredentials(username, password []byte) error