Last active
November 4, 2020 15:06
-
-
Save tranch/6caaf808213cae69a41c64c3728b7ce5 to your computer and use it in GitHub Desktop.
V2ray config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"dns": { | |
"hosts": { | |
"dns.google": "8.8.8.8", | |
"doh.pub": "119.29.29.29" | |
}, | |
"servers": [ | |
"https://dns.google/dns-query", | |
{ | |
"address": "https+local://223.5.5.5/dns-query", | |
"domains": [ | |
"geosite:cn", | |
"geosite:icloud", | |
"full:dl.google.com" | |
], | |
"expectIPs": [ | |
"geoip:cn" | |
] | |
}, | |
{ | |
"address": "https://1.1.1.1/dns-query", | |
"domains": [ | |
"geosite:geolocation-!cn" | |
] | |
} | |
] | |
}, | |
"inbounds": [ | |
{ | |
"listen": "127.0.0.1", | |
"port": 1080, | |
"protocol": "socks", | |
"tag": "Socks-In", | |
"settings": { | |
"auth": "noauth", | |
"udp": true, | |
"ip": "127.0.0.1" | |
} | |
}, | |
{ | |
"listen": "127.0.0.1", | |
"port": 8080, | |
"protocol": "http", | |
"tag": "Http-In", | |
"settings": { | |
"timeout": 0 | |
} | |
} | |
], | |
"outbounds": [ | |
{}, | |
{ | |
"protocol": "dns", | |
"tag": "Dns-Out" | |
}, | |
{ | |
"protocol": "freedom", | |
"tag": "Direct", | |
"settings": { | |
"domainStrategy": "UseIPv4" | |
} | |
}, | |
{ | |
"protocol": "blackhole", | |
"tag": "Reject", | |
"settings": { | |
"response": { | |
"type": "http" | |
} | |
} | |
} | |
], | |
"routing": { | |
"domainStrategy": "IPIfNonMatch", | |
"rules": [ | |
{ | |
"type": "field", | |
"outboundTag": "Direct", | |
"protocol": [ | |
"bittorrent" | |
] | |
}, | |
{ | |
"type": "field", | |
"outboundTag": "Dns-Out", | |
"inboundTag": [ | |
"Socks-In", | |
"Http-In" | |
], | |
"network": "udp", | |
"port": 53 | |
}, | |
{ | |
"type": "field", | |
"outboundTag": "Direct", | |
"ip": [ | |
"223.5.5.5/32", | |
"119.29.29.29/32", | |
"180.76.76.76/32", | |
"114.114.114.114/32", | |
"geoip:cn", | |
"geoip:private" | |
] | |
}, | |
{ | |
"type": "field", | |
"outboundTag": "Direct", | |
"domain": [ | |
"geosite:cn", | |
"full:dl.google.com" | |
] | |
}, | |
{ | |
"type": "field", | |
"outboundTag": "Proxy", | |
"ip": [ | |
"1.1.1.1/32", | |
"1.0.0.1/32", | |
"8.8.8.8/32", | |
"8.8.4.4/32", | |
"geoip:us", | |
"geoip:ca" | |
] | |
}, | |
{ | |
"type": "field", | |
"outboundTag": "Proxy", | |
"domain": [ | |
"geosite:geolocation-!cn" | |
] | |
} | |
] | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
mkdir /usr/local/{etc,share}/v2ray | |
cp ./*.json /usr/local/etc/v2ray | |
cp ./v2{ctl,ray} /usr/local/bin | |
cp ./*.dat /usr/local/share/v2ray |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh /etc/rc.common | |
# V2ray Core Service | |
USE_PROCD=1 | |
start_service() { | |
CONFIG_FILE="/etc/v2ray/config.json" | |
procd_open_instance v2ray | |
procd_set_param command /usr/bin/v2ray -config $CONFIG_FILE | |
procd_set_param env V2RAY_LOCATION_ASSET="/usr/share/v2ray" | |
procd_set_param file $CONFIG_FILE | |
procd_set_param user nobody | |
procd_set_param stdout 1 | |
procd_set_param stderr 1 | |
procd_set_param pidfile /var/run/v2ray.pid | |
procd_close_instance | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/systemd/system/v2ray.service | |
[Unit] | |
Description=V2Ray Service | |
Documentation=https://www.v2fly.org/ | |
After=network.target nss-lookup.target | |
[Service] | |
Environment="V2RAY_LOCATION_ASSET=/usr/local/etc/v2ray" | |
User=nobody | |
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE | |
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE | |
NoNewPrivileges=true | |
ExecStart=/usr/local/bin/v2ray -config /usr/local/etc/v2ray/config.json | |
Restart=on-failure | |
RestartPreventExitStatus=23 | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment