Documentation ¶
Index ¶
- func BroadcastMessage(msgType int, data []byte, skip *Socket)
- func MACIsUnicast(mac MacAddr) bool
- type CommandHandler
- type MacAddr
- type Socket
- func (s *Socket) AddCommandHandler(command string, handler CommandHandler)
- func (s *Socket) BroadcastCommand(command string, args []string) error
- func (s *Socket) Close()
- func (s *Socket) SendCommand(command string, args ...string) error
- func (s *Socket) Serve(ipv6 bool)
- func (s *Socket) SetInterface(iface *water.Interface) error
- func (s *Socket) Wait()
- func (s *Socket) WriteMessage(msgType int, data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BroadcastMessage ¶
BroadcastMessage sends the given data over all sockets.
func MACIsUnicast ¶
MACIsUnicast returns true if the MAC address is a unicast address.
Types ¶
type CommandHandler ¶
CommandHandler is the signature of a function which can be triggered via a command over our websocket connection. We use if for `init`.
type MacAddr ¶
type MacAddr [6]byte
MacAddr stores a MAC address.
func GetDestMAC ¶
GetDestMAC retreives the destination MAC address of a TCP/IP packet.
type Socket ¶
type Socket struct {
// contains filtered or unexported fields
}
Socket holds state about our connection.
func FindSocketByMAC ¶
FindSocketByMAC finds the correct socket, by looking for the specified MAC address.
func MakeSocket ¶
MakeSocket is our constructor. It ties a websocket connection to an interface connection.
func (*Socket) AddCommandHandler ¶
func (s *Socket) AddCommandHandler(command string, handler CommandHandler)
AddCommandHandler binds a function-name to a handler, which is used in our websocket connection.
func (*Socket) BroadcastCommand ¶
BroadcastCommand sends the given data over all sockets.
func (*Socket) SendCommand ¶
SendCommand sends a "command" over our websocket link
func (*Socket) Serve ¶
Serve is the main-driver which never returns Handle proxying data back and forth..
func (*Socket) SetInterface ¶
SetInterface sets the given network-interface to be associated with us.