clientinfo

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2025 License: MIT Imports: 35 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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()

Init initializes all client info discovers.

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) Refresh added in v1.4.0

func (t *Table) Refresh()

Refresh forces all discovers to retrieve new data.

func (*Table) RefreshLoop

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

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

func (*Table) SelfIP added in v1.4.0

func (t *Table) SelfIP() string

SelfIP returns the selfIP value of the Table in a thread-safe manner.

func (*Table) SetSelfIP added in v1.4.0

func (t *Table) SetSelfIP(ip string)

SetSelfIP sets the selfIP value of the Table in a thread-safe manner.

func (*Table) Stop added in v1.4.0

func (t *Table) Stop()

Stop stops all the discovers. It blocks until all the discovers done.

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