clientinfo

package
v1.3.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	IP                netip.Addr
	Mac               string
	Hostname          string
	Source            map[string]struct{}
	QueryCount        int64
	IncludeQueryCount bool
}

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 NewTable

func NewTable(cfg *ctrld.Config, selfIP, cdUID string, ns []string) *Table

func (*Table) AddLeaseFile

func (t *Table) AddLeaseFile(name string, format ctrld.LeaseFileFormat)

func (*Table) Init

func (t *Table) Init()

func (*Table) ListClients

func (t *Table) ListClients() []*Client

ListClients returns list of clients discovered by ctrld.

func (*Table) LocalHostname added in v1.3.6

func (t *Table) LocalHostname() string

LocalHostname returns the localhost hostname associated with loopback IP.

func (*Table) LookupHostname

func (t *Table) LookupHostname(ip, mac string) string

func (*Table) LookupIP

func (t *Table) LookupIP(mac string) string

func (*Table) LookupIPByHostname added in v1.3.2

func (t *Table) LookupIPByHostname(hostname string, v6 bool) *netip.Addr

LookupIPByHostname returns the ip address of given hostname. If v6 is true, return IPv6 instead of default IPv4.

func (*Table) LookupMac

func (t *Table) LookupMac(ip string) string

func (*Table) LookupRFC1918IPv4 added in v1.3.2

func (t *Table) LookupRFC1918IPv4(mac string) string

LookupRFC1918IPv4 returns the RFC1918 IPv4 address for the given MAC address, if any.

func (*Table) RefreshLoop

func (t *Table) RefreshLoop(ctx context.Context)

RefreshLoop runs all the refresher to update new client info data.

func (*Table) StoreVPNClient added in v1.3.1

func (t *Table) StoreVPNClient(ci *ctrld.ClientInfo)

StoreVPNClient stores client info for VPN clients.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL