westworld3

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2021 License: Apache-2.0 Imports: 20 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// 0x0 ... 0x7
	HELLO messageType = iota
	ACK
	DATA
	KEEPALIVE
	CLOSE
)
View Source
const (
	// 0x8 ... 0x80
	RTT        messageFlag = 0x8
	INLINE_ACK messageFlag = 0x10
)

Variables

This section is empty.

Functions

func AddProfile

func AddProfile(p *Profile) (byte, error)

func Dial

func Dial(addr *net.UDPAddr, profileId byte) (conn net.Conn, err error)

func EncodeAcks added in v0.3.5

func EncodeAcks(acks []Ack, data []byte) (n uint32, err error)

func Listen

func Listen(addr *net.UDPAddr, profileId byte) (net.Listener, error)

Types

type Ack added in v0.3.5

type Ack struct {
	Start int32
	End   int32
}

func DecodeAcks added in v0.3.5

func DecodeAcks(data []byte) (acks []Ack, sz uint32, err error)

type Instrument

type Instrument interface {
	NewInstance(id string, peer *net.UDPAddr) InstrumentInstance
}

func NewInstrument

func NewInstrument(name string, config map[string]interface{}) (i Instrument, err error)

func NewMetricsInstrument

func NewMetricsInstrument(config map[string]interface{}) (Instrument, error)

func NewNilInstrument

func NewNilInstrument() Instrument

func NewTraceInstrument

func NewTraceInstrument(config map[string]interface{}) (Instrument, error)

type InstrumentInstance

type InstrumentInstance interface {
	// connection
	Listener(addr *net.UDPAddr)
	Hello(peer *net.UDPAddr)
	Connected(peer *net.UDPAddr)
	ConnectionError(peer *net.UDPAddr, err error)
	Closed(peer *net.UDPAddr)

	// wire
	WireMessageTx(peer *net.UDPAddr, wm *wireMessage)
	WireMessageRetx(peer *net.UDPAddr, wm *wireMessage)
	WireMessageRx(peer *net.UDPAddr, wm *wireMessage)
	UnknownPeer(peer *net.UDPAddr)
	ReadError(peer *net.UDPAddr, err error)
	UnexpectedMessageType(peer *net.UDPAddr, mt messageType)

	// control
	TxAck(peer *net.UDPAddr, wm *wireMessage)
	RxAck(peer *net.UDPAddr, wm *wireMessage)
	TxKeepalive(peer *net.UDPAddr, wm *wireMessage)
	RxKeepalive(peer *net.UDPAddr, wm *wireMessage)

	// txPortal
	TxPortalCapacityChanged(peer *net.UDPAddr, capacity int)
	TxPortalSzChanged(peer *net.UDPAddr, capacity int)
	TxPortalRxSzChanged(peer *net.UDPAddr, sz int)
	NewRetxMs(peer *net.UDPAddr, retxMs int)
	NewRetxScale(peer *net.UDPAddr, retxScale float64)
	DuplicateAck(peer *net.UDPAddr, ack int32)

	// rxPortal
	RxPortalSzChanged(peer *net.UDPAddr, capacity int)
	DuplicateRx(peer *net.UDPAddr, wm *wireMessage)

	// allocation
	Allocate(id string)

	// instrument lifecycle
	Shutdown()
}

type Profile

type Profile struct {
	RandomizeSeq                bool    `cf:"randomize_seq"`
	ConnectionSetupTimeoutMs    int     `cf:"connection_setup_timeout_ms"`
	ConnectionInactiveTimeoutMs int     `cf:"connection_inactive_timeout_ms"`
	SendKeepalive               bool    `cf:"send_keepalive"`
	CloseWaitMs                 int     `cf:"close_wait_ms"`
	CloseCheckMs                int     `cf:"close_check_ms"`
	TxPortalStartSz             int     `cf:"tx_portal_start_sz"`
	TxPortalMinSz               int     `cf:"tx_portal_min_sz"`
	TxPortalMaxSz               int     `cf:"tx_portal_max_sz"`
	TxPortalIncreaseThresh      int     `cf:"tx_portal_increase_thresh"`
	TxPortalIncreaseScale       float64 `cf:"tx_portal_increase_scale"`
	TxPortalDupAckThresh        int     `cf:"tx_portal_dupack_thresh"`
	TxPortalDupAckCapacityScale float64 `cf:"tx_portal_dupack_capacity_scale"`
	TxPortalDupAckSuccessScale  float64 `cf:"tx_portal_dupack_success_scale"`
	TxPortalRetxThresh          int     `cf:"tx_portal_retx_thresh"`
	TxPortalRetxCapacityScale   float64 `cf:"tx_portal_retx_capacity_scale"`
	TxPortalRetxSuccessScale    float64 `cf:"tx_portal_retx_success_scale"`
	TxPortalRxSzPressureScale   float64 `cf:"tx_portal_rx_sz_pressure_scale"`
	RetxStartMs                 int     `cf:"retx_start_ms"`
	RetxScale                   float64 `cf:"retx_scale"`
	RetxScaleFloor              float64 `cf:"retx_scale_floor"`
	RetxAddMs                   int     `cf:"retx_add_ms"`
	RetxEvaluationMs            int     `cf:"retx_evaluation_ms"`
	RetxEvaluationScaleIncr     float64 `cf:"retx_evaluation_scale_incr"`
	RetxEvaluationScaleDecr     float64 `cf:"retx_evaluation_scale_decr"`
	RetxBatchMs                 int     `cf:"retx_batch_ms"`
	RttProbeMs                  int     `cf:"rtt_probe_ms"`
	RttProbeAvg                 int     `cf:"rtt_probe_avg"`
	RxPortalSzPacingThresh      float64 `cf:"rx_portal_sz_pacing_thresh"`
	MaxSegmentSz                int     `cf:"max_segment_sz"`
	PoolBufferSz                int     `cf:"pool_buffer_sz"`
	RxBufferSz                  int     `cf:"rx_buffer_sz"`
	TxBufferSz                  int     `cf:"tx_buffer_sz"`
	TxPortalTreeLen             int     `cf:"tx_portal_tree_len"`
	RetxMonitorTreeLen          int     `cf:"retx_monitor_tree_len"`
	RxPortalTreeLen             int     `cf:"rx_portal_tree_len"`
	ListenerPeersTreeLen        int     `cf:"listener_peers_tree_len"`
	ReadsQueueLen               int     `cf:"reads_queue_len"`
	ListenerRxQueueLen          int     `cf:"listener_rx_queue_len"`
	AcceptQueueLen              int     `cf:"accept_queue_len"`
	// contains filtered or unexported fields
}

func GetProfile added in v0.3.1

func GetProfile(id byte) *Profile

func NewBaselineProfile

func NewBaselineProfile() *Profile

func (*Profile) Dump

func (self *Profile) Dump() string

func (*Profile) Load

func (self *Profile) Load(data map[string]interface{}) error

Jump to

Keyboard shortcuts

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