socks

package
v8.0.12 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2022 License: BSD-3-Clause Imports: 10 Imported by: 7

Documentation

Overview

Current limitations:

  • GSS-API authentication is not supported
  • only SOCKS version 5 is supported
  • TCP bind and UDP not yet supported

Example http client over SOCKS5:

proxy := &socks.Proxy{"127.0.0.1:1080"}
tr := &http.Transport{
	Dial: proxy.Dial,
}
client := &http.Client{Transport: tr}
resp, err := client.Get("https://example.com")

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAuthFailed             = errors.New("authentication failed")
	ErrInvalidProxyResponse   = errors.New("invalid proxy response")
	ErrNoAcceptableAuthMethod = errors.New("no acceptable authentication method")
)
View Source
var (
	ErrPoolMaxConnections = errors.New("maximum number of connections reached")
)

Functions

This section is empty.

Types

type Pool

type Pool struct {
	// contains filtered or unexported fields
}

func NewPool

func NewPool(proxy Proxy, maxOpen uint32) *Pool

func (*Pool) DialContext

func (p *Pool) DialContext(ctx context.Context, network, address string) (net.Conn, error)

type ProxiedAddr

type ProxiedAddr struct {
	Net  string
	Host string
	Port int
}

func (*ProxiedAddr) Network

func (a *ProxiedAddr) Network() string

func (*ProxiedAddr) String

func (a *ProxiedAddr) String() string

type Proxy

type Proxy struct {
	Addr         string
	Username     string
	Password     string
	TorIsolation bool
}

func (*Proxy) Dial

func (p *Proxy) Dial(network, addr string) (net.Conn, error)

func (*Proxy) DialContext

func (p *Proxy) DialContext(ctx context.Context, network, addr string) (net.Conn, error)

func (*Proxy) DialTimeout

func (p *Proxy) DialTimeout(network, addr string, timeout time.Duration) (net.Conn, error)

Jump to

Keyboard shortcuts

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