Documentation
¶
Index ¶
- func ClientHandshake(request *protocol.RequestHeader, reader io.Reader, writer io.Writer, ...) (*net.Destination, error)
- func ClientHandshake4(request *protocol.RequestHeader, reader io.Reader, writer io.Writer) error
- func DecodeUDPPacket(packet *buf.Buffer) (*protocol.RequestHeader, error)
- func EncodeUDPPacket(request *protocol.RequestHeader, data []byte) (*buf.Buffer, error)
- func EncodeUDPPacketFromAddress(address net.Destination, data []byte) (*buf.Buffer, error)
- func ReadUntilNull(reader io.Reader) (string, error)
- func ReadUsernamePassword(reader io.Reader) (string, string, error)
- type Client
- func (c *Client) HandleFlow(ctx context.Context, dst net.Destination, rw buf.ReaderWriter) error
- func (c *Client) HandlePacketConn(ctx context.Context, dst net.Destination, pc udp.PacketReaderWriter) error
- func (c *Client) ListenPacket(ctx context.Context, dst net.Destination) (udp.UdpConn, error)
- func (c *Client) ProxyDial(ctx context.Context, dst net.Destination, initialData buf.MultiBuffer) (i.FlowConn, error)
- type ClientSettings
- type Server
- func (s *Server) AddUser(user i.User)
- func (s *Server) FallbackProcess(ctx context.Context, conn net.Conn) (bool, buf.MultiBuffer, error)
- func (c *Server) HasAccount(username, password string) bool
- func (s *Server) Network() []nethelper.Network
- func (s *Server) Process(ctx context.Context, conn net.Conn) error
- func (s *Server) RemoveUser(id string)
- type ServerSession
- type SocksServerConfig
- type UDPConn
- type UDPReader
- type UDPWriter
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClientHandshake ¶
func ClientHandshake(request *protocol.RequestHeader, reader io.Reader, writer io.Writer, delayAuthWrite bool) (*net.Destination, error)
func ClientHandshake4 ¶
func DecodeUDPPacket ¶
func DecodeUDPPacket(packet *buf.Buffer) (*protocol.RequestHeader, error)
func EncodeUDPPacket ¶
func ReadUntilNull ¶
ReadUntilNull reads content from given reader, until a null (0x00) byte.
func ReadUsernamePassword ¶
ReadUsernamePassword reads Socks 5 username/password message from the given reader. +----+------+----------+------+----------+ |VER | ULEN | UNAME | PLEN | PASSWD | +----+------+----------+------+----------+ | 1 | 1 | 1 to 255 | 1 | 1 to 255 | +----+------+----------+------+----------+
Types ¶
type Client ¶
type Client struct {
ClientSettings
}
func NewClient ¶
func NewClient(settings *ClientSettings) *Client
config won'e be nil, but may be zero-value
func (*Client) HandleFlow ¶
func (c *Client) HandleFlow(ctx context.Context, dst net.Destination, rw buf.ReaderWriter) error
func (*Client) HandlePacketConn ¶
func (c *Client) HandlePacketConn(ctx context.Context, dst net.Destination, pc udp.PacketReaderWriter) error
func (*Client) ListenPacket ¶
type ClientSettings ¶
type ClientSettings struct {
ServerDest net.Destination
User, Secret string
Policy i.TimeoutSetting
DelayAuthWrite bool
DNS i.IPResolver
Dialer i.Dialer
}
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a SOCKS 5 proxy server
func NewServer ¶
func NewServer(config *SocksServerConfig) *Server
NewServer creates a new Server object.
func (*Server) FallbackProcess ¶
func (*Server) HasAccount ¶
func (*Server) RemoveUser ¶
type ServerSession ¶
type ServerSession struct {
// contains filtered or unexported fields
}
func (*ServerSession) Handshake ¶
func (s *ServerSession) Handshake(reader io.Reader, writer io.Writer) (*protocol.RequestHeader, error)
Handshake performs a Socks4/4a/5 handshake.
type SocksServerConfig ¶
type UDPConn ¶
type UDPConn struct {
// contains filtered or unexported fields
}
func (*UDPConn) CloseWrite ¶
type UDPReader ¶
type UDPReader struct {
// contains filtered or unexported fields
}
func NewUDPReader ¶
func (*UDPReader) ReadMultiBuffer ¶
func (r *UDPReader) ReadMultiBuffer() (buf.MultiBuffer, error)
Click to show internal directories.
Click to hide internal directories.