cool-dns/internal/debug.go

36 lines
448 B
Go
Raw Normal View History

2021-02-15 11:02:12 +00:00
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()))
}