v2ray / v2ray-core

A platform for building proxies to bypass network restrictions.
https://www.v2ray.com/
MIT License
45.44k stars 8.95k forks source link

路由中,同时填入damian和IP 出现错误,单独填写damian 则可以正常运行 #606

Closed Fan-chou closed 7 years ago

Fan-chou commented 7 years ago

当前版本是v2.40 环境是Windows10

{
    "log": {
        "access": "Vaccess.log",
        "error": "Verror.log",
        "loglevel": "info"
    },
    "inbound": {
        "port": 8080,
        "listen": "0.0.0.0",
        "protocol": "http",
        "settings": {
            "auth": "noauth",
            "udp": true,
            "ip": "127.0.0.1",
            "clients": null
        },
        "streamSettings": null
    },
    "outbound": {
        "tag": "direct",
        "protocol": "freedom",
        "settings": {
            "domainStrategy": "AsIs",
            "timeout": 0
        }
    },
    "inboundDetour": [
        {
            "port": 8090,
            "listen": "0.0.0.0",
            "protocol": "socks",
            "settings": {
                "auth": "noauth",
                "udp": true,
                "ip": "127.0.0.1",
                "clients": null
            },
            "streamSettings": null
        }
    ],
    "outboundDetour": [
        {
            "protocol": "blackhole",
            "settings": {
                "response": {
                    "type": "http"
                }
            },
            "tag": "blockout"
        },
        {
            "protocol": "vmess",
            "settings": {
                "vnext": [
                    {
                        "address": "mydomain1.com",
                        "port": 443,
                        "users": [
                            {
                                "id": "********************",
                                "alterId": 30,
                                "security": "aes-128-gcm"
                            }
                        ]
                    },
                    {
                        "address": "mydomain2.com",
                        "port": 443,
                        "users": [
                            {
                                "id": "********************",
                                "alterId": 30,
                                "security": "aes-128-gcm"
                            }
                        ]
                    },
                    {
                        "address": "mydomain3.com",
                        "port": 443,
                        "users": [
                            {
                                "id": "********************",
                                "alterId": 64,
                                "security": "aes-128-gcm"
                            }
                        ]
                    },
                    {
                        "address": "mydomain4.com",
                        "port": 443,
                        "users": [
                            {
                                "id": "********************",
                                "alterId": 30,
                                "security": "aes-128-gcm"
                            }
                        ]
                    }
                ]
            },
            "streamSettings": {
                "network": "tcp",
                "security": "tls"
            },
            "tag": "daili"
        }
    ],
    "dns": {
        "servers": [
            "8.8.8.8",
            "8.8.4.4",
            "localhost"
        ]
    },
    "routing": {
        "strategy": "rules",
        "settings": {
            "domainStrategy": "IPIfNonMatch",
            "rules": [
                {
                    "type": "field",
                    "port": null,
                    "outboundTag": "daili",
                    "ip": [
                        "91.108.56.0/22",
                        "91.108.4.0/22",
                        "109.239.140.0/24",
                        "49.154.160.0/20"
                    ],
                    "domain": [
                        "doub.io",
                        "domain:twitch.tv",
                        "ipip.net",
                        "www.google.com",
                        "www.youtube.com",
                        "youtu.be",
                        "domain:telegram.org",
                        "domain:facebook.com",
                        "domain:twitter.com",
                        "domain:spotify.com",
                        "domain:googlesyndication.com",
                        "regexp:\\.goo.*\\.com$",
                        "domain:storage.live.com",
                        "domain:onedrive.com",
                        "securepubads.g.doubleclick.net",
                        "tdesktop.com"
                    ]
                },
                {
                    "type": "field",
                    "port": null,
                    "outboundTag": "blockout",
                    "ip": null,
                    "domain": [
                        "domain:registeridm.com",
                        "domain:internetdownloadmanager.com",
                        "domain:googleservices.com",
                        "bs.serving-sys.com",
                        "adclick.g.doubleclick.net",
                        "pagead2.googlesyndication.com"
                    ]
                },
                {
                    "type": "chinaip",
                    "port": null,
                    "outboundTag": "direct",
                    "ip": null,
                    "domain": null
                }
            ]
        }
    }
}

以上是config.json的部分,如是去除唯一的Ip数组,则可以准确的进行路由功能。 以下是同时填入damian和IP运行的日志文件

2017/10/14 01:24:05 [Info]Transport|Internet|TCP: listening TCP on 0.0.0.0:8080
2017/10/14 01:24:05 [Info]Transport|Internet|TCP: listening TCP on 0.0.0.0:8090
2017/10/14 01:24:05 [Info]Transport|Internet|UDP: listening UDP on 0.0.0.0:8090
2017/10/14 01:24:05 [Warning]Core: V2Ray started
2017/10/14 01:24:07 [Info]Proxy|HTTP: request to Method [CONNECT] Host [www.google.com.hk:443] with URL [//www.google.com.hk:443]
2017/10/14 01:24:07 [Info]App|Router: looking up IP for tcp:www.google.com.hk:443
2017/10/14 01:24:07 [Debug]App|DNS|Server: add pending request id 13863
2017/10/14 01:24:07 [Debug]Transport|Internet|UDP: dispatch request to: udp:8.8.8.8:53
2017/10/14 01:24:07 [Info]Transport|Internet|UDP: establishing new connection for udp:8.8.8.8:53
2017/10/14 01:24:07 [Info]App|Dispatcher|Default: default route for udp:8.8.8.8:53
2017/10/14 01:24:07 [Info]Proxy|Freedom: opening connection to udp:8.8.8.8:53
2017/10/14 01:24:07 [Debug]App|DNS|Server: handling response for id 13863 content: ;; opcode: QUERY, status: NOERROR, id: 13863
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.google.com.hk. IN   A

;; ANSWER SECTION:
www.google.com.hk.  69  IN  A   243.185.187.39

2017/10/14 01:24:07 [Debug]App|DNS|Server: returning 1 IPs for domain www.google.com.hk.
2017/10/14 01:24:07 [Info]App|Dispatcher|Default: default route for tcp:www.google.com.hk:443
2017/10/14 01:24:07 [Info]Proxy|Freedom: opening connection to tcp:www.google.com.hk:443
2017/10/14 01:24:07 [Info]Transport|Internet|TCP: dailing TCP to tcp:www.google.com.hk:443
2017/10/14 01:24:07 [Debug]App|DNS|Server: handling response for id 13863 content: ;; opcode: QUERY, status: NOERROR, id: 13863
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.google.com.hk. IN   A

;; ANSWER SECTION:
www.google.com.hk.  134 IN  A   208.101.21.43

2017/10/14 01:24:07 [Debug]App|DNS|Server: handling response for id 13863 content: ;; opcode: QUERY, status: NOERROR, id: 13863
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.google.com.hk. IN   A

;; ANSWER SECTION:
www.google.com.hk.  113 IN  CNAME   www-wide.l.google.com.
www-wide.l.google.com.  113 IN  A   74.125.204.199

2017/10/14 01:24:08 [Info]App|Proxyman|Outbound: failed to process outbound traffic > Proxy|Freedom: connection ends > context canceled
DarienRaymond commented 7 years ago

在一个路由项中同时写入ip和domain,表示该项在同时匹配ip和domain时才会生效,这基本上是不可能的。如果要达到ip或domain的情况,请分别写两个路由项。