Documentation
¶
Overview ¶
Package multicast provides utilities for network multicast.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var RecvAddrResolver = &AddrResolver{Addr: "224.0.0.1:1900"}
var SystemAssignedInterface bool = false
SystemAssignedInterface indicates use the system assigned multicast interface or not. InterfacesProvider will be ignored when this is true.
Functions ¶
func SetRecvAddrIPv4 ¶
SetRecvAddrIPv4 updates multicast address where to receive packets. This never fail now.
func SetSendAddrIPv4 ¶
SetSendAddrIPv4 updates a UDP address to send multicast packets. This never fail now.
Types ¶
type AddrResolver ¶
type AddrResolver struct { Addr string // contains filtered or unexported fields }
type BytesDataProvider ¶
type BytesDataProvider []byte
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn is multicast connection.
func Listen ¶
func Listen(r *AddrResolver, opts ...ConnOption) (*Conn, error)
Listen starts to receiving multicast messages.
func (*Conn) ReadPackets ¶
func (mc *Conn) ReadPackets(timeout time.Duration, h PacketHandler) error
ReadPackets reads multicast packets.
type ConnOption ¶ added in v0.0.5
type ConnOption interface {
// contains filtered or unexported methods
}
ConnOption is option for Listen()
func ConnSystemAssginedInterface ¶ added in v0.0.5
func ConnSystemAssginedInterface() ConnOption
func ConnTTL ¶ added in v0.0.5
func ConnTTL(ttl int) ConnOption
ConnTTL returns as ConnOption that set default TTL to the connection.
type DataProvider ¶
DataProvider provides a body of multicast message to send.
type InterfacesProviderFunc ¶
var InterfacesProvider InterfacesProviderFunc
InterfacesProvider specify a function to list all interfaces to multicast. If no provider are given, all possible interfaces will be used.