* dhcp,clients: DHCP server module is passed to Clients module during initialization.

This commit is contained in:
Simon Zolin
2019-11-22 14:21:08 +03:00
parent 127a68a39f
commit 149fcc0f2d
5 changed files with 38 additions and 8 deletions

View File

@@ -88,6 +88,13 @@ func (s *Server) CheckConfig(config ServerConfig) error {
return tmpServer.setConfig(config)
}
// Create - create object
func Create(config ServerConfig) *Server {
s := Server{}
s.conf = config
return &s
}
// Init checks the configuration and initializes the server
func (s *Server) Init(config ServerConfig) error {
err := s.setConfig(config)
@@ -98,6 +105,11 @@ func (s *Server) Init(config ServerConfig) error {
return nil
}
// WriteDiskConfig - write configuration
func (s *Server) WriteDiskConfig(c *ServerConfig) {
*c = s.conf
}
func (s *Server) setConfig(config ServerConfig) error {
s.conf = config
s.conf.DBFilePath = filepath.Join(config.WorkDir, dbFilename)