Documentation
¶
Overview ¶
Package multicast is a library for sending and receiving multicast traffic, as well as joining, leaving, and querying multicast groups.
Index ¶
- func ComputeChecksum(buf []byte) uint16
- func ComputeChecksumBytes(buf []byte) (byte, byte)
- func GetInterface(interfaceName string) (*net.Interface, error)
- func IP4ToInt(ip net.IP) uint32
- func IPList(network string, mask int) ([]net.IP, error)
- func IPListCIDR(address string) ([]net.IP, error)
- func IntToIP4(ipInt uint32) net.IP
- func Join(joinIPString string, joinPort int, interfaceName string) error
- func JoinRaw(address string, port int, interfaceName string, interval int, routerAlert bool, ...) error
- func Receive(address string, port int, interfaceName string, showData bool) error
- func SplitCIDR(address string) (string, int, error)
- type ManySender
- type Packet
- func (p *Packet) AddressAndPort() string
- func (p *Packet) Close() error
- func (p *Packet) ConnectRaw() error
- func (p *Packet) ConnectUDP() error
- func (p *Packet) Send() error
- func (p *Packet) SendRaw() error
- func (p *Packet) SendUDP() error
- func (p *Packet) SetAddress(address string)
- func (p *Packet) SetMessageText(message string)
- type Sender
- func (s *Sender) Forever(message string, interval int, startValue int) error
- func (s *Sender) Max(message string, interval int, startValue int, numberOfMessages int) error
- func (s *Sender) One(message string) error
- func (s *Sender) SetLocalAddress(address string) error
- func (s *Sender) SetMessagePadding(paddingSize int)
- func (s *Sender) SetTOS(tos int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeChecksum ¶
ComputeChecksum returns the 16bit 1's compliment for the given byte slice
func ComputeChecksumBytes ¶
ComputeChecksumBytes returns the 16bit checksum split into high and low bytes for a given byte slice.
func GetInterface ¶
GetInterface returns the interface associated with the name provided. It wraps the net.InterfaceByName only adding functionality to allow the specified interface to be an empty string. This helps with command line processing where the default value is an empty string.
func IPList ¶
IPList will return a slice of net.IP addresses for the given ip and mask. The returned slice will be based on the network that the provided ip falls in and not necessarily the exact ip given. The returned slice will also include both the network address and the broadcast address as the first and last items of the slice.
func IPListCIDR ¶
IPListCIDR is a convenience function combining SplitCIDR and IPList. It takes an address in CIDR format and returns a slice of IPs within that range.
func Join ¶
Join will use the system built in IGMP group join mechanisms to join a group. You may not see any IGMP requests sent if the system isn't ready to send them (group is currently joined, and timers are good). Join does not explicitly send a leave request.
func Receive ¶
Receive will listen on the port and addresses provided for incoming UDP messages. Uponn receipt of a UDP message, a message will be printed to the console. If showData is true, the data contained in that message will also be printed with the assumption that the data is a string. address can be in CIDR notation, in which case all of the addresses falling within that network will be listened on
Types ¶
type ManySender ¶
type ManySender struct {
Addresses *[]net.IP
Port int
TTL int
MessagePadding int
TOS int
LocalAddress *net.UDPAddr
}
func NewManySender ¶
func (*ManySender) SetLocalAddress ¶
func (m *ManySender) SetLocalAddress(address string) error
func (*ManySender) SetMessagePadding ¶
func (m *ManySender) SetMessagePadding(paddingSize int)
func (*ManySender) SetTOS ¶
func (m *ManySender) SetTOS(tos int)
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'
LocalAddress *net.UDPAddr
TOS int
// contains filtered or unexported fields
}