Skip to content
This repository has been archived by the owner on Dec 28, 2023. It is now read-only.

Support SSDP in LAN #19

Open
garyyu opened this issue Nov 20, 2019 · 0 comments
Open

Support SSDP in LAN #19

garyyu opened this issue Nov 20, 2019 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@garyyu
Copy link
Collaborator

garyyu commented Nov 20, 2019

Currently we limit the connection in the same NAT address: only one connection is allowed .

	/// Checks whether there's any reason we don't want to accept an incoming peer
	/// connection. There can be a few of them:
	/// 1. Accepting the peer connection would exceed the configured maximum allowed
	/// inbound peer count. Note that seed nodes may wish to increase the default
	/// value for PEER_LISTENER_BUFFER_COUNT to help with network bootstrapping.
	/// A default buffer of 8 peers is allowed to help with network growth.
	/// 2. The peer has been previously banned and the ban period hasn't
	/// expired yet.
	/// 3. We're already connected to a peer at the same IP. While there are
	/// many reasons multiple peers can legitimately share identical IP
	/// addresses (NAT), network distribution is improved if they choose
	/// different sets of peers themselves. In addition, it prevent potential
	/// duplicate connections, malicious or not.
	fn check_undesirable(&self, stream: &TcpStream) -> bool {

At this moment, I don't want to change this behaviour, but In case someone have multiple node servers running in the same NAT, these servers can't connect to each other because above limitation.

A simple solution to solve this is to use the SSDP (Simple Service Discovery Protocol), allowing the node servers discovery each other in same LAN and connect each other.

A Rust SSDP crate can be used for this: https://github.com/GGist/ssdp-rs

Note: To avoid the LAN ip address publishing to peers network, the GetPeerAddrs protocol response should skip all these LAN ip addresses.

@garyyu garyyu added enhancement New feature or request good first issue Good for newcomers labels Nov 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant