betwixt icon indicating copy to clipboard operation
betwixt copied to clipboard

Set proxy programmatically

Open kdzwinel opened this issue 10 years ago • 7 comments

Right now proxy has to be set by hand, there should be a way to set it programmatically.

Question: Should that be a default behaviour? If I want to debug network traffic for a specific thing (e.g. npm), not the whole system, it's better for me to have control.

Challenge: even if it's possible how do we support all operating systems?

kdzwinel avatar Nov 20 '15 22:11 kdzwinel

cc @fcanas for mac... do you know if this is scriptable via jscore?

samccone avatar Nov 20 '15 22:11 samccone

I have another idea that might work (for OSX/Linux). Recently @mafintosh and I wrote https://www.npmjs.com/package/utun which lets you create virtual network devices by using the same syscall that VPN software uses to redirect all system traffic over a custom tunnel. Combining the utun module with some IP routing tricks (using the route command) can redirect system traffic to your own process.

max-mapper avatar Nov 21 '15 20:11 max-mapper

@maxogden that sounds neat! Although, I'm not quite sure what are the benefits of using utun over a proxy - easier setup? (doesn't it require root access?) more accurate data? better transparency?

kdzwinel avatar Nov 23 '15 02:11 kdzwinel

The benefit is that you can do it programmatically and capture all system traffic

max-mapper avatar Nov 23 '15 03:11 max-mapper

@samccone JSCore still needs to be kicked off from a native process which I don't think there's any well-understood tooling for. I think a node native module is the right approach. If you don't want to use utun, it shouldn't be too hard to write your own:

Documentation for configuring network services on the Mac -- see about proxies dictionary in "The System Configuration Schema" Boilerplate for a node native module

fcanas avatar Nov 25 '15 04:11 fcanas

awww snap thanks for the info @fcanas :)

samccone avatar Nov 25 '15 04:11 samccone

We're happy to add anyone to utun who wants to help improve it too (http://openopensource.org/ style). Only thing it needs right now is prebuilt binaries (we use https://www.npmjs.com/package/prebuild but havent hooked it up there yet because we haven't needed to use utun in production yet)

max-mapper avatar Nov 28 '15 20:11 max-mapper