proxy

package
v0.0.0-...-5ec896d Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AtypIPv4       = 1
	AtypDomainName = 3
	AtypIPv6       = 4
)
  1. Requests Once the method-dependent subnegotiation has completed, the client sends the request details. If the negotiated method includes encapsulation for purposes of integrity checking and/or confidentiality, these requests MUST be encapsulated in the method- dependent encapsulation. The SOCKS request is formed as follows: +----+-----+-------+------+----------+----------+ |VER | CMD | RSV | ATYP | DST.ADDR | DST.PORT | +----+-----+-------+------+----------+----------+ | 1 | 1 | X’00’ | 1 | Variable | 2 | +----+-----+-------+------+----------+----------+

Where:

o  VER    protocol version: X’05’
o  CMD
   o  CONNECT X’01’
   o  BIND X’02’
   o  UDP ASSOCIATE X’03’
o  RSV    RESERVED
o  ATYP   address type of following address
   o  IP V4 address: X’01’
   o  DOMAINNAME: X’03’
   o  IP V6 address: X’04’
o  DST.ADDR       desired destination address
o  DST.PORT desired destination port in network octet

order

The SOCKS server will typically evaluate the request based on source
and destination addresses, and return one or more reply messages, as
appropriate for the request type.
  1. Addressing In an address field (DST.ADDR, BND.ADDR), the ATYP field specifies the type of address contained within the field: o X’01’ the address is a version-4 IP address, with a length of 4 octets

o X’03’

the address field contains a fully-qualified domain name.  The first
octet of the address field contains the number of octets of name that
follow, there is no terminating NUL octet.
       o  X’04’
the address is a version-6 IP address, with a length of 16 octets.
View Source
const (
	CmdConnect      = 1
	CmdBind         = 2
	CmdUDPAssociate = 3
)
View Source
const (
	ErrCommandNotSupported = Error(1)
	ErrAddressNotSupported = Error(2)
	InfoUDPAssociate       = Error(3)
)
View Source
const MaxAddrLen = 1 + 1 + 255 + 2
View Source
const (
	MinerTimeOut = time.Second * 5
)

Variables

This section is empty.

Functions

func Socks5Target

func Socks5Target(conn net.Conn) string

Types

type Error

type Error byte

func (Error) Error

func (err Error) Error() string

type LocalProxyApi

type LocalProxyApi interface {
	GetTarget(conn net.Conn) string
	ProxyClose(conn net.Conn)
}

type PacProxy

type PacProxy struct {
}

func (*PacProxy) GetTarget

func (pc *PacProxy) GetTarget(conn net.Conn) string

func (*PacProxy) ProxyClose

func (pc *PacProxy) ProxyClose(conn net.Conn)

type SimpleTunReader

type SimpleTunReader struct {
}

func NewTunReader

func NewTunReader() *SimpleTunReader

func (*SimpleTunReader) Finish

func (str *SimpleTunReader) Finish()

func (*SimpleTunReader) GetTarget

func (str *SimpleTunReader) GetTarget(conn net.Conn) string

func (*SimpleTunReader) InputPacket

func (str *SimpleTunReader) InputPacket(data []byte)

func (*SimpleTunReader) Proxying

func (str *SimpleTunReader) Proxying(chan error)

func (*SimpleTunReader) RemoveFromSession

func (str *SimpleTunReader) RemoveFromSession(keyPort int)

type VpnConfig

type VpnConfig struct {
	Saver        util.ConnSaver
	LocalApi     LocalProxyApi
	MinerHost    string
	SelfAddr     account.ID
	LocalSrvAddr string
	AesKey       []byte
}

type VpnProxy

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

func NewProxyService

func NewProxyService(conf *VpnConfig) (*VpnProxy, error)

func (*VpnProxy) ServingThread

func (vp *VpnProxy) ServingThread(sig chan struct{})

func (*VpnProxy) Stop

func (vp *VpnProxy) Stop()

Jump to

Keyboard shortcuts

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