aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorJon Atack <jon@atack.com>2021-05-01 20:50:01 +0200
committerJon Atack <jon@atack.com>2021-05-02 13:37:41 +0200
commitea269c7ef1a65960d680f405de21708ba477ecce (patch)
tree778af3f9b0d902c1f7f5454e0f176579c0d07e6c /contrib
parentd22e7ee93313b13365bd14a5fffeb055cff4dcd2 (diff)
contrib: parse I2P addresses in generate-seeds.py
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/seeds/generate-seeds.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/contrib/seeds/generate-seeds.py b/contrib/seeds/generate-seeds.py
index d95069277d..9560b586ec 100755
--- a/contrib/seeds/generate-seeds.py
+++ b/contrib/seeds/generate-seeds.py
@@ -16,6 +16,7 @@ These files must consist of lines in the format
<ip>:<port>
[<ipv6>]:<port>
<onion>.onion:<port>
+ <i2p>.b32.i2p:<port>
The output will be two data structures with the peers in binary format:
@@ -52,6 +53,12 @@ def name_to_bip155(addr):
return (BIP155Network.TORV3, vchAddr[:32])
else:
raise ValueError('Invalid onion %s' % vchAddr)
+ elif addr.endswith('.b32.i2p'):
+ vchAddr = b32decode(addr[0:-8] + '====', True)
+ if len(vchAddr) == 32:
+ return (BIP155Network.I2P, vchAddr)
+ else:
+ raise ValueError(f'Invalid I2P {vchAddr}')
elif '.' in addr: # IPv4
return (BIP155Network.IPV4, bytes((int(x) for x in addr.split('.'))))
elif ':' in addr: # IPv6