ip

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package ip handles the IP L3 portion of the packet. Lucius supports IP packets such as IPv4, IPv6 and IP tunnels such as GRE and IP-IP tunnels with IPv4, IPv6 payload and IPv4, IPv6 transport.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GRE

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

A GRE represents a GRE header in the packet. It can be queried, updated added and removed. It supports GRE headers with the optional key and sequence-id attributes.

func (*GRE) Find

func (gre *GRE) Find(id fwdpacket.FieldID) ([]byte, error)

Find returns a copy of the field specified by id.

func (*GRE) Header

func (gre *GRE) Header() []byte

Header returns the GRE header as a slice of bytes.

func (GRE) ID

func (GRE) ID() fwdpb.PacketHeaderId

ID returns the protocol header ID.

func (*GRE) Payload

func (gre *GRE) Payload() (fwdpb.PacketHeaderId, int64)

Payload gets the payload information.

func (*GRE) SetPayload

func (gre *GRE) SetPayload(id fwdpb.PacketHeaderId, length int64)

SetPayload sets the payload.

func (*GRE) Update

func (gre *GRE) Update(id fwdpacket.FieldID, oper int, arg []byte) (bool, error)

Update updates a slice of bytes identified by id.

type IP

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

An IP is a group of IP headers in the L3 portion of the packet. The L3/IP portion of a packet can contain a series IPv4, IPv6 and GRE headers in-case of nested tunnels.

Note that the GRE implementation does not support UDF.

func (*IP) Field

func (ip *IP) Field(id fwdpacket.FieldID) ([]byte, error)

Field returns a copy of the specified field.

func (*IP) Header

func (ip *IP) Header() []byte

Header returns the IP/L3 as a slice of bytes.

func (*IP) ID

func (ip *IP) ID(instance int) fwdpb.PacketHeaderId

ID returns the protocol header ID of the outermost ip header.

func (*IP) Modify

func (ip *IP) Modify(id fwdpb.PacketHeaderId) error

Modify adds an addition IP header effectively tunneling the packet.

func (*IP) Rebuild

func (ip *IP) Rebuild() error

Rebuild updates all the IP headers starting from the innermost IP header.

func (*IP) Remove

func (ip *IP) Remove(id fwdpb.PacketHeaderId) error

Remove removes the outermost IP header from the packet after verifying its type.

func (IP) Trailer

func (IP) Trailer() []byte

Trailer returns the no trailing bytes.

func (*IP) UpdateField

func (ip *IP) UpdateField(id fwdpacket.FieldID, op int, arg []byte) (bool, error)

UpdateField updates the specified field.

type IP4

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

An IP4 represents an IPv4 header including IP options in the packet. It can be query, update, add and remove the IP header.

func (*IP4) Find

func (ip *IP4) Find(id fwdpacket.FieldID) ([]byte, error)

Find returns a copy of the specified field.

func (*IP4) Header

func (ip *IP4) Header() []byte

Header returns the IPv4 header as a slice of bytes.

func (IP4) ID

func (IP4) ID() fwdpb.PacketHeaderId

ID returns the protocol header ID.

func (*IP4) Payload

func (ip *IP4) Payload() (fwdpb.PacketHeaderId, int64)

Payload gets the payload information.

func (*IP4) SetPayload

func (ip *IP4) SetPayload(id fwdpb.PacketHeaderId, length int64)

SetPayload sets the payload.

func (*IP4) Update

func (ip *IP4) Update(id fwdpacket.FieldID, op int, arg []byte) (bool, error)

Update updates the specified field.

type IP6

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

An IP6 represents an IPv6 header in the packet. It can query, update, add and remove the IPv6 header. Note that it does not support IPv6 extensions.

func (*IP6) Find

func (ip *IP6) Find(id fwdpacket.FieldID) ([]byte, error)

Find returns a copy of the specified field.

func (*IP6) Header

func (ip *IP6) Header() []byte

Header returns the header as a slice of bytes.

func (IP6) ID

func (IP6) ID() fwdpb.PacketHeaderId

ID returns the protocol header ID.

func (*IP6) Payload

func (ip *IP6) Payload() (fwdpb.PacketHeaderId, int64)

Payload gets the payload information.

func (*IP6) SetPayload

func (ip *IP6) SetPayload(id fwdpb.PacketHeaderId, length int64)

SetPayload sets the payload.

func (*IP6) Update

func (ip *IP6) Update(id fwdpacket.FieldID, op int, arg []byte) (bool, error)

Update updates the specified field.

Jump to

Keyboard shortcuts

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