v2ray 国内国外 自动分流 - fbion/macos.safe GitHub Wiki

{

"log": {
  "loglevel": "debug",
  "access": "access.log",
  "error": "error.log"
},

// 自定义dns为了让v2使用指定的dns去解析

 "dns": {
   "hosts": {      
   "e.crashlytics.com": "127.0.0.1",
   "mazu.m.qq.com": "127.0.0.1"
 },

  "servers": [
    {
      "address": "127.0.0.1",
      "port": 53,
      "domains": [
        "geosite:cn"
      ],
      "expectIPs": [
        "geoip:cn"
      ]
    },
    {
      "address": "8.8.8.8",
      "port": 53,
      "domains": [
       "google",
       "domain:line.me",
        "geosite:geolocation-!cn",
        "geosite:speedtest",
        "ext:h2y.dat:gfw"
      ]
    },

    "192.168.1.1"
  ]
},

 "inbounds": [
   {
   "port": 1080,
   "protocol": "socks",
   "listen": "127.0.0.1",
   //"listen": "0.0.0.0",

   "sniffing": {
       "enabled": true,
       "destOverride": ["http", "tls"]
     },

   "settings": {
     "auth": "noauth",
     "timeout": 0,
     "udp": true,
     "ip": "127.0.0.1"
   }
   } 
 ],

 "outbounds": 
 [

   {
   "protocol": "vmess",
   "settings": {
     "vnext": [
       {
         "address": "127.0.0.1",
         "port": 5555,
         "users": [
           {
             "id": "0e896190-c32d-4f7c-86b7-5238fa4bc2f6",
             "alterId": 64,
             "security": "aes-128-gcm"
           }
         ]
       }
     ]
   },
   "tag": "ipv6.jp",
   "mux": {
     "enabled": false
   },
   "streamSettings":{
     "network":"kcp",
     "kcpSettings": {
       "mtu": 1200,
       "tti": 20,
       "uplinkCapacity": 1,
       "downlinkCapacity": 100,
       "congestion": false,
       "readBufferSize": 1,
       "writeBufferSize": 1,
       "header": {
         "type": "wechat-video"
       }
     }
   }
 },

 {
     "protocol": "freedom",
     "settings": {
       //"domainStrategy": "UseIP"
     },
     "tag": "direct2" //如果要使用路由,这个 tag 是一定要有的,在这里 direct 就是 freedom 的一个标号,在路由中说 direct V2Ray 就知道是这里的 freedom 了
   },

   {
     "protocol": "blackhole",
     "settings": {},
     "tag": "myblock"//同样的,这个 tag 也是要有的,在路由中说 adblock 就知道是这里的 blackhole(黑洞) 了
   },
   {
     "protocol": "blackhole",
     "settings": {},
     "tag": "adblock"//同样的,这个 tag 也是要有的,在路由中说 adblock 就知道是这里的 blackhole(黑洞) 了
   }

 ],

 "routing": {
   "domainStrategy": "IPIfNonMatch",
   "rules": [

     {

       "ip": [
         "198.18.0.0/16",
         "192.168.1.253/16",
         "127.0.0.1"

       ],
       "network": "tcp,udp",
       "type": "field",
       "outboundTag": "direct2"

     },

     {

       "ip": [
         "8.8.8.8",
         "1.1.1.1"

       ],
       "network": "tcp,udp",
       "type": "field",
       "outboundTag": "ipv6.jp"

     },

     {
       "type": "field",
       "outboundTag": "adblock", // freedom 的 tag
       "domain": ["geosite:category-ads-all"] // ads网站
     },

     {
    "type": "field",
    "outboundTag": "myblock", //拦截广告相关域名
    "domain": [
        "ext:h2y.dat:ad"
    ]
   },

   {
       "domain": [
         "pos.baidu.com",
         "dup.baidustatic.com",
         "cpro.baidustatic.com",
         "eclick.baidu.com",
         "hm.baidu.com"
       ],
       "type": "field",
       "outboundTag": "myblock"       
     },

     {
       "domain": [
         "domain:googlevideo.com",
         "domain:akamaized.net",
         "video.twimg.com"
       ],
       "type": "field",
       "outboundTag": "ipv6.jp"
     },

     {
       "domain": [

“domain:wp.com”, “domain:ytimg.com”,

        "ipv6.google.com"
      ],
      "type": "field",
      "outboundTag": "ipv6.jp"
    },

    {
      "type": "field",
      "outboundTag": "ipv6.jp",
      "domain": [
      "geosite:geolocation-!cn",
      "geosite:google",
      "geosite:facebook",
      "ext:h2y.dat:gfw"

      ]
    },

    {
      "type": "field",
      "outboundTag": "direct2", // freedom 的 tag
      "domain": [
        "geosite:cn"
        ]
    },

    {
      "type": "field",
      "outboundTag": "direct2", // freedom 的 tag
      "ip": [
        "geoip:cn",
        "geoip:private"
        ] // 中国大陆ip网站
    }

  ],
  "strategy": "rules"
}

}

⚠️ **GitHub.com Fallback** ⚠️