ipv4opt

package module
v0.0.0-...-efda16a Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2017 License: BSD-3-Clause Imports: 2 Imported by: 3

README

Build Status

ipv4optparser

Parse IPv4 options into usable structs.

Documentation

Index

Constants

View Source
const (
	//EndOfOptionList indicates the end of the option list. This is used at the
	// end of all options.
	EndOfOptionList = 0
	//NoOperation is used between options.
	NoOperation = 1
	//Security provides a way for hosts to send security compartmentation.
	Security = 130
	//LooseSourceRecordRoute provides a means for the sources of an
	//internet datagram to supply routing information to be used in the
	//gateways in forwarding the datagram to the destination, and to
	//record the route information.
	LooseSourceRecordRoute = 131
	//StrictSourceRecordRoute provides a means for the source of an internet
	//datagram to supply routing information to be used by the gateways
	//in forwardig the datagram to the destination, and to record the route information.
	StrictSourceRecordRoute = 137
	//RecordRoute provides a means to record the route of an internet datagram.
	RecordRoute = 7
	//StreamIdentifier provides a way for the 16-bit SATNET stream identifier
	//to be carried through networks that do not support the stream concept.
	StreamIdentifier = 136
	//InternetTimestamp records timestamps along the path of the datagram.
	InternetTimestamp = 68
	//MaxOptionsLen is the maximum length of an IPv4 option section.
	MaxOptionsLen int = 40 // 60 Byte maximum size - 20 bytes for manditory fields

	//Unclassified security level.
	Unclassified SecurityLevel = 0x0
	//Confidential security level.
	Confidential = 0xF135
	//EFTO security level.
	EFTO = 0x789A
	//MMMM security level.
	MMMM = 0xBC4D
	// PROG security level.
	PROG = 0x5E26
	// Restricted security level.
	Restricted = 0xAF13
	// Secret security level.
	Secret = 0xD788
	// TopSecret security level
	TopSecret = 0x6BC5
	//Reserved0 (reserved for future use).
	Reserved0 = 0x35E2
	//Reserved1 (reserved for future use).
	Reserved1 = 0x9AF1
	//Reserved2 (reserved for future use).
	Reserved2 = 0x4D78
	//Reserved3 (reserved for future use).
	Reserved3 = 0x24BD
	//Reserved4 (reserved for future use).
	Reserved4 = 0x135E
	//Reserved5 (reserved for future use).
	Reserved5 = 0x89AF
	//Reserved6 (reserved for future use).
	Reserved6 = 0xC4D6
	//Reserved7 (reserved for future use).
	Reserved7 = 0xE26B
)
View Source
const (
	//TSOnly specifies that only timestamps should be included in the
	//timestamp option.
	TSOnly = 0
	//TSAndAddr specifies that each timestamp is preceded with the ip
	//address of the registering entity.
	TSAndAddr = 1
	//TSPrespec specifies that the ip address fields are prespecified.
	TSPrespec = 3
)

Variables

View Source
var (
	//ErrOptionDataTooLarge is returned when the length of the option data is
	//greater than the maximum option size.
	ErrOptionDataTooLarge = fmt.Errorf("The length of the options data is larger than the max options length")
	//ErrOptionType is returned when an invalid option type is found.
	ErrOptionType = fmt.Errorf("Invalid option type")
	//ErrIncorrectRRLength is returned when an RR option has route data with a length
	//that is not a multiple of 4.
	ErrIncorrectRRLength = fmt.Errorf("The length of the RR data is not a multiple of 4")
)

Functions

This section is empty.

Types

type Address

type Address uint32

Address is an IPv4 address.

func (Address) String

func (addr Address) String() string

type EOOList

type EOOList struct {
	// contains filtered or unexported fields
}

EOOList is the EndOfOptionsList option

func (EOOList) Data

func (o EOOList) Data() []byte

func (EOOList) Length

func (o EOOList) Length() int

func (EOOList) Type

func (o EOOList) Type() OptionType

type Flag

type Flag uint8

Flag is flag from an option

type IPOption

type IPOption interface {
	Type() OptionType
	Length() int
	Data() []byte
}

IPOption is the interface for an IPv4 option.

type NoOp

type NoOp struct {
	// contains filtered or unexported fields
}

NoOp is the NoOperation option

func (NoOp) Data

func (o NoOp) Data() []byte

func (NoOp) Length

func (o NoOp) Length() int

func (NoOp) Type

func (o NoOp) Type() OptionType

type OptionType

type OptionType uint8

OptionType repesents and option.

type Options

type Options []IPOption

Options is a list of IPv4 Options.

func Parse

func Parse(opts []byte) (Options, error)

Parse parses opts into IPv4 options.

type Overflow

type Overflow uint8

Overflow is an overflow from a timestamp option.

type RR

type RR struct {
	Pointer byte
	Routes  []Route
	// contains filtered or unexported fields
}

RR is an ipv4 record route option

func (RR) Data

func (o RR) Data() []byte

func (RR) Length

func (o RR) Length() int

func (RR) Type

func (o RR) Type() OptionType

type Route

type Route uint32

Route is a recored address in a record route.

func (Route) String

func (r Route) String() string

type Sec

type Sec struct {
	Level       SecurityLevel
	Compartment SecurityCompartment
	Restriction SecurityHandlingRestriction
	TCC         SecurityTCC
	// contains filtered or unexported fields
}

Sec is the ipv4 security option

func (Sec) Data

func (o Sec) Data() []byte

func (Sec) Length

func (o Sec) Length() int

func (Sec) Type

func (o Sec) Type() OptionType

type SecurityCompartment

type SecurityCompartment uint16

SecurityCompartment ...

type SecurityHandlingRestriction

type SecurityHandlingRestriction uint16

SecurityHandlingRestriction ...

type SecurityLevel

type SecurityLevel uint16

SecurityLevel is the security level from a security option.

type SecurityTCC

type SecurityTCC uint32

SecurityTCC ...

type Stamp

type Stamp struct {
	Time Timestamp
	Addr Address
}

Stamp represents a timestamp address pair from a timestamp option

type StreamID

type StreamID struct {
	ID uint16
	// contains filtered or unexported fields
}

StreamID is an ipv4 stream id option

func (StreamID) Data

func (o StreamID) Data() []byte

func (StreamID) Length

func (o StreamID) Length() int

func (StreamID) Type

func (o StreamID) Type() OptionType

type TS

type TS struct {
	Pointer byte
	Flags   Flag
	Over    Overflow
	Stamps  []Stamp
	// contains filtered or unexported fields
}

TS is an IPv4 timestamp option

func (TS) Data

func (o TS) Data() []byte

func (TS) Length

func (o TS) Length() int

func (TS) Type

func (o TS) Type() OptionType

type Timestamp

type Timestamp uint32

Timestamp is a timestamp specified in an IP timestamp option.

Jump to

Keyboard shortcuts

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