@ -48,6 +48,7 @@ type cfg struct {
ServersString []string `json:"default_servers"`
servers []addr
Timeout int `json:"timeout"`
TTL int `json:"ttl"`
BlacklistFiles []string `json:"blacklist_ips"`
blacklistIps item
Rules []Rule `json:"rules"`
@ -1,6 +1,7 @@
{
"listen":["tcp:0.0.0.0:8053","udp::8053"],
"default_servers":["tcp:208.67.222.222:53","tcp:8.8.8.8:53"],
"ttl":3600,
"timeout":1,
"blacklist_ips":["ip.txt"],
"rules":[
@ -116,7 +116,7 @@ func initRouters(c *cfg) {
c,
&dns.Client{Net: "tcp", Timeout: time.Duration(c.Timeout) * time.Second},
&dns.Client{Net: "udp", Timeout: time.Duration(c.Timeout) * time.Second},
newCache(1000, 5*60*60), // cache 5 hours
newCache(1000, int64(c.TTL)), // cache 5 hours
}
dns.Handle(".", router)