Help us shape the future of Go! Take the 2026 Go Developer Survey

pim

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Hello                   = 0x00
	Register                = 0x01
	RegisterStop            = 0x02
	JoinPrune               = 0x03
	Bootstrap               = 0x04
	Assert                  = 0x05
	Graft                   = 0x06
	GraftAck                = 0x07
	CadidateRPAdvertisement = 0x08
)
View Source
const (
	OptionTypeHoldtime      = 1
	OptionTypeLANPruneDelay = 2
	OptionTypeDRPriority    = 19
	OptionTypeGenerationID  = 20
	OptionTypeStateRefresh  = 21
	OptionTypeAddressList   = 24
)
View Source
const (
	SparseBit   = 1 << 2
	WildCardBit = 1 << 1
	RPTreeBit   = 1 << 0
)

Variables

View Source
var (
	PIMMessageType       = gopacket.RegisterLayerType(1666, gopacket.LayerTypeMetadata{Name: "PIM", Decoder: gopacket.DecodeFunc(decodePim)})
	HelloMessageType     = gopacket.RegisterLayerType(1667, gopacket.LayerTypeMetadata{Name: "PIMHelloMessage", Decoder: gopacket.DecodeFunc(decodePimHelloMessage)})
	JoinPruneMessageType = gopacket.RegisterLayerType(1668, gopacket.LayerTypeMetadata{Name: "PIMJoinPruneMessage", Decoder: gopacket.DecodeFunc(decodePimJoinPruneMessage)})
)
View Source
var (
	// Anycast rendezvous point address used within DoubleZero
	RpAddress = net.IP([]byte{10, 0, 0, 0})
)

Functions

Types

type AddressList

type AddressList struct {
	Type             uint16
	Length           uint16
	SecondaryAddress []net.IP
}
0                   1                   2                   3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type = 24 | Length = <Variable> | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Secondary Address 1 (Encoded-Unicast format) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

...

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Secondary Address N (Encoded-Unicast format) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

func (AddressList) Bytes

func (a AddressList) Bytes() []byte

func (AddressList) NewAddressList

func (a AddressList) NewAddressList(addresses []net.IP) AddressList

type DRPriority

type DRPriority struct {
	Type       uint16
	Length     uint16
	DRPriority uint32
}
0                   1                   2                   3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type = 19 | Length = 4 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | DR Priority | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

func NewDRPriority

func NewDRPriority(drPriority uint32) DRPriority

func (DRPriority) Bytes

func (d DRPriority) Bytes() []byte

type EncodedSourceAddressFlag

type EncodedSourceAddressFlag uint8

type GenerationID

type GenerationID struct {
	Type         uint16
	Length       uint16
	GenerationID uint32
}
0                   1                   2                   3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type = 20 | Length = 4 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Generation ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

func NewGenerationID

func NewGenerationID(genID uint32) GenerationID

func (GenerationID) Bytes

func (g GenerationID) Bytes() []byte

type Group

type Group struct {
	GroupID               uint8
	AddressFamily         uint8
	EncodingType          uint8
	Flags                 uint8
	MaskLength            uint8
	MulticastGroupAddress net.IP
	NumJoinedSources      uint16
	NumPrunedSources      uint16
	Joins                 []SourceAddress
	Prunes                []SourceAddress
}

func (Group) Bytes

func (g Group) Bytes() []byte

type HelloMessage

type HelloMessage struct {
	layers.BaseLayer
	Holdtime             uint16
	PropDelay            uint16
	OverrideeInterval    uint16
	DRPriority           uint32
	GenerationID         uint32
	SecondaryAddress     []net.IP
	StateRefreshInterval uint8
	Options              []HelloOption
}

func (*HelloMessage) LayerType

func (p *HelloMessage) LayerType() gopacket.LayerType

func (*HelloMessage) SerializeTo

type HelloOption

type HelloOption struct {
	Type   OptionType
	Length uint16
	Value  []byte
}

type Holdtime

type Holdtime struct {
	Type     uint16
	Length   uint16
	Holdtime uint16
}
0                   1                   2                   3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type = 1 | Length = 2 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Holdtime | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

func NewHoldtime

func NewHoldtime(holdtime uint16) Holdtime

func (Holdtime) Bytes

func (h Holdtime) Bytes() []byte

type JoinPruneMessage

type JoinPruneMessage struct {
	layers.BaseLayer
	UpstreamNeighborAddress net.IP
	Reserved                uint8
	NumGroups               uint8
	Holdtime                uint16
	Groups                  []Group
}

func (*JoinPruneMessage) LayerType

func (p *JoinPruneMessage) LayerType() gopacket.LayerType

func (*JoinPruneMessage) SerializeTo

type LANPruneDelay

type LANPruneDelay struct {
	Type                    uint16
	Length                  uint16
	JoinSuppressionDisabled bool
	PropDelay               uint16
	OverrideInterval        uint16
}
0                   1                   2                   3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type = 2 | Length = 4 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |T| Propagation_Delay | Override_Interval | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

func NewLANPruneDelay

func NewLANPruneDelay(propDelay, overrideInterval uint16) LANPruneDelay

func (LANPruneDelay) Bytes

func (l LANPruneDelay) Bytes() []byte

type MessageType

type MessageType uint8

PIM Common Header

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|PIM Ver| Type  |   Reserved    |           Checksum            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

type OptionType

type OptionType uint16

type PIMHeader

type PIMHeader struct {
	Version  uint8
	Type     MessageType
	Reserved uint8
	Checksum uint16
}

type PIMMessage

type PIMMessage struct {
	layers.BaseLayer
	Header PIMHeader
}

func (*PIMMessage) LayerType

func (p *PIMMessage) LayerType() gopacket.LayerType

func (*PIMMessage) SerializeTo

type PIMServer

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

func NewPIMServer

func NewPIMServer() *PIMServer

func (*PIMServer) Close

func (s *PIMServer) Close() error

func (*PIMServer) Start

func (s *PIMServer) Start(conn RawConner, iface string, tunnelAddr net.IP, groups []net.IP) error

type RawConner

type RawConner interface {
	WriteTo(h *ipv4.Header, b []byte, cm *ipv4.ControlMessage) error
	Close() error
	SetMulticastInterface(iface *net.Interface) error
	SetControlMessage(cm ipv4.ControlFlags, on bool) error
}

type SourceAddress

type SourceAddress struct {
	AddressFamily uint8
	EncodingType  uint8
	Flags         uint8
	MaskLength    uint8
	Address       net.IP
}

func (SourceAddress) Bytes

func (s SourceAddress) Bytes() []byte

type StateRefreshInterval

type StateRefreshInterval struct {
	Type     uint16
	Length   uint16
	Version  uint8
	Interval uint8
	Reserved uint16
}
0                   1                   2                   3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type = 21 | Length = 4 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Version = 1 | Interval | Reserved | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

func NewStateRefreshInterval

func NewStateRefreshInterval(interval uint8) StateRefreshInterval

func (StateRefreshInterval) Bytes

func (s StateRefreshInterval) Bytes() []byte

Directories

Path Synopsis
cmd
send command

Jump to

Keyboard shortcuts

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