layou233 / ZBProxy

🚀Transfer your network data, bypassing the Hypixel unofficial address detection!
https://launium.com/doc/ZBProxy
Apache License 2.0
236 stars 41 forks source link

功能请求:重载配置文件时将正在使用不存在的路由的玩家踢出 #153

Open d0j1a1701 opened 2 weeks ago

d0j1a1701 commented 2 weeks ago

例如原有 hypixel-in,但新配置文件无此路由,则将使用 hypixel-in 的用户全部踢出。

OOPSgary commented 2 weeks ago

@d0j1a1701 我看了一下 ZBProxy的热重载是基于服务的重载 不会新增端口/删除端口 如果需要全部踢出 建议直接重启程序

d0j1a1701 commented 2 weeks ago

我指单独掐掉某个路由的连接(一开始的表述不太清楚,把「路由」打成了「服务」)

例如示例配置文件:

{
  "Log": {
    "Level": "info"
  },
  "Services": [
    {
      "Name": "in",
      "Listen": 25565
    }
  ],
  "Router": {
    "DefaultOutbound": "RESET",
    "Rules": [
      {
        "Type": "always",
        "Sniff": "minecraft"
      },
      {
        "Type": "MinecraftHostname",
        "Parameter": {
            "Domain": "a.example.com"
        },
        "Outbound": "a-out"
      },
      {
        "Type": "MinecraftHostname",
        "Parameter": {
            "Domain": "b.example.com"
        },
        "Outbound": "b-out"
      }
    ]
  },
  "Outbounds": [
    {
      "Name": "a-out",
      "TargetAddress": "mc.hypixel.net",
      "TargetPort": 25565,
      "Minecraft": {
        "EnableHostnameRewrite": true,
        "OnlineCount": {
          "Max": 20,
          "Online": -1,
          "EnableMaxLimit": false
        },
        "MotdDescription": "a's MOTD"
      }
    },
    {
      "Name": "b-out",
      "TargetAddress": "minemen.club",
      "TargetPort": 25565,
      "Minecraft": {
        "EnableHostnameRewrite": true,
        "OnlineCount": {
          "Max": 20,
          "Online": -1,
          "EnableMaxLimit": false
        },
        "MotdDescription": "b's MOTD"
      }
    }
  ],
  "Lists": {}
}

现在玩家 A 在用 a.example.com 玩,玩家 B 在用 b.example.com 玩

然后重载新配置文件:

{
  "Log": {
    "Level": "info"
  },
  "Services": [
    {
      "Name": "in",
      "Listen": 25565
    }
  ],
  "Router": {
    "DefaultOutbound": "RESET",
    "Rules": [
      {
        "Type": "always",
        "Sniff": "minecraft"
      },
      {
        "Type": "MinecraftHostname",
        "Parameter": {
            "Domain": "b.example.com"
        },
        "Outbound": "b-out"
      }
    ]
  },
  "Outbounds": [
    {
      "Name": "b-out",
      "TargetAddress": "minemen.club",
      "TargetPort": 25565,
      "Minecraft": {
        "EnableHostnameRewrite": true,
        "OnlineCount": {
          "Max": 20,
          "Online": -1,
          "EnableMaxLimit": false
        },
        "MotdDescription": "b's MOTD"
      }
    }
  ],
  "Lists": {}
}

可以发现玩家 A 游玩的服务器的路由没了,就把他断开连接。

OOPSgary commented 2 weeks ago

@d0j1a1701 进一下tg群