Documentation
¶
Index ¶
- Constants
- type ID
- type Packet
- type Payload
- type RandPort
- type RateClock
- type RateStats
- type Recv
- type RecvConfig
- type RecvState
- type RecvStats
- func (self RecvStats) PacketLoss() float64
- func (self RecvStats) PacketWin() float64
- func (self RecvStats) StatsFields() map[string]interface{}
- func (self RecvStats) StatsID() stats.ID
- func (self RecvStats) StatsTime() time.Time
- func (self RecvStats) String() string
- func (self RecvStats) Valid() bool
- type Send
- type SendConfig
- type SendStats
- func (self SendStats) CalcRate() float64
- func (self SendStats) Duration() time.Duration
- func (self SendStats) RateError() float64
- func (self SendStats) RateUtil() float64
- func (self SendStats) StatsFields() map[string]interface{}
- func (self SendStats) StatsID() stats.ID
- func (self SendStats) StatsTime() time.Time
- func (self SendStats) String() string
- type SerializableNetworkLayer
- type SockIP
- type SockRecv
- type SockSend
- type SockStats
- type SockSyscall
- type SockUDP
Constants ¶
View Source
const PACKET_MTU = 1500 // XXX: not including IP overhead..?
View Source
const PACKET_TTL uint8 = 64
View Source
const PAYLOAD_SIZE = 16 // XXX: or smaller with varint?
View Source
const PORT uint = 1337 // used as destination port
View Source
const SOURCE_PORT uint = 0
View Source
const SOURCE_PORT_BITS uint = 0
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Packet ¶
type Payload ¶
type Payload struct {
// Chosen by the sender, kept the same for all consecutive packets in the same sequence.
// The receiver requires this to be unique per sender for reliable sequence tracking.
// Required since a sender may transmit from different randomized source addresses, possibly overlapping with other senders.
ID ID
// The sender sends packets with consective sequence numbers, starting from zero.
// Used by the sender to count received/missed/reordered packets, per ID.
Seq uint64
}
type Recv ¶
type Recv struct {
// contains filtered or unexported fields
}
func NewRecv ¶
func NewRecv(config RecvConfig) (*Recv, error)
func (*Recv) Config ¶
func (self *Recv) Config() *RecvConfig
type RecvConfig ¶
type RecvConfig struct {
ListenAddr string `long:"listen-addr" default:"0.0.0.0:1337"`
}
func (RecvConfig) Apply ¶
func (self RecvConfig) Apply() (*Recv, error)
type RecvStats ¶
type RecvStats struct {
ID ID // from recv ID
Time time.Time // stats were init/reset
Duration time.Duration // stats were collected
PacketTime time.Time // time of most recent packet
PacketStart uint64 // stats for packets following this seq (non-inclusive)
PacketSeq uint64 // most recent packet
PacketSize uint // total size of received packets
PacketErrors uint // invalid packets
PacketCount uint // in-sequence packets
PacketSkips uint // skipped in-sequence packets
PacketDups uint // out-of-sequence packets
}
func (RecvStats) PacketLoss ¶
proportion of lost or reordered packets, not counting duplicates this ratio only applies when .Valid()
func (RecvStats) PacketWin ¶
proportion of delivered packets, not counting reordered or duplicated packets this ratio only applies when .Valid()
func (RecvStats) StatsFields ¶
type Send ¶
type Send struct {
// contains filtered or unexported fields
}
func NewSend ¶
func NewSend(config SendConfig) (*Send, error)
type SendConfig ¶
type SendConfig struct {
DestAddr string `long:"dest-addr" value-name:"HOST:PORT" description:"Fixed destination address" required:"yes"`
SourceNet string `long:"source-net" value-name:"HOST/MASK" description:"Use raw IP socket with given randomized range of source addresses"`
SourcePort uint `long:"source-port" value-name:"0-65535" description:"Use raw IP socket with given randomized source port"`
SourcePortBits uint `long:"source-port-bits" value-name:"0-16" description:"Randomize low-order bits of source-port"`
ID string `json:"id" long:"id"` // 64-bit hex ID, or random
Rate uint `json:"rate" long:"rate"` // 0 - unrated
Count uint `json:"count" long:"count"` // 0 - infinite
Size uint `json:"size" long:"size"` // target size of UDP payload
}
type SendStats ¶
type SendStats struct {
ID ID // send id, to correlated with RecvStats
Start time.Time // stats were reset
Time time.Time // stats were updated
Config SendConfig
Rate RateStats
Send SockStats // Send.Bytes includes IP+UDP+Payload
}
func (SendStats) RateError ¶
Return the actual rate vs configured rate as a proportional error, with 1.0 being the most accurate
func (SendStats) RateUtil ¶
Return rate-loop utilization between 0..1, with 1.0 being fully utilized (unable to keep up with rate)
func (SendStats) StatsFields ¶
type SerializableNetworkLayer ¶
type SerializableNetworkLayer interface {
gopacket.NetworkLayer
gopacket.SerializableLayer
}
used for serializing packets with transport-layer checksums
type SockSyscall ¶
type SockSyscall struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.