mirror of
https://github.com/coredns/coredns.git
synced 2025-11-02 10:13:14 -05:00
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>
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user