Skip to content

Commit

Permalink
Fix ResponseMessage nil bug
Browse files Browse the repository at this point in the history
  • Loading branch information
shawn1m committed Jan 2, 2019
1 parent afefc6b commit a0a7af5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions core/inbound/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,14 @@ func (s *Server) ServeDNS(w dns.ResponseWriter, q *dns.Msg) {

cb := d.ActiveClientBundle

if cb.ResponseMessage == nil {
return
}

err := w.WriteMsg(cb.ResponseMessage)
if err != nil {
log.Warn("Write message fail:", cb.ResponseMessage)
return
}
}

Expand Down
2 changes: 1 addition & 1 deletion core/outbound/dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ func (d *Dispatcher) ChooseActiveClientBundle() {
}
if common.IsIPMatchList(net.ParseIP(a.(*dns.AAAA).AAAA.String()), d.IPNetworkAlternativeList, true, "alternative") {
d.ActiveClientBundle = d.AlternativeClientBundle
return
log.Debug("Finally use alternative DNS")
return
}
}
log.Debug("IP network match failed, finally use alternative DNS")
Expand Down

0 comments on commit a0a7af5

Please sign in to comment.