abh / geodns

DNS server with per-client targeted responses
Apache License 2.0
1.39k stars 193 forks source link

edns-client-subnet #112

Closed MolenZhang closed 5 years ago

MolenZhang commented 5 years ago

Hi: Sorry to all moguls first,may be i should not ask this question in here,i just need some advise.I am learning edns recently, and with my code like bellow:

o := new(dns.OPT)
    o.Hdr.Name = "."
    o.Hdr.Rrtype = dns.TypeOPT
    e := new(dns.EDNS0_SUBNET)
    e.Code = dns.EDNS0SUBNET
    e.Family = 1                // 1 for IPv4 source address, 2 for IPv6
    e.SourceNetmask = uint8(32) // 32 for IPV4, 128 for IPv6
    e.SourceScope = 0
    e.Address = net.ParseIP(ip).To4() // for IPv4
    o.Option = append(o.Option, e)
    m.Extra = append(m.Extra, o)

Now what puzzled me was my upstream server which is internal nameserver do not support edns.What i mean is:I add edns to my code and send domain resolve to Google public dnsServer through my clientIP. Of course i get an expected answer. Now i use my upstream server(for example 119.2.2.2) to take the place of google public dnsServer, I can not get the true resp ip. What i want to say is my upstream server may could not support edns. What should I do next step.