Versions in this module Expand all Collapse all v1 v1.0.0 Sep 19, 2020 Changes in this version + const AssociateCommand + const BindCommand + const ConnectCommand + const NoAuth + const UserPassAuth + var NoSupportedAuth = fmt.Errorf("No supported authentication mechanism") + var UserAuthFailed = fmt.Errorf("User authentication failed") + type AddrSpec struct + FQDN string + IP net.IP + Port int + func (a *AddrSpec) String() string + func (a AddrSpec) Address() string + type AddressRewriter interface + Rewrite func(ctx context.Context, request *Request) (context.Context, *AddrSpec) + type AuthContext struct + Method uint8 + Payload map[string]string + type Authenticator interface + Authenticate func(reader io.Reader, writer io.Writer) (*AuthContext, error) + GetCode func() uint8 + type Config struct + AuthMethods []Authenticator + BindIP net.IP + Credentials CredentialStore + Dial func(ctx context.Context, network, addr string) (net.Conn, error) + Logger *log.Logger + Resolver NameResolver + Rewriter AddressRewriter + Rules RuleSet + type CredentialStore interface + Valid func(user, password string) bool + type DNSResolver struct + func (d DNSResolver) Resolve(ctx context.Context, name string) (context.Context, net.IP, error) + type NameResolver interface + Resolve func(ctx context.Context, name string) (context.Context, net.IP, error) + type NoAuthAuthenticator struct + func (a NoAuthAuthenticator) Authenticate(reader io.Reader, writer io.Writer) (*AuthContext, error) + func (a NoAuthAuthenticator) GetCode() uint8 + type PermitCommand struct + EnableAssociate bool + EnableBind bool + EnableConnect bool + func (p *PermitCommand) Allow(ctx context.Context, req *Request) (context.Context, bool) + type Request struct + AuthContext *AuthContext + Command uint8 + DestAddr *AddrSpec + RemoteAddr *AddrSpec + Version uint8 + func NewRequest(bufConn io.Reader) (*Request, error) + type RuleSet interface + Allow func(ctx context.Context, req *Request) (context.Context, bool) + func PermitAll() RuleSet + func PermitNone() RuleSet + type Server struct + func New(conf *Config) (*Server, error) + func (s *Server) ListenAndServe(network, addr string) error + func (s *Server) Serve(l net.Listener) error + func (s *Server) ServeConn(conn net.Conn) error + type StaticCredentials map[string]string + func (s StaticCredentials) Valid(user, password string) bool + type UserPassAuthenticator struct + Credentials CredentialStore + func (a UserPassAuthenticator) Authenticate(reader io.Reader, writer io.Writer) (*AuthContext, error) + func (a UserPassAuthenticator) GetCode() uint8