From f73cbde7a5aca891f962f85576bbfebeee6798a9 Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Mon, 24 Apr 2023 23:50:14 +0700 Subject: [PATCH] Update HTTP request headers --- doh.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/doh.go b/doh.go index 1cd9717..e2e6586 100644 --- a/doh.go +++ b/doh.go @@ -13,12 +13,11 @@ import ( ) const ( - DoHMacHeader = "Dns-Mac" - DoHIPHeader = "Dns-IP" - DoHHostHeader = "Dns-Host" + DoHMacHeader = "x-cd-mac" + DoHIPHeader = "x-cd-ip" + DoHHostHeader = "x-cd-host" - headerContentTypeValue = "application/dns-message" - headerAcceptValue = "application/dns-message" + headerApplicationDNS = "application/dns-message" ) func newDohResolver(uc *UpstreamConfig) *dohResolver { @@ -90,8 +89,8 @@ func (r *dohResolver) Resolve(ctx context.Context, msg *dns.Msg) (*dns.Msg, erro } func addHeader(ctx context.Context, req *http.Request, sendClientInfo bool) { - req.Header.Set("Content-Type", headerContentTypeValue) - req.Header.Set("Accept", headerAcceptValue) + req.Header.Set("Content-Type", headerApplicationDNS) + req.Header.Set("Accept", headerApplicationDNS) if sendClientInfo { if ci, ok := ctx.Value(ClientInfoCtxKey{}).(*ClientInfo); ok && ci != nil { if ci.Mac != "" {