Documentation ¶
Index ¶
- type Client
- func (c *Client) Broadcast(b []byte) error
- func (c *Client) CreateBroadcasterConn() error
- func (c *Client) CreateListenerConn() error
- func (c *Client) CreateTopicClient(projectID, topicName string) error
- func (c *Client) Listen(handler func(*net.UDPAddr, int, []byte)) error
- func (c *Client) LogCounter()
- func (c *Client) Ping(b []byte) error
- func (c *Client) Publish() error
- func (c *Client) PublishS() error
- func (c *Client) SetupCloseHandler()
- type Counter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { // UDP multicast address in <HOST:PORT> format Address string // UDP multicast interface name IfName string // UDP multicast network type name: "udp", "udp4" (IPv4-only), "udp6" (IPv6-only) Net string // Size of the operating system's receive buffer associated with the connection. ReadBufferBytes int // Connection instance Conn *net.UDPConn // PubSub Topic instance Topic *pubsub.Topic // Message counter Counter }
Client for Multicast
func (*Client) Broadcast ¶
Broadcast writes to the client connetion interface and sleeps. Returns error
func (*Client) CreateBroadcasterConn ¶
Create Broadcaster Conn binds to the Client UDP network with address:port and returns Broadcaster connection or error
func (*Client) CreateListenerConn ¶
Create Listener Conn binds to the Client UDP network with address:port and returns Listener connection or error
func (*Client) CreateTopicClient ¶
Create Topic creates a topic client to connect
func (*Client) Listen ¶
Listen sets the UDPConn max datagram size and writes packets received to a buffer then generic hander. Returns error
func (*Client) Ping ¶
Ping continuously writes to the client connetion interface and sleeps. Returns error
func (*Client) Publish ¶
Publish sets the UDPConn max datagram size and writes packets received to a PubSub Topic. Returns error
func (*Client) PublishS ¶
PublishS sets the UDPConn max datagram size and writes packets received as string to a PubSub Topic . Returns error
func (*Client) SetupCloseHandler ¶
func (c *Client) SetupCloseHandler()
SetupCloseHandler creates a 'listener' on a new goroutine which will notify the program if it receives an interrupt from the OS. We then handle this by calling our clean up procedure and exiting the program.