Documentation ¶
Index ¶
- Constants
- func LocalAddressManager(addressChan chan address.InterfaceAddress, exit chan int)
- func WritePacket(out chan OutPacket, exit chan int, handler *PacketHandler)
- type DHCPDevice
- type DHCPPacket
- type Device
- type InformPacket
- type OutPacket
- type PacketHandler
- type SSHConfiguration
- type Server
- func (server *Server) AddDevice(device Device) bool
- func (h *Server) DHCPServer()
- func (server *Server) GetDHCPNetwork() (*net.IPNet, error)
- func (server *Server) GetDevice(mac string) (Device, bool)
- func (server *Server) HandleInform(in chan gopacket.Packet)
- func (server *Server) HasDevice(mac string) bool
- func (server *Server) LocalAddressCLeaner()
- func (server *Server) NewProvisionDevice(dev *Device) *UnifiProvision
- func (server *Server) RemoteAddressManager(address chan address.InterfaceAddress, exit chan int)
- func (server *Server) Start() error
- func (server *Server) Stop() error
- func (h *Server) ValidMAC(mac string) bool
- type Tag
- type TagDescription
- type TagID
- type UnifiDevice
- type UnifiProvision
Constants ¶
View Source
const ( DHCPPort = 67 InformPort = 10001 )
Variables ¶
This section is empty.
Functions ¶
func LocalAddressManager ¶
func LocalAddressManager(addressChan chan address.InterfaceAddress, exit chan int)
func WritePacket ¶
func WritePacket(out chan OutPacket, exit chan int, handler *PacketHandler)
Types ¶
type DHCPDevice ¶
type DHCPPacket ¶
type Device ¶
type Device struct { MacAddress string Unifi *UnifiDevice DHCP *DHCPDevice Log *log.Entry // contains filtered or unexported fields }
type InformPacket ¶
func ParseInformPacket ¶
func ParseInformPacket(raw []byte) (*InformPacket, error)
ParsePacket tries to parse UPD packet data into a Packet
func (*InformPacket) Device ¶
func (p *InformPacket) Device() *UnifiDevice
type OutPacket ¶
type OutPacket struct {
// contains filtered or unexported fields
}
func NewOutPacket ¶
type PacketHandler ¶
type PacketHandler struct { ARP chan gopacket.Packet Inform chan gopacket.Packet DHCP chan gopacket.Packet // contains filtered or unexported fields }
ARP requests only : (arp[6:2] = 1) Our requests "((arp[6:2] = 1) or udp dst port 67 or udp dst port 10001) and not vlan"
func NewHandler ¶
func NewHandler(iface *net.Interface) (*PacketHandler, error)
func (*PacketHandler) Close ¶
func (handler *PacketHandler) Close()
func (*PacketHandler) Listen ¶
func (handler *PacketHandler) Listen(stop chan int)
func (*PacketHandler) SetFilter ¶
func (handler *PacketHandler) SetFilter(filter string) error
func (*PacketHandler) Write ¶
func (handler *PacketHandler) Write(packet []byte) error
type SSHConfiguration ¶
type SSHConfiguration struct { Usernames []string `yaml:"users"` SSHAuthMethods []sshAuthMethod `yaml:"methods"` // contains filtered or unexported fields }
type Server ¶
type Server struct { Interface string `yaml:"interface"` Iface *net.Interface LogLevel string `yaml:"log_level"` LogFile string `yaml:"log_file"` LogFileWriter *os.File Log *log.Entry MaxDevices int `yaml:"max_devices"` MACPrefix []string `yaml:"mac_prefixes"` Provision provisionConfiguration `yaml:"provision"` DHCP dhcpConfiguration `yaml:"dhcp"` Handler *PacketHandler NetManager address.Manager // RPC client to talk to the interface address manager ManageNet chan address.InterfaceAddress StopNet chan int WriteNet chan OutPacket StopWrite chan int StopListen chan int StopClean chan int CleanTicker *time.Ticker Cache *lru.Cache }
func LoadConfig ¶
LoadConfig reads a YAML file and converts it to a Server object
func (*Server) DHCPServer ¶
func (h *Server) DHCPServer()
func (*Server) HandleInform ¶
func (*Server) LocalAddressCLeaner ¶
func (server *Server) LocalAddressCLeaner()
func (*Server) NewProvisionDevice ¶
func (server *Server) NewProvisionDevice(dev *Device) *UnifiProvision
func (*Server) RemoteAddressManager ¶
func (server *Server) RemoteAddressManager(address chan address.InterfaceAddress, exit chan int)
type Tag ¶
type Tag struct { ID TagID // contains filtered or unexported fields }
Tag describes a key value pair
func (*Tag) StringInto ¶
StringInto tries to update the given string reference with a type asserted value (it doesn't perform an update, if the type assertion fails)
type TagDescription ¶
type TagDescription struct {
// contains filtered or unexported fields
}
TagDescription annotates some meta information to a TagID
type UnifiDevice ¶
Click to show internal directories.
Click to hide internal directories.