SadeghHayeri / GreenTunnel

GreenTunnel is an anti-censorship utility designed to bypass the DPI system that is put in place by various ISPs to block access to certain websites.
MIT License
4.4k stars 278 forks source link

No Internet when PC start if Green Tunnel was on and wasn't closed manually before shutdown #168

Open fx-pro opened 1 year ago

fx-pro commented 1 year ago

Scenario:

Suggest solution: Green Tunnel go Off if closed by Windows when shutdown.

Thank you very much for such a great app!

musjj commented 1 year ago

The program manually sets the system's proxy settings (as seen in src/utils/system-proxy.js) when you run it. If you exit cleanly, it will turn it back off, but otherwise the proxy settings will be left as it was when the program was running. I don't think there's anything that Green Tunnel can do about this, but I suppose it can provide a convenient command line option to toggle the proxy.

fx-pro commented 1 year ago

@musjj Thank you for your kindly support. I understand that GTunnel set the proxy for the system, and it isn't clean up when closed by Windows when Shutdown. But Windows don't kill all the processes immediately when PC shutdown, however, it send signal to all running process to let them deal with it/clean up...

In node.js application, we can handle those signals likes:

function shutdownHandler(signal) {
    // do some stuff here

   await unsetProxy();

   //process.exit()
}

process.on('SIGINT', shutdownHandler)
process.on('SIGTERM', shutdownHandler)
process.on('SIGQUIT', shutdownHandler)

Thank you,

junsukim1994 commented 1 year ago

@musjj How do you exit 'cleanly' like in your comment? Now I have to turn gt from my terminal to connect to the App Store every time.

infernys20 commented 2 months ago

For those who use linux, the solution may be with gsettings.

The command looks like this: gsettings set org.gnome.system.proxy mode 'none'

After that, restart the network manager: sudo systemctl restart NetworkManager

Now the proxy should be unset.