npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

openvideo-plugin-ip-ban

v1.0.2

Published

OpenVideoAPI 自动封禁插件:按 IP 请求数 / 流量超限自动封禁(阈值可调),安全中心白名单 IP 除外,支持按 IP 地区屏蔽(ip2region)

Readme

openvideo-plugin-ip-ban

OpenVideoAPI 自动封禁插件:按 IP 请求数 / 流量超限自动封禁(阈值可调),安全中心白名单 IP 除外,支持按 IP 地区(国家)屏蔽。封禁写入安全中心,与后台/请求中间件联动即时生效,可设封禁时长、到期自动解封。

功能

  • 请求数超限:最近每分钟 / 每小时请求数超过阈值 → 自动封禁(0 = 关闭该项)
  • 流量超限:最近每分钟 / 每小时流量(MB)超过阈值 → 自动封禁(0 = 关闭该项)
  • 白名单例外:安全中心白名单中的 IP 永不自动封禁(可关闭此例外)
  • 地区屏蔽:对活跃 IP 用 ip2region(data/ip2region_v4.xdb,服务器自动维护)查询归属地,命中配置的国家名(支持中文 / 英文)自动封禁,如 俄罗斯,美国
  • 封禁时长:可配置分钟数(0 = 永久),到期自动解封
  • 与安全中心联动:封禁写入 security.banned(source=plugin:ip-ban),安全中心可见、请求中间件立即 403
  • 后台 tab「IP 封禁」:扫描状态 / 当前阈值 / 最近封禁记录、立即扫描、手动封禁 / 解封、一键解封本插件产生的全部封禁
  • 仅扫描活跃 IP(最近 N 分钟有请求),避免全量遍历

安装

  • 市场一键安装 openvideo-plugin-ip-ban(或 npm / GitHub),后台启用
  • 无需额外依赖:ip2region 地址库由服务器自动下载维护(安全中心)

使用

后台 → 插件 → 启用「ip-ban」→ 在插件配置中调整阈值 → 「IP 封禁」tab 查看状态 / 手动操作。

典型配置:

| 项 | 建议 | 说明 | | --- | --- | --- | | 每分钟请求阈值 | 300 | 最近 60 秒请求数(容忍落盘滞后取平均) | | 每小时请求阈值 | 5000 | 最近 1 小时请求数 | | 每分钟流量阈值(MB) | 50 | 最近 60 秒流量 | | 每小时流量阈值(MB) | 500 | 最近 1 小时流量 | | 封禁时长(分钟) | 1440 | 0 = 永久 | | 地区屏蔽 | 关 | 开启后按国家名屏蔽 | | 屏蔽地区 | 俄罗斯,美国 | 中文或英文国家名,逗号分隔 | | 白名单 IP 除外 | 开 | 安全中心白名单永不封禁 | | 活跃判定窗口(分钟) | 10 | 仅扫描最近有请求的 IP |

API

| 方法 | 路径 | 说明 | | --- | --- | --- | | GET | /api/plugin/ip-ban/status | 状态 / 阈值 / 最近封禁 | | POST | /api/plugin/ip-ban/scan | 立即扫描一次 | | POST | /api/plugin/ip-ban/ban | { ip } 手动封禁(按配置时长) | | POST | /api/plugin/ip-ban/unban | { ip } 解封 | | POST | /api/plugin/ip-ban/unban-all | 解封本插件产生的全部封禁 |

说明与限制

  • IP 统计(ip-stats)每 60 秒落盘一次,扫描读取磁盘快照,判定最多滞后约 1 分钟(阈值请按分钟级设置)
  • 地区屏蔽依赖 ip2region 地址库(国家名精度);内网 / 保留地址无归属地,不会误匹配
  • 请先把自己的管理 IP 加入安全中心白名单,避免误封锁死(插件默认白名单除外)
  • 封禁为 source=plugin:ip-ban,与手动封禁区分,可一键批量解封

开发

plugins/openvideo-plugin-ip-ban/
├── package.json
├── lib/
│   ├── index.js             # 服务端:定时扫描 + 阈值/地区判定 + 封禁写入
│   └── client/admin/ipban.js # 后台「IP 封禁」tab
└── README.md

发布新版本:npm version patch && git push origin master --tags && npm publish

License

MIT