|
|
|
@ -8,18 +8,19 @@ from torpeer import TorPeer
|
|
|
|
|
def on_announce_rec(api, data=None): |
|
|
|
|
socks_address, socks_port = get_socks()[0] |
|
|
|
|
|
|
|
|
|
announced = data['address'] |
|
|
|
|
announced: str = data['address'] |
|
|
|
|
try: |
|
|
|
|
announced = announced.decode('utf-8') |
|
|
|
|
except AttributeError: |
|
|
|
|
pass |
|
|
|
|
announced = announced.strip() |
|
|
|
|
|
|
|
|
|
if announced == config.get('tor.transport_address'): |
|
|
|
|
if announced.removesuffix('.onion') == config.get( |
|
|
|
|
'tor.transport_address', '').removesuffix('.onion'): |
|
|
|
|
logger.warn( |
|
|
|
|
"Received announcement for our own node, which shouldn't happen") |
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
announced = announced.strip() |
|
|
|
|
if not announced.endswith('.onion'): |
|
|
|
|
announced += '.onion' |
|
|
|
|
|
|
|
|
|