socks

package module
v0.0.0-...-b941c5f Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: MIT Imports: 7 Imported by: 0

README

socks

socks client/server [WIP]

Documentation

Index

Constants

View Source
const (
	V4  ProtocolV4  = 0x04
	V4A ProtocolV4A = 0x04
	V5  ProtocolV5  = 0x05
)

Variables

View Source
var (
	// ErrServerClosed is returned by the Server's Serve, ServeTLS, ListenAndServe,
	// and ListenAndServeTLS methods after a call to Shutdown or Close.
	ErrServerClosed = errors.New("http: Server closed")
)

Functions

func WithUserPW

func WithUserPW(username string, password string) func(*Client)

func WithVersion

func WithVersion(version any) func(*Client)

Types

type Authentication

type Authentication interface {
	Pack(io.Writer) error
	Unpack(io.Reader) error

	// Returns authentication method
	Method() uint8
	Ver() uint8
}

type Client

type Client struct {
	net.Dialer
	ProtocolVersion any
	Authentication  Authentication
	ProxyAddr       string
}

func NewClient

func NewClient(proxyAddr string, options ...func(*Client)) (client *Client, err error)

NewClient creates a new SOCKS client, defaults to protocol version socks5

func (*Client) ConnectV5

func (c *Client) ConnectV5(conn net.Conn, target any) (reply *s5.Reply, err error)

ConnectV5 target can be used as string for both ip and domain or *net.TCPAddr for ip:port only

func (*Client) Dial

func (c *Client) Dial(network string, address string) (conn net.Conn, err error)

Dial connects to the given address via the proxy server.

func (*Client) DialTCP

func (c *Client) DialTCP(network string, laddr, raddr *net.TCPAddr) (conn *net.TCPConn, err error)

DialTCP connects to the given TCPAddr via the proxy server.

func (*Client) HandshakeV5

func (c *Client) HandshakeV5(conn net.Conn) (err error)

type ProtocolV4

type ProtocolV4 uint8

type ProtocolV4A

type ProtocolV4A uint8

type ProtocolV5

type ProtocolV5 uint8

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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