style: format with go fmt
This commit is contained in:
parent
d25c1d24a7
commit
759b725fdc
3 changed files with 11 additions and 18 deletions
1
log.go
1
log.go
|
|
@ -222,7 +222,6 @@ func log_libdns_record(record *libdns.Record) zapcore.ObjectMarshaler {
|
||||||
return zapcore.ObjectMarshalerFunc(f)
|
return zapcore.ObjectMarshalerFunc(f)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// MarshalLogObject satisfies the zapcore.ObjectMarshaler interface.
|
// MarshalLogObject satisfies the zapcore.ObjectMarshaler interface.
|
||||||
func (r request) MarshalLogObject(enc zapcore.ObjectEncoder) error {
|
func (r request) MarshalLogObject(enc zapcore.ObjectEncoder) error {
|
||||||
enc.AddString("zone", r.zone)
|
enc.AddString("zone", r.zone)
|
||||||
|
|
|
||||||
|
|
@ -210,7 +210,7 @@ func (srv *Server) handle_query(q query) {
|
||||||
}
|
}
|
||||||
// queries may be wAcKY casE
|
// queries may be wAcKY casE
|
||||||
// https://datatracker.ietf.org/doc/html/draft-vixie-dnsext-dns0x20-00
|
// https://datatracker.ietf.org/doc/html/draft-vixie-dnsext-dns0x20-00
|
||||||
key := key {
|
key := key{
|
||||||
Type: dns.Type(qstn.Qtype),
|
Type: dns.Type(qstn.Qtype),
|
||||||
Name: strings.ToLower(qstn.Name),
|
Name: strings.ToLower(qstn.Name),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,6 @@ const dns_only_json string = `{
|
||||||
}
|
}
|
||||||
}`
|
}`
|
||||||
|
|
||||||
|
|
||||||
const dns_but_empty string = `{
|
const dns_but_empty string = `{
|
||||||
admin localhost:2999
|
admin localhost:2999
|
||||||
debug
|
debug
|
||||||
|
|
@ -138,7 +137,6 @@ func query_dns(t *testing.T, name string, qtype uint16) *dns.Msg {
|
||||||
return in
|
return in
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func wAcKY_casE(input string) string {
|
func wAcKY_casE(input string) string {
|
||||||
INPUT := strings.ToUpper(input)
|
INPUT := strings.ToUpper(input)
|
||||||
InPuT := ""
|
InPuT := ""
|
||||||
|
|
@ -226,15 +224,15 @@ func check_errors(t *testing.T, m *dns.Msg, rcode int) {
|
||||||
t.Fatal(err, "\n", m)
|
t.Fatal(err, "\n", m)
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
if !reflect.DeepEqual(in.Question, m.Question) {
|
if !reflect.DeepEqual(in.Question, m.Question) {
|
||||||
t.Fatal(
|
t.Fatal(
|
||||||
"question section mismatch!",
|
"question section mismatch!",
|
||||||
"\nsent: ",
|
"\nsent: ",
|
||||||
m.Question,
|
m.Question,
|
||||||
"\nreceived: ",
|
"\nreceived: ",
|
||||||
in.Question,
|
in.Question,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
if in.Rcode != rcode {
|
if in.Rcode != rcode {
|
||||||
t.Fatal(
|
t.Fatal(
|
||||||
|
|
@ -281,7 +279,6 @@ func check_fails(t *testing.T, m *dns.Msg, error_contains string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func TestServer(t *testing.T) {
|
func TestServer(t *testing.T) {
|
||||||
// I guess I have to seed my own RNG like a caveman
|
// I guess I have to seed my own RNG like a caveman
|
||||||
rand.Seed(time.Now().UnixNano())
|
rand.Seed(time.Now().UnixNano())
|
||||||
|
|
@ -292,7 +289,7 @@ func TestServer(t *testing.T) {
|
||||||
tester := caddytest.NewTester(t)
|
tester := caddytest.NewTester(t)
|
||||||
tester.InitServer(dns_only, "caddyfile")
|
tester.InitServer(dns_only, "caddyfile")
|
||||||
|
|
||||||
records := []string {
|
records := []string{
|
||||||
"sub123.example.com. A 127.0.0.1",
|
"sub123.example.com. A 127.0.0.1",
|
||||||
"ABC123 AAAA ::",
|
"ABC123 AAAA ::",
|
||||||
"example.com. CAA 0 issue ca.example.net",
|
"example.com. CAA 0 issue ca.example.net",
|
||||||
|
|
@ -304,7 +301,6 @@ func TestServer(t *testing.T) {
|
||||||
"whitespace. TXT Test 123 ABC XYZ",
|
"whitespace. TXT Test 123 ABC XYZ",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for _, record := range records {
|
for _, record := range records {
|
||||||
check_exists(t, record)
|
check_exists(t, record)
|
||||||
/* WACKY-CASE QUERIES */
|
/* WACKY-CASE QUERIES */
|
||||||
|
|
@ -323,7 +319,6 @@ func TestServer(t *testing.T) {
|
||||||
chaos.Question[0].Qclass = dns.ClassCHAOS
|
chaos.Question[0].Qclass = dns.ClassCHAOS
|
||||||
check_errors(t, chaos, dns.RcodeNotImplemented)
|
check_errors(t, chaos, dns.RcodeNotImplemented)
|
||||||
|
|
||||||
|
|
||||||
/* IGNORE NON-QUESTIONS */
|
/* IGNORE NON-QUESTIONS */
|
||||||
question := new(dns.Msg)
|
question := new(dns.Msg)
|
||||||
question.SetQuestion("sub123.example.com.", dns.TypeA)
|
question.SetQuestion("sub123.example.com.", dns.TypeA)
|
||||||
|
|
@ -333,7 +328,6 @@ func TestServer(t *testing.T) {
|
||||||
not_a_question.Answer = []dns.RR{answer}
|
not_a_question.Answer = []dns.RR{answer}
|
||||||
check_fails(t, not_a_question, "timeout")
|
check_fails(t, not_a_question, "timeout")
|
||||||
|
|
||||||
|
|
||||||
/* REFUSE MULTI-QUESTIONS */
|
/* REFUSE MULTI-QUESTIONS */
|
||||||
multi := new(dns.Msg)
|
multi := new(dns.Msg)
|
||||||
multi.SetQuestion("example.com.", dns.TypeCNAME)
|
multi.SetQuestion("example.com.", dns.TypeCNAME)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue