quicproxy

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DelayCallback

type DelayCallback func(dir Direction, from, to net.Addr, packet []byte) time.Duration

DelayCallback is a callback that determines how much delay to apply to a packet.

type Direction

type Direction int

Direction is the direction a packet is sent.

const (
	// DirectionIncoming is the direction from the client to the server.
	DirectionIncoming Direction = iota
	// DirectionOutgoing is the direction from the server to the client.
	DirectionOutgoing
	// DirectionBoth is both incoming and outgoing
	DirectionBoth
)

func (Direction) Is

func (d Direction) Is(dir Direction) bool

Is says if one direction matches another direction. For example, incoming matches both incoming and both, but not outgoing.

func (Direction) String

func (d Direction) String() string

type DropCallback

type DropCallback func(dir Direction, from, to net.Addr, packet []byte) bool

DropCallback is a callback that determines which packet gets dropped.

type Proxy added in v1.0.0

type Proxy struct {
	// Conn is the UDP socket that the proxy listens on for incoming packets from clients.
	Conn *net.UDPConn

	// ServerAddr is the address of the server that the proxy forwards packets to.
	ServerAddr *net.UDPAddr

	// DropPacket is a callback that determines which packet gets dropped.
	DropPacket DropCallback

	// DelayPacket is a callback that determines how much delay to apply to a packet.
	DelayPacket DelayCallback
	// contains filtered or unexported fields
}

Proxy is a QUIC proxy that can drop and delay packets.

func (*Proxy) Close added in v1.0.0

func (p *Proxy) Close() error

Close stops the UDP Proxy

func (*Proxy) LocalAddr added in v1.0.0

func (p *Proxy) LocalAddr() net.Addr

LocalAddr is the address the proxy is listening on.

func (*Proxy) Start added in v1.0.0

func (p *Proxy) Start() error

func (*Proxy) SwitchConn added in v1.0.0

func (p *Proxy) SwitchConn(clientAddr *net.UDPAddr, conn *net.UDPConn) error

SwitchConn switches the connection for a client, identified the address that the client is sending from.

Jump to

Keyboard shortcuts

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