103 lines
3.0 KiB
Go
103 lines
3.0 KiB
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
"time"
|
|
|
|
"github.com/hashicorp/logutils"
|
|
)
|
|
|
|
type configStructure struct {
|
|
// time configuration
|
|
TimeFormat string
|
|
TimeZone *time.Location
|
|
TimeZoneUTC *time.Location
|
|
|
|
// logging
|
|
Log *logutils.LevelFilter
|
|
|
|
// HTTP Client timeout configurations
|
|
HTTPClientRequestTimeout int
|
|
HTTPClientConnectTimeout int
|
|
HTTPClientTLSHandshakeTimeout int
|
|
HTTPClientIdleTimeout int
|
|
|
|
// Output Filename
|
|
BindOutputFileName string
|
|
|
|
// Config
|
|
ConfigFileLocation string
|
|
Config configFileStruct
|
|
}
|
|
|
|
type configFileStruct struct {
|
|
ZoneConfig struct {
|
|
TTL string `yaml:"timeToLive"`
|
|
Domain string `yaml:"baseDomain"`
|
|
Email string `yaml:"emailAddress"`
|
|
Serial string `yaml:"zoneSerialNumber"`
|
|
Refresh string `yaml:"zoneRefresh"`
|
|
Retry string `yaml:"zoneRetry"`
|
|
Expire string `yaml:"zoneExpire"`
|
|
Minimum string `yaml:"zoneMinimum"`
|
|
NameServers []string `yaml:"nameServers"`
|
|
BlockedDomains []string `yaml:"blockedDomains"`
|
|
} `yaml:"zoneConfig"`
|
|
Sources struct {
|
|
HostFileURLs []string `yaml:"hostFileURLs"`
|
|
DomainListURLs []string `yaml:"domainListURLs"`
|
|
} `yaml:"sources"`
|
|
AllowLists []string `yaml:"allowList"`
|
|
}
|
|
|
|
var config = configStructure{
|
|
TimeFormat: "2006-01-02 15:04:05",
|
|
Log: &logutils.LevelFilter{
|
|
Levels: []logutils.LogLevel{"TRACE", "DEBUG", "INFO", "WARNING", "ERROR"},
|
|
Writer: os.Stderr,
|
|
},
|
|
|
|
// Nice blocklist location: https://firebog.net/
|
|
// Default Blocklist
|
|
Config: configFileStruct{
|
|
Sources: struct {
|
|
HostFileURLs []string `yaml:"hostFileURLs"`
|
|
DomainListURLs []string `yaml:"domainListURLs"`
|
|
}{
|
|
HostFileURLs: []string{
|
|
//"https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts",
|
|
//"http://sysctl.org/cameleon/hosts",
|
|
//"https://raw.githubusercontent.com/DandelionSprout/adfilt/master/Alternate%20versions%20Anti-Malware%20List/AntiMalwareHosts.txt",
|
|
//"https://raw.githubusercontent.com/FadeMind/hosts.extras/master/add.Risk/hosts",
|
|
},
|
|
DomainListURLs: []string{
|
|
//"https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt",
|
|
//"https://s3.amazonaws.com/lists.disconnect.me/simple_malvertising.txt",
|
|
//"https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt",
|
|
//"https://v.firebog.net/hosts/Prigent-Crypto.txt",
|
|
//"https://phishing.army/download/phishing_army_blocklist_extended.txt",
|
|
//"https://gitlab.com/quidsup/notrack-blocklists/raw/master/notrack-malware.txt",
|
|
//"https://raw.githubusercontent.com/Spam404/lists/master/main-blacklist.txt",
|
|
//"https://dbl.oisd.nl/",
|
|
//"https://osint.digitalside.it/Threat-Intel/lists/latestdomains.txt",
|
|
},
|
|
},
|
|
AllowLists: []string{
|
|
// localhosts included in blocklists for some reason
|
|
`localhost`,
|
|
`localhost.localdomain`,
|
|
`local`,
|
|
`broadcasthost`,
|
|
`localhost`,
|
|
`ip6-localhost`,
|
|
`ip6-loopback`,
|
|
`localhost`,
|
|
`ip6-localnet`,
|
|
`ip6-mcastprefix`,
|
|
`ip6-allnodes`,
|
|
`ip6-allrouters`,
|
|
`ip6-allhosts`,
|
|
},
|
|
},
|
|
}
|