Sfoglia il codice sorgente

Add more geoip debugging

Ask Bjørn Hansen 13 anni fa
parent
commit
c788ea0be2
1 ha cambiato i file con 4 aggiunte e 2 eliminazioni
  1. 4 2
      serve.go

+ 4 - 2
serve.go

@@ -35,8 +35,9 @@ func serve(w dns.ResponseWriter, req *dns.Msg, z *Zone) {
 
 
 	var country string
 	var country string
 	if geoIP != nil {
 	if geoIP != nil {
-		country = strings.ToLower(geoIP.GetCountry(w.RemoteAddr().String()))
-		logPrintln("Country:", country)
+		ip := w.RemoteAddr().String()
+		country = strings.ToLower(geoIP.GetCountry(ip))
+		logPrintln("Country:", ip, country)
 	}
 	}
 
 
 	m := new(dns.Msg)
 	m := new(dns.Msg)
@@ -69,6 +70,7 @@ func serve(w dns.ResponseWriter, req *dns.Msg, z *Zone) {
 
 
 			m.Answer = []dns.RR{&dns.RR_TXT{Hdr: h,
 			m.Answer = []dns.RR{&dns.RR_TXT{Hdr: h,
 				Txt: []string{
 				Txt: []string{
+					w.RemoteAddr().String(),
 					string(country),
 					string(country),
 					string(countries.CountryContinent[country]),
 					string(countries.CountryContinent[country]),
 				},
 				},