6

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?

2 Answers 2

3
+50

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).

5

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

enter image description here

Test with the command in the terminal.

curl cip.cc

enter image description here

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

enter image description here

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .