Table of Contents

v2ray

- https://www.v2ray.com/index.html

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
brew services restart v2ray-core

Router Install

Download the correct version

wget -cS https://github.com/v2ray/v2ray-core/releases/download/v4.20.0/v2ray-linux-arm.zip

unzip v2ray-linux-arm.zip

Then copy all the files to the router

scp -r v2ray root@miwifi.com:/userdisk/data/bin/v2ray

Add execution permission

chmod +x v2ray
chmod +x v2ctl

Update the config.json, the run v2ray

./v2ray --config=config.json

Testing the connection

curl -x socks5://127.0.0.1:1088 google.com

Reference

Reference

- https://toutyrater.github.io/basic/routing/cndirect.html

Config file for server

{
  "inbounds": [{
    "port": 2130x,
    "listen": "127.0.0.1",
    "protocol": "vmess",
    "settings": {
      "clients": [
        {
          "id": "58ceb1c6-b580-4d2c-bf41-21b6a35xxxx",
          "level": 1,
          "alterId": 64
        }
      ]
    },
	"streamSettings": {
			"network": "ws",
			"wsSettings": {
			    "path": "/xxxxxxx"
			},
			"kcpSettings": {
			  "uplinkCapacity": 50,
			  "downlinkCapacity": 100,
			  "congestion": true,
			  "header": {
				"type": "none"
			  }
			}
	}
  }
  ],
  "outbounds": [{
    "protocol": "freedom",
    "settings": {}
  },{
    "protocol": "blackhole",
    "settings": {},
    "tag": "blocked"
  }],
  "routing": {
    "rules": [
      {
        "type": "field",
        "ip": ["geoip:private"],
        "outboundTag": "blocked"
      }
    ]
  },
 "log": {
  "access": "/var/log/v2ray/access.log",
  "loglevel": "info",
  "error": "/var/log/v2ray/error.log"
 }
}

Config file for client

{
  "dns": {
    "servers": [
      "1.1.1.1"
    ]
  },
  "inbounds": [
    {
      "port": 10808,
      "protocol": "socks",
      "settings": {
        "auth": "noauth",
        "udp": true,
        "userLevel": 8
      },
      "sniffing": {
        "destOverride": [
          "http",
          "tls"
        ],
        "enabled": true
      },
      "tag": "socks"
    },
    {
      "port": 10809,
      "protocol": "http",
      "settings": {
        "userLevel": 8
      },
      "tag": "http"
    }
  ],
  "log": {
    "loglevel": "warning"
  },
  "outbounds": [
    {
      "mux": {
        "enabled": false
      },
      "protocol": "vmess",
      "settings": {
        "vnext": [
          {
            "address": "pjq.me",
            "port": 443,
            "users": [
              {
                "alterId": 64,
                "id": "58ceb1c6-b580-4d2c-bf41-21bxxxxxxxxxx",
                "level": 8,
                "security": "aes-128-gcm"
              }
            ]
          }
        ]
      },
      "streamSettings": {
        "network": "ws",
        "security": "tls",
        "tlssettings": {
          "allowInsecure": true,
          "serverName": ""
        },
        "wssettings": {
          "connectionReuse": true,
          "headers": {
            "Host": ""
          },
          "path": "xxxxx"
        }
      },
      "tag": "proxy"
    },
    {
      "protocol": "freedom",
      "settings": {},
      "tag": "direct"
    },
    {
      "protocol": "blackhole",
      "settings": {
        "response": {
          "type": "http"
        }
      },
      "tag": "block"
    }
  ],
  "policy": {
    "levels": {
      "8": {
        "connIdle": 300,
        "downlinkOnly": 1,
        "handshake": 4,
        "uplinkOnly": 1
      }
    },
    "system": {
      "statsInboundUplink": true,
      "statsInboundDownlink": true
    }
  },
  "routing": {
    "rules": [
      {
         "type": "field",
         "inboundTag": ["dokodemo", "http", "socks"],
         "outboundTag": "proxy"
        }
    ]
  },
  "stats": {},
  "inboundDetour":[
    {
       "protocol":"dokodemo-door",
       "port":1099,
       "tag": "dokodemo",
       "settings":{
          "address":"",
          "network":"tcp",
          "timeout":0,
          "followRedirect":true
       }
     }
  ]
}

v2ray with nginx

- https://tlanyan.me/v2ray-traffic-mask/