Fix yaml marshalling panic.

This commit is contained in:
Eugene Bujak 2018-12-13 13:17:41 +03:00
parent 9294c9ecb2
commit 96fbf7f134
2 changed files with 4 additions and 4 deletions

View File

@ -52,7 +52,7 @@ var defaultDNS = []string{"tls://1.1.1.1", "tls://1.0.0.1"}
// field ordering is important -- yaml fields will mirror ordering from here // field ordering is important -- yaml fields will mirror ordering from here
type dhcpState struct { type dhcpState struct {
dhcpConfig Config dhcpConfig
Leases []dhcpLease Leases []dhcpLease
} }
@ -98,7 +98,7 @@ var config = configuration{
{Filter: dnsfilter.Filter{ID: 3}, Enabled: false, URL: "https://hosts-file.net/ad_servers.txt", Name: "hpHosts - Ad and Tracking servers only"}, {Filter: dnsfilter.Filter{ID: 3}, Enabled: false, URL: "https://hosts-file.net/ad_servers.txt", Name: "hpHosts - Ad and Tracking servers only"},
{Filter: dnsfilter.Filter{ID: 4}, Enabled: false, URL: "http://www.malwaredomainlist.com/hostslist/hosts.txt", Name: "MalwareDomainList.com Hosts List"}, {Filter: dnsfilter.Filter{ID: 4}, Enabled: false, URL: "http://www.malwaredomainlist.com/hostslist/hosts.txt", Name: "MalwareDomainList.com Hosts List"},
}, },
DHCP: dhcpState{dhcpConfig: dhcpConfig{ DHCP: dhcpState{Config: dhcpConfig{
LeaseDuration: time.Hour * 12, LeaseDuration: time.Hour * 12,
}}, }},
SchemaVersion: currentSchemaVersion, SchemaVersion: currentSchemaVersion,

View File

@ -8,7 +8,7 @@ import (
func handleDHCPStatus(w http.ResponseWriter, r *http.Request) { func handleDHCPStatus(w http.ResponseWriter, r *http.Request) {
status := map[string]interface{}{ status := map[string]interface{}{
"config": config.DHCP.dhcpConfig, "config": config.DHCP.Config,
"leases": config.DHCP.Leases, "leases": config.DHCP.Leases,
} }
@ -28,7 +28,7 @@ func handleDHCPSetConfig(w http.ResponseWriter, r *http.Request) {
return return
} }
config.DHCP.dhcpConfig = newconfig config.DHCP.Config = newconfig
} }
// TODO: implement // TODO: implement