AdGuardHome/home/dhcp.go

37 lines
620 B
Go
Raw Normal View History

package home
2018-12-12 20:22:45 +03:00
import (
"github.com/joomcode/errorx"
2018-12-12 20:22:45 +03:00
)
func startDHCPServer() error {
if !config.DHCP.Enabled {
// not enabled, don't do anything
return nil
}
2019-07-09 18:57:41 +03:00
err := config.dhcpServer.Init(config.DHCP)
if err != nil {
return errorx.Decorate(err, "Couldn't init DHCP server")
}
2019-07-09 18:57:41 +03:00
err = config.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
}
2019-07-09 18:57:41 +03:00
err := config.dhcpServer.Stop()
if err != nil {
return errorx.Decorate(err, "Couldn't stop DHCP server")
}
return nil
}