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 peer info api #258

Merged
merged 1 commit into from
Aug 21, 2023
Merged

Add peer info api #258

merged 1 commit into from
Aug 21, 2023

Conversation

piersy
Copy link
Contributor

@piersy piersy commented Aug 14, 2023

Add an API endpoint to retrieve information about peers.

Part of spacemeshos/go-spacemesh#4778

@piersy piersy merged commit 4bd8230 into master Aug 21, 2023
1 check passed
@piersy piersy deleted the piersy/add-peer-info-api branch August 21, 2023 10:25
bors bot pushed a commit to spacemeshos/go-spacemesh that referenced this pull request Aug 21, 2023
## Motivation
Closes #4778

Note that this is in a draft state because it needs spacemeshos/api#258 to be merged and I guess a release of the API package, before it can be merged. I plan to remove the replace directive for the api in the mod file when, the api has been released.

## Changes
Adds a new streaming API endpoint to the node service to return info about connected peers.

Note this PR changes the PostProviderID field to be exported to allow for config to be easily serialised/deserialised in order to perform a deep copy.

## Test Plan
Added a test, the test doesn't check whether tags are since that part would make things a bit trickier. However through manual checking I can see that tags are being assigned.

```shell
$ grpc_cli call  localhost:9092 spacemesh.v1.NodeService.PeerInfo ''
connecting to localhost:9092
peers {
  id: "12D3KooWRkZMjGNrQfRyeKQC9U58cUwAfyQMtjNsupixkBFag8AY"
  connections {
    address: "/ip4/34.150.215.241/tcp/5000"
    uptime: "29.348584085s"
    outbound: true
  }
  tags: "bootnode"
}
Rpc succeeded with OK status
```

## DevOps Notes
<!-- Please uncheck these items as applicable to make DevOps aware of changes that may affect releases -->
- [x] This PR does not require configuration changes (e.g., environment variables, GitHub secrets, VM resources)
- [x] This PR does not affect public APIs
- [x] This PR does not rely on a new version of external services (PoET, elasticsearch, etc.)
- [x] This PR does not make changes to log messages (which monitoring infrastructure may rely on)
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

2 participants