mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 03:30:37 +00:00
refactor(p2p/dnsdisc): replace strings.IndexByte with strings.Cut (#9236)
similar to https://github.com/ledgerwatch/erigon/pull/9202
This commit is contained in:
parent
cda48aeaf7
commit
79499b5cac
@ -311,11 +311,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, '@')
|
keystring, domain, ok := strings.Cut(e, "@")
|
||||||
if pos == -1 {
|
if !ok {
|
||||||
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 New Issue
Block a user