mirror of
https://github.com/logos-messaging/go-multiaddr.git
synced 2026-01-03 21:43:06 +00:00
Improve the validator
This commit is contained in:
parent
ae5c4f834c
commit
42839924e7
@ -283,9 +283,9 @@ func garlic32BtS(b []byte) (string, error) {
|
||||
func garlic32Validate(b []byte) error {
|
||||
// an i2p base64 for an Encrypted Leaseset v2 will be at least 35 bytes
|
||||
// long
|
||||
if len(b) > 35 {
|
||||
// other than that, they will be at least 32 bytes
|
||||
if len(b) < 32 {
|
||||
if len(b) < 35 {
|
||||
// other than that, they will be exactly 32 bytes
|
||||
if len(b) != 32 {
|
||||
return fmt.Errorf("failed to validate garlic addr: %s not an i2p base32 address. len: %d\n", b, len(b))
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user