Yufu

FreeBSD简单设置websocket+TLS的v2ray

假设远程服务器IP为1.1.1.1,绑定域名example.io

服务端v2ray本地打开1080端口,转发给nginx,server.json如下:

{
	"log": {
		"loglevel": "error",
		"access": "none",
		"error": "/var/log/v2ray.log"
	},
	"inbound": {
		"port": 1080,
		"listen": "127.0.0.1",
		"protocol": "vmess",
		"settings": {
			"clients": [
				{
					"id": "00fcaa23-6563-4255-bc24-34b588553d69",
					"security": "auto",
					"alterId": 0
				}
			]
		},
		"streamSettings": {
			"network": "ws",
			"wsSettings": {
				"path": "/wspath"
			}
		}
	},
	"outbound": {
		"protocol": "freedom",
		"settings": {}
	}
}

本地主机IP为192.168.100.100,打开2000端口,client.json如下:

{
	"log": {
		"loglevel": "warning",
		"access": "none",
		"error": "/var/log/v2ray.log"
	},
	"inbounds": [
		{
			"listen": "192.168.100.100",
			"port": 2000,
			"protocol": "socks",
			"tag": "ser-a"
		}
	],
	"outbounds": [
		{
			"protocol": "vmess",
			"tag": "tun-a",
			"settings": {
				"vnext": [{
					"address": "example.io",
					"port": 443,
					"users": [{
						"id": "00fcaa23-6563-4255-bc24-34b588553d69",
						"security": "auto",
						"alterId": 0
					}]
				}]
			},
			"streamSettings": {
				"network": "ws",
				"security": "tls",
				"wsSettings": {
					"path": "/wspath"
				}
			},
			"mux": {"enabled": true}
		},
		{
			"protocol": "freedom",
			"tag": "direct"
		},
		{
			"protocol": "blackhole",
			"tag": "blocked"
		}
	],
	"dns": {
		"servers": [
			"1.1.1.1",
			"9.9.9.9",
			"localhost"
		]
	},
	"routing": {
		"domainStrategy": "IPOnDemand",
		"rules": [
			{
				"type": "field",
				"outboundTag": "blocked",
				"domain": [
					"geosite:category-ads"
				]
			},
			{
				"type": "field",
				"outboundTag": "direct",
				"ip": [
					"geoip:cn",
					"geoip:private"
				]
			},
			{
				"type": "field",
				"inboundTag": "ser-a",
				"outboundTag": "tun-a"
			}
		]
	}
}