Skip to content

Commit

Permalink
Added default i2p proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
PlasmaPower committed Jan 22, 2016
1 parent b058e85 commit 710cd6d
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions src/btfs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,10 @@ btfs_init(struct fuse_conn_info *conn) {
se.strict_end_game_mode = false;
se.announce_to_all_trackers = true;
se.announce_to_all_tiers = true;

if (params.proxy == NULL && params.proxy_type != NULL && strcmp(params.proxy_type, "i2p") == 0) {
params.proxy = "127.0.0.1:7656";
}

if (params.proxy != NULL) {
se.force_proxy = true;
Expand Down Expand Up @@ -647,26 +651,24 @@ populate_metadata(libtorrent::add_torrent_params& p, const char *arg) {
curl_easy_setopt(ch, CURLOPT_WRITEDATA, (void *) &output);
curl_easy_setopt(ch, CURLOPT_USERAGENT, "btfs/" VERSION);
curl_easy_setopt(ch, CURLOPT_FOLLOWLOCATION, 1);
if (params.proxy != NULL) {
if (params.proxy_type != NULL && strcmp(params.proxy_type, "i2p") == 0) {
if (params.i2p_http_proxy) {
curl_easy_setopt(ch, CURLOPT_PROXY, params.i2p_http_proxy);
} else {
curl_easy_setopt(ch, CURLOPT_PROXY, "127.0.0.1:4444");
}
curl_easy_setopt(ch, CURLOPT_PROXYTYPE, "http");
} else if (params.proxy != NULL) {
if (params.proxy_type == NULL) {
params.proxy_type = "socks5h";
}
if (strcmp(params.proxy_type, "i2p") == 0) {
if (params.i2p_http_proxy) {
curl_easy_setopt(ch, CURLOPT_PROXY, params.i2p_http_proxy);
} else {
curl_easy_setopt(ch, CURLOPT_PROXY, "127.0.0.1:4444");
}
curl_easy_setopt(ch, CURLOPT_PROXYTYPE, "http");
} else {
curl_easy_setopt(ch, CURLOPT_PROXY, params.proxy);
curl_easy_setopt(ch, CURLOPT_PROXYTYPE, params.proxy_type);
if (params.proxy_username != NULL) {
curl_easy_setopt(ch, CURLOPT_PROXYUSERNAME, params.proxy_username);
}
if (params.proxy_password != NULL) {
curl_easy_setopt(ch, CURLOPT_PROXYPASSWORD, params.proxy_password);
}
curl_easy_setopt(ch, CURLOPT_PROXY, params.proxy);
curl_easy_setopt(ch, CURLOPT_PROXYTYPE, params.proxy_type);
if (params.proxy_username != NULL) {
curl_easy_setopt(ch, CURLOPT_PROXYUSERNAME, params.proxy_username);
}
if (params.proxy_password != NULL) {
curl_easy_setopt(ch, CURLOPT_PROXYPASSWORD, params.proxy_password);
}
}

Expand Down

0 comments on commit 710cd6d

Please sign in to comment.