mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-24 05:55:43 +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,9 +619,12 @@ func (clients *clientsContainer) addHostLocked(
|
|||
) (ok bool) {
|
||||
rc := client.NewRuntime(ip)
|
||||
rc.SetInfo(src, []string{host})
|
||||
|
||||
if config.Clients.Sources.DHCP {
|
||||
if dhcpHost := clients.dhcp.HostByIP(ip); dhcpHost != "" {
|
||||
rc.SetInfo(client.SourceDHCP, []string{dhcpHost})
|
||||
}
|
||||
}
|
||||
|
||||
clients.storage.UpdateRuntime(rc)
|
||||
|
||||
|
|
|
@ -117,6 +117,7 @@ func (clients *clientsContainer) handleGetClients(w http.ResponseWriter, r *http
|
|||
return true
|
||||
})
|
||||
|
||||
if config.Clients.Sources.DHCP {
|
||||
for _, l := range clients.dhcp.Leases() {
|
||||
cj := runtimeClientJSON{
|
||||
Name: l.Hostname,
|
||||
|
@ -127,6 +128,7 @@ func (clients *clientsContainer) handleGetClients(w http.ResponseWriter, r *http
|
|||
|
||||
data.RuntimeClients = append(data.RuntimeClients, cj)
|
||||
}
|
||||
}
|
||||
|
||||
data.Tags = clientTags
|
||||
|
||||
|
|
Loading…
Reference in a new issue