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

Add proxy options to allow proxying tracker and peer connections #874

Open
wants to merge 16 commits into
base: master
from
Open
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Clone options before using it in socks

  • Loading branch information
yciabaud committed Aug 25, 2016
commit 072aad6026ba2aad8a8a247321345535627bc1e2
@@ -123,10 +123,14 @@ function WebTorrent (opts) {

// Create HTTP agents from socks proxy if needed
if (!self.proxyOpts.httpAgent) {
self.proxyOpts.httpAgent = new Socks.Agent(self.proxyOpts.socksProxy, false)
var httpOpts = extend(self.proxyOpts.socksProxy)
httpOpts.proxy = extend(opts.proxy)
self.proxyOpts.httpAgent = new Socks.Agent(httpOpts, false)
}
if (!self.proxyOpts.httpsAgent) {
self.proxyOpts.httpsAgent = new Socks.Agent(self.proxyOpts.socksProxy, true)
var httpsOpts = extend(self.proxyOpts.socksProxy)
httpsOpts.proxy = extend(opts.proxy)
self.proxyOpts.httpsAgent = new Socks.Agent(httpsOpts, true)
}

// Convert proxy opts to electron API in webtorrent-hybrid
@@ -1664,6 +1664,7 @@ Torrent.prototype._drain = function () {
command: 'connect',
target: opts
})
proxyOpts.proxy = extend(proxyOpts.proxy)

Socks.createConnection(proxyOpts, onGotSocket)
} else {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.