quicproxy

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2017 License: MIT Imports: 5 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, packetCount uint64) time.Duration

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

var NoDelay DelayCallback = func(Direction, uint64) time.Duration {
	return 0
}

NoDelay doesn't apply a delay.

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

func (Direction) String

func (d Direction) String() string

type DropCallback

type DropCallback func(dir Direction, packetCount uint64) bool

DropCallback is a callback that determines which packet gets dropped.

var NoDropper DropCallback = func(Direction, uint64) bool {
	return false
}

NoDropper doesn't drop packets.

type Opts

type Opts struct {
	// The address this proxy proxies packets to.
	RemoteAddr string
	// DropPacket determines whether a packet gets dropped.
	DropPacket DropCallback
	// DelayPacket determines how long a packet gets delayed. This allows
	// simulating a connection with non-zero RTTs.
	// Note that the RTT is the sum of the delay for the incoming and the outgoing packet.
	DelayPacket DelayCallback
}

Opts are proxy options.

type QuicProxy

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

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

func NewQuicProxy

func NewQuicProxy(local string, version protocol.VersionNumber, opts *Opts) (*QuicProxy, error)

NewQuicProxy creates a new UDP proxy

func (*QuicProxy) Close

func (p *QuicProxy) Close() error

Close stops the UDP Proxy

func (*QuicProxy) LocalAddr

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

LocalAddr is the address the proxy is listening on.

func (*QuicProxy) LocalPort

func (p *QuicProxy) LocalPort() int

LocalPort is the UDP port number the proxy is listening on.

Jump to

Keyboard shortcuts

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