TProxy

package
v0.0.0-...-7685a06 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2021 License: GPL-3.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseHandler

type BaseHandler interface {
	// connection
	Tunnel() error

	// close
	Close()  // direct close handler
	Remove() // remove self from map
	AddMgr(mgr *HandlerMgr)

	// write and read
	WriteRemote([]byte) error
	WriteLocal([]byte) error
	ReadRemote([]byte) error
	ReadLocal([]byte) error
	Communicate()
}

func NewHandler

func NewHandler(proto ProtoTyp, scope define.Scope, key HandlerKey, proxy config.Proxy, lAddr net.Addr, rAddr net.Addr, lConn net.Conn) BaseHandler

type HandlerKey

type HandlerKey struct {
	SrcAddr string
	DstAddr string
}

handler key in case keep the same handler

type HandlerMgr

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

manager all handler

func NewHandlerMgr

func NewHandlerMgr(scope define.Scope) *HandlerMgr

func (*HandlerMgr) AddHandler

func (mgr *HandlerMgr) AddHandler(typ ProtoTyp, key HandlerKey, base BaseHandler)

add handler to mgr

func (*HandlerMgr) CloseAll

func (mgr *HandlerMgr) CloseAll()

close all handler

func (*HandlerMgr) CloseBaseHandler

func (mgr *HandlerMgr) CloseBaseHandler(typ ProtoTyp, key HandlerKey)

close and remove base handler

func (*HandlerMgr) CloseTypHandler

func (mgr *HandlerMgr) CloseTypHandler(typ ProtoTyp)

close handler according to proto

type HttpHandler

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

tcp handler create handle bind lConn conn and rConn conn

func NewHttpHandler

func NewHttpHandler(scope define.Scope, key HandlerKey, proxy config.Proxy, lAddr net.Addr, rAddr net.Addr, lConn net.Conn) *HttpHandler

func (*HttpHandler) AddMgr

func (pr *HttpHandler) AddMgr(mgr *HandlerMgr)

add private to manager and save manager

func (*HttpHandler) Close

func (pr *HttpHandler) Close()

close handler

func (*HttpHandler) Communicate

func (pr *HttpHandler) Communicate()

communicate lConn and rConn

func (*HttpHandler) ReadLocal

func (pr *HttpHandler) ReadLocal(buf []byte) error

func (*HttpHandler) ReadRemote

func (pr *HttpHandler) ReadRemote(buf []byte) error

func (*HttpHandler) Remove

func (pr *HttpHandler) Remove()

close and delete handler from manager

func (*HttpHandler) Tunnel

func (handler *HttpHandler) Tunnel() error

create tunnel between proxy and server

func (*HttpHandler) WriteLocal

func (pr *HttpHandler) WriteLocal(buf []byte) error

func (*HttpHandler) WriteRemote

func (pr *HttpHandler) WriteRemote(buf []byte) error

type HttpHandlerEProxy

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

func NewHttpHandlerEProxy

func NewHttpHandlerEProxy(scope define.Scope, key HandlerKey, proxy config.Proxy, lAddr net.Addr, rAddr net.Addr, lConn net.Conn) *HttpHandlerEProxy

func (*HttpHandlerEProxy) AddMgr

func (pr *HttpHandlerEProxy) AddMgr(mgr *HandlerMgr)

add private to manager and save manager

func (*HttpHandlerEProxy) Close

func (pr *HttpHandlerEProxy) Close()

close handler

func (*HttpHandlerEProxy) Communicate

func (pr *HttpHandlerEProxy) Communicate()

communicate lConn and rConn

func (*HttpHandlerEProxy) ReadLocal

func (pr *HttpHandlerEProxy) ReadLocal(buf []byte) error

func (*HttpHandlerEProxy) ReadRemote

func (pr *HttpHandlerEProxy) ReadRemote(buf []byte) error

func (*HttpHandlerEProxy) Remove

func (pr *HttpHandlerEProxy) Remove()

close and delete handler from manager

func (*HttpHandlerEProxy) Tunnel

func (handler *HttpHandlerEProxy) Tunnel() error

func (*HttpHandlerEProxy) WriteLocal

func (pr *HttpHandlerEProxy) WriteLocal(buf []byte) error

func (*HttpHandlerEProxy) WriteRemote

func (pr *HttpHandlerEProxy) WriteRemote(buf []byte) error

type ProtoTyp

type ProtoTyp string

proto

const (
	NoneProto ProtoTyp = "no-proto"
	HTTP      ProtoTyp = "http"
	SOCK4     ProtoTyp = "sock4"
	SOCK5TCP  ProtoTyp = "sock5-tcp"
	SOCK5UDP  ProtoTyp = "sock5-udp"
)

func BuildProto

func BuildProto(proto string) (ProtoTyp, error)

func (ProtoTyp) String

func (Typ ProtoTyp) String() string

type Sock4Handler

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

func NewSock4Handler

func NewSock4Handler(scope define.Scope, key HandlerKey, proxy config.Proxy, lAddr net.Addr, rAddr net.Addr, lConn net.Conn) *Sock4Handler

func (*Sock4Handler) AddMgr

func (pr *Sock4Handler) AddMgr(mgr *HandlerMgr)

add private to manager and save manager

func (*Sock4Handler) Close

func (pr *Sock4Handler) Close()

close handler

func (*Sock4Handler) Communicate

func (pr *Sock4Handler) Communicate()

communicate lConn and rConn

func (*Sock4Handler) ReadLocal

func (pr *Sock4Handler) ReadLocal(buf []byte) error

func (*Sock4Handler) ReadRemote

func (pr *Sock4Handler) ReadRemote(buf []byte) error

func (*Sock4Handler) Remove

func (pr *Sock4Handler) Remove()

close and delete handler from manager

func (*Sock4Handler) Tunnel

func (handler *Sock4Handler) Tunnel() error

func (*Sock4Handler) WriteLocal

func (pr *Sock4Handler) WriteLocal(buf []byte) error

func (*Sock4Handler) WriteRemote

func (pr *Sock4Handler) WriteRemote(buf []byte) error

type TcpSock5Handler

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

func NewTcpSock5Handler

func NewTcpSock5Handler(scope define.Scope, key HandlerKey, proxy config.Proxy, lAddr net.Addr, rAddr net.Addr, lConn net.Conn) *TcpSock5Handler

func (*TcpSock5Handler) AddMgr

func (pr *TcpSock5Handler) AddMgr(mgr *HandlerMgr)

add private to manager and save manager

func (*TcpSock5Handler) Close

func (pr *TcpSock5Handler) Close()

close handler

func (*TcpSock5Handler) Communicate

func (pr *TcpSock5Handler) Communicate()

communicate lConn and rConn

func (*TcpSock5Handler) ReadLocal

func (pr *TcpSock5Handler) ReadLocal(buf []byte) error

func (*TcpSock5Handler) ReadRemote

func (pr *TcpSock5Handler) ReadRemote(buf []byte) error

func (*TcpSock5Handler) Remove

func (pr *TcpSock5Handler) Remove()

close and delete handler from manager

func (*TcpSock5Handler) Tunnel

func (handler *TcpSock5Handler) Tunnel() error

create tunnel between proxy and server

func (*TcpSock5Handler) WriteLocal

func (pr *TcpSock5Handler) WriteLocal(buf []byte) error

func (*TcpSock5Handler) WriteRemote

func (pr *TcpSock5Handler) WriteRemote(buf []byte) error

type UdpSock5Handler

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

func NewUdpSock5Handler

func NewUdpSock5Handler(scope define.Scope, key HandlerKey, proxy config.Proxy, lAddr net.Addr, rAddr net.Addr, lConn net.Conn) *UdpSock5Handler

func (*UdpSock5Handler) AddMgr

func (pr *UdpSock5Handler) AddMgr(mgr *HandlerMgr)

add private to manager and save manager

func (*UdpSock5Handler) Close

func (handler *UdpSock5Handler) Close()

rewrite close

func (*UdpSock5Handler) Communicate

func (handler *UdpSock5Handler) Communicate()

rewrite communication

func (*UdpSock5Handler) Read

func (handler *UdpSock5Handler) Read(buf []byte) (int, error)

rewrite read remote

func (*UdpSock5Handler) ReadLocal

func (pr *UdpSock5Handler) ReadLocal(buf []byte) error

func (*UdpSock5Handler) ReadRemote

func (pr *UdpSock5Handler) ReadRemote(buf []byte) error

func (*UdpSock5Handler) Remove

func (pr *UdpSock5Handler) Remove()

close and delete handler from manager

func (*UdpSock5Handler) Tunnel

func (handler *UdpSock5Handler) Tunnel() error

create tunnel between proxy and server

func (*UdpSock5Handler) Write

func (handler *UdpSock5Handler) Write(buf []byte) (int, error)

rewrite write remote

func (*UdpSock5Handler) WriteLocal

func (pr *UdpSock5Handler) WriteLocal(buf []byte) error

func (*UdpSock5Handler) WriteRemote

func (pr *UdpSock5Handler) WriteRemote(buf []byte) error

Jump to

Keyboard shortcuts

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