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

add WithAllowLimitedConn for SendRequest #988

Closed

Conversation

ldoublewood
Copy link

In case two nodes are both in private network, Relay service is required for them to communicate between each other, but currently such communication cannot be achieved because that the connection based on Relay is "limited", so "SendRequest" should be granted with the permission of "AllowLimitedConn" .

@ldoublewood ldoublewood requested review from guillaumemichel and a team as code owners September 13, 2024 08:33
@MarcoPolo
Copy link
Contributor

You probably don’t want to change the existing method. Can you pass this on with the context you are using?

@ldoublewood
Copy link
Author

Yes, I can pass this on my own context. But now I am talking the DHT logic, without the code of PR, the DHT of node in private network will stop working and libp2p will report the following error log:

2024-09-14T00:51:13.293Z DEBUG dht net/message_manager.go:96 request failed {"error": "context canceled", "to": "QmaQPiFw6Uv4PJEQ17JQ5rMQYRLF2J5bE3AULsuM4cDe9N"}
2024-09-14T00:51:13.293Z DEBUG dht [email protected]/lookup.go:67 error getting closer peers: context canceled
2024-09-14T00:51:13.293Z DEBUG dht net/message_manager.go:96 request failed {"error": "context canceled", "to": "QmdUSxDaE9xty594vatmtHb1nqLwpY3cFqM7LfWUWm1kTJ"}
2024-09-14T00:51:13.293Z DEBUG dht [email protected]/lookup.go:67 error getting closer peers: context canceled

@guillaumemichel
Copy link
Contributor

In case two nodes are both in private network

Nodes in a private network shouldn't act as a DHT server. go-libp2p-kad-dht is used for server-server and client-server interactions, IIUC you are talking about a client-client connection.

DHT clients can make use of a DHT to discover each other and a relay, but they shouldn't use the DHT code to interact with each other.

@gammazero gammazero marked this pull request as draft October 22, 2024 17:06
@gammazero
Copy link
Contributor

Triage note: Recommend closing based on last comment, here. Will close in a week if no activity.

@Stebalien
Copy link
Member

Additionally, changing this by default can actually break NAT traversal if the server is making a lot of DHT requests (e.g., gateways) because said DHT requests may blow through the limited quota. Not super likely but still...

At the end of the day, if you need truly relayed connections, you need to setup unlimited relays (relays with no quotas). Those connections will, IIRC, not be marked as transient.

@MarcoPolo
Copy link
Contributor

At the end of the day, if you need truly relayed connections, you need to setup unlimited relays (relays with no quotas). Those connections will, IIRC, not be marked as transient.

Correct: https://github.com/libp2p/go-libp2p/blob/master/p2p/protocol/circuitv2/client/dial.go#L181-L186

@guillaumemichel
Copy link
Contributor

Closing due to inactivity. Feel free to reopen is needed

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.

5 participants