mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-21 15:29:27 +00:00
p2p/dnsdisc: use strings.Cut over strings.IndexByte (#28787)
This commit is contained in:
parent
a608c0ac84
commit
1335ba5f28
1 changed files with 3 additions and 3 deletions
|
|
@ -344,11 +344,11 @@ func parseLink(e string) (*linkEntry, error) {
|
||||||
return nil, fmt.Errorf("wrong/missing scheme 'enrtree' in URL")
|
return nil, fmt.Errorf("wrong/missing scheme 'enrtree' in URL")
|
||||||
}
|
}
|
||||||
e = e[len(linkPrefix):]
|
e = e[len(linkPrefix):]
|
||||||
pos := strings.IndexByte(e, '@')
|
|
||||||
if pos == -1 {
|
keystring, domain, found := strings.Cut(e, "@")
|
||||||
|
if !found {
|
||||||
return nil, entryError{"link", errNoPubkey}
|
return nil, entryError{"link", errNoPubkey}
|
||||||
}
|
}
|
||||||
keystring, domain := e[:pos], e[pos+1:]
|
|
||||||
keybytes, err := b32format.DecodeString(keystring)
|
keybytes, err := b32format.DecodeString(keystring)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, entryError{"link", errBadPubkey}
|
return nil, entryError{"link", errBadPubkey}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue