wip
This commit is contained in:
@@ -126,10 +126,6 @@ var config = configuration{
|
||||
PortHTTPS: 443,
|
||||
PortDNSOverTLS: 853, // needs to be passed through to dnsproxy
|
||||
},
|
||||
DHCP: dhcpd.ServerConfig{
|
||||
LeaseDuration: 86400,
|
||||
ICMPTimeout: 1000,
|
||||
},
|
||||
SchemaVersion: currentSchemaVersion,
|
||||
}
|
||||
|
||||
|
||||
36
home/dhcp.go
36
home/dhcp.go
@@ -1,36 +0,0 @@
|
||||
package home
|
||||
|
||||
import (
|
||||
"github.com/joomcode/errorx"
|
||||
)
|
||||
|
||||
func startDHCPServer() error {
|
||||
if !config.DHCP.Enabled {
|
||||
// not enabled, don't do anything
|
||||
return nil
|
||||
}
|
||||
|
||||
err := Context.dhcpServer.Init(config.DHCP)
|
||||
if err != nil {
|
||||
return errorx.Decorate(err, "Couldn't init DHCP server")
|
||||
}
|
||||
|
||||
err = Context.dhcpServer.Start()
|
||||
if err != nil {
|
||||
return errorx.Decorate(err, "Couldn't start DHCP server")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func stopDHCPServer() error {
|
||||
if !config.DHCP.Enabled {
|
||||
return nil
|
||||
}
|
||||
|
||||
err := Context.dhcpServer.Stop()
|
||||
if err != nil {
|
||||
return errorx.Decorate(err, "Couldn't stop DHCP server")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -296,7 +296,7 @@ func run(args options) {
|
||||
}
|
||||
}()
|
||||
|
||||
err = startDHCPServer()
|
||||
err = Context.dhcpServer.Start()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
@@ -447,7 +447,7 @@ func cleanup() {
|
||||
if err != nil {
|
||||
log.Error("Couldn't stop DNS server: %s", err)
|
||||
}
|
||||
err = stopDHCPServer()
|
||||
err = Context.dhcpServer.Stop()
|
||||
if err != nil {
|
||||
log.Error("Couldn't stop DHCP server: %s", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user