User Tools

Site Tools


linux:v2ray

This is an old revision of the document!


v2ray

Install

wget https://install.direct/go.sh
sudo bash go.sh 

The v2ray command will be located at

/usr/bin/v2ray/v2ray

/usr/bin/v2ray/v2ray -h
Usage of /usr/bin/v2ray/v2ray:
  -config string
    	Config file for V2Ray.
  -format string
    	Format of input file. (default "json")
  -test
    	Test config file only, without launching V2Ray server.
  -version
    	Show current version of V2Ray.

config

/etc/v2ray/config.json

start/stop

``` sudo systemctl start v2ray sudo systemctl restart v2ray ```

Mac Install

- https://github.com/v2ray/homebrew-v2ray

brew tap v2ray/v2ray
brew install v2ray-core

Then you can run v2ray, and config file:

/usr/local/etc/v2ray/config.json

run v2ray-core without starting at login.

brew services run v2ray-core

or run v2ray-core and register it to launch at login via:

brew services start v2ray-core

Reference

Config file for client

{
  "log": {
    "loglevel": "warning"
  },
  "inbounds": [{
    "port": 1080,
    "listen": "127.0.0.1",
    "tag": "socks-inbound",
    "protocol": "socks",
    "settings": {
      "auth": "noauth",
      "udp": false,
      "ip": "127.0.0.1"
    },
    "sniffing": {
      "enabled": true,
      "destOverride": ["http", "tls"]
    }
  }],
  "outbounds": [{
    "protocol": "vmess",
    "settings": {
	"vnext": [{
		"address": "ef.pjq.mx",
		"port": 2710x,
		"users": [{ "id": "58ceb1c6-b580-4d2c-bf41-21b6a35ae62x" }]
		}]
    }
  },{
    "protocol": "freedom",
    "settings": {},
    "tag": "direct"
  },{
    "protocol": "blackhole",
    "settings": {},
    "tag": "blocked"
  }],
  "routing": {
    "domainStrategy": "IPOnDemand",
    "rules":[
	{
          "type": "field",
           "outboundTag": "direct",
           "domain": ["geosite:cn"]
        },
        {
           "type": "field",
           "outboundTag": "direct",
           "ip": [
             "geoip:cn",
             "geoip:private"
           ]
        },
       {
        "type": "field",
        "domain": ["geosite:category-ads"],
        "outboundTag": "blocked"
       }
    ]
  },

  "dns": {
    "hosts": {
      "domain:v2ray.com": "www.vicemc.net",
      "domain:github.io": "pages.github.com",
      "domain:wikipedia.org": "www.wikimedia.org",
      "domain:shadowsocks.org": "electronicsrealm.com"
    },
    "servers": [
      "1.1.1.1",
      {
        "address": "114.114.114.114",
        "port": 53,
        "domains": [
          "geosite:cn"
        ]
      },
      "8.8.8.8",
      "localhost"
    ]
  },

  "policy": {
    "levels": {
      "0": {
        "uplinkOnly": 0,
        "downlinkOnly": 0
      }
    },
    "system": {
      "statsInboundUplink": false,
      "statsInboundDownlink": false
    }
  },
  "other": {}
}

/var/www/dokuwiki/wiki/data/attic/linux/v2ray.1563003471.txt.gz · Last modified: 2019/07/13 15:37 by percy