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

core/transport: Improve docs for Transport::address_translation #2976

Merged
merged 4 commits into from Oct 9, 2022

Conversation

elenaf9
Copy link
Contributor

@elenaf9 elenaf9 commented Oct 4, 2022

Description

  • de05313: enhance docs for Transport::address_translation
  • 3785dd8: proposal: add default implementation for Transport::address_translation that returns None.

Links to any relevant issues

Motivated by a recent discussion in #2289 (comment) and a follow-up out of band discussion with @mxinden , that showed that the usage and relevance of this method is currently not well documented.

Open Questions

Does a default None implementation for Transport::address_translation make sense? It might help emphasizing that this is not relevant for all transports? Not sure about this myself, happy to revert that commit.

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • A changelog entry has been made in the appropriate crates

Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

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

Very much in favor of the updates docs. I think we should do without the default implementation. Let me know in case the reasoning makes sense.

core/src/transport.rs Outdated Show resolved Hide resolved
@elenaf9
Copy link
Contributor Author

elenaf9 commented Oct 5, 2022

Force-pushed to drop 3785dd8.

I believe a changelog entry is not needed given that I just updated the docs?

@elenaf9 elenaf9 changed the title core/transport: enhance Transport::address_translation, add default None core/transport: enhance Transport::address_translation Oct 5, 2022
/// so that e.g. the peer is observed at a different IP than the IP of the local
/// listening address. See also [`address_translation`][crate::address_translation].
///
/// Within [`libp2p::Swarm`](<https://docs.rs/libp2p/latest/libp2p/struct.Swarm.html>) this is
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there a better way to link to items from crates that are not a dependency?

Copy link
Member

Choose a reason for hiding this comment

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

I am not aware of a way. Maybe @thomaseizinger?

Copy link
Contributor

Choose a reason for hiding this comment

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

Me neither but I also think it is kind of an odd thing to do. This crate shouldn't "know" about Swarm. Do we have to include this sentence here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Me neither but I also think it is kind of an odd thing to do. This crate shouldn't "know" about Swarm. Do we have to include this sentence here?

Good point. But in practice transports are commonly used in a swarm, so I think its okay to mention this here. When I was looking at it for Quic it helped me to know how it is used in the swarm.

/// so that e.g. the peer is observed at a different IP than the IP of the local
/// listening address. See also [`address_translation`][crate::address_translation].
///
/// Within [`libp2p::Swarm`](<https://docs.rs/libp2p/latest/libp2p/struct.Swarm.html>) this is
Copy link
Member

Choose a reason for hiding this comment

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

I am not aware of a way. Maybe @thomaseizinger?

@thomaseizinger thomaseizinger changed the title core/transport: enhance Transport::address_translation core/transport: Improve docs for Transport::address_translation Oct 6, 2022
@mxinden mxinden merged commit aba5ccb into libp2p:master Oct 9, 2022
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.

None yet

3 participants