ToUpper() pubkey in targets

This commit is contained in:
Jordan Whited 2020-05-13 20:59:42 -07:00
parent 4e16d5b9fc
commit 166a81ace1

View File

@ -83,9 +83,9 @@ func (p *WGSD) ServeDNS(ctx context.Context, w dns.ResponseWriter,
Class: dns.ClassINET, Class: dns.ClassINET,
Ttl: 0, Ttl: 0,
}, },
Ptr: strings.ToLower(fmt.Sprintf("%s.%s%s", Ptr: fmt.Sprintf("%s.%s%s",
base32.StdEncoding.EncodeToString(peer.PublicKey[:]), base32.StdEncoding.EncodeToString(peer.PublicKey[:]),
spPrefix, p.zone)), spPrefix, p.zone),
}) })
} }
w.WriteMsg(m) // nolint: errcheck w.WriteMsg(m) // nolint: errcheck
@ -111,7 +111,8 @@ func (p *WGSD) ServeDNS(ctx context.Context, w dns.ResponseWriter,
Priority: 0, Priority: 0,
Weight: 0, Weight: 0,
Port: uint16(endpoint.Port), Port: uint16(endpoint.Port),
Target: fmt.Sprintf("%s.%s", pubKey, p.zone), Target: fmt.Sprintf("%s.%s",
strings.ToUpper(pubKey), p.zone),
}) })
w.WriteMsg(m) // nolint: errcheck w.WriteMsg(m) // nolint: errcheck
return dns.RcodeSuccess, nil return dns.RcodeSuccess, nil
@ -144,7 +145,7 @@ func getHostRR(pubKey, zone string, endpoint *net.UDPAddr) dns.RR {
if endpoint.IP == nil { if endpoint.IP == nil {
return nil return nil
} }
name := fmt.Sprintf("%s.%s", pubKey, zone) name := fmt.Sprintf("%s.%s", strings.ToUpper(pubKey), zone)
switch { switch {
case endpoint.IP.To4() != nil: case endpoint.IP.To4() != nil:
return &dns.A{ return &dns.A{