-
Notifications
You must be signed in to change notification settings - Fork 119
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: complete identify protocol and improved tests #506
base: main
Are you sure you want to change the base?
Conversation
@acul71, I'm unclear if this is ready for review. It will need a rebase and a newsfragment, otherwise looking good so far. |
This code is ready for review. |
@acul71 : Hi Luca. Kindly add a note that this a draft pull request. I will keep reviewing side by side. For final review by Paul, I will leave a message tagged to him. @pacrob : Wish to share that I recommended Luca and other PLDG cohort members to share the pull request with unit and integration tests. Also, step by step so that we could discuss their work in progress during the maintainer's call every Thursday.
|
@pacrob @seetadev
# get observed address from ``stream``
# class Swarm(Service, INetworkService):
# TODO: Connection and `peer_id` are 1-1 mapping in our implementation,
# whereas in Go one `peer_id` may point to multiple connections.
# connections: dict[ID, INetConn]
# Luca: So I'm assuming that the connection is 1-1 mapping for now
peer_id = stream.muxed_conn.peer_id # remote peer_id
peer_store = host.get_peerstore() # get the peer store from the host
remote_peer_multiaddrs = peer_store.addrs(
peer_id
) # get the Multiaddrs for the remote peer_id
logger.debug("multiaddrs of remote peer is %s", remote_peer_multiaddrs)
logger.debug("received a request for %s from %s", ID, peer_id)
# Select the first address if available, else None
observed_multiaddr = (
remote_peer_multiaddrs[0] if remote_peer_multiaddrs else None
)
protobuf = _mk_identify_protobuf(host, observed_multiaddr) 🕷️ |
NOTE: this is a draft pull request
The returned info agent version was a generic
py-libp2p/unknown
I've added a function in
libp2p/utils.py
that return the agent version so that I can return it in theagentVersion
field ofidentify protocol
modifyinglibp2p/identity/identify/protocol.py
I've improved the test
tests/core/identity/identify/test_protocol.py
adding tests so that every field is verified.I'm planning to complete #358 adding missing
observed address
fromstream
and thenidentify/push
.Specs are here https://github.com/libp2p/specs/blob/master/identify/README.md
🕷️