Skip to content

Commit a4f8765

Browse files
authored
fix: correct formatting of generated SYNTH records (#468)
Fixes #467 Signed-off-by: Aurora Gaffney <[email protected]>
1 parent 05a279d commit a4f8765

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

internal/indexer/handshake.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"errors"
1313
"fmt"
1414
"log/slog"
15+
"strings"
1516
"time"
1617

1718
"github.com/blinklabs-io/cdnsd/handshake"
@@ -249,10 +250,13 @@ func handshakeResourceDataToDomainRecords(domainName string, resData handshake.D
249250
if ip4 == nil {
250251
return nil, fmt.Errorf("Synth4 record has invalid IPv4 address: %s", r.Address.String())
251252
}
253+
base32Enc := base32.HexEncoding.WithPadding(base32.NoPadding)
252254
nsName := fmt.Sprintf(
253255
"_%s._synth.",
254-
base32.HexEncoding.EncodeToString(
255-
ip4,
256+
strings.ToLower(
257+
base32Enc.EncodeToString(
258+
ip4,
259+
),
256260
),
257261
)
258262
ret = append(
@@ -272,10 +276,13 @@ func handshakeResourceDataToDomainRecords(domainName string, resData handshake.D
272276
},
273277
)
274278
case *handshake.Synth6DomainRecord:
279+
base32Enc := base32.HexEncoding.WithPadding(base32.NoPadding)
275280
nsName := fmt.Sprintf(
276281
"_%s._synth.",
277-
base32.HexEncoding.EncodeToString(
278-
r.Address,
282+
strings.ToLower(
283+
base32Enc.EncodeToString(
284+
r.Address,
285+
),
279286
),
280287
)
281288
ret = append(

0 commit comments

Comments
 (0)