Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // UDPTimeout is how long before we stop listening on UDP sockets opened in support of an ASSOCIATE command. UDPTimeout = time.Second * 10 // ListenerTimeout is how long to keep a BIND socket open after the client is done with it. ListenerTimeout = time.Second * 1 )
Functions ¶
This section is empty.
Types ¶
type Authenticator ¶ added in v0.0.4
type Authenticator interface {
// Socks5Authenticate provide authentication of users. Return socks5.ErrAuthMethodNotSupported if the method is
// not supported by the authenticator. For non-anonymous methods, the returned username must not be the
// empty string.
Socks5Authenticate(rw io.ReadWriter, am socks5.AuthMethod, address string) (username string, err error)
}
Authenticator provide authentication of users.
type CredentialsValidator ¶ added in v0.0.18
type CredentialsValidator interface {
ValidateCredentials(username, password, address string) bool
}
CredentialsValidator is used to support user/pass authentication optional network address filtering.
type DialerSelector ¶ added in v0.0.5
type DialerSelector interface {
// SelectDialer returns the ContextDialer to use.
//
// When called, client has already logged in. If username is the empty string, AuthMethodNone was used.
// In case of error, it is recommended to return one of the socks5.ErrReply... errors,
// as those will be mapped to SOCKS5 error codes in the reply to the client.
SelectDialer(username, network, address string) (cd socks5.ContextDialer, err error)
}
A socks5.DialerSelector returns the ContextDialer to use.
type NoAuthAuthenticator ¶ added in v0.0.4
type NoAuthAuthenticator struct{}
NoAuthAuthenticator is used to handle the "No Authentication" mode
func (NoAuthAuthenticator) Socks5Authenticate ¶ added in v0.0.9
func (a NoAuthAuthenticator) Socks5Authenticate(rw io.ReadWriter, am socks5.AuthMethod, _ string) (username string, err error)
type Request ¶
type Request struct {
Addr socks5.Addr
Cmd socks5.CommandType
}
Request is the request packet
type Response ¶
Response contains the contents of a Response packet sent from the proxy to the client.
func (*Response) MarshalBinary ¶
MarshalBinary converts a Response struct into a packet.
type Server ¶
type Server struct {
// List of authentication providers. If nil, uses NoAuthAuthenticator.
// Order matters; they are tried in the given order.
Authenticators []Authenticator
// DialerSelector is called to get the ContextDialer to use for an outgoing connection.
// If nil, socks5.DefaultDialer will be used, which if not changed is a net.Dialer.
DialerSelector
Logger socks5.Logger // If not nil, use this Logger (compatible with log/slog)
Debug bool // If true, output debug logging using Logger.Info
// contains filtered or unexported fields
}
Server is a SOCKS5 proxy server.
type StaticCredentials ¶ added in v0.0.4
StaticCredentials enables using a map directly as a credential store
func (StaticCredentials) ValidateCredentials ¶ added in v0.0.18
func (s StaticCredentials) ValidateCredentials(username, password, _ string) bool
type UserPassAuthenticator ¶ added in v0.0.4
type UserPassAuthenticator struct {
Credentials CredentialsValidator
}
UserPassAuthenticator is used to handle username/password based authentication.
func (UserPassAuthenticator) Socks5Authenticate ¶ added in v0.0.9
func (a UserPassAuthenticator) Socks5Authenticate(rw io.ReadWriter, am socks5.AuthMethod, address string) (username string, err error)
Click to show internal directories.
Click to hide internal directories.