RNS Logo

rns.recipes

◈ 9ce92808be498e9e05590ff27cbfdfe4
NomadNet 1.4.0 released with experimental image support https://pypi.org/project/nomadnet/

Create destination of type "single" without triggering an announce

Started by r8io fbbee7b7c874468e... ·

r8io 7af104ebb0b0e025...
#1

Looking at the Resource.py example that comes with Reticulum, I had the naive conception that, when I run the server, it would sit there quietly without announcing itself until I announce it manually.

My conception turns out to be wrong. When I run the server, it happily announces itself as soon as it is created. No need to hit enter to manually send an announce.

When we create a RNS.Destination, RNS.Transport.register_destination is called which automatically announces every "single" destination.

This behavior is most likely intended and needed (better be carefully here as I owe Mark to beers already ;).

Question:
Wouldn't it be nice if we could create a server that only reveals itself when we actually decide to reveal it with a manual announce or via a config setting like announce_enabled = true?

Examples directory

$ python Resource.py --server

Examples/Resource.py line 38, RNS 1.5.0

server_destination = RNS.Destination(
    server_identity,
    RNS.Destination.IN,
    RNS.Destination.SINGLE,
    APP_NAME,
    "resourceexample"
)

RNS.Transport.py line 2847, RNS 1.5.0

if Transport.owner.is_connected_to_shared_instance:
    if destination.type == RNS.Destination.SINGLE:
        def job():
            time.sleep(0.25)
            destination.announce(path_response=True)
        threading.Thread(target=job, daemon=True).start()
K8 8e4525cda4482720...
edited #2

If you look at the announce handling in _inbound(...) starting from Transport.py:2103, you’ll see that this is part of how clients connected to a local shared instance are handled, and the conditions is_from_local_client and packet.context == RNS.Packet.PATH_RESPONSE are checked in various places to handle these announces differently. Local clients have to announce to their shared instance to get their destination hash where it needs to be in routing tables. I think there should only be a few cases where these internal announces are retransmitted, specifically to other local clients (which is probably what you’re seeing) or if there is a waiting path request for the destination (which I’ve wondered about before, seems like there could be a way to maliciously force a quiet destination to announce?). Are you seeing the announce from that example server on another local client or on a remote instance?

r8io 7af104ebb0b0e025...
#3

Thanks for taking a look at this K8. You are right. I am indeed only seeing these "automatic" announces on my local network.

After your reply I improved my little test setup and exposed it to the public Testnet.
Et voilà, the "automatic" announces do NOT appear on the public Testnet.

So we can consider my question as answered, and the next beer is again on me :)

Post a Reply

Supports Markdown: **bold**, *italic*, `code`, ```code blocks```, [links](url)

Log in to upload images

Quote
Copied to clipboard