eycorsican/kitsunebi-android: A fully-featured V2Ray client for Android.
2019-04-15 15:38:40 Author: github.com(查看原文) 阅读量:793 收藏

A fully-featured V2Ray client for Android.

Kitsunebi 使用的 Core 扩展了 v2ray-core 的功能,新增根据节点延迟值来选择最快速节点的策略,图形界面上可以添加节点组来开启,使用自定义配置的话,有以下配置项,所有时间数值单位为秒:

{
    "tag": "proxy",
    "selector": [
        "primary_proxy",
        "backup_proxy"
    ],
    "strategy": "latency",
    "interval": 60, // 每次测速之间的最少时间间隔
    "totalMeasures": 3, // 每次测速中对每个 outbound 所做的请求次数
    "delay": 1, // 每个测速请求之间的时间间隔
    "timeout": 4, // 测速请求的超时时间
    "probeTarget": "tcp:www.google.com:80", // 测速请求发送的目的地
    "probeContent": "HEAD / HTTP/1.1\r\n\r\n" // 测速请求内容
}

延迟测试并非 ICMP Ping 或 TCP Ping,所用的方法跟负载均衡中的 latency 策略所用的方法大致一样,实际向 outbound 发送一个代理请求,记录返回非空数据所使用的时间。

需要注意的是 延迟速度 并不是同一个概念,比如说同一个服务器上使用 QUIC 的 outbound 和一个使用 TCP 的 outbound,QUIC outbound 一般会有较低的延迟,但实际速度有可能比 TCP 慢。

自 v1.0.0 起,默认的 DNS 处理方式为 Fake DNS,启用 Fake DNS 后,DNS 请求的流量几乎不会被传进 V2Ray,所以 V2Ray 的 内置 DNSDNS outbound 配置不会起太大作用;当 Fake DNS 处于禁用状态,DNS 请求的流量会以正常 UDP 流量的形式进入 V2Ray,这时你可以使用 inbound tag 在路由中配置路由规则来识别出相应 DNS 流量,从而转发给 DNS outbound,从而让 V2Ray 的 内置 DNS 来处理(看下面配置示例)。如果使用自定义配置的同时开启 Fake DNS,则需要确保 freedom outbound 中的域名策略为 非 AsIs

为什么启用了 Fake DNS 后,freedom outbound 一定要用 非 AsIs 策略呢?如果你不熟悉 Fake DNS 怎么工作,可以看看 这篇文章。 启用 Fake DNS 后,本地的系统 DNS 缓存是被染污了的,如果 freedom outbound 用了 AsIs,对于那些非代理的域名请求,到了 freedom outbound 的时候,如果用系统 DNS 去解析(AsIs 策略),得到的 DNS 结果将会是被染污了不可用的 IP,会导致直连的请求发不出去。为了避免这个问题,方法就是让 freedom outbound 不使用系统的 DNS,也即不使用 AsIs,转而使用 V2Ray 的 内置 DNSUseIP 策略)。

{
    "dns": {
        "clientIp": "115.239.211.92",
        "hosts": {
            "localhost": "127.0.0.1"
        },
        "servers": [
            "114.114.114.114",
            {
                "address": "8.8.8.8",
                "domains": [
                    "google",
                    "android",
                    "fbcdn",
                    "facebook",
                    "domain:fb.com",
                    "instagram",
                    "whatsapp",
                    "akamai",
                    "domain:line-scdn.net",
                    "domain:line.me",
                    "domain:naver.jp"
                ],
                "port": 53
            }
        ]
    },
    "log": {
        "loglevel": "warning"
    },
    "outbounds": [
        {
            "protocol": "vmess",
            "settings": {
                "vnext": [
                    {
                        "address": "1.2.3.4",
                        "port": 10086,
                        "users": [
                            {
                                "id": "0e8575fb-a71f-455b-877f-b74e19d3f495"
                            }
                        ]
                    }
                ]
            },
            "streamSettings": {
                "network": "tcp"
            },
            "tag": "proxy"
        },
        {
            "protocol": "freedom",
            "settings": {
                "domainStrategy": "UseIP"
            },
            "streamSettings": {},
            "tag": "direct"
        },
        {
            "protocol": "blackhole",
            "settings": {},
            "tag": "block"
        },
	{
	    "protocol": "dns",
	    "tag": "dns-out"
	}
    ],
    "policy": {
        "levels": {
            "0": {
                "bufferSize": 4096,
                "connIdle": 30,
                "downlinkOnly": 0,
                "handshake": 4,
                "uplinkOnly": 0
            }
        }
    },
    "routing": {
        "domainStrategy": "IPIfNonMatch",
        "rules": [
            {
                "inboundTag": ["tun2socks"],
                "network": "udp",
                "port": 53,
                "outboundTag": "dns-out",
                "type": "field"
            },
            {
                "domain": [
                    "domain:setup.icloud.com"
                ],
                "outboundTag": "proxy",
                "type": "field"
            },
            {
                "ip": [
                    "8.8.8.8/32",
                    "8.8.4.4/32",
                    "1.1.1.1/32",
                    "1.0.0.1/32",
                    "9.9.9.9/32",
                    "149.112.112.112/32",
                    "208.67.222.222/32",
                    "208.67.220.220/32"
                ],
                "outboundTag": "proxy",
                "type": "field"
            },
            {
                "ip": [
                    "geoip:cn",
                    "geoip:private"
                ],
                "outboundTag": "direct",
                "type": "field"
            },
            {
                "outboundTag": "direct",
                "port": "123",
                "type": "field"
            },
            {
                "domain": [
                    "domain:pstatp.com",
                    "domain:snssdk.com",
                    "domain:toutiao.com",
                    "domain:ixigua.com",
                    "domain:apple.com",
                    "domain:crashlytics.com",
                    "domain:icloud.com",
                    "cctv",
                    "umeng",
                    "domain:weico.cc",
                    "domain:jd.com",
                    "domain:360buy.com",
                    "domain:360buyimg.com",
                    "domain:douyu.tv",
                    "domain:douyu.com",
                    "domain:douyucdn.cn",
                    "geosite:cn"
                ],
                "outboundTag": "direct",
                "type": "field"
            },
            {
                "ip": [
                    "149.154.167.0/24",
                    "149.154.175.0/24",
                    "91.108.56.0/24",
                    "125.209.222.0/24"
                ],
                "outboundTag": "proxy",
                "type": "field"
            },
            {
                "domain": [
                    "twitter",
                    "domain:twimg.com",
                    "domain:t.co",
                    "google",
                    "domain:ggpht.com",
                    "domain:gstatic.com",
                    "domain:youtube.com",
                    "domain:ytimg.com",
                    "pixiv",
                    "domain:pximg.net",
                    "tumblr",
                    "instagram",
                    "domain:line-scdn.net",
                    "domain:line.me",
                    "domain:naver.jp",
                    "domain:facebook.com",
                    "domain:fbcdn.net",
                    "pinterest",
                    "github",
                    "dropbox",
                    "netflix",
                    "domain:medium.com",
                    "domain:fivecdm.com"
                ],
                "outboundTag": "proxy",
                "type": "field"
            }
        ],
        "strategy": "rules"
    }
}

文章来源: https://github.com/eycorsican/kitsunebi-android
如有侵权请联系:admin#unsafe.sh