diff options
author | 2018-07-02 15:39:50 +0100 | |
---|---|---|
committer | 2018-07-02 07:39:50 -0700 | |
commit | 6dd2cf8c4b30822f1d718fbef728f6856628a3df (patch) | |
tree | fce20dc6ee9a9400130c0c82292ba470be82fe7b /plugin/rewrite/rewrite_test.go | |
parent | 1abecf99d97270075731b9f7cc01c9e2b687d570 (diff) | |
download | coredns-6dd2cf8c4b30822f1d718fbef728f6856628a3df.tar.gz coredns-6dd2cf8c4b30822f1d718fbef728f6856628a3df.tar.zst coredns-6dd2cf8c4b30822f1d718fbef728f6856628a3df.zip |
plugin/rewrite: use request.Request and other cleanups (#1920)
This was done anyway, but only deep in the functions, just do this
everywhere; allows for shorter code and request.Request allows for
caching as well.
Cleanups, make it more Go like.
* remove unneeded switches
* remove testdir (why was this there??)
* simplify the logic
* remove unneeded variables
* put short functions on a single line
* fix documentation.
* spin off wire funcs in wire.go, make them functions.
Signed-off-by: Miek Gieben <miek@miek.nl>
Diffstat (limited to 'plugin/rewrite/rewrite_test.go')
-rw-r--r-- | plugin/rewrite/rewrite_test.go | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/plugin/rewrite/rewrite_test.go b/plugin/rewrite/rewrite_test.go index 56c446f49..d67f8d0bf 100644 --- a/plugin/rewrite/rewrite_test.go +++ b/plugin/rewrite/rewrite_test.go @@ -482,14 +482,14 @@ func TestRewriteEDNS0LocalVariable(t *testing.T) { }, { []dns.EDNS0{}, - []string{"local", "set", "0xffee", "{server_ip}"}, - []dns.EDNS0{&dns.EDNS0_LOCAL{Code: 0xffee, Data: []byte{0x7F, 0x00, 0x00, 0x01}}}, + []string{"local", "set", "0xffee", "{server_port}"}, + []dns.EDNS0{&dns.EDNS0_LOCAL{Code: 0xffee, Data: []byte{0x00, 0x35}}}, true, }, { []dns.EDNS0{}, - []string{"local", "set", "0xffee", "{server_port}"}, - []dns.EDNS0{&dns.EDNS0_LOCAL{Code: 0xffee, Data: []byte{0x00, 0x35}}}, + []string{"local", "set", "0xffee", "{server_ip}"}, + []dns.EDNS0{&dns.EDNS0_LOCAL{Code: 0xffee, Data: []byte{0x7F, 0x00, 0x00, 0x01}}}, true, }, } @@ -498,7 +498,6 @@ func TestRewriteEDNS0LocalVariable(t *testing.T) { for i, tc := range tests { m := new(dns.Msg) m.SetQuestion("example.com.", dns.TypeA) - m.Question[0].Qclass = dns.ClassINET r, err := newEdns0Rule("stop", tc.args...) if err != nil { @@ -620,7 +619,6 @@ func TestRewriteEDNS0Subnet(t *testing.T) { for i, tc := range tests { m := new(dns.Msg) m.SetQuestion("example.com.", dns.TypeA) - m.Question[0].Qclass = dns.ClassINET r, err := newEdns0Rule("stop", tc.args...) if err != nil { |