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

Can you add run as windows service #139

Open
samanajd2 opened this issue Mar 2, 2025 · 1 comment
Open

Can you add run as windows service #139

samanajd2 opened this issue Mar 2, 2025 · 1 comment

Comments

@samanajd2
Copy link

There is a request that I find very useful.

If you add to this program, as well as opera-proxy, you add a way to run them as windows service so that they are always running on the machine.
It may be useful to you in this:
https://pkg.go.dev/golang.org/x/sys/windows/svc/mgr
And you can take a look at this program that uses this method
https://github.com/DNSCrypt/dnscrypt-proxy/tree/master/dnscrypt-proxy

And thank you very much for these programs, they are very useful to us

@Snawoot
Copy link
Owner

Snawoot commented Mar 2, 2025

Hello! Thanks!

There are at least four ways to run these proxies in background on Windows:

  1. With wrappers like NSSM (recommended).
  2. Using Windows Scheduler (on login or on system start).
  3. As user-defined service with SRVANY.EXE from Windows NT Resource Kit.
  4. Using Autostart and something to hide console window.

I'm personally not interested in 5th way to autostart proxy on Windows. Especially running it as a service:

  • It requires more platform-specific code, it will require platform-specific command line options, someone will need to do a lot of job to partition init logic by platform build tags.
  • It implies only single instance of proxy running while it may not be always the case.
  • For practical use it will require to do something about logs and write them to some file while I'm sticking to 12FA principles and believe it's not program responsibility to do anything about logs other than directing them into stderr stream.

I'll leave this issue open just in case if someone would like to contribute PR implementing such feature, but I'm not doing it myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants