Skip to content

Commit

Permalink
add v2ray config example
Browse files Browse the repository at this point in the history
  • Loading branch information
fancy committed May 1, 2020
1 parent f55b09e commit 5c16fdf
Show file tree
Hide file tree
Showing 22 changed files with 259 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
build
.directory
.vscode
v2ray_config/proxy
v2ray_config/06_outbounds_proxy.json
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.10)

project(cgproxy VERSION 3.4)
project(cgproxy VERSION 3.5)
add_executable(cgattach cgattach.cpp)

install(TARGETS cgattach DESTINATION /usr/bin
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ sudo systemctl restart cgproxy.service
## TIPS

- `systemd-cgls` to see the cgroup hierarchical tree.

- v2ray full config exmaple in [v2ray_buid](https://github.com/springzfx/cgproxy/tree/master/v2ray_buid), more to see [v2ray multi-file config](https://www.v2fly.org/chapter_02/multiple_config.html)
- Qv2ray config example


Expand Down
5 changes: 5 additions & 0 deletions v2ray_config/00_log.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"log": {
"loglevel": "debug"
}
}
10 changes: 10 additions & 0 deletions v2ray_config/01_api.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"api": {
"services": [
"HandlerService",
"LoggerService",
"StatsService"
],
"tag": "API"
}
}
19 changes: 19 additions & 0 deletions v2ray_config/02_dns.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"dns": {
"servers": [
{
"address": "localhost",
"port": 53,
"domains": [
"geosite:cn"
],
"expectIPs": [
"geoip:cn"
]
},
"https+local://1.1.1.1/dns-query",
"223.6.6.6"
],
"tag": "dns_inbound"
}
}
60 changes: 60 additions & 0 deletions v2ray_config/03_routing.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"routing": {
"domainStrategy": "IPIfNonMatch",
"rules": [
{
"outboundTag": "dns-out",
"port": "53",
"type": "field"
},
{
"domain": [
"geosite:google",
"geosite:github",
"geosite:netflix",
"geosite:steam",
"geosite:telegram",
"geosite:tumblr",
"geosite:bbc"
],
"outboundTag": "outBound_PROXY",
"type": "field"
},
{
"ip": [
"geoip:private"
],
"outboundTag": "outBound_DIRECT",
"type": "field"
},
{
"domain": [
"geosite:category-ads-all"
],
"outboundTag": "outBound_BLACKHOLE",
"type": "field"
},
{
"ip": [
"geoip:cn"
],
"outboundTag": "outBound_DIRECT",
"type": "field"
},
{
"domain": [
"geosite:cn"
],
"outboundTag": "outBound_DIRECT",
"type": "field"
},
{
"inboundTag": [
"inbound_API"
],
"outboundTag": "API",
"type": "field"
}
]
}
}
8 changes: 8 additions & 0 deletions v2ray_config/04_policy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"policy": {
"system": {
"statsInboundDownlink": true,
"statsInboundUplink": true
}
}
}
14 changes: 14 additions & 0 deletions v2ray_config/05_inbounds_api.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"inbounds": [
{
"listen": "127.0.0.1",
"port": 15490,
"protocol": "dokodemo-door",
"settings": {
"address": "127.0.0.1"
},
"sniffing": {},
"tag": "inbound_API"
}
]
}
13 changes: 13 additions & 0 deletions v2ray_config/05_inbounds_http.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"inbounds": [
{
"listen": "127.0.0.1",
"port": 8888,
"protocol": "http",
"sniffing": {
"enabled": false
},
"tag": "http_IN"
}
]
}
17 changes: 17 additions & 0 deletions v2ray_config/05_inbounds_socks5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"inbounds": [
{
"listen": "127.0.0.1",
"port": 1080,
"protocol": "socks",
"settings": {
"auth": "noauth",
"userLevel": 0
},
"sniffing": {
"enabled": false
},
"tag": "socks_IN"
}
]
}
30 changes: 30 additions & 0 deletions v2ray_config/05_inbounds_tproxy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"inbounds": [
{
"listen": "0.0.0.0",
"port": 12345,
"protocol": "dokodemo-door",
"settings": {
"address": "",
"followRedirect": true,
"network": "tcp,udp",
"port": 0,
"timeout": 0,
"userLevel": 0
},
"sniffing": {
"destOverride": [
"http",
"tls"
],
"enabled": true
},
"streamSettings": {
"sockopt": {
"tproxy": "tproxy"
}
},
"tag": "tproxy_IN"
}
]
}
19 changes: 19 additions & 0 deletions v2ray_config/06_outbounds_blackhole.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"outbounds": [
{
"protocol": "blackhole",
"sendThrough": "0.0.0.0",
"settings": {
"response": {
"type": "none"
}
},
"streamSettings": {
"sockopt": {
"mark": 255
}
},
"tag": "outBound_BLACKHOLE"
}
]
}
13 changes: 13 additions & 0 deletions v2ray_config/06_outbounds_dns.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"outbounds": [
{
"protocol": "dns",
"streamSettings": {
"sockopt": {
"mark": 255
}
},
"tag": "dns-out"
}
]
}
19 changes: 19 additions & 0 deletions v2ray_config/06_outbounds_freedom.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"outbounds": [
{
"protocol": "freedom",
"sendThrough": "0.0.0.0",
"settings": {
"domainStrategy": "UseIP",
"redirect": ":0",
"userLevel": 0
},
"streamSettings": {
"sockopt": {
"mark": 255
}
},
"tag": "outBound_DIRECT"
}
]
}
1 change: 1 addition & 0 deletions v2ray_config/06_outbounds_myproxy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions v2ray_config/07_transport.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
3 changes: 3 additions & 0 deletions v2ray_config/08_stats.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"stats": {}
}
1 change: 1 addition & 0 deletions v2ray_config/09_reverse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
2 changes: 2 additions & 0 deletions v2ray_config/merge.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
jq -rs 'reduce .[] as $item ({}; . + $item + {inbounds: (.inbounds + $item.inbounds)} + {outbounds: ($item.outbounds + .outbounds)})' *.json |sudo tee /etc/v2ray/config.json
1 change: 1 addition & 0 deletions v2ray_config/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fill `06_outbounds_myproxy.json` with your vmess proxy config with tag `outBound_PROXY`.
19 changes: 19 additions & 0 deletions v2ray_config/v2ray.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[Unit]
Description=V2Ray - A unified platform for anti-censorship
Documentation=https://v2ray.com https://guide.v2fly.org
After=network.target nss-lookup.target
Wants=network-online.target

[Service]
Type=simple
User=nobody
#AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
NoNewPrivileges=yes
ExecStart=+/usr/lib/v2ray/v2ray -config /etc/v2ray/config.json
Restart=on-failure
# Don't restart in the case of configuration error
RestartPreventExitStatus=23

[Install]
WantedBy=multi-user.target

0 comments on commit 5c16fdf

Please sign in to comment.