Documentation ¶
Index ¶
- Constants
- Variables
- func RelayTCP(lConn, rConn net.Conn) (err error)
- func SelectTimeout(packet []byte) time.Duration
- type HijackResp
- type IPMapper
- type LoopbackMapper
- type Proxy
- func (p *Proxy) AllocProjection(target string) (loopback netip.Addr)
- func (p *Proxy) Close() error
- func (p *Proxy) GetOrBuildUDPConn(lAddr net.Addr, target string, data []byte) (rc net.PacketConn, err error)
- func (p *Proxy) GetProjection(ip netip.Addr) (target string)
- func (p *Proxy) GetRealIP(fakeIP netip.Addr) (realIP netip.Addr, ok bool)
- func (p *Proxy) ListenAndServe(port int) error
- func (p *Proxy) ListenTCP(addr string) (err error)
- func (p *Proxy) ListenUDP(addr string) (err error)
- func (p *Proxy) TCPPort() int
- func (p *Proxy) UDPPort() int
- type RealIPMapper
- type ReservedMapper
- type UDPConn
- type UDPConnMapping
- type WriteCloser
Constants ¶
Variables ¶
View Source
var ReservedPrefix = netip.MustParsePrefix("198.18.0.0/15")
Functions ¶
func SelectTimeout ¶
SelectTimeout selects an appropriate timeout for UDP packet.
Types ¶
type HijackResp ¶
type LoopbackMapper ¶
type LoopbackMapper struct {
// contains filtered or unexported fields
}
LoopbackMapper projects something to a loopback IP. It is not thread-safe.
func NewLoopbackMapper ¶
func NewLoopbackMapper() *LoopbackMapper
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
func (*Proxy) AllocProjection ¶
func (*Proxy) GetOrBuildUDPConn ¶
func (p *Proxy) GetOrBuildUDPConn(lAddr net.Addr, target string, data []byte) (rc net.PacketConn, err error)
GetOrBuildUDPConn get a UDP conn from the mapping.
func (*Proxy) ListenAndServe ¶
ListenAndServe will block the goroutine.
type RealIPMapper ¶
type RealIPMapper struct {
// contains filtered or unexported fields
}
func NewRealIPMapper ¶
func NewRealIPMapper() *RealIPMapper
type ReservedMapper ¶
type ReservedMapper struct {
// contains filtered or unexported fields
}
ReservedMapper projects something to a reserved IP. It is not thread-safe.
func NewReservedMapper ¶
func NewReservedMapper() *ReservedMapper
type UDPConn ¶
type UDPConn struct { Establishing chan struct{} Timeout time.Duration net.PacketConn }
func NewUDPConn ¶
func NewUDPConn(conn net.PacketConn) *UDPConn
type UDPConnMapping ¶
func NewUDPConnMapping ¶
func NewUDPConnMapping() *UDPConnMapping
func (*UDPConnMapping) Insert ¶
func (m *UDPConnMapping) Insert(key string, val net.PacketConn) *UDPConn
pass val=nil for stating it is establishing
func (*UDPConnMapping) Remove ¶
func (m *UDPConnMapping) Remove(key string)
type WriteCloser ¶
type WriteCloser interface {
CloseWrite() error
}
Click to show internal directories.
Click to hide internal directories.