Documentation ¶
Index ¶
- Constants
- func StreamHandler(tunnelConn io.ReadWriter, originConn net.Conn, log *zerolog.Logger)
- func StreamNetHandler(tunnelConn io.ReadWriter, accessPolicy *ipaccess.Policy, log *zerolog.Logger)
- type AddrSpec
- type AuthHandler
- type Authenticator
- type ConnDialer
- type ConnectionHandler
- type Dialer
- type NetDialer
- type NoAuthAuthenticator
- type Request
- type RequestHandler
- type StandardAuthHandler
- type StandardConnectionHandler
- type StandardRequestHandler
- type UserPassAuthAuthenticator
Constants ¶
const ( // NoAuth means no authentication is used when connecting NoAuth = uint8(0) // UserPassAuth means a user/password is used when connecting UserPassAuth = uint8(2) )
Variables ¶
This section is empty.
Functions ¶
func StreamHandler ¶
func StreamNetHandler ¶
Types ¶
type AddrSpec ¶
AddrSpec is used to return the target IPv4, IPv6, or a FQDN
type AuthHandler ¶
AuthHandler handles socks authentication requests
func NewAuthHandler ¶
func NewAuthHandler() AuthHandler
NewAuthHandler creates a default auth handler
type Authenticator ¶
Authenticator is the connection passed in as a reader/writer to support different authentication types
func NewNoAuthAuthenticator ¶
func NewNoAuthAuthenticator() Authenticator
NewNoAuthAuthenticator creates a authless Authenticator
func NewUserPassAuthAuthenticator ¶
func NewUserPassAuthAuthenticator(isValid func(string, string) bool) Authenticator
NewUserPassAuthAuthenticator creates a new username/password validator Authenticator
type ConnDialer ¶
type ConnDialer struct {
// contains filtered or unexported fields
}
ConnDialer is like NetDialer but with an existing TCP dialer already created
func (*ConnDialer) Dial ¶
func (d *ConnDialer) Dial(address string) (io.ReadWriteCloser, *AddrSpec, error)
Dial is a TCP dialer but already created
type ConnectionHandler ¶
type ConnectionHandler interface {
Serve(io.ReadWriter) error
}
ConnectionHandler is the Serve method to handle connections from a local TCP listener of the standard library (net.Listener)
func NewConnectionHandler ¶
func NewConnectionHandler(requestHandler RequestHandler) ConnectionHandler
NewConnectionHandler creates a standard SOCKS5 connection handler This process connections from a generic TCP listener from the standard library
type Dialer ¶
type Dialer interface {
Dial(string) (io.ReadWriteCloser, *AddrSpec, error)
}
Dialer is used to provided the transport of the proxy
func NewConnDialer ¶
NewConnDialer creates a new dialer with a already created net.conn (TCP expected)
type NoAuthAuthenticator ¶
type NoAuthAuthenticator struct{}
NoAuthAuthenticator is used to handle the No Authentication mode
type Request ¶
type Request struct { // Protocol version Version uint8 // Requested command Command uint8 // AddrSpec of the destination DestAddr *AddrSpec // contains filtered or unexported fields }
Request is a SOCKS5 command with supporting field of the connection
type RequestHandler ¶
type RequestHandler interface {
Handle(*Request, io.ReadWriter) error
}
RequestHandler is the functions needed to handle a SOCKS5 command
func NewRequestHandler ¶
func NewRequestHandler(dialer Dialer, accessPolicy *ipaccess.Policy) RequestHandler
NewRequestHandler creates a standard SOCKS5 request handler This handles the SOCKS5 commands and proxies them to their destination
type StandardAuthHandler ¶
type StandardAuthHandler struct {
// contains filtered or unexported fields
}
StandardAuthHandler loads the default authenticators
func (*StandardAuthHandler) Handle ¶
Handle gets the methods from the SOCKS5 client and authenticates with the first supported method
func (*StandardAuthHandler) Register ¶
func (h *StandardAuthHandler) Register(method uint8, a Authenticator)
Register adds/replaces an Authenticator to use when handling Authentication requests
type StandardConnectionHandler ¶
type StandardConnectionHandler struct {
// contains filtered or unexported fields
}
StandardConnectionHandler is the base implementation of handling SOCKS5 requests
func (*StandardConnectionHandler) Serve ¶
func (h *StandardConnectionHandler) Serve(c io.ReadWriter) error
Serve process new connection created after calling `Accept()` in the standard library
type StandardRequestHandler ¶
type StandardRequestHandler struct {
// contains filtered or unexported fields
}
StandardRequestHandler implements the base socks5 command processing
func (*StandardRequestHandler) Handle ¶
func (h *StandardRequestHandler) Handle(req *Request, conn io.ReadWriter) error
Handle processes and responds to socks5 commands
type UserPassAuthAuthenticator ¶
UserPassAuthAuthenticator is used to handle the user/password mode