v2fly 服务端
docker-compose.yml
version: '3.1'
services:
v2fly:
image: v2fly/v2fly-core
restart: unless-stopped
ports:
- 12345:12345
volumes:
- ./v2fly:/etc/v2ray
entrypoint: ["v2ray", "run", "-c", "/etc/v2ray/config.json"]
docker swarm
version: '3.8'
services:
v2fly:
image: v2fly/v2fly-core
ports:
- 12345:12345
configs:
- source: v2fly.conf
target: /etc/v2ray/config.json
entrypoint: ["v2ray", "run", "-c", "/etc/v2ray/config.json"]
configs:
v2fly.conf:
file: /root/config/v2fly/config.json
config.json
{
"log": {
"access": "/var/log/v2ray/access.log",
"error": "/var/log/v2ray/error.log",
"loglevel": "warning"
},
"inbound": {
"port": 12345,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "UUID",
"level": 1,
"alterId": 0
}
]
}
},
"outbound": {
"protocol": "freedom",
"settings": {}
},
"inboundDetour": [],
"outboundDetour": [
{
"protocol": "blackhole",
"settings": {},
"tag": "blocked"
}
],
"routing": {
"strategy": "rules",
"settings": {
"rules": [
{
"type": "field",
"ip": [
"0.0.0.0/8",
"10.0.0.0/8",
"100.64.0.0/10",
"127.0.0.0/8",
"169.254.0.0/16",
"172.16.0.0/12",
"192.0.0.0/24",
"192.0.2.0/24",
"192.168.0.0/16",
"198.18.0.0/15",
"198.51.100.0/24",
"203.0.113.0/24",
"::1/128",
"fc00::/7",
"fe80::/10"
],
"outboundTag": "blocked"
}
]
}
}
}
v2fly 客户端
docker-compose.yml
version: '3.1'
services:
v2fly:
image: v2fly/v2fly-core
restart: unless-stopped
network_mode: host
volumes:
- ./v2fly:/etc/v2ray
entrypoint: ["v2ray", "run", "-c", "/etc/v2ray/config.json"]
config.json
{
"log": {
"access": "",
"error": "",
"loglevel": "warning"
},
"inbounds": [
{
"tag": "socks",
"port": 10808,
"listen": "127.0.0.1",
"protocol": "socks",
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
},
"settings": {
"auth": "noauth",
"udp": true,
"allowTransparent": false
}
},
{
"tag": "http",
"port": 10809,
"listen": "127.0.0.1",
"protocol": "http",
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
},
"settings": {
"auth": "noauth",
"udp": true,
"allowTransparent": false
}
}
],
"outbounds": [
{
"tag": "proxy",
"protocol": "vmess",
"settings": {
"vnext": [
{
"address": "IP",
"port": 12345,
"users": [
{
"id": "UUID",
"alterId": 0,
"email": "t@t.tt",
"security": "auto"
}
]
}
]
},
"streamSettings": {
"network": "tcp"
},
"mux": {
"enabled": false,
"concurrency": -1
}
},
{
"tag": "direct",
"protocol": "freedom",
"settings": {}
},
{
"tag": "block",
"protocol": "blackhole",
"settings": {
"response": {
"type": "http"
}
}
}
],
"routing": {
"domainStrategy": "IPIfNonMatch",
"rules": [
{
"type": "field",
"inboundTag": [
"api"
],
"outboundTag": "api",
"enabled": true
},
{
"type": "field",
"outboundTag": "direct",
"domain": [
"domain:example-example.com",
"domain:example-example2.com"
],
"enabled": true
},
{
"type": "field",
"outboundTag": "block",
"domain": [
"geosite:category-ads-all"
],
"enabled": true
},
{
"type": "field",
"outboundTag": "direct",
"domain": [
"geosite:cn"
],
"enabled": true
},
{
"type": "field",
"outboundTag": "direct",
"ip": [
"geoip:private",
"geoip:cn"
],
"enabled": true
},
{
"type": "field",
"port": "0-65535",
"outboundTag": "proxy",
"enabled": true
}
]
}
}