Documentation ¶
Overview ¶
Package sockstest provides utilities for SOCKS testing.
Index ¶
- func MarshalAuthReply(ver int, m socks.AuthMethod) ([]byte, error)
- func MarshalCmdReply(ver int, reply socks.Reply, a *socks.Addr) ([]byte, error)
- func NoAuthRequired(rw io.ReadWriter, b []byte) error
- func NoProxyRequired(rw io.ReadWriter, b []byte) error
- type AuthRequest
- type CmdRequest
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalAuthReply ¶
func MarshalAuthReply(ver int, m socks.AuthMethod) ([]byte, error)
MarshalAuthReply returns an authentication reply in wire format.
func MarshalCmdReply ¶
MarshalCmdReply returns a command reply in wire format.
func NoAuthRequired ¶
func NoAuthRequired(rw io.ReadWriter, b []byte) error
NoAuthRequired handles a no-authentication-required signaling.
func NoProxyRequired ¶
func NoProxyRequired(rw io.ReadWriter, b []byte) error
NoProxyRequired handles a command signaling without constructing a proxy connection to the final destination.
Types ¶
type AuthRequest ¶
type AuthRequest struct { Version int Methods []socks.AuthMethod }
An AuthRequest represents an authentication request.
func ParseAuthRequest ¶
func ParseAuthRequest(b []byte) (*AuthRequest, error)
ParseAuthRequest parses an authentication request.
type CmdRequest ¶
A CmdRequest repesents a command request.
func ParseCmdRequest ¶
func ParseCmdRequest(b []byte) (*CmdRequest, error)
ParseCmdRequest parses a command request.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
A Server repesents a server for handshake testing.
func NewServer ¶
NewServer returns a new server.
The provided authFunc and cmdFunc must parse requests and return appropriate replies to clients.
func (*Server) TargetAddr ¶
TargetAddr returns a fake final destination address.
The returned address is only valid for testing with Server.