From dff16f1d5a58f11953a29d7ad5420f421cfdd111 Mon Sep 17 00:00:00 2001 From: "coredns[bot]" Date: Mon, 10 Apr 2023 10:26:28 +0000 Subject: [PATCH] auto go fmt Signed-off-by: coredns[bot] --- core/dnsserver/register.go | 3 +- plugin/autopath/autopath.go | 6 ++-- plugin/azure/azure_test.go | 40 ++++++++++++------------ plugin/clouddns/clouddns_test.go | 36 +++++++++++----------- plugin/dnssec/black_lies.go | 2 ++ plugin/dnssec/black_lies_bitmap_test.go | 2 +- plugin/dnssec/black_lies_test.go | 4 +-- plugin/dnssec/dnssec_test.go | 4 +-- plugin/file/wildcard_test.go | 10 +++--- plugin/k8s_external/external.go | 1 - plugin/k8s_external/external_test.go | 2 +- plugin/kubernetes/external.go | 2 +- plugin/kubernetes/handler_test.go | 16 +++++----- plugin/metadata/provider.go | 41 ++++++++++++------------- plugin/pkg/fall/fall.go | 1 - plugin/pkg/tls/tls.go | 41 +++++++++++++------------ plugin/route53/route53.go | 5 +-- plugin/route53/route53_test.go | 36 +++++++++++----------- plugin/test/scrape.go | 1 - test/readme_test.go | 8 +++-- 20 files changed, 133 insertions(+), 128 deletions(-) diff --git a/core/dnsserver/register.go b/core/dnsserver/register.go index d64a3e7d0e1..bf0757a5bbc 100644 --- a/core/dnsserver/register.go +++ b/core/dnsserver/register.go @@ -207,7 +207,8 @@ func (c *Config) AddPlugin(m plugin.Plugin) { } // registerHandler adds a handler to a site's handler registration. Handlers -// use this to announce that they exist to other plugin. +// +// use this to announce that they exist to other plugin. func (c *Config) registerHandler(h plugin.Handler) { if c.registry == nil { c.registry = make(map[string]plugin.Handler) diff --git a/plugin/autopath/autopath.go b/plugin/autopath/autopath.go index e5675e87dd2..f6b3488e8b4 100644 --- a/plugin/autopath/autopath.go +++ b/plugin/autopath/autopath.go @@ -25,9 +25,9 @@ autopath.Func. Note the searchpath must be ending with the empty string. I.e: -func (m Plugins ) AutoPath(state request.Request) []string { - return []string{"first", "second", "last", ""} -} + func (m Plugins ) AutoPath(state request.Request) []string { + return []string{"first", "second", "last", ""} + } */ package autopath diff --git a/plugin/azure/azure_test.go b/plugin/azure/azure_test.go index d006f196bce..d308313a886 100644 --- a/plugin/azure/azure_test.go +++ b/plugin/azure/azure_test.go @@ -77,18 +77,18 @@ func TestAzure(t *testing.T) { expectedErr error }{ { - qname: "example.org.", - qtype: dns.TypeA, + qname: "example.org.", + qtype: dns.TypeA, wantAnswer: []string{"example.org. 300 IN A 1.2.3.4"}, }, { - qname: "example.org", - qtype: dns.TypeAAAA, + qname: "example.org", + qtype: dns.TypeAAAA, wantAnswer: []string{"example.org. 300 IN AAAA 2001:db8:85a3::8a2e:370:7334"}, }, { - qname: "example.org", - qtype: dns.TypeSOA, + qname: "example.org", + qtype: dns.TypeSOA, wantAnswer: []string{"org. 300 IN SOA ns1-06.azure-dns.com. azuredns-hostmaster.microsoft.com. 1 3600 300 2419200 300"}, }, { @@ -98,38 +98,38 @@ func TestAzure(t *testing.T) { wantMsgRCode: dns.RcodeServerFailure, }, { - qname: "example.gov", - qtype: dns.TypeA, + qname: "example.gov", + qtype: dns.TypeA, wantAnswer: []string{"example.gov. 300 IN A 2.4.6.8"}, }, { - qname: "example.org", - qtype: dns.TypeSRV, + qname: "example.org", + qtype: dns.TypeSRV, wantAnswer: []string{"example.org. 300 IN SRV 1 10 5269 srv-1.example.com.", "example.org. 300 IN SRV 1 10 5269 srv-2.example.com."}, }, { - qname: "cname.example.org.", - qtype: dns.TypeCNAME, + qname: "cname.example.org.", + qtype: dns.TypeCNAME, wantAnswer: []string{"cname.example.org. 300 IN CNAME example.org."}, }, { - qname: "cname.example.org.", - qtype: dns.TypeA, + qname: "cname.example.org.", + qtype: dns.TypeA, wantAnswer: []string{"cname.example.org. 300 IN CNAME example.org.", "example.org. 300 IN A 1.2.3.4"}, }, { - qname: "mail.example.org.", - qtype: dns.TypeMX, + qname: "mail.example.org.", + qtype: dns.TypeMX, wantAnswer: []string{"mail.example.org. 300 IN MX 10 mailserver.example.com."}, }, { - qname: "ptr.example.org.", - qtype: dns.TypePTR, + qname: "ptr.example.org.", + qtype: dns.TypePTR, wantAnswer: []string{"ptr.example.org. 300 IN PTR www.ptr-example.com."}, }, { - qname: "txt.example.org.", - qtype: dns.TypeTXT, + qname: "txt.example.org.", + qtype: dns.TypeTXT, wantAnswer: []string{"txt.example.org. 300 IN TXT \"TXT for example.org\""}, }, } diff --git a/plugin/clouddns/clouddns_test.go b/plugin/clouddns/clouddns_test.go index e052bf2563b..c378879a67d 100644 --- a/plugin/clouddns/clouddns_test.go +++ b/plugin/clouddns/clouddns_test.go @@ -174,20 +174,20 @@ func TestCloudDNS(t *testing.T) { }{ // 0. example.org A found - success. { - qname: "example.org", - qtype: dns.TypeA, + qname: "example.org", + qtype: dns.TypeA, wantAnswer: []string{"example.org. 300 IN A 1.2.3.4"}, }, // 1. example.org AAAA found - success. { - qname: "example.org", - qtype: dns.TypeAAAA, + qname: "example.org", + qtype: dns.TypeAAAA, wantAnswer: []string{"example.org. 300 IN AAAA 2001:db8:85a3::8a2e:370:7334"}, }, // 2. exampled.org PTR found - success. { - qname: "example.org", - qtype: dns.TypePTR, + qname: "example.org", + qtype: dns.TypePTR, wantAnswer: []string{"example.org. 300 IN PTR ptr.example.org."}, }, // 3. sample.example.org points to example.org CNAME. @@ -203,14 +203,14 @@ func TestCloudDNS(t *testing.T) { // 4. Explicit CNAME query for sample.example.org. // Query must return just CNAME. { - qname: "sample.example.org", - qtype: dns.TypeCNAME, + qname: "sample.example.org", + qtype: dns.TypeCNAME, wantAnswer: []string{"sample.example.org. 300 IN CNAME example.org."}, }, // 5. Explicit SOA query for example.org. { - qname: "example.org", - qtype: dns.TypeNS, + qname: "example.org", + qtype: dns.TypeNS, wantNS: []string{"org. 300 IN SOA ns-cloud-c1.googledomains.com. cloud-dns-hostmaster.google.com. 1 21600 300 259200 300"}, }, // 6. AAAA query for split-example.org must return NODATA. @@ -218,7 +218,7 @@ func TestCloudDNS(t *testing.T) { qname: "split-example.gov", qtype: dns.TypeAAAA, wantRetCode: dns.RcodeSuccess, - wantNS: []string{"org. 300 IN SOA ns-cloud-c1.googledomains.com. cloud-dns-hostmaster.google.com. 1 21600 300 259200 300"}, + wantNS: []string{"org. 300 IN SOA ns-cloud-c1.googledomains.com. cloud-dns-hostmaster.google.com. 1 21600 300 259200 300"}, }, // 7. Zone not configured. { @@ -233,24 +233,24 @@ func TestCloudDNS(t *testing.T) { qtype: dns.TypeA, wantRetCode: dns.RcodeSuccess, wantMsgRCode: dns.RcodeNameError, - wantNS: []string{"org. 300 IN SOA ns-cloud-c1.googledomains.com. cloud-dns-hostmaster.google.com. 1 21600 300 259200 300"}, + wantNS: []string{"org. 300 IN SOA ns-cloud-c1.googledomains.com. cloud-dns-hostmaster.google.com. 1 21600 300 259200 300"}, }, // 9. No record found. Fallthrough. { - qname: "example.gov", - qtype: dns.TypeA, + qname: "example.gov", + qtype: dns.TypeA, wantAnswer: []string{"example.gov. 300 IN A 2.4.6.8"}, }, // 10. other-zone.example.org is stored in a different hosted zone. success { - qname: "other-example.org", - qtype: dns.TypeA, + qname: "other-example.org", + qtype: dns.TypeA, wantAnswer: []string{"other-example.org. 300 IN A 3.5.7.9"}, }, // 11. split-example.org only has A record. Expect NODATA. { - qname: "split-example.org", - qtype: dns.TypeAAAA, + qname: "split-example.org", + qtype: dns.TypeAAAA, wantNS: []string{"org. 300 IN SOA ns-cloud-e1.googledomains.com. cloud-dns-hostmaster.google.com. 1 21600 300 259200 300"}, }, // 12. *.www.example.org is a wildcard CNAME to www.example.org. diff --git a/plugin/dnssec/black_lies.go b/plugin/dnssec/black_lies.go index 68fae22bb58..7c56f16a9ad 100644 --- a/plugin/dnssec/black_lies.go +++ b/plugin/dnssec/black_lies.go @@ -11,7 +11,9 @@ import ( // See https://tools.ietf.org/html/draft-valsorda-dnsop-black-lies-00 // For example, a request for the non-existing name a.example.com would // cause the following NSEC record to be generated: +// // a.example.com. 3600 IN NSEC \000.a.example.com. ( RRSIG NSEC ... ) +// // This inturn makes every NXDOMAIN answer a NODATA one, don't forget to flip // the header rcode to NOERROR. func (d Dnssec) nsec(state request.Request, mt response.Type, ttl, incep, expir uint32, server string) ([]dns.RR, error) { diff --git a/plugin/dnssec/black_lies_bitmap_test.go b/plugin/dnssec/black_lies_bitmap_test.go index a4a487fcd8b..ebc18997f72 100644 --- a/plugin/dnssec/black_lies_bitmap_test.go +++ b/plugin/dnssec/black_lies_bitmap_test.go @@ -59,6 +59,6 @@ func TestBlackLiesBitmapNameError(t *testing.T) { func testTLSAMsg() *dns.Msg { return &dns.Msg{MsgHdr: dns.MsgHdr{Rcode: dns.RcodeSuccess}, Question: []dns.Question{{Name: "25._tcp.example.org.", Qclass: dns.ClassINET, Qtype: dns.TypeTLSA}}, - Ns: []dns.RR{test.SOA("example.org. 1800 IN SOA linode.example.org. miek.example.org. 1461471181 14400 3600 604800 14400")}, + Ns: []dns.RR{test.SOA("example.org. 1800 IN SOA linode.example.org. miek.example.org. 1461471181 14400 3600 604800 14400")}, } } diff --git a/plugin/dnssec/black_lies_test.go b/plugin/dnssec/black_lies_test.go index a9a29029e2d..13e834a3e74 100644 --- a/plugin/dnssec/black_lies_test.go +++ b/plugin/dnssec/black_lies_test.go @@ -74,13 +74,13 @@ func TestBlackLiesNoError(t *testing.T) { func testNxdomainMsg() *dns.Msg { return &dns.Msg{MsgHdr: dns.MsgHdr{Rcode: dns.RcodeNameError}, Question: []dns.Question{{Name: "ww.miek.nl.", Qclass: dns.ClassINET, Qtype: dns.TypeTXT}}, - Ns: []dns.RR{test.SOA("miek.nl. 1800 IN SOA linode.atoom.net. miek.miek.nl. 1461471181 14400 3600 604800 14400")}, + Ns: []dns.RR{test.SOA("miek.nl. 1800 IN SOA linode.atoom.net. miek.miek.nl. 1461471181 14400 3600 604800 14400")}, } } func testSuccessMsg() *dns.Msg { return &dns.Msg{MsgHdr: dns.MsgHdr{Rcode: dns.RcodeSuccess}, Question: []dns.Question{{Name: "www.miek.nl.", Qclass: dns.ClassINET, Qtype: dns.TypeTXT}}, - Answer: []dns.RR{test.TXT(`www.miek.nl. 1800 IN TXT "response"`)}, + Answer: []dns.RR{test.TXT(`www.miek.nl. 1800 IN TXT "response"`)}, } } diff --git a/plugin/dnssec/dnssec_test.go b/plugin/dnssec/dnssec_test.go index fb8a128def0..4c57d97fcc1 100644 --- a/plugin/dnssec/dnssec_test.go +++ b/plugin/dnssec/dnssec_test.go @@ -137,13 +137,13 @@ func testMsg() *dns.Msg { // don't care about the message header return &dns.Msg{ Answer: []dns.RR{test.MX("miek.nl. 1703 IN MX 1 aspmx.l.google.com.")}, - Ns: []dns.RR{test.NS("miek.nl. 1703 IN NS omval.tednet.nl.")}, + Ns: []dns.RR{test.NS("miek.nl. 1703 IN NS omval.tednet.nl.")}, } } func testMsgEx() *dns.Msg { return &dns.Msg{ Answer: []dns.RR{test.MX("example.org. 1703 IN MX 1 aspmx.l.google.com.")}, - Ns: []dns.RR{test.NS("example.org. 1703 IN NS omval.tednet.nl.")}, + Ns: []dns.RR{test.NS("example.org. 1703 IN NS omval.tednet.nl.")}, } } diff --git a/plugin/file/wildcard_test.go b/plugin/file/wildcard_test.go index 894a088c139..fc6ad120c20 100644 --- a/plugin/file/wildcard_test.go +++ b/plugin/file/wildcard_test.go @@ -185,12 +185,12 @@ var apexWildcardTestCases = []test.Case{ { Qname: "foo.example.org.", Qtype: dns.TypeA, Answer: []dns.RR{test.A(`foo.example.org. 3600 IN A 127.0.0.54`)}, - Ns: []dns.RR{test.NS(`example.org. 3600 IN NS b.iana-servers.net.`)}, + Ns: []dns.RR{test.NS(`example.org. 3600 IN NS b.iana-servers.net.`)}, }, { Qname: "bar.example.org.", Qtype: dns.TypeA, Answer: []dns.RR{test.A(`bar.example.org. 3600 IN A 127.0.0.53`)}, - Ns: []dns.RR{test.NS(`example.org. 3600 IN NS b.iana-servers.net.`)}, + Ns: []dns.RR{test.NS(`example.org. 3600 IN NS b.iana-servers.net.`)}, }, } @@ -225,17 +225,17 @@ var multiWildcardTestCases = []test.Case{ { Qname: "foo.example.org.", Qtype: dns.TypeA, Answer: []dns.RR{test.A(`foo.example.org. 3600 IN A 127.0.0.54`)}, - Ns: []dns.RR{test.NS(`example.org. 3600 IN NS b.iana-servers.net.`)}, + Ns: []dns.RR{test.NS(`example.org. 3600 IN NS b.iana-servers.net.`)}, }, { Qname: "bar.example.org.", Qtype: dns.TypeA, Answer: []dns.RR{test.A(`bar.example.org. 3600 IN A 127.0.0.53`)}, - Ns: []dns.RR{test.NS(`example.org. 3600 IN NS b.iana-servers.net.`)}, + Ns: []dns.RR{test.NS(`example.org. 3600 IN NS b.iana-servers.net.`)}, }, { Qname: "bar.intern.example.org.", Qtype: dns.TypeA, Answer: []dns.RR{test.A(`bar.intern.example.org. 3600 IN A 127.0.1.52`)}, - Ns: []dns.RR{test.NS(`example.org. 3600 IN NS b.iana-servers.net.`)}, + Ns: []dns.RR{test.NS(`example.org. 3600 IN NS b.iana-servers.net.`)}, }, } diff --git a/plugin/k8s_external/external.go b/plugin/k8s_external/external.go index bbb844be7a6..9652beb5f06 100644 --- a/plugin/k8s_external/external.go +++ b/plugin/k8s_external/external.go @@ -7,7 +7,6 @@ NXDOMAIN depending on the state of the cluster. A plugin willing to provide these services must implement the Externaler interface, although it likely only makes sense for the *kubernetes* plugin. - */ package external diff --git a/plugin/k8s_external/external_test.go b/plugin/k8s_external/external_test.go index 22ef08cc1e1..f37afaed1ce 100644 --- a/plugin/k8s_external/external_test.go +++ b/plugin/k8s_external/external_test.go @@ -86,7 +86,7 @@ var tests = []test.Case{ { Qname: "svc1.testns.example.com.", Qtype: dns.TypeSRV, Rcode: dns.RcodeSuccess, Answer: []dns.RR{test.SRV("svc1.testns.example.com. 5 IN SRV 0 100 80 svc1.testns.example.com.")}, - Extra: []dns.RR{test.A("svc1.testns.example.com. 5 IN A 1.2.3.4")}, + Extra: []dns.RR{test.A("svc1.testns.example.com. 5 IN A 1.2.3.4")}, }, // SRV Service Not udp/tcp { diff --git a/plugin/kubernetes/external.go b/plugin/kubernetes/external.go index 702bdc30c13..12dbbf1e8de 100644 --- a/plugin/kubernetes/external.go +++ b/plugin/kubernetes/external.go @@ -123,7 +123,7 @@ func (k *Kubernetes) ExternalServices(zone string) (services []msg.Service) { return services } -//ExternalSerial returns the serial of the external zone +// ExternalSerial returns the serial of the external zone func (k *Kubernetes) ExternalSerial(string) uint32 { return uint32(k.APIConn.Modified(true)) } diff --git a/plugin/kubernetes/handler_test.go b/plugin/kubernetes/handler_test.go index ecf47887f0f..73ed5fd957c 100644 --- a/plugin/kubernetes/handler_test.go +++ b/plugin/kubernetes/handler_test.go @@ -39,21 +39,21 @@ var dnsTestCases = []kubeTestCase{ }}, {Case: test.Case{ Qname: "svc1.testns.svc.cluster.local.", Qtype: dns.TypeSRV, - Rcode: dns.RcodeSuccess, + Rcode: dns.RcodeSuccess, Answer: []dns.RR{test.SRV("svc1.testns.svc.cluster.local. 5 IN SRV 0 100 80 svc1.testns.svc.cluster.local.")}, - Extra: []dns.RR{test.A("svc1.testns.svc.cluster.local. 5 IN A 10.0.0.1")}, + Extra: []dns.RR{test.A("svc1.testns.svc.cluster.local. 5 IN A 10.0.0.1")}, }}, {Case: test.Case{ Qname: "svcempty.testns.svc.cluster.local.", Qtype: dns.TypeSRV, - Rcode: dns.RcodeSuccess, + Rcode: dns.RcodeSuccess, Answer: []dns.RR{test.SRV("svcempty.testns.svc.cluster.local. 5 IN SRV 0 100 80 svcempty.testns.svc.cluster.local.")}, - Extra: []dns.RR{test.A("svcempty.testns.svc.cluster.local. 5 IN A 10.0.0.1")}, + Extra: []dns.RR{test.A("svcempty.testns.svc.cluster.local. 5 IN A 10.0.0.1")}, }}, {Case: test.Case{ Qname: "svc6.testns.svc.cluster.local.", Qtype: dns.TypeSRV, - Rcode: dns.RcodeSuccess, + Rcode: dns.RcodeSuccess, Answer: []dns.RR{test.SRV("svc6.testns.svc.cluster.local. 5 IN SRV 0 100 80 svc6.testns.svc.cluster.local.")}, - Extra: []dns.RR{test.AAAA("svc6.testns.svc.cluster.local. 5 IN AAAA 1234:abcd::1")}, + Extra: []dns.RR{test.AAAA("svc6.testns.svc.cluster.local. 5 IN AAAA 1234:abcd::1")}, }}, // SRV Service {Case: test.Case{ @@ -163,7 +163,7 @@ var dnsTestCases = []kubeTestCase{ // AAAA {Case: test.Case{ Qname: "5678-abcd--2.hdls1.testns.svc.cluster.local", Qtype: dns.TypeAAAA, - Rcode: dns.RcodeSuccess, + Rcode: dns.RcodeSuccess, Answer: []dns.RR{test.AAAA("5678-abcd--2.hdls1.testns.svc.cluster.local. 5 IN AAAA 5678:abcd::2")}, }}, // CNAME External @@ -370,7 +370,7 @@ var dnsTestCases = []kubeTestCase{ }}, {Case: test.Case{ Qname: "svc-dual-stack.testns.svc.cluster.local.", Qtype: dns.TypeSRV, - Rcode: dns.RcodeSuccess, + Rcode: dns.RcodeSuccess, Answer: []dns.RR{test.SRV("svc-dual-stack.testns.svc.cluster.local. 5 IN SRV 0 50 80 svc-dual-stack.testns.svc.cluster.local.")}, Extra: []dns.RR{ test.A("svc-dual-stack.testns.svc.cluster.local. 5 IN A 10.0.0.3"), diff --git a/plugin/metadata/provider.go b/plugin/metadata/provider.go index e1bd7059015..2e88d58ea54 100644 --- a/plugin/metadata/provider.go +++ b/plugin/metadata/provider.go @@ -8,33 +8,32 @@ // // Implement the Provider interface for a plugin p: // -// func (p P) Metadata(ctx context.Context, state request.Request) context.Context { -// metadata.SetValueFunc(ctx, "test/something", func() string { return "myvalue" }) -// return ctx -// } +// func (p P) Metadata(ctx context.Context, state request.Request) context.Context { +// metadata.SetValueFunc(ctx, "test/something", func() string { return "myvalue" }) +// return ctx +// } // // Basic example with caching: // -// func (p P) Metadata(ctx context.Context, state request.Request) context.Context { -// cached := "" -// f := func() string { -// if cached != "" { -// return cached -// } -// cached = expensiveFunc() -// return cached -// } -// metadata.SetValueFunc(ctx, "test/something", f) -// return ctx -// } +// func (p P) Metadata(ctx context.Context, state request.Request) context.Context { +// cached := "" +// f := func() string { +// if cached != "" { +// return cached +// } +// cached = expensiveFunc() +// return cached +// } +// metadata.SetValueFunc(ctx, "test/something", f) +// return ctx +// } // // If you need access to this metadata from another plugin: // -// // ... -// valueFunc := metadata.ValueFunc(ctx, "test/something") -// value := valueFunc() -// // use 'value' -// +// // ... +// valueFunc := metadata.ValueFunc(ctx, "test/something") +// value := valueFunc() +// // use 'value' package metadata import ( diff --git a/plugin/pkg/fall/fall.go b/plugin/pkg/fall/fall.go index f819f99b61b..898c8db76b1 100644 --- a/plugin/pkg/fall/fall.go +++ b/plugin/pkg/fall/fall.go @@ -10,7 +10,6 @@ // See https://github.com/coredns/coredns/issues/2723 for some discussion on this, which includes this quote: // // TL;DR: `fallthrough` is indeed risky and hackish, but still a good feature of CoreDNS as it allows to quickly answer boring edge cases. -// package fall import ( diff --git a/plugin/pkg/tls/tls.go b/plugin/pkg/tls/tls.go index cba25503e00..41eff4bc0d7 100644 --- a/plugin/pkg/tls/tls.go +++ b/plugin/pkg/tls/tls.go @@ -31,28 +31,31 @@ func setTLSDefaults(ctls *tls.Config) { // in list of arguments. Typically these come straight from the // Corefile. // no args -// - creates a Config with no cert and using system CAs -// - use for a client that talks to a server with a public signed cert (CA installed in system) -// - the client will not be authenticated by the server since there is no cert +// - creates a Config with no cert and using system CAs +// - use for a client that talks to a server with a public signed cert (CA installed in system) +// - the client will not be authenticated by the server since there is no cert +// // one arg: the path to CA PEM file -// - creates a Config with no cert using a specific CA -// - use for a client that talks to a server with a private signed cert (CA not installed in system) -// - the client will not be authenticated by the server since there is no cert +// - creates a Config with no cert using a specific CA +// - use for a client that talks to a server with a private signed cert (CA not installed in system) +// - the client will not be authenticated by the server since there is no cert +// // two args: path to cert PEM file, the path to private key PEM file -// - creates a Config with a cert, using system CAs to validate the other end -// - use for: -// - a server; or, -// - a client that talks to a server with a public cert and needs certificate-based authentication -// - the other end will authenticate this end via the provided cert -// - the cert of the other end will be verified via system CAs +// - creates a Config with a cert, using system CAs to validate the other end +// - use for: +// - a server; or, +// - a client that talks to a server with a public cert and needs certificate-based authentication +// - the other end will authenticate this end via the provided cert +// - the cert of the other end will be verified via system CAs +// // three args: path to cert PEM file, path to client private key PEM file, path to CA PEM file -// - creates a Config with the cert, using specified CA to validate the other end -// - use for: -// - a server; or, -// - a client that talks to a server with a privately signed cert and needs certificate-based -// authentication -// - the other end will authenticate this end via the provided cert -// - this end will verify the other end's cert using the specified CA +// - creates a Config with the cert, using specified CA to validate the other end +// - use for: +// - a server; or, +// - a client that talks to a server with a privately signed cert and needs certificate-based +// authentication +// - the other end will authenticate this end via the provided cert +// - this end will verify the other end's cert using the specified CA func NewTLSConfigFromArgs(args ...string) (*tls.Config, error) { var err error var c *tls.Config diff --git a/plugin/route53/route53.go b/plugin/route53/route53.go index abe5a7d756d..9f7a2e59130 100644 --- a/plugin/route53/route53.go +++ b/plugin/route53/route53.go @@ -167,8 +167,9 @@ const escapeSeq = "\\" // for everything else. // // Example: -// `\\052.example.com.` -> `*.example.com` -// `\\137.example.com.` -> error ('_' is not valid) +// +// `\\052.example.com.` -> `*.example.com` +// `\\137.example.com.` -> error ('_' is not valid) func maybeUnescape(s string) (string, error) { var out string for { diff --git a/plugin/route53/route53_test.go b/plugin/route53/route53_test.go index 1e740361200..414a691bead 100644 --- a/plugin/route53/route53_test.go +++ b/plugin/route53/route53_test.go @@ -131,20 +131,20 @@ func TestRoute53(t *testing.T) { }{ // 0. example.org A found - success. { - qname: "example.org", - qtype: dns.TypeA, + qname: "example.org", + qtype: dns.TypeA, wantAnswer: []string{"example.org. 300 IN A 1.2.3.4"}, }, // 1. example.org AAAA found - success. { - qname: "example.org", - qtype: dns.TypeAAAA, + qname: "example.org", + qtype: dns.TypeAAAA, wantAnswer: []string{"example.org. 300 IN AAAA 2001:db8:85a3::8a2e:370:7334"}, }, // 2. exampled.org PTR found - success. { - qname: "example.org", - qtype: dns.TypePTR, + qname: "example.org", + qtype: dns.TypePTR, wantAnswer: []string{"example.org. 300 IN PTR ptr.example.org."}, }, // 3. sample.example.org points to example.org CNAME. @@ -160,14 +160,14 @@ func TestRoute53(t *testing.T) { // 4. Explicit CNAME query for sample.example.org. // Query must return just CNAME. { - qname: "sample.example.org", - qtype: dns.TypeCNAME, + qname: "sample.example.org", + qtype: dns.TypeCNAME, wantAnswer: []string{"sample.example.org. 300 IN CNAME example.org."}, }, // 5. Explicit SOA query for example.org. { - qname: "example.org", - qtype: dns.TypeNS, + qname: "example.org", + qtype: dns.TypeNS, wantNS: []string{"org. 300 IN SOA ns-1536.awsdns-00.co.uk. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400"}, }, // 6. AAAA query for split-example.org must return NODATA. @@ -175,7 +175,7 @@ func TestRoute53(t *testing.T) { qname: "split-example.gov", qtype: dns.TypeAAAA, wantRetCode: dns.RcodeSuccess, - wantNS: []string{"org. 300 IN SOA ns-1536.awsdns-00.co.uk. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400"}, + wantNS: []string{"org. 300 IN SOA ns-1536.awsdns-00.co.uk. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400"}, }, // 7. Zone not configured. { @@ -190,24 +190,24 @@ func TestRoute53(t *testing.T) { qtype: dns.TypeA, wantRetCode: dns.RcodeSuccess, wantMsgRCode: dns.RcodeNameError, - wantNS: []string{"org. 300 IN SOA ns-1536.awsdns-00.co.uk. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400"}, + wantNS: []string{"org. 300 IN SOA ns-1536.awsdns-00.co.uk. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400"}, }, // 9. No record found. Fallthrough. { - qname: "example.gov", - qtype: dns.TypeA, + qname: "example.gov", + qtype: dns.TypeA, wantAnswer: []string{"example.gov. 300 IN A 2.4.6.8"}, }, // 10. other-zone.example.org is stored in a different hosted zone. success { - qname: "other-example.org", - qtype: dns.TypeA, + qname: "other-example.org", + qtype: dns.TypeA, wantAnswer: []string{"other-example.org. 300 IN A 3.5.7.9"}, }, // 11. split-example.org only has A record. Expect NODATA. { - qname: "split-example.org", - qtype: dns.TypeAAAA, + qname: "split-example.org", + qtype: dns.TypeAAAA, wantNS: []string{"org. 300 IN SOA ns-15.awsdns-00.co.uk. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400"}, }, // 12. *.www.example.org is a wildcard CNAME to www.example.org. diff --git a/plugin/test/scrape.go b/plugin/test/scrape.go index 7847e39d460..e0eb0573872 100644 --- a/plugin/test/scrape.go +++ b/plugin/test/scrape.go @@ -19,7 +19,6 @@ // // result := Scrape("http://localhost:9153/metrics") // v := MetricValue("coredns_cache_capacity", result) -// package test import ( diff --git a/test/readme_test.go b/test/readme_test.go index 4012a2154ad..b02fe0ebc1f 100644 --- a/test/readme_test.go +++ b/test/readme_test.go @@ -35,9 +35,11 @@ PrivateKey: f03VplaIEA+KHI9uizlemUSbUJH86hPBPjmcUninPoM= // actually works. Each corefile snippet is only used if the language is set to 'corefile': // // ~~~ corefile -// . { -// # check-this-please -// } +// +// . { +// # check-this-please +// } +// // ~~~ // // While we're at it - we also check the README.md itself. It should at least have the sections: