v2ray / v2ray-core

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

调用API删除用户成功,但用户仍可以连接 #2346

Closed zmaplex closed 4 years ago

zmaplex commented 4 years ago

Please read the instruction and answer the following questions before submitting your issue. Thank you. Please answer all the questions with enough information. All issues not following this template will be closed immediately. If you are not sure if your question is truely a bug in V2Ray, please discuss it here first.

1) What version of V2Ray are you using (If you deploy different version on server and client, please explicitly point out)?

/usr/bin/v2ray/v2ray -version
V2Ray 4.22.1 (V2Fly, a community-driven edition of V2Ray.) Custom (go1.13.5 linux/amd64)
A unified platform for anti-censorship.

2) What's your scenario of using V2Ray? E.g., Watching YouTube videos in Chrome via Socks/VMess proxy.

运行环境

本地虚拟机搭建 V2ray 服务端,物理机运行客户端。 使用场景

全局代理,并确认浏览器走的是代理。

通过 API 向服务端添加一个用户,客户端连接正常。

正常观看腾讯视频五分钟后,

通过 API 删除当前用户,十分钟过后,客户端仍可以连接,依旧可以刷新网页,上百度等网页。

3) What did you see? (Please describe in detail, such as timeout, fake TLS certificate etc)

通过 API 删除用户,十分钟后用户仍可以连接。

4) What's your expectation?

拒绝用户连接

5) Please attach your configuration file (Mask IP addresses before submit this issue).

Server configuration:

{

    "log": {
        "access": "/var/log/v2ray/access.log",
        "error": "/var/log/v2ray/error.log",
        "loglevel": "warning"
    },
    "dns": {},
    "stats": {},
    "api": {
        "tag": "api",
        "services": [
            "HandlerService",
            "StatsService"
        ]
    },

    "inbounds": [
        {
            "port": 448,
            "protocol": "vmess",
            "settings": {
                "clients": [
                    {
                        "id": "b4916a4c-5886-4549-acdd-2b7fa41fab68",
                        "alterId": 32
                    }
                ]
            },
            "tag": "in-0",
            "streamSettings": {
                "network": "tcp",
                "security": "tls",
                "tcpSettings": {},
                "tlsSettings": {
                    "certificates": [
                        {
                            "certificateFile": "/etc/v2ray/public.pem",
                            "keyFile": "/etc/v2ray/private.key"
                        }
                    ]
                }
            }
        },
        {
            "listen": "127.0.0.1",
            "port": 8899,
            "protocol": "dokodemo-door",
            "settings": {
                "address": "127.0.0.1"
            },
            "tag": "api"
        }
    ],
    "outbounds": [
        {
            "tag": "direct",
            "protocol": "freedom",
            "settings": {}
        },
        {
            "tag": "blocked",
            "protocol": "blackhole",
            "settings": {}
        }
    ],
    "routing": {
        "settings": {
            "rules": [
                {
                    "inboundTag": [
                        "api"
                    ],
                    "outboundTag": "api",
                    "type": "field"
                }
            ]
        },
        "strategy": "rules"
    },
    "policy": {
        "levels": {
            "0": {
                "statsUserUplink": true,
                "statsUserDownlink": true
            }
        },
        "system": {
            "statsInboundUplink": true,
            "statsInboundDownlink": true
        }
    },
    "reverse": {},
    "transport": {}
}

Client configuration:

{
  "policy": {
    "system": {
      "statsInboundUplink": true,
      "statsInboundDownlink": true
    }
  },
  "log": {
    "access": "",
    "error": "",
    "loglevel": "info"
  },
  "inbounds": [
    {
      "tag": "proxy",
      "port": 10808,
      "listen": "0.0.0.0",
      "protocol": "socks",
      "sniffing": {
        "enabled": false,
        "destOverride": [
          "http",
          "tls"
        ]
      },
      "settings": {
        "auth": "noauth",
        "udp": false,
        "ip": null,
        "address": null,
        "clients": null
      },
      "streamSettings": null
    },
    {
      "tag": "api",
      "port": 10642,
      "listen": "127.0.0.1",
      "protocol": "dokodemo-door",
      "sniffing": null,
      "settings": {
        "auth": null,
        "udp": false,
        "ip": null,
        "address": "127.0.0.1",
        "clients": null
      },
      "streamSettings": null
    }
  ],
  "outbounds": [
    {
      "tag": "proxy",
      "protocol": "vmess",
      "settings": {
        "vnext": [
          {
            "address": "192.168.123.25",
            "port": 448,
            "users": [
              {
                "id": "b751a55efa8c46538e9984e954ddf6af",
                "alterId": 64,
                "email": "t@t.tt",
                "security": "auto"
              }
            ]
          }
        ],
        "servers": null,
        "response": null
      },
      "streamSettings": {
        "network": "tcp",
        "security": "tls",
        "tlsSettings": {
          "allowInsecure": true,
          "serverName": null
        },
        "tcpSettings": null,
        "kcpSettings": null,
        "wsSettings": null,
        "httpSettings": null,
        "quicSettings": null
      },
      "mux": {
        "enabled": false,
        "concurrency": -1
      }
    },
    {
      "tag": "direct",
      "protocol": "freedom",
      "settings": {
        "vnext": null,
        "servers": null,
        "response": null
      },
      "streamSettings": null,
      "mux": null
    },
    {
      "tag": "block",
      "protocol": "blackhole",
      "settings": {
        "vnext": null,
        "servers": null,
        "response": {
          "type": "http"
        }
      },
      "streamSettings": null,
      "mux": null
    }
  ],
  "stats": {},
  "api": {
    "tag": "api",
    "services": [
      "StatsService"
    ]
  },
  "dns": {
    "servers": [
      "8.8.8.8"
    ]
  },
  "routing": {
    "domainStrategy": "IPIfNonMatch",
    "rules": [
      {
        "type": "field",
        "port": null,
        "inboundTag": [
          "api"
        ],
        "outboundTag": "api",
        "ip": null,
        "domain": null
      },
      {
        "type": "field",
        "port": null,
        "inboundTag": null,
        "outboundTag": "proxy",
        "ip": null,
        "domain": [
          "geosite:google",
          "geosite:github",
          "geosite:netflix",
          "geosite:steam",
          "geosite:telegram",
          "geosite:tumblr",
          "geosite:speedtest",
          "geosite:bbc",
          "domain:gvt1.com",
          "domain:textnow.com",
          "domain:twitch.tv",
          "domain:wikileaks.org",
          "domain:naver.com"
        ]
      },
      {
        "type": "field",
        "port": null,
        "inboundTag": null,
        "outboundTag": "proxy",
        "ip": [
          "91.108.4.0/22",
          "91.108.8.0/22",
          "91.108.12.0/22",
          "91.108.20.0/22",
          "91.108.36.0/23",
          "91.108.38.0/23",
          "91.108.56.0/22",
          "149.154.160.0/20",
          "149.154.164.0/22",
          "149.154.172.0/22",
          "74.125.0.0/16",
          "173.194.0.0/16",
          "172.217.0.0/16",
          "216.58.200.0/24",
          "216.58.220.0/24",
          "91.108.56.116",
          "91.108.56.0/24",
          "109.239.140.0/24",
          "149.154.167.0/24",
          "149.154.175.0/24"
        ],
        "domain": null
      },
      {
        "type": "field",
        "port": null,
        "inboundTag": null,
        "outboundTag": "direct",
        "ip": null,
        "domain": [
          "domain:12306.com",
          "domain:51ym.me",
          "domain:52pojie.cn",
          "domain:8686c.com",
          "domain:abercrombie.com",
          "domain:adobesc.com",
          "domain:air-matters.com",
          "domain:air-matters.io",
          "domain:airtable.com",
          "domain:akadns.net",
          "domain:apache.org",
          "domain:api.crisp.chat",
          "domain:api.termius.com",
          "domain:appshike.com",
          "domain:appstore.com",
          "domain:aweme.snssdk.com",
          "domain:bababian.com",
          "domain:battle.net",
          "domain:beatsbydre.com",
          "domain:bet365.com",
          "domain:bilibili.cn",
          "domain:ccgslb.com",
          "domain:ccgslb.net",
          "domain:chunbo.com",
          "domain:chunboimg.com",
          "domain:clashroyaleapp.com",
          "domain:cloudsigma.com",
          "domain:cloudxns.net",
          "domain:cmfu.com",
          "domain:culturedcode.com",
          "domain:dct-cloud.com",
          "domain:didialift.com",
          "domain:douyutv.com",
          "domain:duokan.com",
          "domain:dytt8.net",
          "domain:easou.com",
          "domain:ecitic.net",
          "domain:eclipse.org",
          "domain:eudic.net",
          "domain:ewqcxz.com",
          "domain:fir.im",
          "domain:frdic.com",
          "domain:fresh-ideas.cc",
          "domain:godic.net",
          "domain:goodread.com",
          "domain:haibian.com",
          "domain:hdslb.net",
          "domain:hollisterco.com",
          "domain:hongxiu.com",
          "domain:hxcdn.net",
          "domain:images.unsplash.com",
          "domain:img4me.com",
          "domain:ipify.org",
          "domain:ixdzs.com",
          "domain:jd.hk",
          "domain:jianshuapi.com",
          "domain:jomodns.com",
          "domain:jsboxbbs.com",
          "domain:knewone.com",
          "domain:kuaidi100.com",
          "domain:lemicp.com",
          "domain:letvcloud.com",
          "domain:lizhi.io",
          "domain:localizecdn.com",
          "domain:lucifr.com",
          "domain:luoo.net",
          "domain:mai.tn",
          "domain:maven.org",
          "domain:miwifi.com",
          "domain:moji.com",
          "domain:moke.com",
          "domain:mtalk.google.com",
          "domain:mxhichina.com",
          "domain:myqcloud.com",
          "domain:myunlu.com",
          "domain:netease.com",
          "domain:nfoservers.com",
          "domain:nssurge.com",
          "domain:nuomi.com",
          "domain:ourdvs.com",
          "domain:overcast.fm",
          "domain:paypal.com",
          "domain:paypalobjects.com",
          "domain:pgyer.com",
          "domain:qdaily.com",
          "domain:qdmm.com",
          "domain:qin.io",
          "domain:qingmang.me",
          "domain:qingmang.mobi",
          "domain:qqurl.com",
          "domain:rarbg.to",
          "domain:rrmj.tv",
          "domain:ruguoapp.com",
          "domain:sm.ms",
          "domain:snwx.com",
          "domain:soku.com",
          "domain:startssl.com",
          "domain:store.steampowered.com",
          "domain:symcd.com",
          "domain:teamviewer.com",
          "domain:tmzvps.com",
          "domain:trello.com",
          "domain:trellocdn.com",
          "domain:ttmeiju.com",
          "domain:udache.com",
          "domain:uxengine.net",
          "domain:weather.bjango.com",
          "domain:weather.com",
          "domain:webqxs.com",
          "domain:weico.cc",
          "domain:wenku8.net",
          "domain:werewolf.53site.com",
          "domain:windowsupdate.com",
          "domain:wkcdn.com",
          "domain:workflowy.com",
          "domain:xdrig.com",
          "domain:xiaojukeji.com",
          "domain:xiaomi.net",
          "domain:xiaomicp.com",
          "domain:ximalaya.com",
          "domain:xitek.com",
          "domain:xmcdn.com",
          "domain:xslb.net",
          "domain:xteko.com",
          "domain:yach.me",
          "domain:yixia.com",
          "domain:yunjiasu-cdn.net",
          "domain:zealer.com",
          "domain:zgslb.net",
          "domain:zimuzu.tv",
          "domain:zmz002.com",
          "domain:samsungdm.com"
        ]
      },
      {
        "type": "field",
        "port": null,
        "inboundTag": null,
        "outboundTag": "block",
        "ip": null,
        "domain": [
          "geosite:category-ads"
        ]
      },
      {
        "type": "field",
        "port": null,
        "inboundTag": null,
        "outboundTag": "direct",
        "ip": [
          "geoip:private"
        ],
        "domain": null
      },
      {
        "type": "field",
        "port": null,
        "inboundTag": null,
        "outboundTag": "direct",
        "ip": [
          "geoip:cn"
        ],
        "domain": null
      },
      {
        "type": "field",
        "port": null,
        "inboundTag": null,
        "outboundTag": "direct",
        "ip": null,
        "domain": [
          "geosite:cn"
        ]
      }
    ]
  }
}

6) Please attach error logs, especially the bottom lines if the file is large. Error log file is usually at /var/log/v2ray/error.log on Linux.

Server error log:

   2020/03/13 09:35:59 [Warning] v2ray.com/core: V2Ray 4.21.3 started
2020/03/17 16:05:29 [Warning] v2ray.com/core: V2Ray 4.21.3 started
2020/03/17 16:45:13 [Warning] v2ray.com/core: V2Ray 4.22.1 started
2020/03/17 16:45:15 [Warning] v2ray.com/core: V2Ray 4.22.1 started
2020/03/17 16:50:49 [Warning] v2ray.com/core: V2Ray 4.22.1 started

Client error log:

    无错误日志

7) Please attach access log. Access log is usually at '/var/log/v2ray/access.log' on Linux.


2020/03/17 17:01:35 192.168.123.98:7204 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user
2020/03/17 17:01:36 192.168.123.98:7207 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user
2020/03/17 17:01:39 192.168.123.98:7225 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user
2020/03/17 17:01:39 192.168.123.98:7243 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user
2020/03/17 17:01:40 192.168.123.98:7249 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user
2020/03/17 17:01:42 192.168.123.98:7254 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user
2020/03/17 17:01:42 192.168.123.98:7256 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user
2020/03/17 17:01:42 192.168.123.98:7258 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user
2020/03/17 17:01:42 192.168.123.98:7260 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user
2020/03/17 17:01:42 192.168.123.98:7262 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user
2020/03/17 17:01:42 192.168.123.98:7265 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user
2020/03/17 17:01:42 192.168.123.98:7267 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user
2020/03/17 17:01:42 192.168.123.98:7268 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user
2020/03/17 17:01:42 192.168.123.98:7270 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user
2020/03/17 17:01:42 192.168.123.98:7273 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user
2020/03/17 17:01:42 192.168.123.98:7274 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user
2020/03/17 17:01:42 192.168.123.98:7276 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user
2020/03/17 17:01:42 192.168.123.98:7278 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user
2020/03/17 17:01:42 192.168.123.98:7281 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user
2020/03/17 17:01:42 192.168.123.98:7282 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user
2020/03/17 17:01:42 192.168.123.98:7284 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user
2020/03/17 17:01:42 192.168.123.98:7286 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user
2020/03/17 17:01:42 192.168.123.98:7288 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user
2020/03/17 17:01:42 192.168.123.98:7290 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user
2020/03/17 17:01:42 192.168.123.98:7293 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user
2020/03/17 17:01:42 192.168.123.98:7295 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user
2020/03/17 17:01:42 192.168.123.98:7297 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user
2020/03/17 17:01:42 192.168.123.98:7299 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user
2020/03/17 17:01:42 192.168.123.98:7301 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user
2020/03/17 17:01:42 192.168.123.98:7303 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user
2020/03/17 17:01:43 192.168.123.98:7305 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user
2020/03/17 17:01:43 192.168.123.98:7307 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user
2020/03/17 17:01:43 192.168.123.98:7308 rejected  v2ray.com/core/proxy/vmess/encoding: invalid user

8) Other configurations (such as Nginx) and logs.

null

9) If V2Ray doesn't run, please attach output from --test.

The command is usually /usr/bin/v2ray/v2ray --test --config /etc/v2ray/config.json, but may vary according to your scenario.

10) If V2Ray service doesn't run, please attach journal log.

Usual command is journalctl -u v2ray.

Please review your issue before submitting.

zmaplex commented 4 years ago

客户端路由问题导致,国内直连没走代理。

清空 routing 配置项后,测试正常,可以删除用户连接会话。