proxies

package module
v0.0.0-...-107da9e Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2025 License: MIT Imports: 9 Imported by: 0

README

proxies

Simple library for SOCKS5/HTTP proxies

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PROXY_SCHEMES []string = []string{"http", "socks5"}
View Source
var RE_PROXY_USERNAME *regexp.Regexp = regexp.MustCompile(`^[a-zA-Z0-9-_\.]+$`)

Functions

This section is empty.

Types

type ConnectionCheckFailed

type ConnectionCheckFailed struct{ ErrorInfo }

type DialerInitFailed

type DialerInitFailed struct{ ErrorInfo }

type ErrorInfo

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

func (*ErrorInfo) Error

func (e *ErrorInfo) Error() string

func (*ErrorInfo) Info

func (e *ErrorInfo) Info() *any

type InvalidPort

type InvalidPort struct{ ErrorInfo }

type InvalidScheme

type InvalidScheme struct{ ErrorInfo }

type InvalidURL

type InvalidURL struct{ ErrorInfo }

type InvalidUsername

type InvalidUsername struct{ ErrorInfo }

type Proxy

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

Proxy server struct. You must create it using following constructors:

  • NewProxy(scheme string, host string, port uint16, auth *ProxyAuth)
  • NewProxyFromURL(url *net/url.Url)
  • NewProxyFromStringURL(url string)

NOTE: If proxy does not use authentication, set "auth" parameter to nil

func NewProxy

func NewProxy(scheme, host string, port uint16, auth *ProxyAuth) (*Proxy, error)

func NewProxyFromStringURL

func NewProxyFromStringURL(u string) (*Proxy, error)

func NewProxyFromURL

func NewProxyFromURL(u *url.URL) (*Proxy, error)

func (*Proxy) Auth

func (p *Proxy) Auth() *ProxyAuth

Returns pointer to ProxyAuth specified in proxy.

func (*Proxy) CheckConnection

func (p *Proxy) CheckConnection(u string) error

func (*Proxy) DialContext

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

func (*Proxy) GetHttpTransport

func (p *Proxy) GetHttpTransport() *http.Transport

func (*Proxy) GetSocks5Dialer

func (p *Proxy) GetSocks5Dialer() (*proxy.Dialer, error)

func (*Proxy) GetStringURL

func (p *Proxy) GetStringURL() string

func (*Proxy) GetURL

func (p *Proxy) GetURL() *url.URL

func (*Proxy) Host

func (p *Proxy) Host() string

Returns proxy IPv4/IPv6 address (example: 1.1.1.1, ::1) or domain name (example: proxy.example.com).

func (*Proxy) Port

func (p *Proxy) Port() uint16

Returns port (integer from 1 to 65535).

func (*Proxy) Scheme

func (p *Proxy) Scheme() string

Returns proxy scheme ("socks5" or "http").

type ProxyAuth

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

Proxy server authentication. You must create it using following constructors:

  • NewAuth(user string)
  • NewPasswordAuth(user string, password string)

func NewAuth

func NewAuth(user string) (*ProxyAuth, error)

func NewPasswordAuth

func NewPasswordAuth(user, password string) (*ProxyAuth, error)

func (*ProxyAuth) IsPasswordSet

func (a *ProxyAuth) IsPasswordSet() bool

Returns false if password is empty string and true if password is not empty.

func (*ProxyAuth) Password

func (a *ProxyAuth) Password() string

Returns password. If password is empty, empty string will be returned. You can check is password set with getter "ProxyAuth.IsPasswordSet() bool".

func (*ProxyAuth) User

func (a *ProxyAuth) User() string

Returns user name. Can't be empty if authentication field is specified in "Proxy".

Jump to

Keyboard shortcuts

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