socks5

package
v0.0.0-...-08f4d47 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2018 License: BSD-2-Clause, BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package socks5 implements a SOCKS 5 server and the required pluggable transport specific extensions. For more information see RFC 1928 and RFC 1929.

Notes:

  • GSSAPI authentication, is NOT supported.
  • Only the CONNECT command is supported.
  • The authentication provided by the client is always accepted as it is used as a channel to pass information rather than for authentication for pluggable transports.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Version

func Version() string

Version returns a string suitable to be included in a call to Cmethod.

Types

type ReplyCode

type ReplyCode byte

ReplyCode is a SOCKS 5 reply code.

const (
	ReplySucceeded ReplyCode = iota
	ReplyGeneralFailure
	ReplyConnectionNotAllowed
	ReplyNetworkUnreachable
	ReplyHostUnreachable
	ReplyConnectionRefused
	ReplyTTLExpired
	ReplyCommandNotSupported
	ReplyAddressNotSupported
)

The various SOCKS 5 reply codes from RFC 1928.

func ErrorToReplyCode

func ErrorToReplyCode(err error) ReplyCode

ErrorToReplyCode converts an error to the "best" reply code.

type Request

type Request struct {
	Target string
	Args   pt.Args
	// contains filtered or unexported fields
}

Request describes a SOCKS 5 request.

func Handshake

func Handshake(conn net.Conn) (*Request, error)

Handshake attempts to handle a incoming client handshake over the provided connection and receive the SOCKS5 request. The routine handles sending appropriate errors if applicable, but will not close the connection.

func (*Request) Reply

func (req *Request) Reply(code ReplyCode) error

Reply sends a SOCKS5 reply to the corresponding request. The BND.ADDR and BND.PORT fields are always set to an address/port corresponding to "0.0.0.0:0".

Jump to

Keyboard shortcuts

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