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

'peers' RPC command #78

Closed
wants to merge 3 commits into from
Closed

'peers' RPC command #78

wants to merge 3 commits into from

Conversation

mappum
Copy link
Contributor

@mappum mappum commented Sep 15, 2014

This just adds a peers RPC command which outputs a list of the currently connected peers.

Also includes a fix to core to populate the PeerMap, making the peer data accessible.

@jbenet
Copy link
Member

jbenet commented Sep 15, 2014

LGTM. @whyrusleeping should probably comment, given he knows that part of the codebase better. though its small enough we can merge if you want it in master tonight


for _, p := range *n.PeerMap {
addrs := make([]string, len(p.Addresses))
for i, addr := range p.Addresses {
Copy link
Contributor

Choose a reason for hiding this comment

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

this 'i' is shadowing 'i' on L22.

On 25, you can use the presently underscored variable as an outer i

Copy link
Member

Choose a reason for hiding this comment

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

i'd make them distinct too -- for pn, p := ... and for an, addr := ...

@whyrusleeping
Copy link
Member

So, to start this all off, (still need to read over things more to determine safety of certain calls), could you add a user facing command "ipfs peers" that allows the user to invoke this command directly? Another cool feature would be a 'format' flag that lets the user specify how the data gets output (json vs text vs ????)

@@ -88,13 +89,15 @@ func NewIpfsNode(cfg *config.Config, online bool) (*IpfsNode, error) {
return nil, err
}

peers = &peer.Map{}
Copy link
Member

Choose a reason for hiding this comment

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

you dont need to take a pointer to map types, theyre already psuedo reference types anyways

@mappum
Copy link
Contributor Author

mappum commented Sep 15, 2014

Re the ipfs peers command: I was going to work on a PR for making a nice interface for implementing commands that work via CLI or RPC call without any transport-specific setup, and available in any encoding (JSON, XML, Protobuf, whatever). Right now there is a lot of boilerplate when making new commands and making them available in more than one place.

@btc
Copy link
Contributor

btc commented Sep 15, 2014

@mappum excited!

@jbenet
Copy link
Member

jbenet commented Nov 16, 2014

This PR will have to change with new cmds. @mappum i'll close it for now, reopen if it changes.

@jbenet jbenet closed this Nov 16, 2014
ribasushi pushed a commit that referenced this pull request Jul 4, 2021
ariescodescream pushed a commit to ariescodescream/go-ipfs that referenced this pull request Oct 23, 2021
@aschmahmann aschmahmann mentioned this pull request Dec 1, 2021
80 tasks
laurentsenta pushed a commit to laurentsenta/kubo that referenced this pull request Feb 25, 2022
Add Init Alternative allowing specification of ED25519 key
laurentsenta pushed a commit to laurentsenta/kubo that referenced this pull request Feb 25, 2022
Add Init Alternative allowing specification of ED25519 key
laurentsenta pushed a commit to laurentsenta/kubo that referenced this pull request Mar 4, 2022
Add Init Alternative allowing specification of ED25519 key
laurentsenta pushed a commit to laurentsenta/kubo that referenced this pull request Mar 4, 2022
Add Init Alternative allowing specification of ED25519 key
ariescodescream pushed a commit to ariescodescream/go-ipfs that referenced this pull request Apr 7, 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.

4 participants