-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
3,151 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
include $(TOPDIR)/rules.mk | ||
|
||
PKG_NAME:=homebox | ||
PKG_VERSION:=0.0.0-dev.2020062901 | ||
PKG_RELEASE:=14 | ||
|
||
PKG_SOURCE_URL_FILE:=v$(PKG_VERSION).tar.gz | ||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz | ||
PKG_SOURCE_URL:=https://github.com/XGHeaven/homebox/archive/refs/tags/ | ||
PKG_HASH:=skip | ||
|
||
PKG_BUILD_DEPENDS:=golang/host homebox/host | ||
PKG_BUILD_PARALLEL:=1 | ||
PKG_USE_MIPS16:=0 | ||
|
||
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/${PKG_NAME} | ||
|
||
include $(INCLUDE_DIR)/host-build.mk | ||
include $(INCLUDE_DIR)/package.mk | ||
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk | ||
|
||
define Package/$(PKG_NAME) | ||
SECTION:=net | ||
CATEGORY:=Network | ||
SUBMENU:=Web Servers/Proxies | ||
TITLE:=A Toolbox for Home Local Networks | ||
URL:=https://github.com/XGHeaven/homebox | ||
DEPENDS:=$(GO_ARCH_DEPENDS) | ||
MENU:=1 | ||
endef | ||
|
||
define Package/$(PKG_NAME)/description | ||
A Toolbox for Home Local Networks Speed Test | ||
endef | ||
|
||
GO_PKG_BUILD_VARS += GO111MODULE=auto | ||
TAR_OPTIONS:=--strip-components 1 $(TAR_OPTIONS) | ||
TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS) | ||
|
||
define Build/Configure | ||
( \ | ||
cd $(PKG_BUILD_DIR)/server; \ | ||
$(GO_PKG_VARS) \ | ||
go get -d -modcacherw; \ | ||
) | ||
( \ | ||
cd $(PKG_BUILD_DIR)/server; \ | ||
GOPATH=$(PKG_BUILD_DIR)/.go_work/build \ | ||
go install -modcacherw github.com/go-bindata/go-bindata/...@latest; \ | ||
) | ||
endef | ||
|
||
define Build/Compile | ||
rm -rf $(PKG_BUILD_DIR)/build/static | ||
mkdir -p $(PKG_BUILD_DIR)/build | ||
$(CP) $(HOST_BUILD_DIR)/build/static $(PKG_BUILD_DIR)/build/ | ||
( \ | ||
cd $(PKG_BUILD_DIR); \ | ||
$(GO_PKG_VARS) PATH=$(PKG_BUILD_DIR)/.go_work/build/bin:$$$$PATH \ | ||
$(MAKE) build-server; \ | ||
) | ||
endef | ||
|
||
define Package/$(PKG_NAME)/install | ||
$(INSTALL_DIR) $(1)/usr/bin | ||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/build/server $(1)/usr/bin/homebox | ||
endef | ||
|
||
define Host/Configure | ||
cd $(HOST_BUILD_DIR)/web && rm -f package-lock.json && npm --cache-min 1440 install | ||
endef | ||
|
||
define Host/Compile | ||
cd $(HOST_BUILD_DIR) && $(MAKE) build-web | ||
endef | ||
|
||
define Host/Install | ||
endef | ||
|
||
define Host/Clean | ||
rm -f $(HOST_BUILD_DIR)/build/static | ||
endef | ||
|
||
$(eval $(call HostBuild)) | ||
$(eval $(call BuildPackage,homebox)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
# Copyright (C) 2020-2021 sirpdboy <herboy2008@gmail.com> | ||
# | ||
# This is free software, licensed under the GNU General Public License v3. | ||
# | ||
|
||
include $(TOPDIR)/rules.mk | ||
|
||
PKG_NAME:=luci-app-netspeedtest | ||
|
||
LUCI_TITLE:=LuCI Support for netspeedtest | ||
LUCI_DEPENDS:=+python3 +iperf3 +homebox +netperf | ||
LUCI_PKGARCH:=all | ||
PKG_VERSION:=2.1.1 | ||
PKG_RELEASE:=20230116 | ||
PKG_MAINTAINER:=<https://github.com/sirpdboy/netspeedtest> | ||
|
||
include $(TOPDIR)/feeds/luci/luci.mk | ||
|
||
|
||
# call BuildPackage - OpenWrt buildroot signature |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
## luci-app-netspeedtest | ||
|
||
### 访问数:[![](https://visitor-badge.glitch.me/badge?page_id=sirpdboy-visitor-badge)] [![](https://img.shields.io/badge/TG群-点击加入-FFFFFF.svg)](https://t.me/joinchat/AAAAAEpRF88NfOK5vBXGBQ) | ||
|
||
![screenshots](https://raw.githubusercontent.com/sirpdboy/openwrt/master/doc/说明1.jpg) | ||
|
||
luci-app-netspeedtest 网络速度诊断测试(包括:内网网页版测速、内网iperf3吞吐测速、外网speedtest.net网速测试、特定服务器的端口延迟测速) | ||
|
||
[luci-app-netspeedtest 网络速度诊断测试](https://github.com/sirpdboy/netspeedtest) | ||
|
||
请 **认真阅读完毕** 本页面,本页面包含注意事项和如何使用。 | ||
|
||
## 写在前面 | ||
|
||
- 一直在找OPENWRT上测试速度的插件,苦寻不到,于是有了它! 此插件可进行内外和外网网络速度测试。 | ||
- TG群友说插件2年没更新了,花了几天时间结合时下需要,将网络测试功能升级到2.0版本。 | ||
|
||
<!-- TOC --> | ||
|
||
## [菜单向导](#luci-app-netspeedtest) | ||
- [功能说明](#功能说明) | ||
- [注意事项](#iperf3吞吐测试注意事项) | ||
- [版本说明](#版本说明) | ||
- [使用方法](#使用方法) | ||
- [源码说明](#源码说明) | ||
- [界面](#界面) | ||
- [其它](#其它) | ||
- [感谢](#感谢) | ||
- [捐助](#捐助) | ||
|
||
<!-- /TOC --> | ||
|
||
## 功能说明 | ||
- 内网网页版测速插件 :基于speedtest-web网页版,启用后再点start进行测速。网页版启动后程序会驻留内存不测速建议不启用服务。 | ||
- 内网iperf3吞吐测试 ,服务端路由器如果没有安装请先安装此iperf3插件。 | ||
- 外网测速使用speedtest.net测速内核,基于speedtest-cli,需要有python3才能执行。 | ||
- 特定服务器的端口延迟测速,是测试指定服务器的端口的延迟情况。 | ||
|
||
## iperf3吞吐测试注意事项 | ||
- 测速的终端使用机器必须和测速服务器在同一个局域网络中! | ||
- 客户端使用步骤:启动测速服务器端-->下载测试客户端-->运行测速客户端-->输入服务端IP地址-->查看结果。 | ||
- 客户端运行,国内端下载中有“iperf3测速客户端”,运行它输入服务器IP即可。 | ||
国外原版,需要手动进入 CMD命令模式,再输入命令:iperf3.exe -c 服务器IP | ||
- 网络测速iperf3客户端下载地址:https://sipdboy.lanzoui.com/b01c3esih 密码:cpd6 | ||
- 需要依赖: python3 iperf3 speedtest-web | ||
|
||
## 版本说明 | ||
|
||
### 2022.10.18 网速测试V2.0.2: | ||
- 代码基本重写和优化。 | ||
- Iperf3可实时体现服务状态。 | ||
- 增加内网测试网页版。 | ||
- 外网测速,加入更详细测试报告。 | ||
|
||
### 2021.3.2 网速测试V1.6: | ||
- 升级宽带测试带2.13内核。 | ||
- 解决1.806以上版本不能编译问题。 | ||
|
||
## 使用方法 | ||
|
||
将NetSpeedTest 主题添加至 LEDE/OpenWRT 源码的方法。 | ||
|
||
### 下载源码方法一: | ||
- 编辑源码文件夹根目录feeds.conf.default并加入如下内容: | ||
|
||
```Brach | ||
# feeds获取源码: | ||
src-git netspeedtest https://github.com/sirpdboy/netspeedtest | ||
``` | ||
```Brach | ||
# 更新feeds,并安装主题: | ||
scripts/feeds update netspeedtest | ||
scripts/feeds install netspeedtest | ||
``` | ||
|
||
### 下载源码方法二: | ||
|
||
```Brach | ||
# 下载源码 | ||
git clone https://github.com/sirpdboy/netspeedtest.git package/netspeedtest | ||
make menuconfig | ||
``` | ||
### 配置菜单 | ||
|
||
```Brach | ||
make menuconfig | ||
# 找到 LuCI -> Applications, 选择 luci-app-netspeedtest, 保存后退出。 | ||
``` | ||
|
||
### 编译 | ||
|
||
```Brach | ||
# 编译固件 | ||
make package/netspeedtest/luci-app-netspeedtest/compile V=s | ||
``` | ||
|
||
|
||
## 源码说明 | ||
|
||
- 源码来源和依赖: | ||
- luci-app-netspeedtest:https://github.com/sirpdboy/netspeedtest | ||
- speedtest-web:https://github.com/ZeaKyX/speedtest-web | ||
- speedtest-cl:https://github.com/sivel/speedtest-cli | ||
|
||
- 你可以随意使用其中的源码,但请注明出处。 | ||
|
||
![screenshots](https://raw.githubusercontent.com/sirpdboy/openwrt/master/doc/说明2.jpg) | ||
|
||
## 界面 | ||
|
||
![screenshots](https://raw.githubusercontent.com/sirpdboy/openwrt/master/doc/netspeedtest1.jpg) | ||
|
||
![screenshots](https://raw.githubusercontent.com/sirpdboy/openwrt/master/doc/netspeedtest2.jpg) | ||
|
||
![screenshots](https://raw.githubusercontent.com/sirpdboy/openwrt/master/doc/netspeedtest3.jpg) | ||
|
||
![screenshots](https://raw.githubusercontent.com/sirpdboy/openwrt/master/doc/netspeedtest4.jpg) | ||
|
||
|
||
## 其它 | ||
- 我的其它项目: | ||
- 网络速度测试 :https://github.com/sirpdboy/NetSpeedTest | ||
- 定时设置插件 : https://github.com/sirpdboy/luci-app-autotimeset | ||
- 关机功能插件 : https://github.com/sirpdboy/luci-app-poweroffdevice | ||
- btmob 主题: https://github.com/sirpdboy/luci-theme-btmob | ||
- 系统高级设置 : https://github.com/sirpdboy/luci-app-advanced | ||
- ddns-go动态域名: https://github.com/sirpdboy/luci-app-ddns-go | ||
- Lucky(大吉): https://github.com/sirpdboy/luci-app-lucky | ||
|
||
## 感谢 | ||
|
||
感谢superspeed、user1121114685、ZeaKyX、佐须之男、lean等。因为有你们珠玉在前! | ||
|
||
## 捐助 | ||
|
||
![screenshots](https://raw.githubusercontent.com/sirpdboy/openwrt/master/doc/说明3.jpg) | ||
|
||
| <img src="https://img.shields.io/badge/-支付宝-F5F5F5.svg" href="#赞助支持本项目-" height="25" alt="图飞了😂"/> | <img src="https://img.shields.io/badge/-微信-F5F5F5.svg" height="25" alt="图飞了😂" href="#赞助支持本项目-"/> | | ||
| :-----------------: | :-------------: | | ||
|![xm1](https://raw.githubusercontent.com/sirpdboy/openwrt/master/doc/支付宝.png) | ![xm1](https://raw.githubusercontent.com/sirpdboy/openwrt/master/doc/微信.png) | | ||
|
||
<a href="#readme"> | ||
<img src="https://img.shields.io/badge/-返回顶部-orange.svg" alt="图飞了😂" title="返回顶部" align="right"/> | ||
</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
-- Copyright (C) 2020-2022 sirpdboy <herboy2008@gmail.com> https://github.com/sirpdboy/netspeedtest | ||
|
||
module("luci.controller.netspeedtest", package.seeall) | ||
local fs=require"nixio.fs" | ||
local sys = require "luci.sys" | ||
function index() | ||
entry({"admin","network","netspeedtest"},alias("admin", "network", "netspeedtest", "homebox"),_("Net Speedtest"), 90).dependent = true | ||
entry({"admin","network","netspeedtest","homebox"},cbi("netspeedtest/homebox"),_("Lan homebox Web"),20).leaf = true | ||
entry({"admin","network","netspeedtest","speedtestiperf3"},cbi("netspeedtest/speedtestiperf3", {hideapplybtn=true, hidesavebtn=true, hideresetbtn=true}),_("Lan Speedtest Iperf3"),30).leaf = true | ||
entry({"admin","network","netspeedtest","speedtestwan"},cbi("netspeedtest/speedtestwan", {hideapplybtn=true, hidesavebtn=true, hideresetbtn=true}),_("Wan Speedtest"), 40).leaf = true | ||
entry({"admin","network","netspeedtest","netperftestwan"},cbi("netspeedtest/netperftestwan", {hideapplybtn=true, hidesavebtn=true, hideresetbtn=true}),_("Netperf Speedtest"), 40).leaf = true | ||
|
||
entry({"admin", "network", "netspeedtest", "checknet"}, call("check_net")) | ||
entry({"admin", "network", "homebox_status"}, call("homebox_status")) | ||
entry({"admin", "network", "iperf3_status"}, call("iperf3_status")) | ||
|
||
entry({"admin", "network","test_iperf0"}, post("test_iperf0"), nil).leaf = true | ||
entry({"admin", "network","test_iperf1"}, post("test_iperf1"), nil).leaf = true | ||
|
||
entry({"admin","network","netspeedtest", "speedtestrun"}, call("speedtestrun")) | ||
entry({"admin","network","netspeedtest", "netperfrun"}, call("netperfrun")) | ||
|
||
entry({"admin", "network", "netspeedtest", "realtime_log"}, call("get_log")) | ||
entry({"admin", "network", "netspeedtest", "dellog"},call("dellog")) | ||
end | ||
|
||
|
||
function homebox_status() | ||
local e = { | ||
run = (sys.call("pidof homebox >/dev/null") == 0), | ||
port = 3300 | ||
} | ||
luci.http.prepare_content("application/json") | ||
luci.http.write_json(e) | ||
end | ||
|
||
function iperf3_status() | ||
local e={} | ||
e.run=sys.call("pgrep iperf3 >/dev/null")==0 | ||
luci.http.prepare_content("application/json") | ||
luci.http.write_json(e) | ||
end | ||
|
||
function testout(cmd, addr) | ||
luci.http.prepare_content("text/plain") | ||
local util = io.popen(cmd) | ||
if util then | ||
while true do | ||
local ln = util:read("*l") | ||
if not ln then break end | ||
luci.http.write(ln) | ||
luci.http.write("\n") | ||
end | ||
util:close() | ||
end | ||
|
||
end | ||
|
||
function test_iperf0(addr) | ||
sys.call("pgrep -f unblockneteasemusic | xargs kill -9 >/dev/null 2>&1 ") | ||
sys.call("/etc/init.d/unblockneteasemusic stop ") | ||
sys.call("/etc/init.d/unblockmusic stop ") | ||
testout("iperf3 -s ", addr) | ||
end | ||
|
||
function test_iperf1(addr) | ||
sys.call("pgrep -f iperf3 | xargs kill -9 >/dev/null 2>&1 ") | ||
sys.call("/etc/init.d/unblockneteasemusic restart") | ||
sys.call("/etc/init.d/unblockmusic restart") | ||
end | ||
|
||
function get_log() | ||
local e = {} | ||
e.running = sys.call("busybox ps -w | grep netspeedtest | grep -v grep >/dev/null") == 0 | ||
e.log = fs.readfile("/var/log/netspeedtest.log") or "" | ||
luci.http.prepare_content("application/json") | ||
luci.http.write_json(e) | ||
end | ||
|
||
function dellog() | ||
fs.writefile("/var/log/netspeedtest.log","") | ||
http.prepare_content("application/json") | ||
http.write('') | ||
end | ||
|
||
function speedtestrun() | ||
testout("/etc/init.d/netspeedtest nstest ") | ||
end | ||
|
||
function netperfrun() | ||
testout("sh /usr/bin/netperftest") | ||
end |
25 changes: 25 additions & 0 deletions
25
luci-app-netspeedtest/luasrc/model/cbi/netspeedtest/homebox.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
-- Copyright (C) 2020-2022 sirpdboy <herboy2008@gmail.com> https://github.com/sirpdboy/netspeedtest | ||
|
||
local m, s ,o | ||
|
||
|
||
m = Map("netspeedtest", "<font color='green'>" .. translate("Net Speedtest") .."</font>",translate( "Network speed diagnosis test (including intranet and extranet)<br/>For specific usage, see:") ..translate("<a href=\'https://github.com/sirpdboy/netspeedtest.git' target=\'_blank\'>GitHub @sirpdboy/netspeedtest</a>") ) | ||
-- m:section(SimpleSection).template = "netspeedtest/homebox_status" | ||
|
||
s = m:section(TypedSection, "homebox", translate('Lan homebox Web')) | ||
s.addremove=false | ||
s.anonymous=true | ||
|
||
o=s:option(Flag,"enabled",translate("Enable")) | ||
o.default=0 | ||
|
||
o = s:option(DummyValue, '', '') | ||
o.rawhtml = true | ||
o.template ='netspeedtest/homebox' | ||
|
||
m.apply_on_parse = true | ||
m.on_after_apply = function(self,map) | ||
io.popen("/etc/init.d/netspeedtest restart") | ||
end | ||
|
||
return m |
18 changes: 18 additions & 0 deletions
18
luci-app-netspeedtest/luasrc/model/cbi/netspeedtest/netperftestwan.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
-- Copyright (C) 2020-2022 sirpdboy <herboy2008@gmail.com> https://github.com/sirpdboy/netspeedtest | ||
require("luci.util") | ||
local o,t,e | ||
|
||
o = Map("netspeedtest", "<font color='green'>" .. translate("Net Speedtest") .."</font>",translate( "Network speed diagnosis test (including intranet and extranet)<br/>For specific usage, see:") ..translate("<a href=\'https://github.com/sirpdboy/netspeedtest.git' target=\'_blank\'>GitHub @sirpdboy/netspeedtest</a>") ) | ||
|
||
t=o:section(TypedSection,"wanspeedtest",translate("Netperf Speedtest")) | ||
t.anonymous=true | ||
|
||
e = t:option(DummyValue, '', '') | ||
e.rawhtml = true | ||
e.template ='netspeedtest/netperftestwan' | ||
|
||
e =t:option(DummyValue, '', '') | ||
e.rawhtml = true | ||
e.template = 'netspeedtest/log' | ||
|
||
return o |
Oops, something went wrong.