├── Dockerfile ├── README.md ├── build.sh ├── index.html ├── nginx.conf ├── tc_limit.sh └── tcp-cal2.png /Dockerfile: -------------------------------------------------------------------------------- 1 | # 使用官方 nginx 镜像作为基础镜像 2 | FROM nginx:alpine 3 | 4 | # 将当前目录下的 index.html 复制到 nginx 的默认网页目录 5 | COPY index.html /usr/share/nginx/html/ 6 | 7 | # 复制自定义的 nginx 配置文件 8 | COPY nginx.conf /etc/nginx/conf.d/default.conf 9 | 10 | # 暴露 80 端口 11 | EXPOSE 80 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TCP 缓冲区计算器 2 | 3 | 一个简单的网页工具,用于计算 TCP 缓冲区大小和带宽延迟积(BDP)。 4 | 5 |  6 | 7 | > 相关文章:[TCP 调优参数计算器](https://www.nodeseek.com/post-199442-1) 8 | > 在线使用:[TCP 调优参数计算器](https://tcp-cal.mereith.com) 9 | 10 | ## 功能特点 11 | 12 | - 计算带宽延迟积(BDP) 13 | - 提供推荐的 TCP 缓冲区设置 14 | - 支持 Mbps 带宽输入 15 | - 支持毫秒级 RTT 输入 16 | - 提供 Docker 容器部署支持 17 | 18 | ## 快速开始 19 | 20 | ### Docker 部署 21 | 22 | ```shell 23 | #拉取镜像 24 | docker pull mereith/tcp-cal:latest 25 | #运行容器 26 | docker run -d -p 80:80 mereith/tcp-cal:latest 27 | ``` 28 | 29 | 访问 `http://localhost:80` 即可使用计算器。 30 | 31 | ### 手动部署 32 | 33 | 直接将 `index.html` 文件部署到任何 Web 服务器即可。 34 | 35 | ## 使用方法 36 | 37 | 1. 输入带宽(单位:Mbps) 38 | 2. 输入 RTT(单位:毫秒) 39 | 3. 点击"计算"按钮 40 | 4. 查看计算结果和建议的 TCP 缓冲区设置 41 | 42 | ## 构建说明 43 | 44 | 项目包含 Docker 构建脚本,可以使用以下命令构建并推送镜像: 45 | 46 | ```bash 47 | ./build.sh 48 | ``` 49 | 50 | ## PS 51 | 52 | `tc_limit` 是另一个限流思路的调优脚本,我没仔细测试,需要的话可以试试看。 53 | 54 | ## 许可证 55 | 56 | MIT License 57 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | IMAGE=mereith/tcp-cal 4 | VERSION=v0.1.0 5 | 6 | echo "Building Docker image: ${IMAGE}:${VERSION}" 7 | 8 | docker buildx build \ 9 | --platform linux/amd64 \ 10 | --tag ${IMAGE}:${VERSION} \ 11 | --tag ${IMAGE}:latest \ 12 | --push \ 13 | . -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 |