Stack Exchange Network
Stack Exchange network consists of 183 Q&A communities including
Stack Overflow
, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack Exchange
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.
Sign up to join this community
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
With v2ray on macOX 10.13.6, I can access some sites from Chrome but I cannot access those sites from terminal.
the configuration for v2ray looks like this
"v": "2",
"ps": "\u8bxx-Azure",
"add": "xx.acrossgw.info",
"port": 8088,
"id": "xxx-b6xxx8954c",
"aid": "16",
"net": "ws",
"type": "none",
"host": "xx.acrossgw.info",
"path": "\/data",
"tls": "tls"
Per this
post
, this command sets proxy for terminal session
export http_proxy="username:password@ip address:port number"
I put this line at the end of my ~/.bash_profile
export http_proxy="xxx-b6xxx8954c:\[email protected]:8088"
but I cannot access those sites from terminal either, how do I do?
Taking a quick stab from the documentation:
It does not appear that v2ray will pick up from the environment the http_proxy
env var, it needs to be configured via a JSON (or protobuf) file. There's an example client config file here.
You'd save that file somewhere, then run it in your terminal like this:
v2ray --config=/etc/v2ray/config.json
(or wherever your config file lives).
Click the V2ray icon > Copy HTTP Proxy Shell Export Line
You can get the below command. Run the command in the terminal. You can enable the proxy.
export http_proxy=http://127.0.0.1:1087;export https_proxy=http://127.0.0.1:1087;export ALL_PROXY=socks5://127.0.0.1:1080
Test with the command in the terminal.
curl cip.cc
Remove the proxy with the command.
alias unproxy='unset all_proxy'
Test again with the command in the terminal. Your ip location is change.
curl cip.cc
The better solution is to set the below alias
command in your zsh or bash.
alias proxy='export http_proxy=http://127.0.0.1:1087;export https_proxy=http://127.0.0.1:1087;export ALL_PROXY=socks5://127.0.0.1:1080'
alias unproxy='unset all_proxy'
Then you can use the command proxy
to enable the proxy. Use the command 'unproxy' to disable the proxy.