vxlan

package
v0.0.0-...-a9890c3 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler VxLAN endpoint protocol

func NewHandler

func NewHandler() *Handler

NewHandler creates a new VxLAN handler

func (*Handler) Send

func (p *Handler) Send(packets []protocol.Packet, rdst net.IP) (int, error)

Send sends a group of packets to a dest endpoint

func (*Handler) SendOne

func (p *Handler) SendOne(packet *protocol.Packet, rdst net.IP) (int, error)

SendOne sends a single packet to a dest endpoint

func (*Handler) SetHandler

func (p *Handler) SetHandler(handle protocol.HandlerFunc)

SetHandler sets the receiving callback

func (*Handler) Start

func (p *Handler) Start() error

Start opens a UDP endpoint for VxLAN packets

func (*Handler) Stop

func (p *Handler) Stop() error

Stop ends the UDP endpoint

type Packet

type Packet struct {
	Flags       uint8
	GroupPolicy uint32 //wire: uint24
	VNID        uint32 //wire: uint24

	InnerFrame ethernet.Frame
	// contains filtered or unexported fields
}

Packet represents the VxLAN headers and inner packet

func FromBytes

func FromBytes(bytesReader io.Reader) (*Packet, error)

FromBytes converts a byte array to a vxlan packet

func NewPacket

func NewPacket(vnid uint32, innerFrame []byte) Packet

NewPacket encaps a inner packet with VXlan headers

func (*Packet) Bytes

func (p *Packet) Bytes() []byte

Bytes converts the packet to raw bytes

func (*Packet) WriteTo

func (p *Packet) WriteTo(w *bytes.Buffer) (int64, error)

WriteTo writes a pakcet to a give writer

Jump to

Keyboard shortcuts

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