Versions in this module Expand all Collapse all v0 v0.0.1 Sep 15, 2023 Changes in this version + const CmdBindTCP + const CmdDialTCP + const CmdForwardUDP + const DefaultSocksPort + const Socks5Version + var ErrNoAcceptableAuth = errors.New("No acceptable auth were offered") + var ErrTargetBlocked = errors.New("Target address is blocked") + var ErrUnauthorized = errors.New("Unauthorized") + var ErrUnsupportCommand = errors.New("Unsupported command") + var ErrUnsupportVersion = errors.New("Unsupport packet format verion") + var ErrVersionChanged = errors.New("Version changed after auth") + func ListenAndServe(addr string, handler Handler) (err error) + func Serve(listener net.Listener, handler Handler) (err error) + type AddrPort struct + Data []byte + Port uint16 + Type AddrType + func AddrPortFromNetAddr(na net.Addr) (a *AddrPort, err error) + func (a *AddrPort) GetDomain() (domain string, ok bool) + func (a *AddrPort) GetIPv4() (ip net.IP, ok bool) + func (a *AddrPort) GetIPv6() (ip net.IP, ok bool) + func (a *AddrPort) MarshalBinary() (buf []byte, err error) + func (a *AddrPort) ReadFrom(r io.Reader) (n int64, err error) + func (a *AddrPort) SetDomain(domain string) *AddrPort + func (a *AddrPort) SetIPv4(ip net.IP) *AddrPort + func (a *AddrPort) SetIPv6(ip net.IP) *AddrPort + func (a *AddrPort) String() (s string) + func (a *AddrPort) WriteTo(w io.Writer) (n int64, err error) + type AddrType byte + const DomainAddr + const IPv4Addr + const IPv6Addr + type AuthType = byte + const GSSAPIAuth + const NoAuth + const UserAuth + type Handler interface + BindTCP func(ctx context.Context, addr *AddrPort) (net.Listener, error) + BindUDP func(ctx context.Context, addr *AddrPort) (net.PacketConn, error) + DialTCP func(ctx context.Context, addr *AddrPort) (net.Conn, error) + type MemoryUserGuarder struct + func NewMemoryUserGuarder() *MemoryUserGuarder + func NewMemoryUserGuarderFromMap(m map[string]string) *MemoryUserGuarder + func (g *MemoryUserGuarder) Auth(username string, password string) (ok bool) + func (g *MemoryUserGuarder) DelUser(username string) + func (g *MemoryUserGuarder) ListUsers() (users []string) + func (g *MemoryUserGuarder) SetUser(username string, password string) + type Server struct + Addr string + DialTimeout time.Duration + Handler Handler + UserGuarder UserGuarder + func (s *Server) Handle(netconn net.Conn) (err error) + func (s *Server) ListenAndServe() (err error) + func (s *Server) Serve(listener net.Listener) (err error) + func (s *Server) Shutdown(ctx context.Context) (err error) + type StatusCode byte + const StatusAddrTypeUnsupported + const StatusBlocked + const StatusCommandUnsupported + const StatusFailed + const StatusGranted + const StatusHostUnreachable + const StatusNetworkUnreachable + const StatusRefused + const StatusTLLExpired + type UnsupportVersionError struct + Version byte + func (e *UnsupportVersionError) Error() string + type UserGuarder interface + Auth func(username string, password string) (ok bool)