Skip to content

Commit a0a7af5

Browse files
committed
Fix ResponseMessage nil bug
1 parent afefc6b commit a0a7af5

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

core/inbound/server.go

+5
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,14 @@ func (s *Server) ServeDNS(w dns.ResponseWriter, q *dns.Msg) {
6262

6363
cb := d.ActiveClientBundle
6464

65+
if cb.ResponseMessage == nil {
66+
return
67+
}
68+
6569
err := w.WriteMsg(cb.ResponseMessage)
6670
if err != nil {
6771
log.Warn("Write message fail:", cb.ResponseMessage)
72+
return
6873
}
6974
}
7075

core/outbound/dispatcher.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ func (d *Dispatcher) ChooseActiveClientBundle() {
148148
}
149149
if common.IsIPMatchList(net.ParseIP(a.(*dns.AAAA).AAAA.String()), d.IPNetworkAlternativeList, true, "alternative") {
150150
d.ActiveClientBundle = d.AlternativeClientBundle
151-
return
152151
log.Debug("Finally use alternative DNS")
152+
return
153153
}
154154
}
155155
log.Debug("IP network match failed, finally use alternative DNS")

0 commit comments

Comments
 (0)