Skip to content

Commit 1335ba5

Browse files
authored
p2p/dnsdisc: use strings.Cut over strings.IndexByte (#28787)
1 parent a608c0a commit 1335ba5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

p2p/dnsdisc/tree.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -344,11 +344,11 @@ func parseLink(e string) (*linkEntry, error) {
344344
return nil, fmt.Errorf("wrong/missing scheme 'enrtree' in URL")
345345
}
346346
e = e[len(linkPrefix):]
347-
pos := strings.IndexByte(e, '@')
348-
if pos == -1 {
347+
348+
keystring, domain, found := strings.Cut(e, "@")
349+
if !found {
349350
return nil, entryError{"link", errNoPubkey}
350351
}
351-
keystring, domain := e[:pos], e[pos+1:]
352352
keybytes, err := b32format.DecodeString(keystring)
353353
if err != nil {
354354
return nil, entryError{"link", errBadPubkey}

0 commit comments

Comments
 (0)