ip

package
v0.0.0-...-c5fcff7 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

GetDSCP holds all the DSCP values in a slice.

Functions

func GetIPHeaderLayer

func GetIPHeaderLayer(af int, tos DSCPValue, tcpLen uint16, srcIP net.IP, dstIP net.IP) (gopacket.NetworkLayer, error)

GetIPHeaderLayer returns the appriately versioned gopacket IP layer

func GetIPLayerOptions

func GetIPLayerOptions() gopacket.SerializeOptions

GetIPLayerOptions returns the gopacket options for serialization specific to Linux. In linux, gopacket correctly computes the ip Header lengths and checksum.

Types

type Conn

type Conn struct {
	SrcAddr net.IP
	AF      int

	ListenPort layers.TCPPort
	// contains filtered or unexported fields
}

Conn represents the underlying functionality to send and recv Arachne echo requests.

func NewConn

func NewConn(af int, listenPort layers.TCPPort, intf string, srcAddr net.IP, logger *log.Logger) *Conn

NewConn returns a raw socket connection to send and receive packets.

func (*Conn) Close

func (c *Conn) Close(logger *log.Logger)

Close is used to close a Conn's send file descriptor and recv source file desciptor.

func (*Conn) NextPacket

func (c *Conn) NextPacket() (gopacket.Packet, error)

NextPacket gets bytes of next available packet, and returns them in a decoded gopacket.Packet

func (*Conn) SendTo

func (c *Conn) SendTo(b []byte, to net.IP) error

SendTo operates on a Conn file descriptor and mirrors the Sendto syscall.

type DSCPSlice

type DSCPSlice []DSCPValue

DSCPSlice represents a slice of DSCP values.

func (DSCPSlice) Pos

func (slice DSCPSlice) Pos(value DSCPValue, logger *log.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 *log.Logger) string

Text provides the text description of the DSCPValue.

Jump to

Keyboard shortcuts

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