mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-21 20:45:33 +03:00
home: clients runtime sources dhcp
This commit is contained in:
parent
a74c32f742
commit
3ab945bb44
2 changed files with 15 additions and 10 deletions
|
@ -619,8 +619,11 @@ func (clients *clientsContainer) addHostLocked(
|
||||||
) (ok bool) {
|
) (ok bool) {
|
||||||
rc := client.NewRuntime(ip)
|
rc := client.NewRuntime(ip)
|
||||||
rc.SetInfo(src, []string{host})
|
rc.SetInfo(src, []string{host})
|
||||||
if dhcpHost := clients.dhcp.HostByIP(ip); dhcpHost != "" {
|
|
||||||
rc.SetInfo(client.SourceDHCP, []string{dhcpHost})
|
if config.Clients.Sources.DHCP {
|
||||||
|
if dhcpHost := clients.dhcp.HostByIP(ip); dhcpHost != "" {
|
||||||
|
rc.SetInfo(client.SourceDHCP, []string{dhcpHost})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
clients.storage.UpdateRuntime(rc)
|
clients.storage.UpdateRuntime(rc)
|
||||||
|
|
|
@ -117,15 +117,17 @@ func (clients *clientsContainer) handleGetClients(w http.ResponseWriter, r *http
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|
||||||
for _, l := range clients.dhcp.Leases() {
|
if config.Clients.Sources.DHCP {
|
||||||
cj := runtimeClientJSON{
|
for _, l := range clients.dhcp.Leases() {
|
||||||
Name: l.Hostname,
|
cj := runtimeClientJSON{
|
||||||
Source: client.SourceDHCP,
|
Name: l.Hostname,
|
||||||
IP: l.IP,
|
Source: client.SourceDHCP,
|
||||||
WHOIS: &whois.Info{},
|
IP: l.IP,
|
||||||
}
|
WHOIS: &whois.Info{},
|
||||||
|
}
|
||||||
|
|
||||||
data.RuntimeClients = append(data.RuntimeClients, cj)
|
data.RuntimeClients = append(data.RuntimeClients, cj)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data.Tags = clientTags
|
data.Tags = clientTags
|
||||||
|
|
Loading…
Reference in a new issue