pocket icon indicating copy to clipboard operation
pocket copied to clipboard

[P2P] [Tooling] Peer discovery `peer connections` subcommand

Open bryanchriswhite opened this issue 1 year ago • 2 comments

@Reviewer

This PR may be more digestible / reviewable on a commit-by-commit basis. Commits are organized logically and any given line is only modified in a single commit, with few exceptions*.

*(In the interest of preserving the git-time-continuum :police_officer::rotating_light:, this applies in batches of commits between comments or reviews by humans, only once "in review")


Description

Adds the following subcommands:

Print open peer connections

Usage:
  p1 peer connections [flags]

Flags:
  -h, --help   help for connections

Global Flags:
  -a, --all                     operations apply to both staked & unstaked router peerstores (default)
      --config string           Path to config
      --data_dir string         Path to store pocket related data (keybase etc.) (default "/home/bwhite/.pocket")
  -l, --local                   operations apply to the local (CLI binary's) P2P module instead of being broadcast
      --non_interactive         if true skips the interactive prompts wherever possible (useful for scripting & automation)
      --remote_cli_url string   takes a remote endpoint in the form of <protocol>://<host>:<port> (uses RPC Port) (default "http://localhost:50832")
  -s, --staked                  operations only apply to staked router peerstore (i.e. raintree)
  -u, --unstaked                operations only apply to unstaked router peerstore (i.e. gossipsub)
      --verbose                 Show verbose output

Issue

Related:

  • #730

Dependencies:

  • #804
  • #891

Type of change

Please mark the relevant option(s):

  • [x] New feature, functionality or library
  • [ ] Bug fix
  • [ ] Code health or cleanup
  • [ ] Major breaking change
  • [ ] Documentation
  • [ ] Other

List of changes

  • Added peer connections subcommand
  • Added P2PModule#GetConnections() interface method & implementation

Testing

  • [x] make develop_test; if any code changes were made
  • [ ] make test_e2e on k8s LocalNet; if any code changes were made
  • [ ] e2e-devnet-test passes tests on DevNet; if any code was changed
  • [ ] Docker Compose LocalNet; if any major functionality was changed or introduced
  • [x] k8s LocalNet; if any infrastructure or configuration changes were made

Required Checklist

  • [x] I have performed a self-review of my own code
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [ ] I have added, or updated, godoc format comments on touched members (see: tip.golang.org/doc/comment)
  • [x] I have tested my changes using the available tooling
  • [ ] I have updated the corresponding CHANGELOG

If Applicable Checklist

  • [ ] I have updated the corresponding README(s); local and/or global
  • [ ] I have added tests that prove my fix is effective or that my feature works
  • [ ] I have added, or updated, mermaid.js diagrams in the corresponding README(s)
  • [ ] I have added, or updated, documentation and mermaid.js diagrams in shared/docs/* if I updated shared/*README(s)

bryanchriswhite avatar Jun 02 '23 13:06 bryanchriswhite

Codecov Report

:exclamation: No coverage uploaded for pull request base (re/refactor/cli@a18c047). Click here to learn what that means. Patch has no changes to coverable lines.

:exclamation: Current head 10e00d0 differs from pull request most recent head ca2e971. Consider uploading reports for the commit ca2e971 to get more accurate results

Additional details and impacted files
@@                Coverage Diff                 @@
##             re/refactor/cli     #801   +/-   ##
==================================================
  Coverage                   ?   29.96%           
==================================================
  Files                      ?      108           
  Lines                      ?     8829           
  Branches                   ?        0           
==================================================
  Hits                       ?     2646           
  Misses                     ?     5873           
  Partials                   ?      310           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Jun 02 '23 13:06 codecov[bot]

@bryanchriswhite Can you pick this up when you're back?

Olshansk avatar Jul 28 '23 20:07 Olshansk