mirror of
https://github.com/m13253/dns-over-https.git
synced 2026-03-30 14:15:40 +00:00
Preserve TransactionID
This commit is contained in:
@@ -95,6 +95,7 @@ func (s *Server) parseRequestIETF(w http.ResponseWriter, r *http.Request) *DNSRe
|
||||
fmt.Printf("%s - - [%s] \"%s %s %s\"\n", r.RemoteAddr, time.Now().Format("02/Jan/2006:15:04:05 -0700"), questionName, questionClass, questionType)
|
||||
}
|
||||
|
||||
transactionID := msg.Id
|
||||
msg.Id = dns.Id()
|
||||
opt := msg.IsEdns0()
|
||||
if opt == nil {
|
||||
@@ -137,14 +138,15 @@ func (s *Server) parseRequestIETF(w http.ResponseWriter, r *http.Request) *DNSRe
|
||||
}
|
||||
|
||||
return &DNSRequest{
|
||||
request: msg,
|
||||
isTailored: isTailored,
|
||||
request: msg,
|
||||
transactionID: transactionID,
|
||||
isTailored: isTailored,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) generateResponseIETF(w http.ResponseWriter, r *http.Request, req *DNSRequest) {
|
||||
respJSON := jsonDNS.Marshal(req.response)
|
||||
req.response.Id = 0
|
||||
req.response.Id = req.transactionID
|
||||
respBytes, err := req.response.Pack()
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
|
||||
@@ -48,6 +48,7 @@ type Server struct {
|
||||
type DNSRequest struct {
|
||||
request *dns.Msg
|
||||
response *dns.Msg
|
||||
transactionID uint16
|
||||
currentUpstream string
|
||||
isTailored bool
|
||||
errcode int
|
||||
|
||||
Reference in New Issue
Block a user