tcp

package
v0.0.0-...-7ede39d Latest Latest
Warning

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

Go to latest
Published: May 3, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EchoRequest echoType = iota + 1
	EchoReply
)

'Echo' Types

Variables

GetDSCP holds all the DSCP values in a slice.

Functions

func EchoTargets

func EchoTargets(
	remotes interface{},
	srcAddr *net.IP,
	targetPort uint16,
	srcPortRange PortRange,
	QoSEnabled bool,
	currentDSCP *DSCPValue,
	realBatchInterval time.Duration,
	batchEndCycle *time.Ticker,
	sentC chan Message,
	senderOnlyMode bool,
	completeCycleUpload chan bool,
	finishedCycleUpload *sync.WaitGroup,
	kill chan struct{},
	logger zap.Logger,
)

EchoTargets sends echoes (SYNs) to all targets included in 'remotes.'

func Receiver

func Receiver(
	af string,
	srcAddr *net.IP,
	listenPort uint16,
	interfaceName string,
	sentC chan Message,
	rcvdC chan Message,
	kill chan struct{},
	logger zap.Logger,
) error

Receiver checks if the incoming packet is actually a response to our probe and acts accordingly. TODO Test IPv6

Types

type DSCPSlice

type DSCPSlice []DSCPValue

DSCPSlice represents a slice of DSCP values.

func (DSCPSlice) Pos

func (slice DSCPSlice) Pos(value DSCPValue, logger zap.Logger) uint8

Pos returns the index of the DSCP value in the DSCPSlice, not the actual DSCP value.

type DSCPValue

type DSCPValue uint8

DSCPValue represents a QoS DSCP value.

const (
	DSCPBeLow     DSCPValue = 0   // 000000 BE
	DSCPBeHigh    DSCPValue = 4   // 000001 BE
	DSCPBulkLow   DSCPValue = 40  // 001010 AF11
	DSCPBulkHigh  DSCPValue = 56  // 001110 AF13
	DSCPTier2Low  DSCPValue = 72  // 010010 AF21
	DSCPTier2High DSCPValue = 88  // 010110 AF23
	DSCPTier1Low  DSCPValue = 104 // 011010 AF31
	DSCPTier1High DSCPValue = 120 // 011110 AF33
	DSCPTier0Low  DSCPValue = 160 // 101000 EF
	DSCPNc6       DSCPValue = 192 // 110000 CS6
	DSCPNc7       DSCPValue = 224 // 111000 CS7
)

QoS DSCP values mapped to TOS.

func (DSCPValue) Text

func (q DSCPValue) Text(logger zap.Logger) string

Text provides the text description of the DSCPValue.

type Message

type Message struct {
	Type    echoType
	SrcAddr net.IP
	DstAddr net.IP
	Af      string
	SrcPort uint16
	DstPort uint16
	QosDSCP DSCPValue
	Ts      Timestamp
	Seq     uint32
	Ack     uint32
}

Message is filled with the info about the 'echo' request sent or 'echo' reply received and emitted onto the 'sent' and 'rcvd' channels, respectively, for further processing by the collector.

func (Message) FromExternalTarget

func (m Message) FromExternalTarget(servicePort uint16) bool

FromExternalTarget returns true if message has been received from external server and not an arachne agent.

type PortRange

type PortRange [2]uint16

PortRange is the inclusive range of src ports.

func (PortRange) Contains

func (t PortRange) Contains(p uint16) bool

Contains returns true if p is included within the PortRange t.

type Timestamp

type Timestamp struct {
	Unix    time.Time
	Run     time.Time
	Payload time.Time
}

Timestamp holds all the different types of time stamps.

Jump to

Keyboard shortcuts

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