Involved Source Filesclient.go Package socks provides a SOCKS version 5 client implementation.
SOCKS protocol version 5 is defined in RFC 1928.
Username/Password authentication for SOCKS version 5 is defined in
RFC 1929.
Package-Level Type Names (total 7, all are exported)
A Conn represents a forward proxy connection.Connnet.ConnboundAddrnet.Addr BoundAddr returns the address assigned by the proxy server for
connecting to the command target address from the proxy server. Close closes the connection.
Any blocked Read or Write operations will be unblocked and return errors. LocalAddr returns the local network address, if known. Read reads data from the connection.
Read can be made to time out and return an error after a fixed
time limit; see SetDeadline and SetReadDeadline. RemoteAddr returns the remote network address, if known. SetDeadline sets the read and write deadlines associated
with the connection. It is equivalent to calling both
SetReadDeadline and SetWriteDeadline.
A deadline is an absolute time after which I/O operations
fail instead of blocking. The deadline applies to all future
and pending I/O, not just the immediately following call to
Read or Write. After a deadline has been exceeded, the
connection can be refreshed by setting a deadline in the future.
If the deadline is exceeded a call to Read or Write or to other
I/O methods will return an error that wraps os.ErrDeadlineExceeded.
This can be tested using errors.Is(err, os.ErrDeadlineExceeded).
The error's Timeout method will return true, but note that there
are other possible errors for which the Timeout method will
return true even if the deadline has not been exceeded.
An idle timeout can be implemented by repeatedly extending
the deadline after successful Read or Write calls.
A zero value for t means I/O operations will not time out. SetReadDeadline sets the deadline for future Read calls
and any currently-blocked Read call.
A zero value for t means Read will not time out. SetWriteDeadline sets the deadline for future Write calls
and any currently-blocked Write call.
Even if write times out, it may return n > 0, indicating that
some of the data was successfully written.
A zero value for t means Write will not time out. Write writes data to the connection.
Write can be made to time out and return an error after a fixed
time limit; see SetDeadline and SetWriteDeadline.
Conn : internal/bisect.Writer
Conn : io.Closer
Conn : io.ReadCloser
Conn : io.Reader
Conn : io.ReadWriteCloser
Conn : io.ReadWriter
Conn : io.WriteCloser
Conn : io.Writer
Conn : net.Conn
Conn : crypto/tls.transcriptHash
A Dialer holds SOCKS-specific options. AuthMethods specifies the list of request authentication
methods.
If empty, SOCKS client requests only AuthMethodNotRequired. Authenticate specifies the optional authentication
function. It must be non-nil when AuthMethods is not empty.
It must return an error when the authentication is failed. ProxyDial specifies the optional dial function for
establishing the transport connection. // either CmdConnect or cmdBind // proxy server address // network between a proxy server and a client Dial connects to the provided address on the provided network.
Unlike DialContext, it returns a raw transport connection instead
of a forward proxy connection.
Deprecated: Use DialContext or DialWithConn instead. DialContext connects to the provided address on the provided
network.
The returned error value may be a net.OpError. When the Op field of
net.OpError contains "socks", the Source field contains a proxy
server address and the Addr field contains a command target
address.
See func Dial of the net package of standard library for a
description of the network and address parameters. DialWithConn initiates a connection from SOCKS server to the target
network and address using the connection c that is already
connected to the SOCKS server.
It returns the connection's local address assigned by the SOCKS
server.(*Dialer) connect(ctx context.Context, c net.Conn, address string) (_ net.Addr, ctxErr error)(*Dialer) pathAddrs(address string) (proxy, dst net.Addr, err error)(*Dialer) validateTarget(network, address string) error
*Dialer : golang.org/x/net/proxy.ContextDialer
*Dialer : golang.org/x/net/proxy.Dialer
func NewDialer(network, address string) *Dialer
UsernamePassword are the credentials for the username/password
authentication method.PasswordstringUsernamestring Authenticate authenticates a pair of username and password with the
proxy server.
Package-Level Functions (total 2, in which 1 is exported)
NewDialer returns a new Dialer that dials through the provided
proxy server's network and address.
The pages are generated with Goldsv0.6.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.