Skip to content

net.socks #

SOCKS5 connections

net.socks connects through SOCKS5 proxies, with optional username/password authentication. Destinations may be IPv4 addresses or domain names, followed by a port. IPv6 destinations are currently unsupported, including bracketed and scoped literals. Attempting one returns IPv6 SOCKS5 destinations are not supported and closes the connection to the proxy without sending a CONNECT request. Domain names made only of hexadecimal letters are still encoded as domains.

fn new_socks5_dialer #

fn new_socks5_dialer(base net.Dialer, proxy_address string, username string, password string) net.Dialer

new_socks5_dialer creates a dialer that will use a SOCKS5 proxy server to initiate connections. An underlying dialer is required to initiate the connection to the proxy server. Most users should use either net.default_tcp_dialer or ssl.create_ssl_dialer.

fn socks5_dial #

fn socks5_dial(proxy_url string, host string, username string, password string) !&net.TcpConn

socks5_dial create new instance of &net.TcpConn

fn socks5_ssl_dial #

fn socks5_ssl_dial(proxy_url string, host string, username string, password string) !&ssl.SSLConn

socks5_ssl_dial create new instance of &ssl.SSLConn

struct SOCKS5Dialer #

struct SOCKS5Dialer {
pub:
	dialer        net.Dialer
	proxy_address string
	username      string
	password      string
}

SOCKS5Dialer implements the Dialer interface initiating connections through a SOCKS5 proxy.

fn (SOCKS5Dialer) dial #

fn (sd SOCKS5Dialer) dial(address string) !net.Connection

dial initiates a new connection through the SOCKS5 proxy.