2018-01-13 14:41:49 +01:00
|
|
|
package respond
|
|
|
|
|
|
|
|
import "github.com/FreifunkBremen/yanic/lib/duration"
|
|
|
|
|
|
|
|
type Config struct {
|
2018-01-17 20:20:35 +01:00
|
|
|
Enable bool `toml:"enable"`
|
|
|
|
Synchronize duration.Duration `toml:"synchronize"`
|
2017-12-05 23:17:49 +01:00
|
|
|
Interfaces []InterfaceConfig `toml:"interfaces"`
|
2018-01-17 20:20:35 +01:00
|
|
|
Sites map[string]SiteConfig `toml:"sites"`
|
|
|
|
CollectInterval duration.Duration `toml:"collect_interval"`
|
2019-11-17 10:44:11 +01:00
|
|
|
CustomFields []CustomFieldConfig `toml:"custom_field"`
|
2018-01-17 20:20:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (c *Config) SitesDomains() (result map[string][]string) {
|
|
|
|
result = make(map[string][]string)
|
|
|
|
for site, siteConfig := range c.Sites {
|
|
|
|
result[site] = siteConfig.Domains
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
type SiteConfig struct {
|
|
|
|
Domains []string `toml:"domains"`
|
2018-01-13 14:41:49 +01:00
|
|
|
}
|
2017-12-05 23:17:49 +01:00
|
|
|
|
|
|
|
type InterfaceConfig struct {
|
|
|
|
InterfaceName string `toml:"ifname"`
|
|
|
|
IPAddress string `toml:"ip_address"`
|
2018-03-11 20:21:35 +01:00
|
|
|
SendNoRequest bool `toml:"send_no_request"`
|
2017-12-05 23:17:49 +01:00
|
|
|
MulticastAddress string `toml:"multicast_address"`
|
|
|
|
Port int `toml:"port"`
|
|
|
|
}
|
2019-11-17 10:44:11 +01:00
|
|
|
|
|
|
|
type CustomFieldConfig struct {
|
|
|
|
Name string `toml:"name"`
|
|
|
|
Path string `toml:"path"`
|
|
|
|
}
|