mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-24 14:05:45 +03:00
+ "dhcp_available"
This commit is contained in:
parent
82bd8dbbf2
commit
4f0a4173b5
4 changed files with 21 additions and 10 deletions
|
@ -388,6 +388,7 @@ Response:
|
|||
"language":"en",
|
||||
"protection_enabled":true,
|
||||
"running":true,
|
||||
"dhcp_available":true,
|
||||
"version":"undefined"
|
||||
}
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ func handleStatus(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
"protection_enabled": c.ProtectionEnabled,
|
||||
}
|
||||
data["dhcp_available"] = (Context.dhcpServer != nil)
|
||||
|
||||
jsonVal, err := json.Marshal(data)
|
||||
if err != nil {
|
||||
|
|
27
home/home.go
27
home/home.go
|
@ -211,10 +211,12 @@ func run(args options) {
|
|||
config.DHCP.WorkDir = Context.workDir
|
||||
config.DHCP.HTTPRegister = httpRegister
|
||||
config.DHCP.ConfigModified = onConfigModified
|
||||
Context.dhcpServer = dhcpd.Create(config.DHCP)
|
||||
if Context.dhcpServer == nil {
|
||||
log.Error("Failed to initialize DHCP server, exiting")
|
||||
os.Exit(1)
|
||||
if runtime.GOOS != "windows" {
|
||||
Context.dhcpServer = dhcpd.Create(config.DHCP)
|
||||
if Context.dhcpServer == nil {
|
||||
log.Error("Failed to initialize DHCP server, exiting")
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
Context.autoHosts.Init("")
|
||||
Context.clients.Init(config.Clients, Context.dhcpServer, &Context.autoHosts)
|
||||
|
@ -296,9 +298,11 @@ func run(args options) {
|
|||
}
|
||||
}()
|
||||
|
||||
err = Context.dhcpServer.Start()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
if Context.dhcpServer != nil {
|
||||
err = Context.dhcpServer.Start()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -447,9 +451,12 @@ func cleanup() {
|
|||
if err != nil {
|
||||
log.Error("Couldn't stop DNS server: %s", err)
|
||||
}
|
||||
err = Context.dhcpServer.Stop()
|
||||
if err != nil {
|
||||
log.Error("Couldn't stop DHCP server: %s", err)
|
||||
|
||||
if Context.dhcpServer != nil {
|
||||
err = Context.dhcpServer.Stop()
|
||||
if err != nil {
|
||||
log.Error("Couldn't stop DHCP server: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
Context.autoHosts.Close()
|
||||
|
|
|
@ -1049,6 +1049,8 @@ definitions:
|
|||
maximum: 65535
|
||||
protection_enabled:
|
||||
type: "boolean"
|
||||
dhcp_available:
|
||||
type: "boolean"
|
||||
querylog_enabled:
|
||||
type: "boolean"
|
||||
running:
|
||||
|
|
Loading…
Reference in a new issue