-
Notifications
You must be signed in to change notification settings - Fork 24
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
feat: Add AutoNAT behavior #632
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #632 +/- ##
==========================================
- Coverage 69.85% 69.81% -0.05%
==========================================
Files 98 100 +2
Lines 13394 13577 +183
==========================================
+ Hits 9357 9479 +122
- Misses 4037 4098 +61
|
It was mostly testing the libp2p implementation, not our use of it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Damn good stuff @bgins.
autonat::Event::StatusChanged { old, new } => { | ||
match &new { | ||
NatStatus::Public(address) => { | ||
event_handler.swarm.add_external_address(address.clone()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏽
Description
This PR makes the following changes:
external_addresses
with reported public addressesStatusChangedAutonat
notificationNatStatus
extension trait withto_tuple
helperWhen the
NatStatus
changes to public, the reported address is added toexternal_addresses
. If a previously reported address transitions from public to private or unknown, the address is removed fromexternal_addresses
.Note that
announce_addresses
are always kept inexternal_addresses
and will not be removed by changes toNatStatus
.Link to issue
Implements #398
Type of change
Test plan (required)
This PR adds the following tests:
StatusAutoNat
notification to and from IPLD bytes and JSON testsNatStatus
to_tuple
returns expected tuples