Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
Coredns
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Railgun
Coredns
Commits
1a7f0dea
Commit
1a7f0dea
authored
Mar 22, 2016
by
Miek Gieben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More cleanup - needs to think a little about NewSOA()
parent
22dade9e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
136 additions
and
112 deletions
+136
-112
middleware/etcd/etcd.go
middleware/etcd/etcd.go
+8
-0
middleware/etcd/handler.go
middleware/etcd/handler.go
+44
-75
middleware/etcd/lookup.go
middleware/etcd/lookup.go
+83
-25
middleware/etcd/msg/service.go
middleware/etcd/msg/service.go
+0
-10
middleware/proxy/lookup_test.go
middleware/proxy/lookup_test.go
+1
-2
No files found.
middleware/etcd/etcd.go
View file @
1a7f0dea
...
@@ -147,6 +147,14 @@ func (g Etcd) Ttl(node *etcdc.Node, serv *msg.Service) uint32 {
...
@@ -147,6 +147,14 @@ func (g Etcd) Ttl(node *etcdc.Node, serv *msg.Service) uint32 {
return
serv
.
Ttl
return
serv
.
Ttl
}
}
// etcNameError checks if the error is ErrorCodeKeyNotFound from etcd.
func
isEtcdNameError
(
err
error
)
bool
{
if
e
,
ok
:=
err
.
(
etcdc
.
Error
);
ok
&&
e
.
Code
==
etcdc
.
ErrorCodeKeyNotFound
{
return
true
}
return
false
}
const
(
const
(
priority
=
10
// default priority when nothing is set
priority
=
10
// default priority when nothing is set
ttl
=
300
// default ttl when nothing is set
ttl
=
300
// default ttl when nothing is set
...
...
middleware/etcd/handler.go
View file @
1a7f0dea
...
@@ -16,90 +16,59 @@ func (e Etcd) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (i
...
@@ -16,90 +16,59 @@ func (e Etcd) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (i
m
.
RecursionAvailable
=
true
m
.
RecursionAvailable
=
true
m
.
Compress
=
true
m
.
Compress
=
true
return
0
,
nil
// TODO(miek): get current zone when serving multiple
}
zone
:=
"."
// only needs state and current zone name we are auth for.
/*
func (s *server) ServeDNS(w dns.ResponseWriter, req *dns.Msg) {
q := req.Question[0]
switch
state
.
Type
()
{
name := strings.ToLower(q.Name)
case
"A"
:
records
,
err
:=
e
.
A
(
zone
,
state
,
nil
)
switch q.Qtype {
case
"AAAA"
:
case dns.TypeNS:
records
,
err
:=
e
.
AAAA
(
zone
,
state
,
nil
)
records, extra, err := s.NSRecords(q, s.config.dnsDomain)
fallthrough
if isEtcdNameError(err, s) {
case
"TXT"
:
m = s.NameError(req)
records
,
err
:=
e
.
TXT
(
zone
,
state
)
return
fallthrough
}
case
"CNAME"
:
m.Answer = append(m.Answer, records...)
records
,
err
:=
e
.
CNAME
(
zone
,
state
)
m.Extra = append(m.Extra, extra...)
fallthrough
case dns.TypeA, dns.TypeAAAA:
case
"MX"
:
records, err := s.AddressRecords(q, name, nil, bufsize, dnssec, false)
records
,
extra
,
err
:=
e
.
MX
(
zone
,
state
)
if isEtcdNameError(err, s) {
fallthrough
m = s.NameError(req)
case
"SRV"
:
return
records
,
extra
,
err
:=
e
.
SRV
(
zone
,
state
)
if
isEtcdNameError
(
err
)
{
NameError
(
zone
,
state
)
return
dns
.
RcodeNameError
,
nil
}
}
m.Answer = append(m.Answer, records...)
case dns.TypeTXT:
records, err := s.TXTRecords(q, name)
if isEtcdNameError(err, s) {
m = s.NameError(req)
return
}
m.Answer = append(m.Answer, records...)
case dns.TypeCNAME:
records, err := s.CNAMERecords(q, name)
if isEtcdNameError(err, s) {
m = s.NameError(req)
return
}
m.Answer = append(m.Answer, records...)
case dns.TypeMX:
records, extra, err := s.MXRecords(q, name, bufsize, dnssec)
if isEtcdNameError(err, s) {
m = s.NameError(req)
return
}
m.Answer = append(m.Answer, records...)
m.Extra = append(m.Extra, extra...)
default:
fallthrough // also catch other types, so that they return NODATA
case dns.TypeSRV:
records, extra, err := s.SRVRecords(q, name, bufsize, dnssec)
if
err
!=
nil
{
if
err
!=
nil
{
if isEtcdNameError(err, s) {
// TODO(miek): err or nil in this case?
m = s.NameError(req)
return
dns
.
RcodeServerFailure
,
err
return
}
logf("got error from backend: %s", err)
if q.Qtype == dns.TypeSRV { // Otherwise NODATA
m = s.ServerFailure(req)
return
}
}
}
// if we are here again, check the types, because an answer may only
if
len
(
records
)
>
0
{
// be given for SRV. All other types should return NODATA, the
// NXDOMAIN part is handled in the above code. TODO(miek): yes this
// can be done in a more elegant manor.
if q.Qtype == dns.TypeSRV {
m
.
Answer
=
append
(
m
.
Answer
,
records
...
)
m
.
Answer
=
append
(
m
.
Answer
,
records
...
)
}
if
len
(
extra
)
>
0
{
m
.
Extra
=
append
(
m
.
Extra
,
extra
...
)
m
.
Extra
=
append
(
m
.
Extra
,
extra
...
)
}
}
default
:
// Nodata response
// also catch other types, so that they return NODATA
}
}
return
e
.
Next
.
ServeDNS
(
ctx
,
w
,
r
)
}
if len(m.Answer) == 0 { // NODATA response
// NameError writes a name error to the client.
m.Ns = []dns.RR{s.NewSOA()}
func
NameError
(
zone
string
,
state
middleware
.
State
)
{
m.Ns[0].Header().Ttl = s.config.MinTtl
m
:=
new
(
dns
.
Msg
)
}
m
.
SetRcode
(
state
.
Req
,
dns
.
RcodeNameError
)
m
.
Ns
=
[]
dns
.
RR
{
NewSOA
()}
m
.
Ns
[
0
]
.
Header
()
.
Ttl
=
minTtl
state
.
W
.
WriteMsg
(
m
)
}
}
// etcNameError checks if the error is ErrorCodeKeyNotFound from etcd.
// NoData write a nodata response to the client.
func isEtcdNameError(err error, s *server) bool {
func
NoData
(
zone
string
,
state
middleware
.
State
)
{
if e, ok := err.(etcd.Error); ok && e.Code == etcd.ErrorCodeKeyNotFound {
// TODO(miek): write it
return true
}
return false
}
}
*/
middleware/etcd/lookup.go
View file @
1a7f0dea
...
@@ -11,8 +11,70 @@ import (
...
@@ -11,8 +11,70 @@ import (
)
)
// need current zone argument.
// need current zone argument.
func
(
e
Etcd
)
A
(
zone
string
,
state
middleware
.
State
,
previousRecords
[]
dns
.
RR
)
(
records
[]
dns
.
RR
,
err
error
)
{
services
,
err
:=
e
.
Records
(
state
.
Name
(),
false
)
if
err
!=
nil
{
return
nil
,
err
}
services
=
msg
.
Group
(
services
)
for
_
,
serv
:=
range
services
{
ip
:=
net
.
ParseIP
(
serv
.
Host
)
switch
{
case
ip
==
nil
:
// Try to resolve as CNAME if it's not an IP, but only if we don't create loops.
// TODO(miek): lowercasing, use Match in middleware/
if
state
.
Name
()
==
dns
.
Fqdn
(
serv
.
Host
)
{
// x CNAME x is a direct loop, don't add those
continue
}
newRecord
:=
serv
.
NewCNAME
(
state
.
QName
(),
dns
.
Fqdn
(
serv
.
Host
))
if
len
(
previousRecords
)
>
7
{
// don't add it, and just continue
continue
}
if
isDuplicateCNAME
(
newRecord
,
previousRecords
)
{
continue
}
state1
:=
copyState
(
state
,
serv
.
Host
,
state
.
QType
())
nextRecords
,
err
:=
e
.
A
(
zone
,
state1
,
append
(
previousRecords
,
newRecord
))
if
err
==
nil
{
// Not only have we found something we should add the CNAME and the IP addresses.
if
len
(
nextRecords
)
>
0
{
// TODO(miek): sorting here?
records
=
append
(
records
,
newRecord
)
records
=
append
(
records
,
nextRecords
...
)
}
continue
}
// This means we can not complete the CNAME, try to look else where.
target
:=
newRecord
.
Target
if
dns
.
IsSubDomain
(
zone
,
target
)
{
// We should already have found it
continue
}
m1
,
e1
:=
e
.
Proxy
.
Lookup
(
state
,
target
,
state
.
QType
())
if
e1
!=
nil
{
continue
}
// Len(m1.Answer) > 0 here is well?
records
=
append
(
records
,
newRecord
)
records
=
append
(
records
,
m1
.
Answer
...
)
continue
case
ip
.
To4
()
!=
nil
:
records
=
append
(
records
,
serv
.
NewA
(
state
.
QName
(),
ip
.
To4
()))
case
ip
.
To4
()
==
nil
:
// noda?
}
}
return
records
,
nil
}
func
(
e
Etcd
)
A
ddressRecords
(
zone
string
,
state
middleware
.
State
,
previousRecords
[]
dns
.
RR
)
(
records
[]
dns
.
RR
,
err
error
)
{
func
(
e
Etcd
)
A
AAA
(
zone
string
,
state
middleware
.
State
,
previousRecords
[]
dns
.
RR
)
(
records
[]
dns
.
RR
,
err
error
)
{
services
,
err
:=
e
.
Records
(
state
.
Name
(),
false
)
services
,
err
:=
e
.
Records
(
state
.
Name
(),
false
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
@@ -41,11 +103,12 @@ func (e Etcd) AddressRecords(zone string, state middleware.State, previousRecord
...
@@ -41,11 +103,12 @@ func (e Etcd) AddressRecords(zone string, state middleware.State, previousRecord
}
}
state1
:=
copyState
(
state
,
serv
.
Host
,
state
.
QType
())
state1
:=
copyState
(
state
,
serv
.
Host
,
state
.
QType
())
nextRecords
,
err
:=
e
.
A
ddressRecords
(
zone
,
state1
,
append
(
previousRecords
,
newRecord
))
nextRecords
,
err
:=
e
.
A
AAA
(
zone
,
state1
,
append
(
previousRecords
,
newRecord
))
if
err
==
nil
{
if
err
==
nil
{
//
O
nly have we found something we should add the CNAME and the IP addresses.
//
Not o
nly have we found something we should add the CNAME and the IP addresses.
if
len
(
nextRecords
)
>
0
{
if
len
(
nextRecords
)
>
0
{
// TODO(miek): sorting here?
records
=
append
(
records
,
newRecord
)
records
=
append
(
records
,
newRecord
)
records
=
append
(
records
,
nextRecords
...
)
records
=
append
(
records
,
nextRecords
...
)
}
}
...
@@ -66,18 +129,18 @@ func (e Etcd) AddressRecords(zone string, state middleware.State, previousRecord
...
@@ -66,18 +129,18 @@ func (e Etcd) AddressRecords(zone string, state middleware.State, previousRecord
records
=
append
(
records
,
m1
.
Answer
...
)
records
=
append
(
records
,
m1
.
Answer
...
)
continue
continue
// both here again
// both here again
case
ip
.
To4
()
!=
nil
&&
(
state
.
QType
()
==
dns
.
TypeA
)
:
case
ip
.
To4
()
!=
nil
:
records
=
append
(
records
,
serv
.
NewA
(
state
.
QName
(),
ip
.
To4
()))
// nada?
case
ip
.
To4
()
==
nil
&&
(
state
.
QType
()
==
dns
.
TypeAAAA
)
:
case
ip
.
To4
()
==
nil
:
records
=
append
(
records
,
serv
.
NewAAAA
(
state
.
QName
(),
ip
.
To16
()))
records
=
append
(
records
,
serv
.
NewAAAA
(
state
.
QName
(),
ip
.
To16
()))
}
}
}
}
return
records
,
nil
return
records
,
nil
}
}
// SRV
Records
returns SRV records from etcd.
// SRV returns SRV records from etcd.
// If the Target is not a name but an IP address, a name is created on the fly.
// If the Target is not a name but an IP address, a name is created on the fly.
func
(
e
Etcd
)
SRV
Records
(
zone
string
,
state
middleware
.
State
)
(
records
[]
dns
.
RR
,
extra
[]
dns
.
RR
,
err
error
)
{
func
(
e
Etcd
)
SRV
(
zone
string
,
state
middleware
.
State
)
(
records
[]
dns
.
RR
,
extra
[]
dns
.
RR
,
err
error
)
{
services
,
err
:=
e
.
Records
(
state
.
Name
(),
false
)
services
,
err
:=
e
.
Records
(
state
.
Name
(),
false
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
nil
,
err
...
@@ -140,10 +203,11 @@ func (e Etcd) SRVRecords(zone string, state middleware.State) (records []dns.RR,
...
@@ -140,10 +203,11 @@ func (e Etcd) SRVRecords(zone string, state middleware.State) (records []dns.RR,
// view.
// view.
state1
:=
copyState
(
state
,
srv
.
Target
,
dns
.
TypeA
)
state1
:=
copyState
(
state
,
srv
.
Target
,
dns
.
TypeA
)
// TODO(both is true here!
// TODO(both is true here!
addr
,
e1
:=
e
.
A
ddressRecords
(
zone
,
state1
,
nil
)
addr
,
e1
:=
e
.
A
(
zone
,
state1
,
nil
)
if
e1
==
nil
{
if
e1
==
nil
{
extra
=
append
(
extra
,
addr
...
)
extra
=
append
(
extra
,
addr
...
)
}
}
// e.AAA(zone, state1, nil) as well...
case
ip
.
To4
()
!=
nil
:
case
ip
.
To4
()
!=
nil
:
serv
.
Host
=
e
.
Domain
(
serv
.
Key
)
serv
.
Host
=
e
.
Domain
(
serv
.
Key
)
srv
:=
serv
.
NewSRV
(
state
.
QName
(),
weight
)
srv
:=
serv
.
NewSRV
(
state
.
QName
(),
weight
)
...
@@ -161,9 +225,9 @@ func (e Etcd) SRVRecords(zone string, state middleware.State) (records []dns.RR,
...
@@ -161,9 +225,9 @@ func (e Etcd) SRVRecords(zone string, state middleware.State) (records []dns.RR,
return
records
,
extra
,
nil
return
records
,
extra
,
nil
}
}
// MX
Records
returns MX records from etcd.
// MX returns MX records from etcd.
// If the Target is not a name but an IP address, a name is created on the fly.
// If the Target is not a name but an IP address, a name is created on the fly.
func
(
e
Etcd
)
MX
Records
(
zone
string
,
state
middleware
.
State
)
(
records
[]
dns
.
RR
,
extra
[]
dns
.
RR
,
err
error
)
{
func
(
e
Etcd
)
MX
(
zone
string
,
state
middleware
.
State
)
(
records
[]
dns
.
RR
,
extra
[]
dns
.
RR
,
err
error
)
{
services
,
err
:=
e
.
Records
(
state
.
Name
(),
false
)
services
,
err
:=
e
.
Records
(
state
.
Name
(),
false
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
nil
,
err
...
@@ -204,10 +268,11 @@ func (e Etcd) MXRecords(zone string, state middleware.State) (records []dns.RR,
...
@@ -204,10 +268,11 @@ func (e Etcd) MXRecords(zone string, state middleware.State) (records []dns.RR,
// Internal name
// Internal name
// both is true here as well
// both is true here as well
state1
:=
copyState
(
state
,
mx
.
Mx
,
dns
.
TypeA
)
state1
:=
copyState
(
state
,
mx
.
Mx
,
dns
.
TypeA
)
addr
,
e1
:=
e
.
A
ddressRecords
(
zone
,
state1
,
nil
)
addr
,
e1
:=
e
.
A
(
zone
,
state1
,
nil
)
if
e1
==
nil
{
if
e1
==
nil
{
extra
=
append
(
extra
,
addr
...
)
extra
=
append
(
extra
,
addr
...
)
}
}
// e.AAAA as well
case
ip
.
To4
()
!=
nil
:
case
ip
.
To4
()
!=
nil
:
serv
.
Host
=
e
.
Domain
(
serv
.
Key
)
serv
.
Host
=
e
.
Domain
(
serv
.
Key
)
records
=
append
(
records
,
serv
.
NewMX
(
state
.
QName
()))
records
=
append
(
records
,
serv
.
NewMX
(
state
.
QName
()))
...
@@ -221,7 +286,7 @@ func (e Etcd) MXRecords(zone string, state middleware.State) (records []dns.RR,
...
@@ -221,7 +286,7 @@ func (e Etcd) MXRecords(zone string, state middleware.State) (records []dns.RR,
return
records
,
extra
,
nil
return
records
,
extra
,
nil
}
}
func
(
e
Etcd
)
CNAME
Records
(
zone
string
,
state
middleware
.
State
)
(
records
[]
dns
.
RR
,
err
error
)
{
func
(
e
Etcd
)
CNAME
(
zone
string
,
state
middleware
.
State
)
(
records
[]
dns
.
RR
,
err
error
)
{
services
,
err
:=
e
.
Records
(
state
.
Name
(),
true
)
services
,
err
:=
e
.
Records
(
state
.
Name
(),
true
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
@@ -238,7 +303,7 @@ func (e Etcd) CNAMERecords(zone string, state middleware.State) (records []dns.R
...
@@ -238,7 +303,7 @@ func (e Etcd) CNAMERecords(zone string, state middleware.State) (records []dns.R
return
records
,
nil
return
records
,
nil
}
}
func
(
e
Etcd
)
TXT
Records
(
zone
string
,
state
middleware
.
State
)
(
records
[]
dns
.
RR
,
err
error
)
{
func
(
e
Etcd
)
TXT
(
zone
string
,
state
middleware
.
State
)
(
records
[]
dns
.
RR
,
err
error
)
{
services
,
err
:=
e
.
Records
(
state
.
Name
(),
false
)
services
,
err
:=
e
.
Records
(
state
.
Name
(),
false
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
@@ -255,6 +320,10 @@ func (e Etcd) TXTRecords(zone string, state middleware.State) (records []dns.RR,
...
@@ -255,6 +320,10 @@ func (e Etcd) TXTRecords(zone string, state middleware.State) (records []dns.RR,
return
records
,
nil
return
records
,
nil
}
}
func
(
e
Etcd
)
SOA
(
zone
string
,
state
middleware
.
State
)
*
dns
.
SOA
{
return
nil
}
func
isDuplicateCNAME
(
r
*
dns
.
CNAME
,
records
[]
dns
.
RR
)
bool
{
func
isDuplicateCNAME
(
r
*
dns
.
CNAME
,
records
[]
dns
.
RR
)
bool
{
for
_
,
rec
:=
range
records
{
for
_
,
rec
:=
range
records
{
if
v
,
ok
:=
rec
.
(
*
dns
.
CNAME
);
ok
{
if
v
,
ok
:=
rec
.
(
*
dns
.
CNAME
);
ok
{
...
@@ -271,14 +340,3 @@ func copyState(state middleware.State, target string, typ uint16) middleware.Sta
...
@@ -271,14 +340,3 @@ func copyState(state middleware.State, target string, typ uint16) middleware.Sta
state1
.
Req
.
Question
[
0
]
=
dns
.
Question
{
dns
.
Fqdn
(
target
),
dns
.
ClassINET
,
typ
}
state1
.
Req
.
Question
[
0
]
=
dns
.
Question
{
dns
.
Fqdn
(
target
),
dns
.
ClassINET
,
typ
}
return
state1
return
state1
}
}
/*
// Move to state.go somehow?
func (s *server) NameError(req *dns.Msg) *dns.Msg {
m := new(dns.Msg)
m.SetRcode(req, dns.RcodeNameError)
m.Ns = []dns.RR{s.NewSOA()}
m.Ns[0].Header().Ttl = s.config.MinTtl
return m
}
*/
middleware/etcd/msg/service.go
View file @
1a7f0dea
...
@@ -66,21 +66,11 @@ func (s *Service) NewCNAME(name string, target string) *dns.CNAME {
...
@@ -66,21 +66,11 @@ func (s *Service) NewCNAME(name string, target string) *dns.CNAME {
return
&
dns
.
CNAME
{
Hdr
:
dns
.
RR_Header
{
Name
:
name
,
Rrtype
:
dns
.
TypeCNAME
,
Class
:
dns
.
ClassINET
,
Ttl
:
s
.
Ttl
},
Target
:
target
}
return
&
dns
.
CNAME
{
Hdr
:
dns
.
RR_Header
{
Name
:
name
,
Rrtype
:
dns
.
TypeCNAME
,
Class
:
dns
.
ClassINET
,
Ttl
:
s
.
Ttl
},
Target
:
target
}
}
}
// NewNS returns a new NS record based on the Service.
func
(
s
*
Service
)
NewNS
(
name
string
,
target
string
)
*
dns
.
NS
{
return
&
dns
.
NS
{
Hdr
:
dns
.
RR_Header
{
Name
:
name
,
Rrtype
:
dns
.
TypeNS
,
Class
:
dns
.
ClassINET
,
Ttl
:
s
.
Ttl
},
Ns
:
target
}
}
// NewTXT returns a new TXT record based on the Service.
// NewTXT returns a new TXT record based on the Service.
func
(
s
*
Service
)
NewTXT
(
name
string
)
*
dns
.
TXT
{
func
(
s
*
Service
)
NewTXT
(
name
string
)
*
dns
.
TXT
{
return
&
dns
.
TXT
{
Hdr
:
dns
.
RR_Header
{
Name
:
name
,
Rrtype
:
dns
.
TypeTXT
,
Class
:
dns
.
ClassINET
,
Ttl
:
s
.
Ttl
},
Txt
:
split255
(
s
.
Text
)}
return
&
dns
.
TXT
{
Hdr
:
dns
.
RR_Header
{
Name
:
name
,
Rrtype
:
dns
.
TypeTXT
,
Class
:
dns
.
ClassINET
,
Ttl
:
s
.
Ttl
},
Txt
:
split255
(
s
.
Text
)}
}
}
// NewPTR returns a new PTR record based on the Service.
func
(
s
*
Service
)
NewPTR
(
name
string
,
ttl
uint32
)
*
dns
.
PTR
{
return
&
dns
.
PTR
{
Hdr
:
dns
.
RR_Header
{
Name
:
name
,
Rrtype
:
dns
.
TypePTR
,
Class
:
dns
.
ClassINET
,
Ttl
:
ttl
},
Ptr
:
dns
.
Fqdn
(
s
.
Host
)}
}
// Group checks the services in sx, it looks for a Group attribute on the shortest
// Group checks the services in sx, it looks for a Group attribute on the shortest
// keys. If there are multiple shortest keys *and* the group attribute disagrees (and
// keys. If there are multiple shortest keys *and* the group attribute disagrees (and
// is not empty), we don't consider it a group.
// is not empty), we don't consider it a group.
...
...
middleware/proxy/lookup_test.go
View file @
1a7f0dea
...
@@ -16,8 +16,7 @@ func TestLookupProxy(t *testing.T) {
...
@@ -16,8 +16,7 @@ func TestLookupProxy(t *testing.T) {
defer
log
.
SetOutput
(
os
.
Stderr
)
defer
log
.
SetOutput
(
os
.
Stderr
)
p
:=
New
([]
string
{
"8.8.8.8:53"
})
p
:=
New
([]
string
{
"8.8.8.8:53"
})
fakestate
:=
fakeState
()
resp
,
err
:=
p
.
Lookup
(
fakeState
(),
"example.org."
,
dns
.
TypeA
)
resp
,
err
:=
p
.
Lookup
(
fakestate
,
"example.org."
,
dns
.
TypeA
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
(
"Expected to receive reply, but didn't"
)
t
.
Error
(
"Expected to receive reply, but didn't"
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment