conn

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTcpConn

func NewTcpConn(ctx context.Context, metadata *C.Metadata, rule constants.IpRule, defaultInterface string) (net.Conn, error)

func NewUdpConn

func NewUdpConn(ctx context.Context, metadata *C.Metadata, rule constants.IpRule, defaultInterface string) (net.PacketConn, error)

func UpdateProxy

func UpdateProxy(proxy C.Proxy)

Types

type TcpConnContext

type TcpConnContext struct {
	Wg *sync.WaitGroup

	Rule constants.IpRule
	Ctx  context.Context
	// contains filtered or unexported fields
}

func NewTcpConnContext

func NewTcpConnContext(ctx context.Context, conn net.Conn, metadata *constant.Metadata, wg *sync.WaitGroup) *TcpConnContext

func (*TcpConnContext) Conn

func (t *TcpConnContext) Conn() net.Conn

func (*TcpConnContext) ID

func (t *TcpConnContext) ID() uuid.UUID

func (*TcpConnContext) Metadata

func (t *TcpConnContext) Metadata() *constant.Metadata

type UdpConn

type UdpConn interface {
	ReadFrom([]byte) (int, net.Addr, error)
	WriteTo([]byte, net.Addr) (int, error)
	Close() error
	SetDeadline(t time.Time) error
	SetReadDeadline(t time.Time) error
}

type UdpConnContext

type UdpConnContext struct {
	Wg *sync.WaitGroup

	Rule      constants.IpRule
	Ctx       context.Context
	ProxyAddr string
	// contains filtered or unexported fields
}

func NewUdpConnContext

func NewUdpConnContext(ctx context.Context, conn UdpConn, metadata *constant.Metadata, wg *sync.WaitGroup) (*UdpConnContext, error)

func (*UdpConnContext) Conn

func (u *UdpConnContext) Conn() UdpConn

func (*UdpConnContext) ID

func (u *UdpConnContext) ID() uuid.UUID

func (*UdpConnContext) Metadata

func (u *UdpConnContext) Metadata() *constant.Metadata

Jump to

Keyboard shortcuts

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