service

package
v4.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2019 License: BSD-3-Clause, GPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SO_ORIGINAL_DST = 80
)

Variables

View Source
var (
	ErrProtocol        = errors.New("protocol error")
	ErrWrongFmt        = errors.New("connect packet wrong format")
	ErrUnknownAddrType = errors.New("unknown addr type")
	ErrIPv6            = errors.New("ipv6 not support yet")
	ErrAuthPacket      = errors.New("Auth Packet Error")
	ErrAuthMethod      = errors.New("auth method wrong")
	ErrAuthFailed      = errors.New("auth failed")
)

Functions

func CreatePAC

func CreatePAC(pacfile string, cfg interface{}) (handler http.Handler, err error)

func CreatePortmap

func CreatePortmap(pm *PortMap, dialer common.Dialer)

func GetConnect

func GetConnect(reader *bufio.Reader) (hostname string, port uint16, err error)

func GetHandshake

func GetHandshake(reader *bufio.Reader) (methods []byte, err error)

func GetUserPass

func GetUserPass(reader *bufio.Reader) (user string, password string, err error)

func RunDnsServer

func RunDnsServer(addr string, exchanger common.Exchanger)

func SendAuthResult

func SendAuthResult(writer *bufio.Writer, status byte) (err error)

func SendConnectResponse

func SendConnectResponse(writer *bufio.Writer, res byte) (err error)

func SendHandshakeResponse

func SendHandshakeResponse(writer *bufio.Writer, status byte) (err error)

Types

type DnsHandler

type DnsHandler struct {
	common.Exchanger
}

func (*DnsHandler) ServeDNS

func (handler *DnsHandler) ServeDNS(w dns.ResponseWriter, quiz *dns.Msg)

type HostDispatcher

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

func NewHostDispatcher

func NewHostDispatcher(local http.Handler, remote http.Handler) (hostdisp *HostDispatcher)

func (*HostDispatcher) ServeHTTP

func (hostdisp *HostDispatcher) ServeHTTP(w http.ResponseWriter, req *http.Request)

type HttpBasicAuth

type HttpBasicAuth struct {
	ReqHeader  string
	RespHeader string
	RespStatus int
	// contains filtered or unexported fields
}

func NewHttpBasicAuth

func NewHttpBasicAuth(upstream http.Handler) (bauth *HttpBasicAuth)

func NewProxyBasicAuth

func NewProxyBasicAuth(upstream http.Handler) (bauth *HttpBasicAuth)

func (*HttpBasicAuth) AddUserPass

func (bauth *HttpBasicAuth) AddUserPass(usr, pwd string)

func (*HttpBasicAuth) Authenticate

func (bauth *HttpBasicAuth) Authenticate(req *http.Request) bool

func (*HttpBasicAuth) ServeHTTP

func (bauth *HttpBasicAuth) ServeHTTP(w http.ResponseWriter, req *http.Request)

type HttpProxy

type HttpProxy struct {
	Handler http.Handler
	// contains filtered or unexported fields
}

func NewHttpProxy

func NewHttpProxy(dialer common.Dialer) (p *HttpProxy)

func (*HttpProxy) ServeConnect

func (p *HttpProxy) ServeConnect(w http.ResponseWriter, r *http.Request)

func (*HttpProxy) ServeHTTP

func (p *HttpProxy) ServeHTTP(w http.ResponseWriter, req *http.Request)

type PortMap

type PortMap struct {
	Net string
	Src string
	Dst string
}

type ServeFile

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

func NewServeFile

func NewServeFile(body []byte) (s *ServeFile)

func (*ServeFile) ServeHTTP

func (s *ServeFile) ServeHTTP(w http.ResponseWriter, req *http.Request)

type SocksProxy

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

func NewSocksProxy

func NewSocksProxy(dialer common.Dialer, username, password string) (p *SocksProxy)

func (*SocksProxy) ServeConn

func (p *SocksProxy) ServeConn(conn net.Conn) (err error)

func (*SocksProxy) SocksHandler

func (p *SocksProxy) SocksHandler(conn net.Conn) (dstconn net.Conn, err error)

func (*SocksProxy) Start

func (p *SocksProxy) Start(addr string)

type TcpPortMap

type TcpPortMap struct {
	*PortMap
	common.Dialer
}

func (*TcpPortMap) ServeConn

func (tpm *TcpPortMap) ServeConn(lconn net.Conn) (err error)

type TransparentProxy

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

func NewTransparentProxy

func NewTransparentProxy(dialer common.Dialer) (tproxy *TransparentProxy)

func (*TransparentProxy) ServeConn

func (tproxy *TransparentProxy) ServeConn(conn net.Conn) (err error)

func (*TransparentProxy) Start

func (tproxy *TransparentProxy) Start(network, addr string)

Jump to

Keyboard shortcuts

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