[WIP] Add option for bt extended handshake version/user agent string#947
[WIP] Add option for bt extended handshake version/user agent string#947tatsuhiro-t merged 2 commits intoaria2:masterfrom
Conversation
|
Just checking in to see if there was any feedback on this PR. |
src/bittorrent_helper.h
Outdated
| // generateStaticPeerId("aria2-") | ||
| const unsigned char* getStaticPeerId(); | ||
|
|
||
| const unsigned char* getStaticPeerAgent(); |
There was a problem hiding this comment.
Since we use peer agent as std::string, it would be nice to return std::string rather than const unsigned char*
|
Thank you. PR is on the right track. Could you remove the code you comment out? |
3ddb0e7 to
a3925b9
Compare
|
I have updated the PeerAgent to be a std::string and removed the commented code. I also added a simple test for the PeerAgent functions. I have also rebased it to the current head commit. |
src/bittorrent_helper.cc
Outdated
| if (peerAgent.empty()) { | ||
| generateStaticPeerAgent(DEFAULT_PEER_AGENT); | ||
| } | ||
| return const_cast<const std::string&>(peerAgent); |
There was a problem hiding this comment.
I think you don't have to do const_cat<> here. Just return peerAgent. Caller will see const std::string & as per function return type.
Add --peer-agent for setting the version/user agent used in the extended handshake protocol for bittorrent.
|
Hmm, must have had some typo that made me add that cast, removing the cast worked fine. |
|
Thank you. Looks good to me. |
Just hacked this together after reading #901
I modeled this after the --peer-id-prefix settings, is this a good approach for implementing this functionality? Should I model this option after a different option?
Also any suggestions on the name for this setting/parameter I named it since its similar to the "user agent". Maybe "bt-agent", "bt-user-agent", "bt-version", "peer-version", or "bt-extended-version"? Im hesitant to call it anything with "version" since it is more of an identifier than anything else and may confuse users.