Documentation ¶
Index ¶
- Constants
- func ListenAndServe(addr string) error
- type AddrType
- type AuthMethod
- type AuthStatus
- type AuthenticateFunc
- type Command
- type Conn
- type Dialer
- type IdentFunc
- type Listener
- type MethodSelectRequest
- type MethodSelectResponse
- type Options
- type Server
- type Socks4Dialer
- type Socks4DialerOptions
- type Socks4Request
- type Socks4Response
- type Socks4Status
- type Socks5Dialer
- type Socks5DialerOptions
- type Socks5Request
- type Socks5Response
- type Socks5Status
- type UsernamePasswordAuthRequest
- type UsernamePasswordAuthResponse
- type UsernamePasswordAuthVersion
- type Version
Constants ¶
View Source
const (
UsernamePasswordAuthVersion1 = 0x01
)
Variables ¶
This section is empty.
Functions ¶
func ListenAndServe ¶
Types ¶
type AuthMethod ¶
type AuthMethod uint8
const ( AuthMethodNotRequired AuthMethod = 0x00 // no authentication required AuthMethodGSSAPI AuthMethod = 0x01 // use GSSAPI AuthMethodUsernamePassword AuthMethod = 0x02 // use username/password AuthMethodNoAcceptableMethods AuthMethod = 0xff // no acceptable authentication methods )
type AuthStatus ¶ added in v0.0.4
type AuthStatus uint8
const ( AuthStatusSuccess AuthStatus = 0x00 AuthStatusFailure AuthStatus = 0xff )
type AuthenticateFunc ¶ added in v0.0.3
type AuthenticateFunc func(context.Context, *Conn, AuthMethod) error
type Conn ¶ added in v0.0.4
type Conn struct {
// contains filtered or unexported fields
}
func (Conn) WaitForClose ¶ added in v0.0.9
func (c Conn) WaitForClose()
type MethodSelectRequest ¶
type MethodSelectRequest struct {
Methods []AuthMethod
}
func (*MethodSelectRequest) MarshalBinary ¶
func (req *MethodSelectRequest) MarshalBinary() ([]byte, error)
func (*MethodSelectRequest) UnmarshalBinary ¶
func (req *MethodSelectRequest) UnmarshalBinary(p []byte) error
type MethodSelectResponse ¶
type MethodSelectResponse struct {
Method AuthMethod
}
func (*MethodSelectResponse) MarshalBinary ¶
func (resp *MethodSelectResponse) MarshalBinary() ([]byte, error)
func (*MethodSelectResponse) UnmarshalBinary ¶
func (resp *MethodSelectResponse) UnmarshalBinary(p []byte) error
type Options ¶
type Options struct { // Logger specifies an optional logger. // If nil, logging is done via the log package's standard logger. Logger golog.Logger Dialer Dialer Listener Listener // Ident specifies the optional ident function. // It must return an error when the ident is failed. Ident IdentFunc // AuthMethods specifies the list of supported authentication // methods. // If empty, SOCKS server supports AuthMethodNotRequired. AuthMethods []AuthMethod // 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. Authenticate AuthenticateFunc }
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) ListenAndServe ¶
type Socks4Dialer ¶
type Socks4Dialer struct {
// contains filtered or unexported fields
}
func NewSocks4Dialer ¶
func NewSocks4Dialer(network, address string, optFns ...func(*Socks4DialerOptions)) *Socks4Dialer
NewSocks4Dialer returns a new Socks4Dialer that dials through the provided proxy server's network and address.
func (*Socks4Dialer) DialContext ¶
type Socks4DialerOptions ¶ added in v0.0.3
type Socks4Request ¶
func (*Socks4Request) MarshalBinary ¶
func (req *Socks4Request) MarshalBinary() ([]byte, error)
func (*Socks4Request) UnmarshalBinary ¶
func (req *Socks4Request) UnmarshalBinary(p []byte) error
type Socks4Response ¶
type Socks4Response struct { Status Socks4Status Addr string }
func (*Socks4Response) MarshalBinary ¶
func (resp *Socks4Response) MarshalBinary() ([]byte, error)
func (*Socks4Response) UnmarshalBinary ¶
func (resp *Socks4Response) UnmarshalBinary(p []byte) error
type Socks4Status ¶
type Socks4Status uint8
const ( Socks4StatusGranted Socks4Status = 0x5a Socks4StatusRejected Socks4Status = 0x5b Socks4StatusNoIdentd Socks4Status = 0x5c Socks4StatusInvalidUserID Socks4Status = 0x5d )
func (Socks4Status) String ¶ added in v0.0.7
func (code Socks4Status) String() string
type Socks5Dialer ¶
type Socks5Dialer struct {
// contains filtered or unexported fields
}
func NewSocks5Dialer ¶
func NewSocks5Dialer(network, address string, optFns ...func(*Socks5DialerOptions)) *Socks5Dialer
NewSocks5Dialer returns a new Socks5Dialer that dials through the provided proxy server's network and address.
func (*Socks5Dialer) DialContext ¶
type Socks5DialerOptions ¶ added in v0.0.3
type Socks5DialerOptions struct { // Logger specifies an optional logger. // If nil, logging is done via the log package's standard logger. Logger golog.Logger // ProxyDialer specifies the optional dialer for // establishing the transport connection. ProxyDialer Dialer // AuthMethods specifies the list of request authentication // methods. // If empty, SOCKS client requests only AuthMethodNotRequired. AuthMethods []AuthMethod // 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. Authenticate AuthenticateFunc }
type Socks5Request ¶
func (*Socks5Request) MarshalBinary ¶
func (req *Socks5Request) MarshalBinary() ([]byte, error)
func (*Socks5Request) UnmarshalBinary ¶
func (req *Socks5Request) UnmarshalBinary(p []byte) error
type Socks5Response ¶
type Socks5Response struct { Status Socks5Status Addr string }
func (*Socks5Response) MarshalBinary ¶
func (resp *Socks5Response) MarshalBinary() ([]byte, error)
func (*Socks5Response) UnmarshalBinary ¶
func (resp *Socks5Response) UnmarshalBinary(p []byte) error
type Socks5Status ¶
type Socks5Status uint8
const ( Socks5StatusGranted Socks5Status = 0x00 Socks5StatusFailure Socks5Status = 0x01 Socks5StatusNotAllowed Socks5Status = 0x02 Socks5StatusNetworkUnreaachable Socks5Status = 0x03 Socks5StatusHostUnreachable Socks5Status = 0x04 Socks5StatusConnectionRefused Socks5Status = 0x05 Socks5StatusTTLExpired Socks5Status = 0x06 Socks5StatusCMDNotSupported Socks5Status = 0x07 Socks5StatusAddrTypeNotSupported Socks5Status = 0x08 )
func (Socks5Status) String ¶ added in v0.0.7
func (code Socks5Status) String() string
type UsernamePasswordAuthRequest ¶ added in v0.0.4
func (*UsernamePasswordAuthRequest) MarshalBinary ¶ added in v0.0.4
func (req *UsernamePasswordAuthRequest) MarshalBinary() ([]byte, error)
func (*UsernamePasswordAuthRequest) UnmarshalBinary ¶ added in v0.0.4
func (req *UsernamePasswordAuthRequest) UnmarshalBinary(p []byte) error
type UsernamePasswordAuthResponse ¶ added in v0.0.4
type UsernamePasswordAuthResponse struct {
Status AuthStatus
}
func (*UsernamePasswordAuthResponse) MarshalBinary ¶ added in v0.0.4
func (resp *UsernamePasswordAuthResponse) MarshalBinary() ([]byte, error)
func (*UsernamePasswordAuthResponse) UnmarshalBinary ¶ added in v0.0.4
func (resp *UsernamePasswordAuthResponse) UnmarshalBinary(p []byte) error
type UsernamePasswordAuthVersion ¶ added in v0.0.4
type UsernamePasswordAuthVersion uint8
Click to show internal directories.
Click to hide internal directories.