net: golang.org/x/net/internal/sockstest Index | Files

package sockstest

import "golang.org/x/net/internal/sockstest"

Package sockstest provides utilities for SOCKS testing.

Index

Package Files

server.go

func MarshalAuthReply Uses

func MarshalAuthReply(ver int, m socks.AuthMethod) ([]byte, error)

MarshalAuthReply returns an authentication reply in wire format.

func MarshalCmdReply Uses

func MarshalCmdReply(ver int, reply socks.Reply, a *socks.Addr) ([]byte, error)

MarshalCmdReply returns a command reply in wire format.

func NoAuthRequired Uses

func NoAuthRequired(rw io.ReadWriter, b []byte) error

NoAuthRequired handles a no-authentication-required signaling.

func NoProxyRequired Uses

func NoProxyRequired(rw io.ReadWriter, b []byte) error

NoProxyRequired handles a command signaling without constructing a proxy connection to the final destination.

type AuthRequest Uses

type AuthRequest struct {
    Version int
    Methods []socks.AuthMethod
}

An AuthRequest represents an authentication request.

func ParseAuthRequest Uses

func ParseAuthRequest(b []byte) (*AuthRequest, error)

ParseAuthRequest parses an authentication request.

type CmdRequest Uses

type CmdRequest struct {
    Version int
    Cmd     socks.Command
    Addr    socks.Addr
}

A CmdRequest repesents a command request.

func ParseCmdRequest Uses

func ParseCmdRequest(b []byte) (*CmdRequest, error)

ParseCmdRequest parses a command request.

type Server Uses

type Server struct {
    // contains filtered or unexported fields
}

A Server repesents a server for handshake testing.

func NewServer Uses

func NewServer(authFunc, cmdFunc func(io.ReadWriter, []byte) error) (*Server, error)

NewServer returns a new server.

The provided authFunc and cmdFunc must parse requests and return appropriate replies to clients.

func (*Server) Addr Uses

func (s *Server) Addr() net.Addr

Addr rerurns a server address.

func (*Server) Close Uses

func (s *Server) Close() error

Close closes the server.

func (*Server) TargetAddr Uses

func (s *Server) TargetAddr() net.Addr

TargetAddr returns a fake final destination address.

The returned address is only valid for testing with Server.

Package sockstest imports 5 packages (graph). Updated 2019-10-24. Refresh now. Tools for package owners.