multicast

package
v1.13.4 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2023 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Overview

Package multicast contains various utility functions to work with IPv6 multicast

Index

Constants

This section is empty.

Variables

View Source
var (
	// AllNodesIfcLocalMaddr is the multicast address that identifies the group of
	// all IPv6 nodes, within scope 1 (interface-local)
	AllNodesIfcLocalMaddr net.IP = net.ParseIP("ff01::1")

	// AllNodesLinkLocalMaddr is the multicast address that identifies the group of
	// all IPv6 nodes, within scope 2 (link-local)
	AllNodesLinkLocalMaddr net.IP = net.ParseIP("ff02::1")

	// AllRoutersIfcLocalMaddr is the multicast address that identifies the group of
	// all IPv6 routers, within scope 1 (interface-local)
	AllRoutersIfcLocalMaddr net.IP = net.ParseIP("ff01::2")

	// AllRoutersLinkLocalMaddr is the multicast address that identifies the group of
	// all IPv6 routers, within scope 2 (link-local)
	AllRoutersLinkLocalMaddr net.IP = net.ParseIP("ff02::2")

	// AllRoutersSiteLocalMaddr is the multicast address that identifies the group of
	// all IPv6 routers, within scope 5 (site-local)
	AllRoutersSiteLocalMaddr net.IP = net.ParseIP("ff05::2")

	// SolicitedNodeMaddrPrefix is the prefix of the multicast address that is used
	// as part of NDP
	SolicitedNodeMaddrPrefix net.IP = net.ParseIP("ff02::1:ff00:0")
)

Functions

func IsInGroup

func IsInGroup(ifc string, maddr netip.Addr) (bool, error)

IsInGroup tells if interface ifc belongs to group represented by maddr

func JoinGroup

func JoinGroup(ifc string, ip netip.Addr) error

JoinGroup joins the group address group on the interface ifc

func LeaveGroup

func LeaveGroup(ifc string, ip netip.Addr) error

LeaveGroup leaves the group address group on the interface ifc

func ListGroup

func ListGroup(ifc string) ([]net.Addr, error)

ListGroup lists multicast addresses on the interface ifc

Types

type Address

type Address netip.Addr

Address encapsulates the functionality to generate solicated node multicast address

func (Address) Key

func (a Address) Key() int32

Key takes the last 3 bytes of endpoint's IPv6 address and compile them in to an int32 value as key of the endpoint. It assumes the input is a valid IPv6 address. Otherwise it returns 0 (https://tools.ietf.org/html/rfc4291#section-2.7.1)

func (Address) SolicitedNodeMaddr

func (a Address) SolicitedNodeMaddr() netip.Addr

SolicitedNodeMaddr returns solicited node multicast address

Jump to

Keyboard shortcuts

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