socks5

package
v0.0.0-...-c6b16a5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2020 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthNone     = 0x00
	AuthPassword = 0x02
)

SOCKS auth type

View Source
const (
	CmdConnect      = 0x01
	CmdBind         = 0x02
	CmdUDPAssociate = 0x03
)

SOCKS request commands as defined in RFC 1928 section 4

View Source
const (
	ATypIP4    = 0x1
	ATypDomain = 0x3
	ATypIP6    = 0x4
)

SOCKS address types as defined in RFC 1928 section 4

View Source
const Name = "socks5"
View Source
const Version5 = 0x05

Version is socks5 version number.

Variables

This section is empty.

Functions

func NewSocks5Server

func NewSocks5Server(ctx context.Context, url *url.URL) (proxy.Server, error)

func ParseAddr

func ParseAddr(s string) []byte

ParseAddr parse a address string to bytes in socks5 format.

+------+----------+----------+
| ATYP | DST.ADDR | DST.PORT |
+------+----------+----------+
|  1   | Variable |    2     |
+------+----------+----------+

func ReadTargetAddr

func ReadTargetAddr(r io.Reader) (*proxy.TargetAddr, int, error)

ReadTargetAddr read bytes from conn and create a proxy.TargetAddr

Types

type PacketConn

type PacketConn struct {
	// Connection from client
	net.PacketConn
	// contains filtered or unexported fields
}

func (*PacketConn) GetTargetAddr

func (pc *PacketConn) GetTargetAddr() *proxy.TargetAddr

func (*PacketConn) ReadFrom

func (pc *PacketConn) ReadFrom(p []byte) (int, net.Addr, error)

ReadFrom overrides the original function from net.PacketConn.

func (*PacketConn) WriteTo

func (pc *PacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error)

WriteTo overrides the original function from net.PacketConn.

type Server

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

func (*Server) Addr

func (s *Server) Addr() string

func (*Server) Handshake

func (s *Server) Handshake(underlay net.Conn) (proxy.StreamConn, *proxy.TargetAddr, error)

func (*Server) Name

func (s *Server) Name() string

func (*Server) Pack

func (s *Server) Pack(underlay net.Conn) (proxy.PacketConn, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL