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
I2P support #2530
Comments
Yes, libtorrent use the SAM protocol. The main problem with libtorrent's i2p support is that it does not have any regression tests, so it's possible that it has broken at some point. Do you have a log of the alerts you get? please enable all alerts in the |
As you suggested i added to the code session.set_alert_mask(lt.alert.category_t.all_categories) in the end And get the following: add_torrent_alert added torrent: test Everything looks fine for me. The torrent is from tracker2.postman.i2p. I read that previously the tracker was not supported by the libtorrent, because the program did not support base32 names. Am i correct that now base32 names are supproted? |
there must be more alerts than that, right? things like announces to the trackers for instance. |
Indeed, it is strange. i do not see any other alerts |
oh, you're probably setting the mask after everything already happened. set the mask as part of the |
Ok, i put session = lt.session(alert_mask=lt.alert.category_t.all_categories,flags=0) listen_succeeded_alert successfully listening on [TCP] [::]:6881 after few seconds in the end i get Segmentation fault (core dumped) |
The program looks like this: import libtorrent as lt session = lt.session(alert_mask=lt.alert.category_t.all_categories,flags=0) h = session.add_torrent({'ti': lt.torrent_info('/tmp/Downloads/test.torrent'), 'save_path': '/tmp/Downloads/'}) session.listen_on(6861, 6861) Without h.auto_managed(False) i get the alerts above but the program crashes. With h.auto_managed(False) the program doesnot crash and i get only this: listen_succeeded_alert successfully listening on [TCP] [::]:6881 |
I am still trying to find my mistake. I rewrote c++
In the result i get successfully listening on [TCP] [::]:6881 |
Ok, i build libtorrent with the debug option. It seems it is some kind of bug in the libtorrent. gdb shows the following
|
Also, i turned off the openssl. I get the error in the different place Test.Torrent: [1000] 0 0 0 0 0 0 0 0 0 0 version: 1.1.5.0-37ffe99a1 file: 'http_connection.cpp' stack: |
yeah, it seems like there's an issue with the i2p support in the http_connection or http_tracker_connection. The proper fix for this includes implementing a simple mock SAM server in the simulator, to be able to have tests. The reason I haven't done that yet is that I haven't really considered i2p support a critical (or particularly popular) feature. |
this error message: "*** tracker error: (161) Waiting for i2p acceptor from SAM bridge" specifically, it means the local i2p endpoint has not been looked up yet (which is done by the SAM name lookup of "ME"). It either means we haven't even connected yet, or the name lookup hasn't returned (which presumably means something is wrong) |
does this help any? #2564 |
@reichKV do you think you will have a chance to try that patch? |
Sure i will try to do it |
Sorry for the delay. I understand that i am probably the only one in the world who uses libtorrent in i2p. I need this for educational purposes. And I appreciate your help. i used your pathes and with the test program, which i described above, i get the following
added torrent: test.mkv In the i2pd console i see the following: 22:12:22@698/info - Clients: starting SAM bridge at 127.0.0.1:7656 |
Previously i got the errors with the standard java i2p and c++ i2p. Right now i used c++ i2p. I can do the same with java i2p if you think the problem can be with the router |
@ReichKV you're certainly not the only one, I just encountered the same bug. This is also a blocker for qBittorrent implementing it. With the death of Net Neutrality and more ISPs throttling/blocking torrents, I think this issue will begin to see more popularity. Hopefully it will get resolved soon so that we can get libtorrent-based torrent clients back on the network. |
|
Is |
Lol, this article was written by the developer of I2Pd, all the problems mentioned in it have been fixed for a long time. |
@master255 |
@TomasGlgg @cathalgarvey Torrents are decentralized. If everyone distributes content and it cannot be traced and blocked (as in Url-seeds), that would mean complete anonymity for the source? |
Are we alone? Have you seen the statistics of the local tracker in I2P? |
it seems this thread is drifting a bit off-topic. libtorrent (used to) support i2p via its SAM bridge (which on the libtorrent side is configured as a kind of proxy). There are no tests for this unfortunately, so it's possible it has bit rotted a bit. If the SAM protocol has changed in the last 10 years, that would also explain it. |
Yes, It has changed. https://geti2p.net/en/docs/api/samv3 Also, I2P is updated to newer version - https://geti2p.net/en/blog/post/2022/2/21/1.7.0-Release Update - https://geti2p.net/en/docs/applications/bittorrent Here's the reason, with screenshots, why I am asking for this specific request - qbittorrent/qBittorrent#16257 |
It may be possible to design unit tests using libi2pd. Unfortunately the process is totally undocumented... |
UPDATE AS OF JUNE 2022 SAM version 3 = https://geti2p.net/en/docs/api/samv3 Also, I2P is updated to newer version - https://geti2p.net/en/blog/post/2022/5/23/1.8.0-Release Update - https://geti2p.net/en/docs/applications/bittorrent New UDP protocol introduced in i2p 1.8.0 called SSU = https://geti2p.net/en/docs/transport/ssu Specs of the proposal = https://geti2p.net/spec/proposals/159-ssu2 more information on this is present in release data of 1.8.0 (provided above) Here's the reason, with screenshots, why I am asking for this specific request - qbittorrent/qBittorrent#16257 |
A seedbox is just a VPS with bittorrent on it. There are services providing these as a servuce.
There are many data centres in the world and not all care about bittorrent. If you buy budget, they are often underpricing traffic so they get annoyed if you actually use the traffic. Other datacentres or products will care less, unless your torrenting lands them in legal hot water. (that is, copyright - the branch of law that most frequently causes them headaches)
All the more reason to support properly anonymous torrenting, then.
That's not to say it would be wholly benign - it's good that ISPs and datacentres and VPNs can come after you if you are sharing actually evil content. But the motivation for i2p is about avoiding mass surveillance and tyrrany, and webseeds have literally no serious role there.
|
@cathalgarvey I was recently in USA. They sell any sim cards without a passport. Torrents work great in them. So which countries have problems? Mexico sells any sim cards without a passport too. Directly from official stores. |
@master255, buying a SIM card without person identification is already difficult in China, Germany, Poland, Russia, Spain and other countries. This can create problems with the law for the seller. Besides. Mobile devices usually transfer their serial number to mobile operators. Therefore the simple replacement of the SIM card does not give anonymity. You might think that there is a workaround. For example, you buy a new device, and then persuade a homeless person to buy you a SIM card in his name. Homeless people usually do not refuse money and alcohol. But there is another problem. The location of the mobile device can be found using triangulation. This is usually enough to find a pirate or a dissident. If the city recognition system has been introduced in the city, then calculating the senders and recipients of Internet traffic is even easier. Sorry for my google translate. |
@ri-gilfanov There's a firewall in China. In Russia, anonymous SIM cards are sold and torrents are not banned by ISPs. That only leaves some European countries. It is possible, at best, to calculate the location of base stations with the accuracy of the house. But not to the apartment where you live. Imei can be changed with full rights on the device (super user). That is why torrents are still anonymous everywhere except in some European countries and China. |
Guys, just add support with the option to turn it on and off, you don’t need to decide legal and other issues for the user, who needs to turn it on, who doesn’t need to turn it off |
I have to agree with @ivan1986. Talking about the legal risks of users is beyond the scope of the topic. @master255, I will point out one thing. The Bittorrent protocol works best with a static IP address. The anonymous I2P network provide an anonymous alternative to the static IP address in the clearnet. |
any progress on this topic? I2P has gained more attention lately and would be great to be able to use libtorrent with it. |
Update on I2P side as of December 2022. SAM has been upgraded. SSU2 has been launched. I2P itself upgraded to 2.0 I2P router upgraded to 0.9.56
Very soon Vuze won't work cause approximately 50% of all I2P network is upgrading to 2.0 & 0.9.56. I suggest BiglyBT because it is regularly maintained.
100%. I want qBittorrent to work flawlessly with I2P or atleast have an inbuilt router just like BiglyBT has. |
I tested I2P support today. Versions:
Settings: Proxy type I2P, address 127.0.0.1, port 7656 Result:
Then torrent client closes connection and writes I don't know how it is possible to fail parsing of such simple message, but library fails to do this. |
I decided to test with libtorrent directly and to use latest version. Build command is something like that:
#include <iostream>
#include <thread>
#include <chrono>
#include <libtorrent/session.hpp>
#include <libtorrent/session_params.hpp>
#include <libtorrent/add_torrent_params.hpp>
#include <libtorrent/torrent_handle.hpp>
#include <libtorrent/alert_types.hpp>
#include <libtorrent/magnet_uri.hpp>
int main(int argc, char const* argv[]) try
{
const char* magnet =
"magnet:?xt=urn:btih:cb18974db461c640c0d938710203bb263a746694"
"&dn=I2P%2B+Universal+Installer+2.0.0%2B"
"&tr=http://tracker2.postman.i2p/announce.php";
lt::settings_pack p;
p.set_str(lt::settings_pack::listen_interfaces, "0.0.0.0:6881");
p.set_int(lt::settings_pack::proxy_type, lt::settings_pack::i2p_proxy);
p.set_int(lt::settings_pack::i2p_port, 7656);
p.set_str(lt::settings_pack::i2p_hostname, "127.0.0.1");
p.set_bool(lt::settings_pack::enable_upnp, false);
p.set_bool(lt::settings_pack::enable_natpmp, false);
p.set_bool(lt::settings_pack::enable_dht, false);
p.set_int(lt::settings_pack::alert_mask,
lt::alert_category::status | lt::alert_category::error);
lt::session ses(p);
lt::add_torrent_params atp = lt::parse_magnet_uri(magnet);
atp.save_path = "."; // save in current dir
lt::torrent_handle h = ses.add_torrent(std::move(atp));
for (;;) {
std::vector<lt::alert*> alerts;
ses.pop_alerts(&alerts);
for (lt::alert const* a : alerts) {
std::cout << a->message() << std::endl;
// if we receive the finished alert or an error, we're done
if (lt::alert_cast<lt::torrent_finished_alert>(a)) {
goto done;
}
if (lt::alert_cast<lt::torrent_error_alert>(a)) {
goto done;
}
}
std::this_thread::sleep_for(std::chrono::milliseconds(200));
}
done:
std::cout << "done, shutting down" << std::endl;
}
catch (std::exception& e)
{
std::cerr << "Error: " << e.what() << std::endl;
} Result is the same
|
Looks like something wrong happened in 2019. libtorrent/include/libtorrent/i2p_stream.hpp Lines 235 to 238 in 690881f
SAM connection process went further and SAM session was created. It still failed at the end (when tested with i2pd 2.45.0):
But I think it is still important to fix support at least partially. upd. libtorrent/include/libtorrent/i2p_stream.hpp Line 285 in 690881f
And sometimes this check fails because "OK" != "OK\0" here: libtorrent/include/libtorrent/i2p_stream.hpp Line 309 in 690881f
So that line, probably, should look like: string_view remaining(m_buffer.data(), m_buffer.size() - 1);
|
Most likely, #7272 solved problems described in this bugreport. |
addressed here: #7356 |
libtorrent version: 1.1.1.0
platform/architecture: Ubuntu 17.10
Hey, i am just curious what is the status of the I2P support. The documentation about this feature is a little bit light right now. In particular i am not sure where i do mistake in the following python code:
import libtorrent as lt
session = lt.session(flags=0)
h = session.add_torrent({'ti': lt.torrent_info('/tmp/Downloads/test.torrent'), 'save_path': '/tmp/Downloads'})
#session.listen_on(6881, 6881)
proxy_settings = lt.proxy_settings()
proxy_settings.hostname = '127.0.0.1'
proxy_settings.port = 7656
session.set_i2p_proxy(proxy_settings)
The program doesnot download anything and cannot find peers(the i2pshark do it very fast). Please help me to figure out what is going on. Am i right that libtorrent use SAM interface, so i should use port 7656?
The text was updated successfully, but these errors were encountered: