Skip to content

Instantly share code, notes, and snippets.

@iandol
Last active October 13, 2022 20:06
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save iandol/fea0dbcf73347a65f1c766e73461cab7 to your computer and use it in GitHub Desktop.
Save iandol/fea0dbcf73347a65f1c766e73461cab7 to your computer and use it in GitHub Desktop.
V2Ray setup, adds HTTP and SOCKS proxy and more logging (see https://www.v2ray.com/en/configuration/index.html). Another option is to use clash to provide a HTTP to SOCKS proxy https://github.com/Dreamacro/clash
{
"log": {
"logelevel": "info"
},
// Run a local SOCKS proxy for apps to connect to.
"inbounds": [{
"port": 1080,
"listen": "127.0.0.1",
"protocol": "socks",
"sniffing": {
"enabled": true,
"destOverride": ["http", "tls"]
},
"settings": {
"udp": true
}
},
{
"port": 8880,
"listen": "127.0.0.1",
"protocol": "http",
"sniffing": {
"enabled": true,
"destOverride": ["http", "tls"]
},
"settings": {
"allowTransparent": true
}
}],
"outbounds": [{
// Add our v2Ray server as an outbound destination.
"protocol": "vmess",
"settings": {
"vnext": [{
"address": "ip.here",
"port": 443,
"users": [{
"id": "aaaaaaaaaaaaaaaaaaaaaaaaaa-bbbbbbbbbbbbbbbbbb",
"alterId": 0
}]
}]
},
"streamSettings": {
"network": "ws",
"security": "tls",
"tlssettings": {
"allowInsecure": false,
"serverName": "static.cldcdn.net"
},
"wssettings": {
"connectionReuse": true,
"path": "/ray",
"headers": {
"Host": "static.cldcdn.net"
}
}
}
},{
// Add a destination for traffic that should NOT go to the VPN.
"protocol": "freedom",
"tag": "direct",
"settings": {}
}],
"routing": {
"domainStrategy": "IPOnDemand",
"rules": [
{
// Don't send LAN traffic to the VPN.
"ip": ["geoip:private"],
"outboundTag": "direct",
"type": "field"
},
{
// Don't send Chinese IP's to the VPN.
"ip": ["geoip:cn"],
"outboundTag": "direct",
"type": "field"
},
{
// Don't send .cn domains to the VPN.
"domain": ["geosite:cn"],
"outboundTag": "direct",
"type": "field"
}
// Everything else goes to VPN server.
]
}
}
# routes http to socks
port: 8888
log-level: info
proxies:
- name: "socks"
type: socks5
server: 127.0.0.1
port: 1080
rules:
- DOMAIN-SUFFIX,google.com,socks
- DOMAIN-KEYWORD,google,socks
- DOMAIN,google.com,socks
- DOMAIN-SUFFIX,ad.com,REJECT
- SRC-IP-CIDR,192.168.1.201/32,DIRECT
- IP-CIDR,127.0.0.0/8,DIRECT
- MATCH,socks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment