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

Need to set peer ID to start with "-WD-" #688

Closed
feross opened this issue Jun 29, 2016 · 6 comments
Closed

Need to set peer ID to start with "-WD-" #688

feross opened this issue Jun 29, 2016 · 6 comments

Comments

@feross
Copy link
Member

feross commented Jun 29, 2016

Continuation of this PR: #462

Need to set the Peer ID using logic that's just like that in webtorrent here: https://github.com/feross/webtorrent/blob/46b3655927eefb4a18fbbfd547013863ccdaed4b/index.js#L23-L65

@rjmille2
Copy link

rjmille2 commented Jul 1, 2016

I'm very new to node, but I assuming you want the client.peerId to be a string and the client.peerIdBuffer to be a Buffer, right? I think I've basically fixed this, but just want to make sure I'm understanding correctly.

@rjmille2
Copy link

rjmille2 commented Jul 1, 2016

The format that I have created is -WD0018-bc9d8c89a36d for example. I'm not sure why I'm getting 0018 when the semver is 0.8.1. It seems it should be -WD0008-bc9d8c89a36d, but I'm just copying the code from webtorrent repo. It has something to do with this regex being incorrect.

var VERSION_STR = VERSION.match(/([0-9]+)/g).slice(0, 2).map(zeroFill(2)).join('')

@mathiasvr
Copy link
Contributor

@rjmille2 I opened a PR for fixing the version string webtorrent/webtorrent#851. I only think you need to pass the peerId.

@rjmille2
Copy link

rjmille2 commented Jul 6, 2016

@mathiasvr, thanks for letting me know. I didn't realize that you could do lambda operations like that in node. I looked at your PR and learned something new today!

@feross
Copy link
Member Author

feross commented Jul 27, 2016

@rjmille2 I assume that you got busy -- I'll send a PR to implement this today.

@feross
Copy link
Member Author

feross commented Jul 27, 2016

PR: #742

@feross feross closed this as completed Jul 27, 2016
@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants