+ dhcpv6 server; rewrite dhcpv4 server; changed API
This commit is contained in:
17
home/home.go
17
home/home.go
@@ -219,10 +219,8 @@ 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)
|
||||
}
|
||||
Context.autoHosts.Init("")
|
||||
|
||||
@@ -317,9 +315,8 @@ func run(args options) {
|
||||
}
|
||||
}()
|
||||
|
||||
err = startDHCPServer()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
if Context.dhcpServer != nil {
|
||||
_ = Context.dhcpServer.Start()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -505,9 +502,9 @@ func cleanup() {
|
||||
if err != nil {
|
||||
log.Error("Couldn't stop DNS server: %s", err)
|
||||
}
|
||||
err = stopDHCPServer()
|
||||
if err != nil {
|
||||
log.Error("Couldn't stop DHCP server: %s", err)
|
||||
|
||||
if Context.dhcpServer != nil {
|
||||
Context.dhcpServer.Stop()
|
||||
}
|
||||
|
||||
Context.autoHosts.Close()
|
||||
|
||||
Reference in New Issue
Block a user