cool-dns/internal/debug.go
2021-02-15 12:02:12 +01:00

36 lines
448 B
Go

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()))
}