multicast

package
v0.0.0-...-da21d56 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JoinASM

func JoinASM(address string, ifi *net.Interface) (*ipv4.PacketConn, error)

JoinASM Join the ASM group

func JoinSSM

func JoinSSM(address string, sourceAddress string, ifi *net.Interface) (*ipv4.PacketConn, error)

JoinSSM Join the SSM group

func LeaveASM

func LeaveASM(address string, ifi *net.Interface, conn *ipv4.PacketConn) error

LeaveASM Leave the ASM

func LeaveSSM

func LeaveSSM(address string, sourceAddress string, ifi *net.Interface, conn *ipv4.PacketConn) error

LeaveSSM: Leave the SSM group

func Listen

func Listen(packetConn *ipv4.PacketConn, handler func(*ipv4.ControlMessage, net.Addr, int, []byte)) error

Listen: loop and handle the log

func Receive

func Receive(address string, sourceAddress string, ifi *net.Interface, handler func(*ipv4.ControlMessage, net.Addr, int, []byte)) error

Receive is a function providing ASM and SSM receive function

func Send

func Send(address string, localaddress string, content_byte []byte, intervalns int, handler func(int, []byte)) error

write buffer([]byte) into the connection

Types

type Packet

type Packet struct {
	TTL          int
	Port         int
	Address      net.IP
	RouterAlert  bool
	Raw          bool
	IGMPVersion  int // 1, 2, or 3
	Interface    *net.Interface
	Message      []byte
	Protocol     string // 'udp' or 'ip:2'/'ip4:2'
	TargetAddr   *net.UDPAddr
	LocalAddress *net.UDPAddr

	TOS int
	// contains filtered or unexported fields
}

func Broadcast

func Broadcast(address string, localaddress string) (*Packet, error)

Use struct to define a multicast packet

func NewPacket

func NewPacket() *Packet

Create a Packet Struct init-instance function

Jump to

Keyboard shortcuts

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