This is a simple tool for toggling company proxy settings on and off in the shell environment on MacOS.
I previously made a version of this tool in python.
Use with eval
in the shell to make changes to your configuration, e.g.
eval $(goproxy on)
.
on
: turn on proxy environment settingsoff
: turn off proxy environment settingsstatus
: print the current network location (proxies request tonetworksetup
)reset
: reconfigure current proxy environment settings without changing location
Edit myvars.go
to ensure the correct hosts, port and network locations are set before building the binary.
I have the following in my ~/.profile
file. I run the reset
command after setting up my variables etc. so that every new shell session loads with the correct environment by the time it shows an interactive prompt.
alias proxy="~/bin/goproxy"
proxy_on() {
eval "$(proxy on)"
}
proxy_off() {
eval "$(proxy off)"
}
proxy_reset() {
eval "$(proxy reset)"
}
# various setup actions...
proxy_reset