Skip to content

Commit

Permalink
all: use ptr instead of value
Browse files Browse the repository at this point in the history
  • Loading branch information
EugeneOne1 committed Sep 13, 2022
1 parent ec526c2 commit cfc3cfb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion internal/dhcpd/dhcpd.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ type Interface interface {
}

// Create - create object
func Create(conf ServerConfig) (s *server, err error) {
func Create(conf *ServerConfig) (s *server, err error) {
s = &server{
conf: &ServerConfig{
ConfigModified: conf.ConfigModified,
Expand Down
2 changes: 1 addition & 1 deletion internal/home/clients_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ func TestClientsAddExisting(t *testing.T) {
ip := net.IP{1, 2, 3, 4}

// First, init a DHCP server with a single static lease.
config := dhcpd.ServerConfig{
config := &dhcpd.ServerConfig{
Enabled: true,
DBFilePath: "leases.db",
Conf4: dhcpd.V4ServerConf{
Expand Down
6 changes: 3 additions & 3 deletions internal/home/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ type configuration struct {
WhitelistFilters []filter `yaml:"whitelist_filters"`
UserRules []string `yaml:"user_rules"`

DHCP dhcpd.ServerConfig `yaml:"dhcp"`
DHCP *dhcpd.ServerConfig `yaml:"dhcp"`

// Clients contains the YAML representations of the persistent clients.
// This field is only used for reading and writing persistent client data.
Expand Down Expand Up @@ -232,7 +232,7 @@ var config = &configuration{
PortDNSOverTLS: defaultPortTLS, // needs to be passed through to dnsproxy
PortDNSOverQUIC: defaultPortQUIC,
},
DHCP: dhcpd.ServerConfig{
DHCP: &dhcpd.ServerConfig{
LocalDomainName: "lan",
},
Clients: &clientsConfig{
Expand Down Expand Up @@ -433,7 +433,7 @@ func (c *configuration) write() (err error) {
}

if Context.dhcpServer != nil {
Context.dhcpServer.WriteDiskConfig(&config.DHCP)
Context.dhcpServer.WriteDiskConfig(config.DHCP)
}

config.Clients.Persistent = Context.clients.forConfig()
Expand Down

0 comments on commit cfc3cfb

Please sign in to comment.