Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
eycorsican committed Feb 24, 2019
1 parent 9fa17a7 commit e233573
Showing 1 changed file with 52 additions and 61 deletions.
113 changes: 52 additions & 61 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,51 @@ Github Releases: https://github.com/eycorsican/Kitsunebi4Android/releases
- App 使用较新的 v2ray-core 版本,你或许需要确保服务端也升级到相应的版本,具体版本号请看 Release Notes
- 把配置文件复制粘贴至主界面后,点击连接按钮即可启动
- 配置文件的 freedom outbound 推荐使用 [`UseIP` 策略](https://www.v2ray.com/chapter_02/protocols/freedom.html#outboundconfigurationobject)
- 配置文件不需要有 inbound,app 使用了 `tun2socks` 作为 inbound,并已开启 [http,tls 流量嗅探](https://www.v2ray.com/chapter_02/01_overview.html#sniffingobject)
- 设备所有 DNS 请求均会由 V2Ray 的 [DNS 服务器](https://www.v2ray.com/chapter_02/04_dns.html) 来解析,正确设置了 DNS 服务器可以避免 DNS 污染以及 CDN 相关的 DNS 问题
- 配置文件不需要有 inbound,app 使用了 `tun2socks` 作为 inbound,默认开启 [http,tls 流量嗅探](https://www.v2ray.com/chapter_02/01_overview.html#sniffingobject) ,默认的标识(tag)为 "tun2socks"
- 关于 DNS 污染等问题,可以通过配置 V2Ray 的 DNS outbound 来解决,可在路由里添加一条识别出来自 tun2socks 的 DNS 流量,并转给 DNS outbound,具体请参考下面配置例子
- 下面是一个可以拿来日常使用的配置模板,在 `outbounds` 中替换上你的服务器信息即可,其中的路由规则和 DNS 规则从这个 [规则集文件](https://github.com/eycorsican/rule-sets/blob/master/kitsunebi_default.conf) 生成:
```json
{
"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": [
{
"mux": {
"concurrency": 8,
"enabled": false
},
"protocol": "vmess",
"settings": {
"vnext": [
{
"address": "yourserver.com",
"address": "1.2.3.4",
"port": 10086,
"users": [
{
"alterId": 10,
"security": "chacha20-poly1305",
"id": "xxxx-xxx-xx-xx-x-xx"
"id": "0e8575fb-a71f-455b-877f-b74e19d3f495"
}
]
}
Expand All @@ -53,70 +76,40 @@ Github Releases: https://github.com/eycorsican/Kitsunebi4Android/releases
{
"protocol": "freedom",
"settings": {
"userLevel": 2018,
"domainStrategy": "UseIP"
},
"streamSettings": {},
"tag": "direct"
},
{
"tag": "block",
"protocol": "blackhole",
"settings": {}
}
"settings": {},
"tag": "block"
},
{
"protocol": "dns",
"tag": "dns-out"
}
],
"policy": {
"levels": {
"0": {
"uplinkOnly": 0,
"bufferSize": 4096,
"connIdle": 30,
"downlinkOnly": 0,
"connIdle": 5,
"handshake": 4
},
"2018": {
"uplinkOnly": 0,
"downlinkOnly": 0,
"connIdle": 5,
"handshake": 4
"handshake": 4,
"uplinkOnly": 0
}
}
},
"dns": {
"hosts": {
"localhost": "127.0.0.1"
},
"servers": [
"223.5.5.5",
"114.114.114.114",
{
"address": "8.8.8.8",
"port": 53,
"domains": [
"google",
"android",
"fbcdn",
"facebook",
"domain:fb.com",
"instagram",
"whatsapp",
"akamai",
"domain:line-scdn.net",
"domain:line.me",
"domain:naver.jp"
]
},
"8.8.4.4"
],
"clientIp": "115.239.211.92"
},
"inbounds": [],
"routing": {
"domainStrategy": "IPIfNonMatch",
"rules": [
{
"domain": [
"domain:doubleclick.net"
],
"outboundTag": "block",
"inboundTag": ["tun2socks"],
"network": "udp",
"port": 53,
"outboundTag": "dns-out",
"type": "field"
},
{
Expand Down Expand Up @@ -149,9 +142,9 @@ Github Releases: https://github.com/eycorsican/Kitsunebi4Android/releases
"type": "field"
},
{
"type": "field",
"outboundTag": "direct",
"port": "123"
"port": "123",
"type": "field"
},
{
"domain": [
Expand Down Expand Up @@ -216,21 +209,19 @@ Github Releases: https://github.com/eycorsican/Kitsunebi4Android/releases
"type": "field"
}
],
"domainStrategy": "IPIfNonMatch",
"strategy": "rules"
}
}
```

## Build

You must first build/download the `tun2socks.aar` library from [this repo](https://github.com/eycorsican/go-tun2socks-android/releases) and copy into `app/libs`, get `geoip.dat` and `geosite.dat` from [these](https://github.com/v2ray/geoip/releases) [two](https://github.com/v2ray/domain-list-community/releases) repos and copy them into `app/src/main/res/raw`, don't forget renaming them.
You must first build/download the `tun2socks.aar` library from [here](https://github.com/eycorsican/kitsunebi-android/releases) and copy into `app/libs`, get `geoip.dat` and `geosite.dat` from [these](https://github.com/v2ray/geoip/releases) [two](https://github.com/v2ray/domain-list-community/releases) repos and copy them into `app/src/main/res/raw`, don't forget renaming them.

## 开发相关问题

这个 V2Ray Android 客户端利用 `go-tun2socks` 把所有的 TCP/UDP 流量转给到 V2Ray 处理,所用的 `v2ray-core` 是没经过任何修改的官方版本,所以在配置和体验方面不会有太大差别。但在 Android 上有一些东西需要特殊处理,这也是在配置和使用上造成一些差别的地方。

- UDP 流量在转给 V2Ray 之前,会先在 `go-tun2socks` 里面经过一个嗅探步骤,如果嗅探出来是 DNS 流量,这些 UDP 流量就不会直接转给 V2Ray,而是把其中需要解析的域名抽取出来再通过 V2Ray 的 DNS 去解析,这时 V2Ray 所用的 DNS 服务器是按照配置文件上的配置来选取,也就是说所用的 DNS 服务器不需要跟原来 UDP 流量的目的地址相同。
- 在 Android 上有几个情况会造成流量/请求的死循环,目前就我所知的有以下几个:
- 通过 VpnService 的 TUN 接口读取数据,再由代理程序代为发出时,如果不 [protect](https://developer.android.com/reference/android/net/VpnService#protect(int)) 代理程序用来发数据的 socket fd,代理程序发出的数据又会被转到 TUN 接口上,这个问题基本可以用 v2ray-core 提供的 `RegisterDialerController()``RegisterListenerController()` 两个接口完美解决
- 还有一些由 Go 的 [net.DefaultResolver](https://golang.org/src/net/lookup.go#L102) 所发出的 DNS 查询流量没有被 protect 起来,在一些特定的情况下也有可能引起死循环

0 comments on commit e233573

Please sign in to comment.