Documentation ¶
Index ¶
- type Client
- type HostnameByIpResolver
- type HostnameByMacResolver
- type HostnameResolver
- type IpResolver
- type MacResolver
- type Table
- func (t *Table) AddLeaseFile(name string, format ctrld.LeaseFileFormat)
- func (t *Table) Init()
- func (t *Table) ListClients() []*Client
- func (t *Table) LookupHostname(ip, mac string) string
- func (t *Table) LookupIP(mac string) string
- func (t *Table) LookupIPByHostname(hostname string, v6 bool) *netip.Addr
- func (t *Table) LookupMac(ip string) string
- func (t *Table) LookupRFC1918IPv4(mac string) string
- func (t *Table) RefreshLoop(ctx context.Context)
- func (t *Table) StoreVPNClient(ci *ctrld.ClientInfo)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HostnameByIpResolver ¶
type HostnameByIpResolver interface { // LookupHostnameByIP returns hostname of the given ip. LookupHostnameByIP(ip string) string }
HostnameByIpResolver is the interface for retrieving hostname from IP.
type HostnameByMacResolver ¶
type HostnameByMacResolver interface { // LookupHostnameByMac returns hostname of the device with given mac. LookupHostnameByMac(mac string) string }
HostnameByMacResolver is the interface for retrieving hostname from Mac.
type HostnameResolver ¶
type HostnameResolver interface { fmt.Stringer HostnameByIpResolver HostnameByMacResolver }
HostnameResolver is the interface for retrieving hostname from either IP or Mac.
type IpResolver ¶
type IpResolver interface { fmt.Stringer // LookupIP returns ip of the device with given mac. LookupIP(mac string) string }
IpResolver is the interface for retrieving IP from Mac.
type MacResolver ¶
type MacResolver interface { fmt.Stringer // LookupMac returns mac of the device with given ip. LookupMac(ip string) string }
MacResolver is the interface for retrieving Mac from IP.
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
func (*Table) AddLeaseFile ¶
func (t *Table) AddLeaseFile(name string, format ctrld.LeaseFileFormat)
func (*Table) ListClients ¶
ListClients returns list of clients discovered by ctrld.
func (*Table) LookupHostname ¶
func (*Table) LookupIPByHostname ¶ added in v1.3.2
LookupIPByHostname returns the ip address of given hostname. If v6 is true, return IPv6 instead of default IPv4.
func (*Table) LookupRFC1918IPv4 ¶ added in v1.3.2
LookupRFC1918IPv4 returns the RFC1918 IPv4 address for the given MAC address, if any.
func (*Table) RefreshLoop ¶
func (*Table) StoreVPNClient ¶ added in v1.3.1
func (t *Table) StoreVPNClient(ci *ctrld.ClientInfo)
StoreVPNClient stores client info for VPN clients.