quic-go: github.com/lucas-clemente/quic-go/integrationtests/tools/proxy Index | Files

package quicproxy

import "github.com/lucas-clemente/quic-go/integrationtests/tools/proxy"


Package Files


type DelayCallback Uses

type DelayCallback func(dir Direction, packet []byte) time.Duration

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

var NoDelay DelayCallback = func(Direction, []byte) time.Duration {
    return 0

NoDelay doesn't apply a delay.

type Direction Uses

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.
    // DirectionBoth is both incoming and outgoing

func (Direction) Is Uses

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 Uses

func (d Direction) String() string

type DropCallback Uses

type DropCallback func(dir Direction, packet []byte) bool

DropCallback is a callback that determines which packet gets dropped.

var NoDropper DropCallback = func(Direction, []byte) bool {
    return false

NoDropper doesn't drop packets.

type Opts Uses

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 Uses

type QuicProxy struct {
    // contains filtered or unexported fields

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

func NewQuicProxy Uses

func NewQuicProxy(local string, opts *Opts) (*QuicProxy, error)

NewQuicProxy creates a new UDP proxy

func (*QuicProxy) Close Uses

func (p *QuicProxy) Close() error

Close stops the UDP Proxy

func (*QuicProxy) LocalAddr Uses

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

LocalAddr is the address the proxy is listening on.

func (*QuicProxy) LocalPort Uses

func (p *QuicProxy) LocalPort() int

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

Package quicproxy imports 5 packages (graph). Updated 2019-07-21. Refresh now. Tools for package owners.