socks5

package
v0.0.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
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.

func (ReplyCode) Error added in v0.0.5

func (e ReplyCode) Error() string

Error returns a human-readable description of the error, based on the SOCKS5 RFC.

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL