dns: query in udp when client requests in udp and no forwarder specified

This commit is contained in:
nadoo committed 2018-08-02 00:11:22 +08:00
1 parent 8d20331096
commit 9acaff5b4a
4 files changed
+118 -72

No files matched your search

+2 -3
View File
@@ -61,11 +61,10 @@ func (s *Server) ListenAndServeUDP() {
log.F("[dns] not enough message data")
continue
}
binary.BigEndian.PutUint16(reqBytes[:2], reqLen)
go func() {
respBytes, err := s.Client.Exchange(reqBytes[:2+n], caddr.String())
respBytes, err := s.Client.Exchange(reqBytes[:2+n], caddr.String(), false)
if err != nil {
log.F("[dns] error in exchange: %s", err)
return
@@ -123,7 +122,7 @@ func (s *Server) ServeTCP(c net.Conn) {
binary.BigEndian.PutUint16(reqBytes[:2], reqLen)
respBytes, err := s.Exchange(reqBytes, c.RemoteAddr().String())
respBytes, err := s.Exchange(reqBytes, c.RemoteAddr().String(), true)
if err != nil {
log.F("[dns]-tcp error in exchange: %s", err)
return