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

Setting Syncthing environment variable all_proxy #98

Open
jiajunhuang opened this issue Apr 2, 2019 · 11 comments
Open

Setting Syncthing environment variable all_proxy #98

jiajunhuang opened this issue Apr 2, 2019 · 11 comments

Comments

@jiajunhuang
Copy link

how can I use proxy in syncthing-macos? I can set a all_proxy=... in systemd service file, but it does not provide a way to set environment variable in syncthing-macos.

@xor-gate
Copy link
Member

xor-gate commented Apr 2, 2019

Currently setting a proxy is not possible. So it is a missing feature.

@xor-gate xor-gate changed the title How can I use proxy? Setting custom syncthing environment variables e.g all_proxy Aug 9, 2020
@opensource21
Copy link

As a workaround you could follow #154 (comment)

@xor-gate
Copy link
Member

xor-gate commented Jun 2, 2021

@opensource21 setting environment variables is not possible with #154 only commandline parameters

@opensource21
Copy link

@xor-gate This why I link to the workaround where a shell-script is called. Otherwise, I had written it's solved with #154

@AlliotTech
Copy link

Here is a less elegant way to achieve the goal:
export all_proxy=socks5://127.0.0.1:1234 && open /Applications/Syncthing.app;

@xor-gate
Copy link
Member

xor-gate commented Jul 31, 2024

Yeah I understand you need to bypass the (corporate) firewall or proxy via e.g Tor using the SOCKS5 protocol. For my own reference we need to inject the all_proxy envvar.

Code need to be touched located here:

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

_process = [[DaemonProcess alloc] initWithPath:_executable arguments: _arguments delegate:self];

environment["STNOUPGRADE"] = "true"

@AlliotTech
Copy link

AlliotTech commented Jul 31, 2024

Yeah I understand you need to bypass the (corporate) firewall or proxy via e.g Tor using the SOCKS5 protocol. For my own reference we need to inject the all_proxy envvar.

Yes, I have checked the documentation on environment variables for a specific agent. Is there another way to specify the agent through the application, rather than, as I mentioned earlier, using the command line to start the app to achieve the purpose of injecting environment variables?

@xor-gate
Copy link
Member

xor-gate commented Jul 31, 2024

No currently the only environment variable we set/inject is STNOUPGRADE. As a intermediate solution we could use the hidden turning knob like settings commandline argument as documented here https://github.com/syncthing/syncthing-macos?tab=readme-ov-file#preferences. We then could add something like:

defaults write com.github.xor-gate.syncthing-macosx Proxy 'socks5://127.0.0.1:1234'

It would be more nice to have two turning knobs in the GUI so you can set the URL and enable/disable proxying.

I can't promise when I implement this, but its not that hard. Syncthing macOS is a one man show, I do it in my (expensive) free time.

@xor-gate
Copy link
Member

Maybe we should also detect system wide proxy: https://apple.stackexchange.com/a/396066.

@AlliotTech
Copy link

No currently the only environment variable we set/inject is STNOUPGRADE. As a intermediate solution we could use the hidden turning knob like settings commandline argument as documented here https://github.com/syncthing/syncthing-macos?tab=readme-ov-file#preferences. We then could add something like:

defaults write com.github.xor-gate.syncthing-macosx Proxy 'socks5://127.0.0.1:1234'

It would be more nice to have two turning knobs in the GUI so you can set the URL and enable/disable proxying.

I can't promise when I implement this, but its not that hard. Syncthing macOS is a one man show, I do it in my (expensive) free time.

Thank you sir.
Unfortunately, after tested, the command "defaults write com.github.xor-gate.syncthing-macosx Proxy 'socks5://127.0.0.1:1234'" did not work.

@xor-gate
Copy link
Member

xor-gate commented Jul 31, 2024

Thank you sir. Unfortunately, after tested, the command "defaults write com.github.xor-gate.syncthing-macosx Proxy 'socks5://127.0.0.1:1234'" did not work.

Sure it doesn't work, it was a proposal for myself if that was not clear. It has not been implemented yet to inject the proxy environment variable.

@xor-gate xor-gate changed the title Setting custom syncthing environment variables e.g all_proxy Setting custom syncthing environment variable all_proxy Jul 31, 2024
@xor-gate xor-gate changed the title Setting custom syncthing environment variable all_proxy Setting Syncthing environment variable all_proxy Jul 31, 2024
@xor-gate xor-gate self-assigned this Aug 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants