monkeyWie / proxyee

HTTP proxy server,support HTTPS&websocket.MITM impl,intercept and tamper HTTPS traffic.
MIT License
1.52k stars 567 forks source link

如何管理已连接的客户端连接数 #135

Closed dujianchi closed 3 years ago

dujianchi commented 3 years ago

大佬,我目前基于这个做了一个http/https代理,实现了一个无密码的代理服务器,然后现在老板要求需要新增3个功能:

  1. 实时列出当前已经连接上的客户端列表(设备ip或者其他区分连接的唯一值、连接创建时间等)
  2. 需要能够单独断开某个客户端的连接(断开或者短时间内拒绝该ip再次连接)
  3. 设置最大连接数,超过连接数的客户端直接拒绝连接

以上需求是否能够实现?请大佬指点一下思路orz

monkeyWie commented 3 years ago
  1. 客户端ip可以获取到,但是目前没有暴露客户端连接进来的钩子函数
  2. 第一点实现了就可以实现
  3. 同上
monkeyWie commented 3 years ago

@dujianchi 1.4.0版本已经实现了客户端连接钩子,可以参考:https://github.com/monkeyWie/proxyee/blob/master/src/test/java/com/github/monkeywie/proxyee/AcceptHttpProxyServer.java

dujianchi commented 3 years ago

@monkeyWie 非常感谢!还特地写了个样例!

dujianchi commented 3 years ago

@monkeyWie 大佬,我测试了一下,根据上面例子实现的效果,它连接数是不断累加的,假设我现在连上去开个网页,可能一下子就飙到10个连接数了,我不知道有没有它断开的检测,这样我就可以在断开检测的地方扣除这个数量?

monkeyWie commented 3 years ago

@dujianchi 这个断开连接的检测是没有,我加一下吧

monkeyWie commented 3 years ago

@dujianchi 1.4.1已经支持,还是参考之前那个示例代码就行

dujianchi commented 3 years ago

@monkeyWie 谢谢大佬!大佬666

monkeyWie commented 3 years ago

@dujianchi 不客气🤓