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

feat(libp2p/identify): can discover peer ids even if they are not passed in the multiaddr #27

Merged
merged 1 commit into from
Aug 1, 2023

Conversation

aschmahmann
Copy link
Contributor

Related to libp2p/specs#458 and a useful debugging tool. This code would be much less brittle and cleaner if go-libp2p returned typed errors to check against (aside from the issue of whether it's reasonable for the core swarm functionality to allow the MITM behavior that can accompany dialing a multiaddr without a peerID).

@aschmahmann aschmahmann force-pushed the feat/identify-without-peerid branch from d6f3089 to b1d60d6 Compare July 7, 2023 19:00
@codecov-commenter
Copy link

codecov-commenter commented Jul 7, 2023

Codecov Report

Merging #27 (973a280) into main (b05def4) will increase coverage by 3.22%.
The diff coverage is 49.15%.

@@            Coverage Diff             @@
##             main      #27      +/-   ##
==========================================
+ Coverage   21.13%   24.35%   +3.22%     
==========================================
  Files           5        5              
  Lines         530      583      +53     
==========================================
+ Hits          112      142      +30     
- Misses        392      408      +16     
- Partials       26       33       +7     
Files Changed Coverage Δ
main.go 0.00% <0.00%> (ø)
lib/identify.go 59.55% <51.78%> (-0.98%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@aschmahmann aschmahmann force-pushed the feat/identify-without-peerid branch from b1d60d6 to 0e50d29 Compare July 7, 2023 19:06
}

return extractIdentifyInfo(h.Peerstore(), ai.ID)
}

func extractPeerIDFromError(inputErr error) (peer.ID, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: this function is no fun and is brittle. Suggestions welcome for improvements.

@aschmahmann
Copy link
Contributor Author

merging, since this is better than the status quo and this repo is generally low on reviewers.

@aschmahmann aschmahmann merged commit 6975a58 into main Aug 1, 2023
16 checks passed
@aschmahmann aschmahmann deleted the feat/identify-without-peerid branch August 1, 2023 00:55
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.

2 participants