Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: local as runtime opt #2595

Open
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

grumbach
Copy link
Member

@grumbach grumbach commented Jan 3, 2025

No description provided.

@grumbach grumbach changed the title feat: local as runtime opt WIP: local as runtime opt Jan 3, 2025
@grumbach grumbach force-pushed the local_as_runtime_opt branch from ac19db4 to 854582a Compare January 6, 2025 17:17
@grumbach grumbach force-pushed the local_as_runtime_opt branch from 88acdd0 to f3cf215 Compare January 7, 2025 15:30
@grumbach grumbach enabled auto-merge January 7, 2025 17:17
@@ -254,7 +253,7 @@ pub(super) struct NodeBehaviour {
pub(super) blocklist:
libp2p::allow_block_list::Behaviour<libp2p::allow_block_list::BlockedPeers>,
pub(super) identify: libp2p::identify::Behaviour,
#[cfg(feature = "local")]
/// mDNS behaviour to use in local mode
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we not make this a Toggle? Then disable it completely with non-local mode to prevent home network noise.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you look at the implementation I check if we are in local mode before executing anything. But not sure if it does anything else? Not too familiar with how Behaviors work.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is no Toggle mDNS behavior will be activated, thus broadcasting the address on the home network.

Copy link
Contributor

@b-zee b-zee Jan 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if a public node is running on a home network it will still broadcast its address to a local test network's nodes. Shouldn't be a problem because of different network IDs/identifiers (plus the fact, like you mentioned, that you don't handle the mDNS events), but would still add a lot of noisy logs for those local nodes I presume.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmmh I see, that's not ideal. @dirvine mentioned getting rid of mdns all together eventually, maybe it's not worth the effort now if we plan to remove it altogether?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't mind getting it out, but Toggle is fine with me too. You can use the UPnP behavior as an example which is a bunch of lines below mDNS in the build method.

@@ -684,7 +681,6 @@ impl NetworkBuilder {
request_response,
kademlia,
identify,
#[cfg(feature = "local")]
mdns,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where the mDNS behavior is executed both with and withouth the --local flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants