parent
00a82aca87
commit
7255fc02c8
@ -124,7 +124,5 @@ func handleRequest(w dns.ResponseWriter, r *dns.Msg, zone zoneView) {
|
||||
m.SetRcode(m, dns.RcodeNameError)
|
||||
}
|
||||
|
||||
debugResponse(m)
|
||||
|
||||
w.WriteMsg(m)
|
||||
}
|
||||
|
@ -18,13 +18,6 @@ type zoneMap map[string][]zoneView
|
||||
|
||||
// Start starts cooldns
|
||||
func Start(configPath string) {
|
||||
|
||||
debug := os.Getenv("COOLDNS_DEBUG")
|
||||
if len(debug) != 0 {
|
||||
debugFlag = true
|
||||
debugLog("Enabled debug")
|
||||
}
|
||||
|
||||
config, err := loadConfig(configPath)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to load config: %s\n", err.Error())
|
||||
@ -87,8 +80,6 @@ func createServer(zones zoneMap, config config, aclList map[string]*net.IPNet, b
|
||||
return
|
||||
}
|
||||
|
||||
debugRequest(r, ip)
|
||||
|
||||
// Check if it is a ACME DNS-01 challange
|
||||
if config.Lego.Enable && handleACMERequest(w, r, acmeList) {
|
||||
return
|
||||
@ -105,7 +96,6 @@ func createServer(zones zoneMap, config config, aclList map[string]*net.IPNet, b
|
||||
handleBlockedDomain(w, r)
|
||||
} else {
|
||||
// Forward request
|
||||
debugLog("Forwarded request")
|
||||
in, _, err := c.Exchange(r, config.Forward.Server)
|
||||
|
||||
if err != nil {
|
||||
@ -177,8 +167,6 @@ func createHandler(zones []zoneView, config config, aclList map[string]*net.IPNe
|
||||
return
|
||||
}
|
||||
|
||||
debugRequest(r, ip)
|
||||
|
||||
// Check if it is a ACME DNS-01 challange
|
||||
if config.Lego.Enable && handleACMERequest(w, r, acmeList) {
|
||||
return
|
||||
|
@ -1,35 +0,0 @@
|
||||
package cooldns
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
|
||||
"github.com/miekg/dns"
|
||||
)
|
||||
|
||||
var debugFlag = false
|
||||
|
||||
func debugLog(msg string) {
|
||||
if !debugFlag {
|
||||
return
|
||||
}
|
||||
|
||||
log.Printf("DEBUG: %s", msg)
|
||||
}
|
||||
|
||||
func debugRequest(r *dns.Msg, ip net.IP) {
|
||||
if !debugFlag {
|
||||
return
|
||||
}
|
||||
|
||||
debugLog(fmt.Sprintf("Request from %s: %s", ip, r.String()))
|
||||
}
|
||||
|
||||
func debugResponse(m *dns.Msg) {
|
||||
if !debugFlag {
|
||||
return
|
||||
}
|
||||
|
||||
debugLog(fmt.Sprintf("Response send: %s", m.String()))
|
||||
}
|
Loading…
Reference in New Issue
Block a user