From 166a81ace1d2317aa17173fd8c6157d53c25c52f Mon Sep 17 00:00:00 2001 From: Jordan Whited Date: Wed, 13 May 2020 20:59:42 -0700 Subject: [PATCH] ToUpper() pubkey in targets --- wgsd.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/wgsd.go b/wgsd.go index ad2bbc5..5922ef3 100644 --- a/wgsd.go +++ b/wgsd.go @@ -83,9 +83,9 @@ func (p *WGSD) ServeDNS(ctx context.Context, w dns.ResponseWriter, Class: dns.ClassINET, Ttl: 0, }, - Ptr: strings.ToLower(fmt.Sprintf("%s.%s%s", + Ptr: fmt.Sprintf("%s.%s%s", base32.StdEncoding.EncodeToString(peer.PublicKey[:]), - spPrefix, p.zone)), + spPrefix, p.zone), }) } w.WriteMsg(m) // nolint: errcheck @@ -111,7 +111,8 @@ func (p *WGSD) ServeDNS(ctx context.Context, w dns.ResponseWriter, Priority: 0, Weight: 0, 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 return dns.RcodeSuccess, nil @@ -144,7 +145,7 @@ func getHostRR(pubKey, zone string, endpoint *net.UDPAddr) dns.RR { if endpoint.IP == nil { return nil } - name := fmt.Sprintf("%s.%s", pubKey, zone) + name := fmt.Sprintf("%s.%s", strings.ToUpper(pubKey), zone) switch { case endpoint.IP.To4() != nil: return &dns.A{