udpnat

package
v0.0.0-...-775528f Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2023 License: GPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler = func(ctx context.Context, conn *NATConn)

type NATConn

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

func (*NATConn) Close

func (c *NATConn) Close() error

func (*NATConn) LocalAddr

func (c *NATConn) LocalAddr() net.Addr

func (*NATConn) Read

func (c *NATConn) Read(p []byte) (n int, err error)

func (*NATConn) ReadFrom

func (c *NATConn) ReadFrom(p []byte) (n int, addr net.Addr, err error)

func (*NATConn) ReadPacket

func (c *NATConn) ReadPacket() (*buffer.PacketBuffer, error)

func (*NATConn) RecvChan

func (c *NATConn) RecvChan() chan *buffer.PacketBuffer

func (*NATConn) RemoteAddr

func (c *NATConn) RemoteAddr() net.Addr

func (*NATConn) SetDeadline

func (c *NATConn) SetDeadline(t time.Time) error

func (*NATConn) SetReadDeadline

func (c *NATConn) SetReadDeadline(t time.Time) error

func (*NATConn) SetWriteDeadline

func (c *NATConn) SetWriteDeadline(t time.Time) error

func (*NATConn) Upstream

func (c *NATConn) Upstream() any

func (*NATConn) Write

func (c *NATConn) Write(b []byte) (n int, err error)

func (*NATConn) WritePacket

func (c *NATConn) WritePacket(packet *buffer.PacketBuffer) error

func (*NATConn) WriteTo

func (c *NATConn) WriteTo(p []byte, addr net.Addr) (n int, err error)

type Options

type Options struct {
	Timeout  time.Duration
	Capacity int
	Handler  Handler
	Logger   log.Logger
}

type Service

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

func New

func New(options Options) *Service

func (*Service) HandlePacket

func (s *Service) HandlePacket(source netip.AddrPort, destination netip.AddrPort, packet *buffer.PacketBuffer, constructor func(natConn *NATConn) (context.Context, N.PacketWriter))

Jump to

Keyboard shortcuts

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