Skip to content

Commit

Permalink
fix: Fix DNS round robin response (#39)
Browse files Browse the repository at this point in the history
* Fix DNS round robin response

* Remove debug print

* Improve tests to catch this bug
  • Loading branch information
nt0xa authored Jul 17, 2020
1 parent 55c2738 commit ba7d3e1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/handlers/dnsx/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (h *DNSX) handleFunc(w dns.ResponseWriter, r *dns.Msg) {

case models.DNSStrategyRoundRobin:
if rec.LastAnswer != nil {
msg.Answer = rotate(rec.LastAnswerRRs(h.origin))
msg.Answer = rotate(rec.LastAnswerRRs(origin))
} else {
msg.Answer = rec.RRs(origin)
}
Expand Down
1 change: 1 addition & 0 deletions internal/handlers/dnsx/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ func TestDNSMgr(t *testing.T) {

for j, a := range in.Answer {
assert.Contains(t, a.String(), tt.results[i][j])
assert.Equal(t, a.Header().Name, tt.name)
}
}
})
Expand Down

0 comments on commit ba7d3e1

Please sign in to comment.