You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To support SOCKS proxy for WebRTC in webtorrent in an Electron app, using a combination of electron-wrtc and window.webContents.session.setProxy({proxyRules:"socks5://1.2.3.4:1080"}) seems to be the simplest way to support this (even if not lightweight).
However, when testing (only on OS X for now), I've encountered some problems:
if node_modules/electron-prebuilt is in app.asar, then spawning the electron process will fail (I think it's a known bug with spawn and asar).
If node_modules/electron-prebuilt is in asar.unpacked (or the app is simply not packaged in an asar), codesign will fail: ...../app.asar.unpacked/node_modules/electron-prebuilt/dist/Electron.app/Contents/Frameworks/Electron Framework.framework: bundle format unrecognized, invalid, or unsuitable
If instantiating electron-wrtc with opts.electron = app.getPath('exe') (the path of the Electron executable from the current app), it throws an error (electron exited with code 0).
I'm also thinking that using electron-wrtc may be overkill in that case (as we could simply create a new hidden window, set a proxy on it and communicate back and forth for WebRTC).
Note: the reason why we can't just session.setProxy() in the current window is that it would then proxy everything happening there (we may not want to proxy connections to trackers for example, or we may be doing something else not webtorrent-related in that window, etc.).
To support SOCKS proxy for WebRTC in webtorrent in an Electron app, using a combination of electron-wrtc and
window.webContents.session.setProxy({proxyRules:"socks5://1.2.3.4:1080"})
seems to be the simplest way to support this (even if not lightweight).However, when testing (only on OS X for now), I've encountered some problems:
...../app.asar.unpacked/node_modules/electron-prebuilt/dist/Electron.app/Contents/Frameworks/Electron Framework.framework: bundle format unrecognized, invalid, or unsuitable
electron-wrtc
withopts.electron = app.getPath('exe')
(the path of the Electron executable from the current app), it throws an error (electron exited with code 0).Here is the PR about SOCKS proxy support in webtorrent:
webtorrent/webtorrent#874
I'm also thinking that using electron-wrtc may be overkill in that case (as we could simply create a new hidden window, set a proxy on it and communicate back and forth for WebRTC).
Note: the reason why we can't just session.setProxy() in the current window is that it would then proxy everything happening there (we may not want to proxy connections to trackers for example, or we may be doing something else not webtorrent-related in that window, etc.).
Any suggestions on how to approach this?
Thanks!
cc @yciabaud
The text was updated successfully, but these errors were encountered: