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 debugapi /addresses endpoint to expose libp2p mutiaddresses #44

Merged
merged 1 commit into from Apr 1, 2020

Conversation

janos
Copy link
Member

@janos janos commented Mar 31, 2020

This PR is adding a new endpoint to debug api to expose LibP2P MultiAddresses. This is mainly needed for infrastructure automation to provide addresses that other nodes can connect to.

If the debug api is enabled a GET request to http://localhost:6060/addresses should return a list of addresses that node is listening to, for example:

{
    "addresses": [
        "/ip4/127.0.0.1/tcp/7071/p2p/16Uiu2HAmTBuJT9LvNmBiQiNoTsxE5mtNy6YG3paw79m94CRa9sRb",
        "/ip4/192.168.0.101/tcp/7071/p2p/16Uiu2HAmTBuJT9LvNmBiQiNoTsxE5mtNy6YG3paw79m94CRa9sRb",
        "/ip4/127.0.0.1/udp/7071/quic/p2p/16Uiu2HAmTBuJT9LvNmBiQiNoTsxE5mtNy6YG3paw79m94CRa9sRb",
        "/ip4/192.168.0.101/udp/7071/quic/p2p/16Uiu2HAmTBuJT9LvNmBiQiNoTsxE5mtNy6YG3paw79m94CRa9sRb",
        "/ip6/::1/tcp/7071/p2p/16Uiu2HAmTBuJT9LvNmBiQiNoTsxE5mtNy6YG3paw79m94CRa9sRb",
        "/ip6/::1/udp/7071/quic/p2p/16Uiu2HAmTBuJT9LvNmBiQiNoTsxE5mtNy6YG3paw79m94CRa9sRb",
        "/ip4/109.245.209.24/tcp/19049/p2p/16Uiu2HAmTBuJT9LvNmBiQiNoTsxE5mtNy6YG3paw79m94CRa9sRb",
        "/ip4/109.245.209.24/udp/19049/quic/p2p/16Uiu2HAmTBuJT9LvNmBiQiNoTsxE5mtNy6YG3paw79m94CRa9sRb"
    ]
}

@janos janos added the ready for review The PR is ready to be reviewed label Mar 31, 2020
@janos janos added this to the Sprint 0 milestone Mar 31, 2020
@janos janos self-assigned this Mar 31, 2020
Copy link
Member

@acud acud left a comment

Choose a reason for hiding this comment

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

LGTM @janos. I am just wondering if the semantics of /addresses should not reflect all of the addresses in the addressbook. maybe we can have this as /addresses/connected? WDYT?

@acud
Copy link
Member

acud commented Apr 1, 2020

Also, maybe it would be good to just dump the overlay together with the underlay? (in case we do cross reference this with the address book)

@Eknir Eknir mentioned this pull request Apr 1, 2020
5 tasks
@janos
Copy link
Member Author

janos commented Apr 1, 2020

@acud thanks for the review. These are addresses of the node itself, not the connected nodes. And overlay address is the same. For the addressbook, I would maybe have it under a dedicated path prefix, but that is when it is needed to be implemented. Let's change the api endpoint when we have more of them and want to reorganise debug api.

Copy link
Contributor

@pradovic pradovic left a comment

Choose a reason for hiding this comment

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

LGTM!

@acud
Copy link
Member

acud commented Apr 1, 2020

cool! thanks @janos

@janos janos merged commit b120c01 into master Apr 1, 2020
@janos janos deleted the debugapi-addresses branch April 1, 2020 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for review The PR is ready to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants