package lean: remove
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
parent
272fe95263
commit
0934b343c5
@ -1,86 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2021 ImmortalWrt
|
||||
# <https://immortalwrt.org>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=UnblockNeteaseMusic-Go
|
||||
PKG_VERSION:=0.2.10
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/cnsilvan/UnblockNeteaseMusic/tar.gz/$(PKG_VERSION)?
|
||||
PKG_HASH:=2103562e399d04fcce0aa017057357e6fcec8beb6dc65c17ad1bdc06f38d6b7a
|
||||
|
||||
PKG_LICENSE:=GPL-3.0
|
||||
PKG_LICENSE_FILE:=LICENSE
|
||||
PKG_MAINTAINER:=Silvan <cnsilvan@gmail.com>
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
CONFIG_UNBLOCKNETEASEMUSIC_GO_COMPRESS_GOPROXY \
|
||||
CONFIG_UNBLOCKNETEASEMUSIC_GO_COMPRESS_UPX
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(firstword $(subst -, ,$(PKG_NAME)))-$(PKG_VERSION)
|
||||
PKG_BUILD_DEPENDS:=golang/host
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
|
||||
GO_PKG:=github.com/cnsilvan/UnblockNeteaseMusic
|
||||
GO_PKG_BUILD_PKG:=$$(GO_PKG)
|
||||
GO_PKG_LDFLAGS:=-s -w
|
||||
COMPILE_TIME:= $(shell TZ=UTC-8 date '+%Y-%m-%d %H:%M:%S')
|
||||
GO_PKG_LDFLAGS+= \
|
||||
-X '$(GO_PKG)/version.Version=$(PKG_VERSION)' \
|
||||
-X '$(GO_PKG)/version.BuildTime=$(COMPILE_TIME)' \
|
||||
-X '$(GO_PKG)/version.ExGoVersionInfo=$(GO_ARM) $(GO_MIPS)$(GO_MIPS64)'
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
|
||||
|
||||
define Package/UnblockNeteaseMusic-Go/config
|
||||
config UNBLOCKNETEASEMUSIC_GO_COMPRESS_GOPROXY
|
||||
bool "Compiling with GOPROXY proxy"
|
||||
default n
|
||||
|
||||
config UNBLOCKNETEASEMUSIC_GO_COMPRESS_UPX
|
||||
bool "Compress executable files with UPX"
|
||||
default y
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_UNBLOCKNETEASEMUSIC_GO_COMPRESS_GOPROXY),y)
|
||||
export GO111MODULE=on
|
||||
export GOPROXY=https://goproxy.io
|
||||
endif
|
||||
|
||||
define Package/UnblockNeteaseMusic-Go
|
||||
SECTION:=multimedia
|
||||
CATEGORY:=Multimedia
|
||||
TITLE:=Revive Netease Cloud Music (Golang)
|
||||
URL:=https://github.com/cnsilvan/UnblockNeteaseMusic
|
||||
DEPENDS:=$(GO_ARCH_DEPENDS)
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(call GoPackage/Build/Compile)
|
||||
ifeq ($(CONFIG_GOST_COMPRESS_UPX),y)
|
||||
$(STAGING_DIR_HOST)/bin/upx --lzma --best $(GO_PKG_BUILD_BIN_DIR)/UnblockNeteaseMusic
|
||||
endif
|
||||
endef
|
||||
|
||||
define Package/UnblockNeteaseMusic-Go/install
|
||||
$(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR))
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/UnblockNeteaseMusic $(1)/usr/bin/UnblockNeteaseMusic
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/UnblockNeteaseMusicGo
|
||||
$(CP) ./files/* $(1)/usr/share/UnblockNeteaseMusicGo/
|
||||
|
||||
endef
|
||||
|
||||
$(eval $(call GoBinPackage,UnblockNeteaseMusic-Go))
|
||||
$(eval $(call BuildPackage,UnblockNeteaseMusic-Go))
|
||||
@ -1,21 +0,0 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDdzCCAl+gAwIBAgIJAKX8LdIETDklMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNV
|
||||
BAYTAkNOMSQwIgYDVQQDDBtVbmJsb2NrTmV0ZWFzZU11c2ljIFJvb3QgQ0ExHTAb
|
||||
BgNVBAoMFEdpdEh1Yi5jb20gQG5vbmRhbmVlMB4XDTE5MDUxODE2MDU0NVoXDTI0
|
||||
MDUxNjE2MDU0NVowUjELMAkGA1UEBhMCQ04xJDAiBgNVBAMMG1VuYmxvY2tOZXRl
|
||||
YXNlTXVzaWMgUm9vdCBDQTEdMBsGA1UECgwUR2l0SHViLmNvbSBAbm9uZGFuZWUw
|
||||
ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQD23K6Ti2TfLJToCmpCAVgE
|
||||
Xb8+qTMfrifCpnKlJ+hrL+4KI1j4vSqTOOatqmxGSXZdF/j2kJuI40YThaokcgYx
|
||||
GFcPcEftSCYGWy8o20u2hzTkkW3KW9wlsDRIXICFXVIsHeSDwz+aVSudkyJHjfaS
|
||||
aLNb5pPovE7MRj8tDbp55scaSqhEcOe3m1ZlwlCeeXvD7RLKr3xhBKbGEqlJAjFq
|
||||
RNGzuqylqyJVBLScNHC7Lcf4n6pKr1yPGOeLePOUrIwtj0ynHUcBfeMuCVCsIKL8
|
||||
vy/oNwlDrZaAMfu5QQslzEf87KY1QgtI6Ppii+tzbmVx1ZxnlaCKqiuwlgBoi/5r
|
||||
AgMBAAGjUDBOMB0GA1UdDgQWBBRDhbGjnXEUouE9wNFS2k9PtgYYjDAfBgNVHSME
|
||||
GDAWgBRDhbGjnXEUouE9wNFS2k9PtgYYjDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3
|
||||
DQEBCwUAA4IBAQDRUh5+JFLEALXQkhPfwrVf4sCXTwLMwVujTPo3NMbhpWiP4cnn
|
||||
XHGCD5V57bBwjeD6NSrczDIdnN9uTJyFmLNVFMZBguEIeZfLUJLJ6w1ZhfgciX1D
|
||||
9djyyo6eclkHvi+aPZKfzgMmc5BvHcjyUyS5MzI23kUW6WXUDn3IDIUKrfaH9Mjc
|
||||
/d4DDZVKQCYrLoBL+XO7pEHUY0u9XZVYWEavQ5tSN8XY1SDrO0yGUpRWET0ltubE
|
||||
zV7W0LOhuoVCiemboc5H8+njBjCis8obAo1XMmDZzW189L9GPFxHNWlka+KlajZB
|
||||
tMo90PooZYEOw1rTUrzHb+VZY/tYIAAomGZ0
|
||||
-----END CERTIFICATE-----
|
||||
@ -1,22 +0,0 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDkjCCAnqgAwIBAgIJAK/bIUIlE36LMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNV
|
||||
BAYTAkNOMSQwIgYDVQQDDBtVbmJsb2NrTmV0ZWFzZU11c2ljIFJvb3QgQ0ExHTAb
|
||||
BgNVBAoMFEdpdEh1Yi5jb20gQG5vbmRhbmVlMB4XDTIwMDUxNjE3MTIxM1oXDTIx
|
||||
MDUxNjE3MTIxM1owezELMAkGA1UEBhMCQ04xETAPBgNVBAcMCEhhbmd6aG91MSww
|
||||
KgYDVQQKDCNOZXRFYXNlIChIYW5nemhvdSkgTmV0d29yayBDby4sIEx0ZDERMA8G
|
||||
A1UECwwISVQgRGVwdC4xGDAWBgNVBAMMDyoubXVzaWMuMTYzLmNvbTCCASIwDQYJ
|
||||
KoZIhvcNAQEBBQADggEPADCCAQoCggEBALobECypwEoe8VqM/FJvBRR3p2T+ZWdi
|
||||
MSPrwfiRJr5p7OMtWBlLveCBV85+R3feidYbQTXlvVTdToY+GN6mFE1x6zG2dvLD
|
||||
s4UuRnipmvGcFYhIRTX8J4AJiN8VMtW0TNXscRMudpz/FAVtsRrggRaThYg4f/rI
|
||||
oAPMqKMsS4JoYhxs9ED6E6/tpj3XmSg1ekaXhgacYSYHeyxizZwoOFVCLH3TG5sF
|
||||
sD6CYNnukYol8bR+VRpvHftIYss5Yz+DyyhYEAMJm1CfQo+xoGR3D0ozbT3hUnzm
|
||||
fEoOhmSp3sALrFVE4iJSuajoh2/3xhmcyi3xZdWyq4F8hpb+URyaoW0CAwEAAaNC
|
||||
MEAwEwYDVR0lBAwwCgYIKwYBBQUHAwEwKQYDVR0RBCIwIIINbXVzaWMuMTYzLmNv
|
||||
bYIPKi5tdXNpYy4xNjMuY29tMA0GCSqGSIb3DQEBCwUAA4IBAQB+zW0o1169aGQI
|
||||
7GA/8BQ769svpkpdy/lfvkokapFjzoxLTBQhjMo9rqzmGOwr9ksePwQqSDXn685W
|
||||
mKnEl0CzhBrKnL5x3gHus8bg591xpW+01xAFXSyLITOfMJqMEdY7ylymkm0XZ3aN
|
||||
vm+yFdP1fr/bZNw6Wrprg3i7eGhj7TdBXRA96usVgBcnCkC1SzEZfnDZsKl9o8Xx
|
||||
TSOpvzIMSaD7++Bp7BdzA5oCCydv2c++zV/sgCPIr26Jq8UQac+qQP5SMlYyGbAl
|
||||
vIQRRZyfQ4fPonYDnEPHWFCMyBkQIN39LMhDRsUgn8bT0rnP91xkNAd9S4VWbNDA
|
||||
5TMiQy3F
|
||||
-----END CERTIFICATE-----
|
||||
@ -1,27 +0,0 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIEowIBAAKCAQEAuhsQLKnASh7xWoz8Um8FFHenZP5lZ2IxI+vB+JEmvmns4y1Y
|
||||
GUu94IFXzn5Hd96J1htBNeW9VN1Ohj4Y3qYUTXHrMbZ28sOzhS5GeKma8ZwViEhF
|
||||
NfwngAmI3xUy1bRM1exxEy52nP8UBW2xGuCBFpOFiDh/+sigA8yooyxLgmhiHGz0
|
||||
QPoTr+2mPdeZKDV6RpeGBpxhJgd7LGLNnCg4VUIsfdMbmwWwPoJg2e6RiiXxtH5V
|
||||
Gm8d+0hiyzljP4PLKFgQAwmbUJ9Cj7GgZHcPSjNtPeFSfOZ8Sg6GZKnewAusVUTi
|
||||
IlK5qOiHb/fGGZzKLfFl1bKrgXyGlv5RHJqhbQIDAQABAoIBAEmAvtalBMlBh1mY
|
||||
LV/xcTQwPfDpeOtoILhrOOUPjxnNhD4FfrIe9BNjgmaQAXIadp4VjZ/X6PtHnOfw
|
||||
RqpJNeOQhq/PvRMMsC59pF+rvQKH/wkgYhV8Ta2IFoLlQHqfB2nGRLKquzYumJ28
|
||||
QSK4YMOl6CtxBTrrWiemAUTRDdGm8tARiipJH1SEJrS6d/NoRoJx2vixFgD2eS6X
|
||||
bjnhGjIzvX/w5FWjctqj+SFITP1UI62b6DyWsPOkoosKNteK+Ulz+K6ZFvOx7day
|
||||
XgUoTcVpwCVr2dVGhJtOrbKPcl1jYCYHJAHwzUZND4x4yftm1mnnsi3bthYqbtHQ
|
||||
vxLE9YECgYEA9hiZxwiVvLjSe1xT/D75HbB8S1XSnwzpMmqgzStguxCQ0Qg5yiLI
|
||||
UKRDY8UZvEDV4i2bQGy7mk8lFvX1q2z7Q30+dtT9r2N9a6ujMk5RMfo2BZg/poI6
|
||||
yDWe2tKUg9cTwfgni4TutLOYkpz3VDPIQHs3k2mpNh7f+8X4RIybDqkCgYEAwZhp
|
||||
uWMV38Bb0WytswHXL1dRuwBskKqALUBY61dtXkyBuocj8AuRRxfxfZpgJRrHFxDX
|
||||
O9bQ2nxpVlwKsR6DJDUdxU3+kvwyPfseU5XUBey8WdkuAKD7cKZOHMhFVWccks0U
|
||||
YJzykNrxB+rGTiwVKa0MOhipuJ7boerwwaN2SyUCgYBP9Ow5o4tq9q3EUNoksZ0k
|
||||
zUuE+oxlCr/VlplKL9bM0HQMxlxoVWa59LTEfKyA4pvbUbAIfYtydlZ5oE5CdTUp
|
||||
105tM4R88Jk2W1y5ooJ093OH29CKW/OXSvyi4hpIv592vRa0GOupoFRpBkDBhdWB
|
||||
RcdnyMOmht+FIOwp8XkLiQKBgAUK3j4Y6ZnxXbLfvMp70soF4TgYs7s05a/IDEjc
|
||||
9xlMrthX6sS22GrcocqeucBdqS/dnW2Ok9QNB4VbUl/4pnvL8mGQPYBAl2Jr5wdQ
|
||||
ULxyxRkmAf+8MbBmdIRlZwDpdaIRO2Wk0OCbA0osgEvK9CYovrfIqqsHYDsgbnLs
|
||||
ugkNAoGBAJok06BN05caPXXLQ2pMwI/7mjcZFjcOMxSloYi7LFkxlyvoTqReAeSa
|
||||
yOb6W/7obS1X8ms/EAkqiyzJuPtNZJCW/nvV0iCoZ/NxLuyHnFaO344GBAweol+S
|
||||
Jx0MY8KuDCyeGErc2xdz/yr3ld2PSTq71dhBluGyba2YX+peJ2Yv
|
||||
-----END RSA PRIVATE KEY-----
|
||||
@ -1,54 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2021 ImmortalWrt
|
||||
# <https://immortalwrt.org>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=UnblockNeteaseMusic
|
||||
PKG_VERSION:=0.25.3
|
||||
PKG_RELEASE:=6
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/nondanee/UnblockNeteaseMusic.git
|
||||
PKG_SOURCE_DATE:=2020-12-22
|
||||
PKG_SOURCE_VERSION:=b8d5f4b4fe59cef9c021b99f3cf2606d99fa4790
|
||||
PKG_MIRROR_HASH:=bd7fa102415ae8dbcd22829fce5ad0cd358a0869547c30f10271389e6c698317
|
||||
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILE:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/UnblockNeteaseMusic
|
||||
SECTION:=multimedia
|
||||
CATEGORY:=Multimedia
|
||||
TITLE:=Revive Netease Cloud Music (NodeJS)
|
||||
URL:=https://github.com/nondanee/UnblockNeteaseMusic
|
||||
DEPENDS:=+node +libopenssl
|
||||
PKGARCH:=all
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
xzcat $(DL_DIR)/$(PKG_SOURCE) | $(TAR) -C $(PKG_BUILD_DIR) $(TAR_OPTIONS)
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
echo -e $(PKG_VERSION) > $(PKG_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/core_ver
|
||||
echo -e $(PKG_SOURCE_VERSION) > $(PKG_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/local_ver
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
true
|
||||
endef
|
||||
|
||||
define Package/UnblockNeteaseMusic/install
|
||||
$(INSTALL_DIR) $(1)/usr/share/UnblockNeteaseMusic
|
||||
$(CP) $(PKG_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/* $(1)/usr/share/UnblockNeteaseMusic
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,UnblockNeteaseMusic))
|
||||
@ -1,73 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2015-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=adbyby
|
||||
PKG_VERSION:=2.7
|
||||
PKG_RELEASE:=2
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/adbyby
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Powerful adblock module to block ad.
|
||||
DEPENDS:=@(i386||x86_64||arm||aarch64||mipsel||mips)
|
||||
URL:=http://www.adbyby.com/
|
||||
endef
|
||||
|
||||
define Package/adbyby/description
|
||||
Adbyby is a powerful adblock module to block ad,just like adblock.
|
||||
endef
|
||||
|
||||
ifeq ($(ARCH),i386)
|
||||
ADBYBY_DIR:=x86
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH),x86_64)
|
||||
ADBYBY_DIR:=amd64
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH),arm)
|
||||
ADBYBY_DIR:=armv7
|
||||
ifeq ($(CONFIG_HAS_FPU),)
|
||||
ADBYBY_DIR:=arm
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH),aarch64)
|
||||
ADBYBY_DIR:=armv7
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH),mips)
|
||||
ADBYBY_DIR:=mips
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH),mipsel)
|
||||
ADBYBY_DIR:=mipsle
|
||||
endif
|
||||
|
||||
define Build/Compile
|
||||
true
|
||||
endef
|
||||
|
||||
define Package/adbyby/install
|
||||
$(INSTALL_DIR) $(1)/usr/share/adbyby
|
||||
$(INSTALL_BIN) ./files/adbyby.sh $(1)/usr/share/adbyby/
|
||||
$(INSTALL_CONF) ./files/adhook.ini $(1)/usr/share/adbyby/
|
||||
$(INSTALL_CONF) ./files/user.action $(1)/usr/share/adbyby/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/adbyby/data
|
||||
$(INSTALL_DATA) ./files/data/* $(1)/usr/share/adbyby/data/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/adbyby/doc
|
||||
$(INSTALL_DATA) ./files/doc/* $(1)/usr/share/adbyby/doc/
|
||||
|
||||
$(INSTALL_BIN) ./files/$(ADBYBY_DIR)/adbyby $(1)/usr/share/adbyby/adbyby
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,adbyby))
|
||||
@ -1,16 +0,0 @@
|
||||
#!/bin/sh
|
||||
PROG_PATH=/usr/share/adbyby
|
||||
err=0
|
||||
until [ $err -ge 5 ]; do
|
||||
if [ -n "$(pgrep $PROG_PATH/adbyby)" ]; then
|
||||
iptables-save | grep ADBYBY >/dev/null || \
|
||||
/etc/init.d/adbyby add_rule
|
||||
sleep 10
|
||||
err=0
|
||||
else
|
||||
$PROG_PATH/adbyby --no-daemon &>/dev/null &
|
||||
sleep 1
|
||||
err=$((err+1))
|
||||
fi
|
||||
done
|
||||
/etc/init.d/adbyby del_rule
|
||||
@ -1,14 +0,0 @@
|
||||
[cfg]
|
||||
### 2.1 ###
|
||||
listen-address=0.0.0.0:8118
|
||||
buffer-limit=1024
|
||||
keep-alive-timeout=30
|
||||
socket-timeout=60
|
||||
### 2.5 ###
|
||||
max_client_connections=0
|
||||
### 2.6 ###
|
||||
stack_size=200
|
||||
auto_restart=0
|
||||
### 2.7 ###
|
||||
debug=0
|
||||
ipset=0
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,25 +0,0 @@
|
||||
! -----¸üÐÂʱ¼ä: 2018-10-08 23:07:52 by:xwhyc-----
|
||||
.php?ad=
|
||||
/99rejs/js
|
||||
/agetsou.js^
|
||||
/c@*!25.js|$script
|
||||
/cococ-66/$script
|
||||
/defaultts.tc.qq.com/*.ts?index=0&start=0&
|
||||
/defaultts.tc.qq.com/*.ts?index=0&start=0&end=*&ver=4
|
||||
/gg_js/
|
||||
/imgs.js?t=
|
||||
/js/adtop.js|
|
||||
/js/guanggao_gg.js?d=
|
||||
/js/sss/ad.js
|
||||
/static/js/aall.js
|
||||
/unionjs/$script
|
||||
/variety.tc.qq.com/*.mp4^*fmt=hd
|
||||
/variety.tc.qq.com/*.mp4^*fmt=shd
|
||||
/video.dispatch.tc.qq.com/*.mp4^*sdtfrom=
|
||||
/view/image/QT_HY.jpg?t=
|
||||
/view/js/slade.js|$script
|
||||
/vlive.qqvideo.tc.qq.com/*.mp4^*fmt=hd
|
||||
/vlive.qqvideo.tc.qq.com/*.mp4^*fmt=shd
|
||||
/vmind.qqvideo.tc.qq.com/*.mp4^*sdtfrom=
|
||||
/vmindhls.tc.qq.com/*ugc=0&ga=0&gv=0&start=
|
||||
/zzhzgg.js
|
||||
@ -1,15 +0,0 @@
|
||||
! ------------------------------ ADByby 自定义过滤语法简表---------------------------------
|
||||
! -------------- 规则基于abp规则,并进行了字符替换部分的扩展-----------------------------
|
||||
! ABP规则请参考https://adblockplus.org/zh_CN/filters,下面为大致摘要
|
||||
! "!" 为行注释符,注释行以该符号起始作为一行注释语义,用于规则描述
|
||||
! "*" 为字符通配符,能够匹配0长度或任意长度的字符串,该通配符不能与正则语法混用。
|
||||
! "^" 为分隔符,可以是除了字母、数字或者 _ - . % 之外的任何字符。
|
||||
! "|" 为管线符号,来表示地址的最前端或最末端
|
||||
! "||" 为子域通配符,方便匹配主域名下的所有子域。
|
||||
! "~" 为排除标识符,通配符能过滤大多数广告,但同时存在误杀, 可以通过排除标识符修正误杀链接。
|
||||
! "##" 为元素选择器标识符,后面跟需要隐藏元素的CSS样式例如 #ad_id .ad_class
|
||||
!! 元素隐藏暂不支持全局规则和排除规则
|
||||
!! 字符替换扩展
|
||||
! 文本替换选择器标识符,后面跟需要替换的文本数据,格式:$s@模式字符串@替换后的文本@
|
||||
! 支持通配符*和?
|
||||
! -------------------------------------------------------------------------------------------
|
||||
@ -1,30 +0,0 @@
|
||||
! -----更新时间: 2018-10-08 23:06:11 by:xwhyc-----------------------------------------------
|
||||
! -----广告反馈:http://www.adbyby.com/help.htm QQ群: 79547134(满), 364066294(满),470705224(满),534897434,438394572--------------
|
||||
|
||||
|
||||
!-------------------------------------------
|
||||
/showadv/
|
||||
3199.cn###ad640,[id^="ad0"]
|
||||
76fengyun.com###down_box{display:block!important;}.gggg,.ggao
|
||||
9553.com##[class="zm"]
|
||||
962.net##.show_ad,.g-962-ad
|
||||
amazon.cn##.adv-float-div
|
||||
downsx.rocks##.adbox,.Left-ad3_fixed,.google-ad2_fixed
|
||||
edu-acc.cn###doyoo_monitor
|
||||
fx678.com##[class^="adv-"]
|
||||
||76fengyun.com/body22233.js
|
||||
||76fengyun.com/file/$s@onclick="window.open('*');startWait();"@onclick="window.open(document.getElementById('downpage_link').href);startWait();"@
|
||||
||atanx.alicdn.com/t/tanxssp.js?_v=
|
||||
||biquguan.com/guan/$script
|
||||
||djv99sxoqpv11.cloudfront.net
|
||||
||jmxlaser.com
|
||||
||jump2.bdimg.com/p/$s@<div class="l_post l_post_bright j_l_post clearfix ?????????? "@<div style="display:none"@
|
||||
||nxkycx.com
|
||||
||res.jklan.cn/wp-content/themes/tt/js/system.js?ver=$s@function goto()@function xxx()@
|
||||
||tieba.com/p/$s@<div class="l_post l_post_bright j_l_post clearfix ?????????? "@<div style="display:none"@
|
||||
||ychap.com
|
||||
!-----------------------
|
||||
/qkostn.js|
|
||||
|http://mark.l.qq.com/fcgi-bin/get_video_mark_all*&strAdParam=
|
||||
!---------adbyby---------
|
||||
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
@ -1,10 +0,0 @@
|
||||
;¸üйæÔòurl,dir,size,reverse,reverse
|
||||
http://update.adbyby.com/rule3/lazy.jpg \data\lazy.txt 385337 4 0
|
||||
http://update.adbyby.com/rule3/video.jpg \data\video.txt 1028 4 0
|
||||
http://update.adbyby.com/rule3/user.action \user.action 512 5 0
|
||||
http://update.adbyby.com/rule3/clean.ini \data\clean.ini 2167 0 0
|
||||
http://update.adbyby.com/rule3/adclear.ini \data\adclear.ini 4901 0 0
|
||||
https://github.com/gchangchen/suho/raw/master/adhook.dll \adhook.dll 117248 0 0 2.4.3.2
|
||||
https://github.com/gchangchen/suho/raw/master/adhook64.dll \adhook64.dll 142848 0 0 2.4.3.2
|
||||
https://github.com/gchangchen/suho/raw/master/adbyby.exe \adbyby.exe 1004183 1 0 2.4.4.0
|
||||
|
||||
Binary file not shown.
@ -1,102 +0,0 @@
|
||||
# Copyright (C) 2021 ImmortalWrt
|
||||
# <https://immortalwrt.org>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=aMule
|
||||
PKG_VERSION:=2.3.2
|
||||
PKG_RELEASE:=5
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/amule-project/amule.git
|
||||
PKG_SOURCE_DATE:=2021-01-30
|
||||
PKG_SOURCE_VERSION:=c3a1018329633234ac941055b64a43b9e2df7fad
|
||||
PKG_MIRROR_HASH:=f03b60e909346c4d984aeb9cf3a115b5b43fa6158ee01ed41b99e7217b436bb7
|
||||
|
||||
PKG_CONFIG_DEPEDS:= CONFIG_AMULE_CRYPTOPP_STATIC_LINKING
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_BUILD_DEPENDS:=libcryptopp libgd
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/nls.mk
|
||||
|
||||
define Package/amule
|
||||
SUBMENU:=P2P
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=A multi-platform eMule-like ed2k client
|
||||
URL:=http://www.amule.org/
|
||||
DEPENDS:=+libpng +libpthread +libncurses +libreadline +libwxbase +libupnp +libbfd \
|
||||
$(ICONV_DEPENDS) $(INTL_DEPENDS) +!AMULE_CRYPTOPP_STATIC_LINKING:libcryptopp
|
||||
endef
|
||||
|
||||
define Package/amule/config
|
||||
config AMULE_CRYPTOPP_STATIC_LINKING
|
||||
bool "Link libcryptopp statically"
|
||||
default n
|
||||
endef
|
||||
|
||||
TARGET_LDFLAGS+= -liconv
|
||||
|
||||
CONFIGURE_ARGS+= \
|
||||
--disable-static \
|
||||
--disable-rpath \
|
||||
--with-gnu-ld \
|
||||
--disable-ccache \
|
||||
--disable-optimize \
|
||||
--disable-profile \
|
||||
--disable-monolithic \
|
||||
--enable-amule-daemon \
|
||||
--enable-amulecmd \
|
||||
--enable-webserver \
|
||||
--disable-amule-gui \
|
||||
--disable-cas \
|
||||
--disable-wxcas \
|
||||
--disable-ed2k \
|
||||
--disable-alc \
|
||||
--disable-alcc \
|
||||
--disable-fileview \
|
||||
--disable-plasmamule \
|
||||
--without-wxdebug \
|
||||
--enable-dlp \
|
||||
--enable-upnp \
|
||||
--with-zlib="$(STAGING_DIR)/usr" \
|
||||
--with-gdlib-prefix="$(STAGING_DIR)/usr" \
|
||||
--with-libpng-prefix="$(STAGING_DIR)/usr" \
|
||||
--with-wx-prefix="$(STAGING_DIR)/usr" \
|
||||
--with-crypto-prefix="$(STAGING_DIR)/usr" \
|
||||
--with-libiconv-prefix="$(ICONV_PREFIX)" \
|
||||
--with-libintl-prefix="$(INTL_PREFIX)" \
|
||||
--with-libupnp-prefix="$(STAGING_DIR)/usr" \
|
||||
--without-x \
|
||||
--disable-debug
|
||||
|
||||
MAKE_FLAGS += HOSTCC="$(HOSTCC)"
|
||||
|
||||
define Build/Configure
|
||||
cd $(PKG_BUILD_DIR); $(SHELL) autogen.sh
|
||||
$(call Build/Configure/Default)
|
||||
ifeq ($(CONFIG_AMULE_CRYPTOPP_STATIC_LINKING),y)
|
||||
$(SED) 's;^CRYPTOPP_LIBS.*;CRYPTOPP_LIBS \= "$(STAGING_DIR)/usr/lib/libcryptopp.a";g' \
|
||||
$(PKG_BUILD_DIR)/src/Makefile
|
||||
endif
|
||||
endef
|
||||
|
||||
define Package/amule/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/amulecmd $(1)/usr/bin/amulecmd
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/amuled $(1)/usr/bin/amuled
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/amuleweb $(1)/usr/bin/amuleweb
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/share/amule $(1)/usr/share/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,amule))
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,22 +0,0 @@
|
||||
--- a/m4/libupnp.m4
|
||||
+++ b/m4/libupnp.m4
|
||||
@@ -57,7 +57,6 @@ dnl Test for --with-libupnp-prefix
|
||||
])
|
||||
|
||||
dnl Check for libupnp >= MIN_LIBUPNP_VERSION
|
||||
- AS_IF([test $cross_compiling = no], [
|
||||
AC_MSG_CHECKING([for libupnp version >= MIN_LIBUPNP_VERSION])
|
||||
AS_IF([test -n "$PKG_CONFIG"], [
|
||||
AS_IF([$PKG_CONFIG libupnp --exists], [
|
||||
@@ -84,11 +83,6 @@ dnl Check for libupnp >= MIN_LIBUPNP_VER
|
||||
])
|
||||
AC_MSG_RESULT([$result$resultstr])
|
||||
libupnp_error="libupnp >= MIN_LIBUPNP_VERSION not found$resultstr"
|
||||
- ], [
|
||||
-dnl Currently cross-compilation with libupnp is not supported.
|
||||
- result=no
|
||||
- libupnp_error="cross compiling"
|
||||
- ])
|
||||
|
||||
dnl Execute the right action.
|
||||
AS_IF([test ${result:-no} = yes], [$2], [$3])
|
||||
@ -1,47 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2021 ImmortalWrt
|
||||
# <https://immortalwrt.org>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=antileech
|
||||
PKG_VERSION:=2.3.2
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_BUILD_DEPENDS:=libgd
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/nls.mk
|
||||
|
||||
define Package/antileech
|
||||
SUBMENU:=P2P
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=AntiLeech for amule
|
||||
URL:=http://www.amule.org/
|
||||
DEPENDS:=+libc +amule +libwxbase
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
$(SED) "s:^AC_CHECK_PROG.WXCONFIG,.*::g" $(PKG_BUILD_DIR)/configure.ac
|
||||
$(SED) "s:wx-config --cppflags:$(STAGING_DIR)/usr/bin/wx-config --cppflags:g" $(PKG_BUILD_DIR)/configure.ac
|
||||
|
||||
cd $(PKG_BUILD_DIR); $(SHELL) ./autogen.sh
|
||||
$(call Build/Configure/Default)
|
||||
endef
|
||||
|
||||
MAKE_FLAGS += HOSTCC="$(HOSTCC)"
|
||||
|
||||
define Package/antileech/install
|
||||
$(INSTALL_DIR) $(1)/usr/share/amule
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/share/amule/libantiLeech.so* $(1)/usr/share/amule/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,antileech))
|
||||
@ -1,63 +0,0 @@
|
||||
/**
|
||||
* Author: Bill Lee<bill.lee.y@gmail.com>
|
||||
* License: GNU GPL
|
||||
*/
|
||||
//---------------------
|
||||
#ifndef CSTRING_WX_H
|
||||
#define CSTRING_WX_H
|
||||
|
||||
//#include <wx/wx.h>
|
||||
#include <wx/string.h>
|
||||
|
||||
class CString : public wxString{
|
||||
public:
|
||||
CString(){}
|
||||
CString(wxChar c, size_t n=1): wxString(c, n){}
|
||||
CString(const wxChar* str): wxString(str){}
|
||||
CString(const wxString& str): wxString(str){}
|
||||
CString(const CString& str): wxString(str){}
|
||||
//---------------------
|
||||
CString& operator=(const wxChar* str){
|
||||
wxString::operator=(str);
|
||||
return *this;
|
||||
}
|
||||
//operator*() from wxString;
|
||||
size_t GetLength()const{ return Length(); }
|
||||
wxChar GetAt(size_t nIndex)const{ return GetChar(nIndex); }
|
||||
//IsEmpty() from wxString;
|
||||
CString& TrimLeft(wxChar c){
|
||||
size_t pos = find_first_not_of(c);
|
||||
if(pos == 0)
|
||||
return *this;
|
||||
erase(0, pos);
|
||||
return *this;
|
||||
}
|
||||
CString& TrimRight(wxChar c){
|
||||
size_t pos = find_last_not_of(c) + 1;
|
||||
if(pos == Length())
|
||||
return *this;
|
||||
erase(pos, Length() - pos);
|
||||
return *this;
|
||||
}
|
||||
CString Trim(){
|
||||
CString ret(*this);
|
||||
ret.wxString::Trim(false); /* wxString::Trim(bool fromright = true) */
|
||||
ret.wxString::Trim(true);
|
||||
return ret;
|
||||
}
|
||||
//Find(wxChar) and Find(wxChar*) from wxString;
|
||||
int Find(const CString& str)const{ return wxString::Find(str.c_str()); }
|
||||
int ReverseFind(const wxChar c)const{ return wxString::Find(c, true); }
|
||||
int ReverseFind(const wxChar* str)const{ return rfind(str); }
|
||||
int ReverseFind(const CString& str)const{ return rfind(str); }
|
||||
CString Right(size_t len)const{ return wxString::Right(len); }
|
||||
CString Left(size_t len)const{ return wxString::Left(len); }
|
||||
#if wxCHECK_VERSION(2, 9, 0)
|
||||
CString Mid(size_t first, size_t count = wxString::npos)const{
|
||||
#else
|
||||
CString Mid(size_t first, size_t count = wxSTRING_MAXLEN)const{
|
||||
#endif
|
||||
return wxString::Mid(first, count);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
@ -1,28 +0,0 @@
|
||||
/*
|
||||
* =====================================================================================
|
||||
*
|
||||
* Filename: Interface.cpp
|
||||
*
|
||||
* Description: A part of aMule DLP
|
||||
*
|
||||
* Created: 2011-02-24 19:49
|
||||
*
|
||||
* Author: Bill Lee , bill.lee.y@gmail.com
|
||||
*
|
||||
* Copyright (c) 2011, Bill Lee
|
||||
* License: GNU General Public License
|
||||
*
|
||||
* =====================================================================================
|
||||
*/
|
||||
|
||||
/* ##### HEADER FILE INCLUDES ################################################### */
|
||||
#include "antiLeech.h"
|
||||
|
||||
/* ##### FUNCTION DEFINITIONS - EXPORTED FUNCTIONS ############################ */
|
||||
extern "C" IantiLeech* createAntiLeechInstant(){
|
||||
return new CantiLeech;
|
||||
}
|
||||
extern "C" int destoryAntiLeechInstant(IantiLeech* ptr){
|
||||
delete ptr;
|
||||
return 0;
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
pkgdir = $(datadir)/amule
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
pkg_LTLIBRARIES = libantiLeech.la
|
||||
libantiLeech_la_CPPFLAGS = ${ANTILEECH_CPPFLAGS}
|
||||
libantiLeech_la_LDFLAGS = ${ANTILEECH_LDFLAGS} -module -avoid-version --no-la-files
|
||||
libantiLeech_la_SOURCES = \
|
||||
antiLeech.h \
|
||||
antiLeech_wx.h \
|
||||
CString_wx.h \
|
||||
antiLeech.cpp \
|
||||
antiLeech_wx.cpp \
|
||||
Interface.cpp
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,161 +0,0 @@
|
||||
#ifndef ANTILEECH_H
|
||||
#define ANTILEECH_H
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "antiLeech_wx.h"
|
||||
#include "CString_wx.h"
|
||||
|
||||
class IantiLeech
|
||||
{
|
||||
public:
|
||||
virtual ~IantiLeech(){}; /* Bill Lee: Not be used currently */
|
||||
//BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD,LPVOID);
|
||||
virtual DWORD GetDLPVersion() = 0;
|
||||
//old versions to keep compatible
|
||||
/* //drop old version support
|
||||
virtual LPCTSTR DLPCheckModstring(LPCTSTR modversion, LPCTSTR clientversion);
|
||||
virtual LPCTSTR DLPCheckUsername(LPCTSTR username);
|
||||
virtual LPCTSTR DLPCheckNameAndHash(CString username, CString& userhash);
|
||||
*/
|
||||
//new versions
|
||||
virtual LPCTSTR DLPCheckModstring_Hard(LPCTSTR modversion, LPCTSTR clientversion) = 0;
|
||||
virtual LPCTSTR DLPCheckModstring_Soft(LPCTSTR modversion, LPCTSTR clientversion) = 0;
|
||||
virtual LPCTSTR DLPCheckUsername_Hard(LPCTSTR username) = 0;
|
||||
virtual LPCTSTR DLPCheckUsername_Soft(LPCTSTR username) = 0;
|
||||
virtual LPCTSTR DLPCheckNameAndHashAndMod(const CString& username, const CString& userhash, const CString& modversion) = 0;
|
||||
virtual LPCTSTR DLPCheckMessageSpam(LPCTSTR messagetext) = 0;
|
||||
|
||||
|
||||
virtual LPCTSTR DLPCheckUserhash(const PBYTE userhash) = 0;
|
||||
|
||||
|
||||
virtual LPCTSTR DLPCheckHelloTag(UINT tagnumber) = 0;
|
||||
virtual LPCTSTR DLPCheckInfoTag(UINT tagnumber) = 0;
|
||||
|
||||
//void TestFunc();
|
||||
|
||||
//Bill Lee: no need in interface abstract class
|
||||
//private:
|
||||
// static bool IsTypicalHex (const CString& addon);
|
||||
};
|
||||
|
||||
//Bill Lee: never call delete on IantiLeech, use destoryAntiLeechInstat instead.
|
||||
extern "C" IantiLeech* createAntiLeechInstant();
|
||||
extern "C" int destoryAntiLeechInstant(IantiLeech*);
|
||||
|
||||
class CantiLeech: public IantiLeech
|
||||
{
|
||||
public:
|
||||
//BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD,LPVOID);
|
||||
virtual DWORD GetDLPVersion(){ return DLPVersion; }
|
||||
//old versions to keep compatible
|
||||
/* //drop old version support
|
||||
virtual LPCTSTR DLPCheckModstring(LPCTSTR modversion, LPCTSTR clientversion);
|
||||
virtual LPCTSTR DLPCheckUsername(LPCTSTR username);
|
||||
virtual LPCTSTR DLPCheckNameAndHash(CString username, CString& userhash);
|
||||
*/
|
||||
//new versions
|
||||
virtual LPCTSTR DLPCheckModstring_Hard(LPCTSTR modversion, LPCTSTR clientversion);
|
||||
virtual LPCTSTR DLPCheckModstring_Soft(LPCTSTR modversion, LPCTSTR clientversion);
|
||||
virtual LPCTSTR DLPCheckUsername_Hard(LPCTSTR username);
|
||||
virtual LPCTSTR DLPCheckUsername_Soft(LPCTSTR username);
|
||||
virtual LPCTSTR DLPCheckNameAndHashAndMod(const CString& username, const CString& userhash, const CString& modversion);
|
||||
virtual LPCTSTR DLPCheckMessageSpam(LPCTSTR messagetext);
|
||||
|
||||
|
||||
virtual LPCTSTR DLPCheckUserhash(const PBYTE userhash);
|
||||
|
||||
|
||||
virtual LPCTSTR DLPCheckHelloTag(UINT tagnumber);
|
||||
virtual LPCTSTR DLPCheckInfoTag(UINT tagnumber);
|
||||
|
||||
//void TestFunc();
|
||||
|
||||
private:
|
||||
static const DWORD DLPVersion;
|
||||
static bool IsTypicalHex (const CString& addon);
|
||||
};
|
||||
|
||||
//<<< new tags from eMule 0.04x
|
||||
#define CT_UNKNOWNx0 0x00 // Hybrid Horde protocol
|
||||
#define CT_UNKNOWNx12 0x12 // http://www.haspepapa-welt.de (DodgeBoards)
|
||||
#define CT_UNKNOWNx13 0x13 // http://www.haspepapa-welt.de (DodgeBoards)
|
||||
#define CT_UNKNOWNx14 0x14 // http://www.haspepapa-welt.de (DodgeBoards)
|
||||
#define CT_UNKNOWNx15 0x15 // http://www.haspepapa-welt.de (DodgeBoards) & DarkMule |eVorte|X|
|
||||
#define CT_UNKNOWNx16 0x16 // http://www.haspepapa-welt.de (DodgeBoards)
|
||||
#define CT_UNKNOWNx17 0x17 // http://www.haspepapa-welt.de (DodgeBoards)
|
||||
#define CT_UNKNOWNx4D 0x4D // pimp my mule (00de)
|
||||
#define CT_UNKNOWNxE6 0xE6 // http://www.haspepapa-welt.de
|
||||
#define CT_UNKNOWNx22 0x22 // DarkMule |eVorte|X|
|
||||
#define CT_UNKNOWNx5D 0x5D // md4
|
||||
#define CT_UNKNOWNx63 0x63 // ?
|
||||
#define CT_UNKNOWNx64 0x64 // ?
|
||||
#define CT_UNKNOWNx69 0x69 // eMuleReactor //Xman don't use this, it's webcache!
|
||||
#define CT_UNKNOWNx6B 0x6B // md4
|
||||
#define CT_UNKNOWNx6C 0x6C // md4
|
||||
#define CT_UNKNOWNx74 0x74 // md4
|
||||
#define CT_UNKNOWNx76 0x76 // www.donkey2002.to
|
||||
#define CT_UNKNOWNx79 0x79 // Bionic
|
||||
#define CT_UNKNOWNx7A 0x7A // NewDarkMule
|
||||
#define CT_UNKNOWNx83 0x83 // Fusspi
|
||||
#define CT_UNKNOWNx87 0x87 // md4
|
||||
#define CT_UNKNOWNx88 0x88 // DarkMule v6 |eVorte|X|
|
||||
#define CT_UNKNOWNx8c 0x8c // eMule v0.27c [LSD7c]
|
||||
#define CT_UNKNOWNx8d 0x8d // unknown Leecher - (client version:60)
|
||||
#define CT_UNKNOWNx94 0x94 // 00.de community //Xman 20.08.05
|
||||
#define CT_UNKNOWNx97 0x97 // Emulereactor Community Mod
|
||||
#define CT_UNKNOWNx98 0x98 // Emulereactor Community Mod
|
||||
#define CT_UNKNOWNx99 0x99 // eMule v0.26d [RAMMSTEIN 8b]
|
||||
#define CT_UNKNOWNx9C 0x9C // Emulereactor Community Mod
|
||||
#define CT_UNKNOWNxbb 0xbb // emule.de (client version:60)
|
||||
#define CT_UNKNOWNxc4 0xc4 //MD5 Community from new bionic - hello
|
||||
#define CT_UNKNOWNxC8 0xc8 // MD5 Community from new bionic - hello //Xman x4
|
||||
#define CT_UNKNOWNxCA 0xCA // NewDarkMule
|
||||
#define CT_UNKNOWNxCD 0xCD // www.donkey2002.to
|
||||
#define CT_UNKNOWNxCE 0xCE // FRZ community //Xman 20.08.05
|
||||
#define CT_UNKNOWNxCF 0xCF // FRZ community //Xman 20.08.05
|
||||
#define CT_UNKNOWNxDA 0xDA // Emulereactor Community Mod
|
||||
#define CT_UNKNOWNxEC 0xec // SpeedMule and clones //Xman x4
|
||||
#define CT_UNKNOWNxF0 0xF0 // Emulereactor Community Mod
|
||||
#define CT_UNKNOWNxF4 0xF4 // Emulereactor Community Mod
|
||||
#define CT_UNKNOWNxD2 0xD2 // Chinese Leecher //SquallATF
|
||||
//#define CT_UNKNOWNx85 0x85 // viper-israel.org and eChanblardNext //zz_fly, viper become good
|
||||
|
||||
#define CT_FRIENDSHARING 0x66 //eWombat [SNAFU]
|
||||
#define CT_DARK 0x54 //eWombat [SNAFU]
|
||||
#define FRIENDSHARING_ID 0x5F73F1A0 // Magic Key, DO NOT CHANGE!
|
||||
|
||||
// unknown eMule tags
|
||||
#define ET_MOD_UNKNOWNx12 0x12 // http://www.haspepapa-welt.de
|
||||
#define ET_MOD_UNKNOWNx13 0x13 // http://www.haspepapa-welt.de
|
||||
#define ET_MOD_UNKNOWNx14 0x14 // http://www.haspepapa-welt.de
|
||||
#define ET_MOD_UNKNOWNx17 0x17 // http://www.haspepapa-welt.de
|
||||
#define ET_MOD_UNKNOWNx2F 0x2F // eMule v0.30 [OMEGA v.07 Heiko]
|
||||
#define ET_MOD_UNKNOWNx30 0x30 // aMule 1.2.0
|
||||
#define ET_MOD_UNKNOWNx36 0x36 // eMule v0.26
|
||||
#define ET_MOD_UNKNOWNx3C 0x3C // enkeyDev.6 / LamerzChoice 9.9a
|
||||
#define ET_MOD_UNKNOWNx41 0x41 // CrewMod (pre-release mod based on Plus) identification
|
||||
#define ET_MOD_UNKNOWNx42 0x42 // CrewMod (pre-release mod based on Plus) key verification
|
||||
#define ET_MOD_UNKNOWNx43 0x43 // CrewMod (pre-release mod based on Plus) version info
|
||||
#define ET_MOD_UNKNOWNx50 0x50 // Bionic 0.20 Beta]
|
||||
#define ET_MOD_UNKNOWNx59 0x59 // emule 0.40 / eMule v0.30 [LSD.12e]
|
||||
#define ET_MOD_UNKNOWNx5B 0x5B // eMule v0.26
|
||||
#define ET_MOD_UNKNOWNx60 0x60 // eMule v0.30a Hunter.6 + eMule v0.26
|
||||
#define ET_MOD_UNKNOWNx64 0x64 // LSD.9dT / Athlazan(0.29c)Alpha.3
|
||||
#define ET_MOD_UNKNOWNx76 0x76 // http://www.haspepapa-welt.de (DodgeBoards)
|
||||
#define ET_MOD_UNKNOWNx84 0x84 // eChanblardv3.2
|
||||
#define ET_MOD_UNKNOWNx85 0x85 // ?
|
||||
#define ET_MOD_UNKNOWNx86 0x86 // ?
|
||||
#define ET_MOD_UNKNOWNx93 0x93 // ?
|
||||
#define ET_MOD_UNKNOWNxA6 0xA6 // eMule v0.26
|
||||
#define ET_MOD_UNKNOWNxB1 0xB1 // Bionic 0.20 Beta]
|
||||
#define ET_MOD_UNKNOWNxB4 0xB4 // Bionic 0.20 Beta]
|
||||
#define ET_MOD_UNKNOWNxC8 0xC8 // Bionic 0.20 Beta]
|
||||
#define ET_MOD_UNKNOWNxC9 0xC9 // Bionic 0.20 Beta]
|
||||
#define ET_MOD_UNKNOWNxDA 0xDA // Rumata (rus)(Plus v1f) - leecher mod?
|
||||
//>>> eWombat [SNAFU_V3]
|
||||
|
||||
#undef __declspec
|
||||
#endif
|
||||
@ -1,25 +0,0 @@
|
||||
//Author: greensea <gs@bbxy.net>
|
||||
#include "antiLeech_wx.h" //Modified by Bill Lee.
|
||||
|
||||
//Bug fixed by Orzogc Lee
|
||||
LPCTSTR StrStrI(LPCTSTR haystack, LPCTSTR needle){
|
||||
//Bill Lee: allocate wchar array on the stack
|
||||
wchar_t haystacki[512];
|
||||
wchar_t needlei[512];
|
||||
int i = 0;
|
||||
do{
|
||||
haystacki[i] = towlower(haystack[i]);
|
||||
if(i == 511)
|
||||
break;
|
||||
}while(haystack[i++]); //As haystacki is allocated on the stack, it wans't set 0. So the NULL needs to be copy.
|
||||
i = 0;
|
||||
do{
|
||||
needlei[i] = towlower(needle[i]);
|
||||
if(i == 511)
|
||||
break;
|
||||
}while(needle[i++]);
|
||||
const wchar_t* ret = wcsstr(haystacki, needlei);
|
||||
if(ret != NULL)
|
||||
ret = ret - haystacki + haystack;
|
||||
return ret;
|
||||
}
|
||||
@ -1,54 +0,0 @@
|
||||
#ifndef ANTILEECH_WX_H
|
||||
#define ANTILEECH_WX_H
|
||||
|
||||
#include <wx/defs.h>
|
||||
#include <string.h>
|
||||
#include <wctype.h> // for towlower()
|
||||
|
||||
#define LPCTSTR const wxChar*
|
||||
#define BOOL bool
|
||||
//#define _T(var) wxT(var) //defined in wxWidgets
|
||||
#define DWORD wxUint32
|
||||
#define UINT wxUint16
|
||||
#define WINAPI
|
||||
#define HINSTANCE
|
||||
#define LPVOID void*
|
||||
#define PBYTE unsigned char*
|
||||
#define TCHAR wxChar
|
||||
#define _TINT wxInt32
|
||||
#define SSIZE_T ptrdiff_t
|
||||
|
||||
#define StrCmpI _tcsicmp
|
||||
#define _tcsicmp _wcsicmp
|
||||
|
||||
#define _istdigit(var) iswdigit(var)
|
||||
#define _istcntrl(var) iswcntrl(var)
|
||||
#define _istpunct(var) iswpunct(var)
|
||||
#define _istspace(var) iswspace(var)
|
||||
#define _istxdigit(var) iswxdigit(var)
|
||||
inline float _tstof(const wchar_t* str){
|
||||
wchar_t** ptail = NULL;
|
||||
return wcstof(str, ptail);
|
||||
}
|
||||
//This function is not used. by Orzogc Lee
|
||||
//But I think there is no need to removing, linker will remove it.
|
||||
/*
|
||||
inline void tolowers(wxChar* str){
|
||||
int i = 0;
|
||||
do{
|
||||
str[i] = towlower(str[i]);
|
||||
}while(str[++i]);
|
||||
}
|
||||
*/
|
||||
#define _tcsstr(haystack, needle) wcsstr(haystack, needle)
|
||||
#define _tcslen(var) wcslen(var)
|
||||
#define StrStr(a, b) wcsstr(a, b)
|
||||
#define StrStrIW(a, b) StrStrI(a, b)
|
||||
|
||||
LPCTSTR StrStrI(LPCTSTR haystack, LPCTSTR needle);
|
||||
//Bill Lee: I think inlining this function make no senses, because it is a very large operation.
|
||||
|
||||
#define _wcsicmp(a, b) wcscasecmp(a, b)
|
||||
#define StrCmpIW(a, b) wcscasecmp(a, b)
|
||||
|
||||
#endif
|
||||
@ -1,8 +0,0 @@
|
||||
mkdir -pv m4
|
||||
libtoolize
|
||||
aclocal
|
||||
aclocal -I m4
|
||||
automake --add-missing --copy
|
||||
autoconf
|
||||
|
||||
|
||||
@ -1,44 +0,0 @@
|
||||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
# Copyright (C) 2011 Bill Lee <bill.lee.y@gmail.com>
|
||||
# License: GNU GPL v3 or any later version released by Free Software Foundation
|
||||
|
||||
#AC_PREREQ([2.65])
|
||||
AC_INIT([antiLeech], [44], [https://github.com/persmule/amule-dlp/issues])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
AM_INIT_AUTOMAKE()
|
||||
AC_CONFIG_SRCDIR([antiLeech.cpp])
|
||||
#AC_CONFIG_HEADERS([config.h])
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CXX
|
||||
AC_PROG_CC
|
||||
AC_PROG_CPP
|
||||
AC_PROG_MAKE_SET
|
||||
AM_DISABLE_STATIC
|
||||
AC_PROG_LIBTOOL
|
||||
|
||||
#Check for wx-config
|
||||
|
||||
AC_CHECK_PROG(WXCONFIG, [wx-config], [wx-config])
|
||||
ANTILEECH_CPPFLAGS=$(wx-config --cppflags)
|
||||
|
||||
AC_SUBST(ANTILEECH_CPPFLAGS)
|
||||
|
||||
# Checks for libraries.
|
||||
ANTILEECH_LDFLAGS=
|
||||
|
||||
AC_SUBST(ANTILEECH_LDFLAGS)
|
||||
|
||||
# Checks for header files.
|
||||
AC_CHECK_HEADERS([string.h], [wx/string.h], [wx/defs.h])
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_HEADER_STDBOOL
|
||||
AC_C_INLINE
|
||||
AC_TYPE_SIZE_T
|
||||
|
||||
# Checks for library functions.
|
||||
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_OUTPUT
|
||||
@ -1,61 +0,0 @@
|
||||
--- antiLeech.cpp.win 2016-02-15 19:31:18.748711749 +0800
|
||||
+++ antiLeech.cpp 2016-02-15 20:49:25.691484626 +0800
|
||||
@@ -17,8 +17,11 @@
|
||||
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
|
||||
-#include <atlstr.h>
|
||||
+#include "CString_wx.h"
|
||||
#include "antiLeech.h"
|
||||
+#define __declspec(var) CantiLeech::
|
||||
+#define SPECIAL_DLP_VERSION
|
||||
+#define ALL_VERYCD_MOD
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
@@ -51,7 +54,10 @@ LPCTSTR apszSnafuTag[]=
|
||||
//,_T("[eChanblardNext]") //21 zz_fly
|
||||
};
|
||||
|
||||
+const DWORD CantiLeech::DLPVersion = 4405;
|
||||
|
||||
+//deactivate M$WIN-specific codes
|
||||
+#if 0
|
||||
BOOL WINAPI DllMain (
|
||||
HANDLE hModule,
|
||||
DWORD dwFunction,
|
||||
@@ -74,6 +80,7 @@ void __declspec(dllexport) TestFunc()
|
||||
{
|
||||
::MessageBox(NULL,_T("Inside the DLL!"),_T("Nix"),0);
|
||||
}
|
||||
+#endif
|
||||
|
||||
//old versions just to keep compatible
|
||||
/* //drop old version support
|
||||
@@ -285,7 +292,7 @@ LPCTSTR __declspec(dllexport) DLPCheckNa
|
||||
*/
|
||||
//end old version ------------------------------------------
|
||||
|
||||
-bool IsTypicalHex(CString& addon)
|
||||
+bool CantiLeech::IsTypicalHex(const CString& addon)
|
||||
{
|
||||
if(addon.GetLength()>25 || addon.GetLength()<5)
|
||||
return false;
|
||||
@@ -1244,7 +1251,7 @@ LPCTSTR __declspec(dllexport) DLPCheckUs
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-LPCTSTR __declspec(dllexport) DLPCheckNameAndHashAndMod(CString username, CString& userhash, CString& modversion)
|
||||
+LPCTSTR __declspec(dllexport) DLPCheckNameAndHashAndMod(const CString& username, const CString& userhash, const CString& modversion)
|
||||
{
|
||||
if(username.IsEmpty() || userhash.IsEmpty())
|
||||
return NULL;
|
||||
@@ -1309,7 +1316,7 @@ LPCTSTR __declspec(dllexport) DLPCheckNa
|
||||
|
||||
//Check for aedit
|
||||
//remark: a unmodded emule can't send a space at last sign
|
||||
- if(modversion.IsEmpty() && username.Right(1)==32)
|
||||
+ if(modversion.IsEmpty() && username.Right(1)==_T(" "))
|
||||
return _T("AEdit");
|
||||
|
||||
//Check for Hex-Modstring
|
||||
@ -1,74 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2020 Lean <coolsnowwolf@gmail.com>
|
||||
#
|
||||
# Copyright (C) 2021 ImmortalWrt
|
||||
# <https://immortalwrt.org>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=autocore
|
||||
PKG_VERSION:=1
|
||||
PKG_RELEASE:=40
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/autocore-arm
|
||||
TITLE:=Arm auto core loadbalance script.
|
||||
MAINTAINER:=CN_SZTL
|
||||
DEPENDS:=@(TARGET_bcm27xx||TARGET_bcm53xx||TARGET_ipq40xx||TARGET_ipq806x||TARGET_mvebu||TARGET_rockchip||TARGET_sunxi) \
|
||||
+TARGET_bcm27xx:bcm27xx-userland \
|
||||
+TARGET_bcm53xx:nvram \
|
||||
+(TARGET_ipq40xx||TARGET_ipq806x):lm-sensors
|
||||
VARIANT:=arm
|
||||
endef
|
||||
|
||||
define Package/autocore-x86
|
||||
TITLE:=x86/x64 auto core loadbalance script.
|
||||
MAINTAINER:=Lean
|
||||
DEPENDS:=@TARGET_x86 +bc +lm-sensors +ethtool
|
||||
VARIANT:=x86
|
||||
endef
|
||||
|
||||
define Package/autocore-arm/description
|
||||
A luci autoconfig hotplug script.
|
||||
endef
|
||||
|
||||
define Package/autocore-x86/description
|
||||
A usb autoconfig hotplug script.
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
true
|
||||
endef
|
||||
|
||||
define Package/autocore-arm/install
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(INSTALL_DATA) ./files/arm/index.htm $(1)/etc/index.htm
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/arm/090-cover-index_htm $(1)/etc/uci-defaults/090-cover-index_htm
|
||||
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) ./files/arm/sbin/cpuinfo $(1)/sbin/cpuinfo
|
||||
ifneq (, $(findstring $(BOARD), ipq40xx ipq806x))
|
||||
$(INSTALL_BIN) ./files/arm/sbin/tempinfo $(1)/sbin/tempinfo
|
||||
endif
|
||||
endef
|
||||
|
||||
define Package/autocore-x86/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/x86/autocore $(1)/etc/init.d/autocore
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(INSTALL_DATA) ./files/x86/index.htm $(1)/etc/index.htm
|
||||
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(CP) ./files/x86/sbin/* $(1)/sbin
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,autocore-arm))
|
||||
$(eval $(call BuildPackage,autocore-x86))
|
||||
@ -1,5 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -f /etc/index.htm ] && mv /etc/index.htm /usr/lib/lua/luci/view/admin_status/index.htm
|
||||
|
||||
exit 0
|
||||
@ -1,822 +0,0 @@
|
||||
<%#
|
||||
Copyright 2008 Steven Barth <steven@midlink.org>
|
||||
Copyright 2008-2011 Jo-Philipp Wich <jow@openwrt.org>
|
||||
Licensed to the public under the Apache License 2.0.
|
||||
-%>
|
||||
|
||||
<%
|
||||
local fs = require "nixio.fs"
|
||||
local util = require "luci.util"
|
||||
local stat = require "luci.tools.status"
|
||||
local ver = require "luci.version"
|
||||
|
||||
local has_ipv6 = fs.access("/usr/sbin/ip6tables")
|
||||
local has_dhcp = fs.access("/etc/config/dhcp")
|
||||
local has_wifi = ((fs.stat("/etc/config/wireless", "size") or 0) > 0)
|
||||
local has_temp = fs.access("/sbin/tempinfo")
|
||||
|
||||
local sysinfo = luci.util.ubus("system", "info") or { }
|
||||
local boardinfo = luci.util.ubus("system", "board") or { }
|
||||
local unameinfo = nixio.uname() or { }
|
||||
|
||||
local meminfo = sysinfo.memory or {
|
||||
total = 0,
|
||||
free = 0,
|
||||
buffered = 0,
|
||||
shared = 0
|
||||
}
|
||||
|
||||
local mem_cached = luci.sys.exec("sed -e '/^Cached: /!d; s#Cached: *##; s# kB##g' /proc/meminfo")
|
||||
|
||||
local swapinfo = sysinfo.swap or {
|
||||
total = 0,
|
||||
free = 0
|
||||
}
|
||||
|
||||
local has_dsl = fs.access("/etc/init.d/dsl_control")
|
||||
|
||||
if luci.http.formvalue("status") == "1" then
|
||||
local ntm = require "luci.model.network".init()
|
||||
local wan = ntm:get_wannet()
|
||||
local wan6 = ntm:get_wan6net()
|
||||
|
||||
local conn_count = tonumber(
|
||||
fs.readfile("/proc/sys/net/netfilter/nf_conntrack_count") or "") or 0
|
||||
|
||||
local conn_max = tonumber(luci.sys.exec(
|
||||
"sysctl -n -e net.nf_conntrack_max net.ipv4.netfilter.ip_conntrack_max"
|
||||
):match("%d+")) or 4096
|
||||
|
||||
local user_info = luci.sys.exec("cat /proc/net/arp | grep 'br-lan' | grep '0x2' | wc -l")
|
||||
|
||||
local cpu_usage = luci.sys.exec("top -n1 | awk '/^CPU/ {printf(\"%d%%\", 100 - $8)}'") or "6%"
|
||||
local cpu_info = luci.sys.exec("/sbin/cpuinfo") or "ARM Processor"
|
||||
|
||||
local rv = {
|
||||
cpuinfo = cpu_info,
|
||||
cpuusage = cpu_usage,
|
||||
userinfo = user_info,
|
||||
uptime = sysinfo.uptime or 0,
|
||||
localtime = os.date(),
|
||||
loadavg = sysinfo.load or { 0, 0, 0 },
|
||||
memory = meminfo,
|
||||
memcached = mem_cached,
|
||||
swap = swapinfo,
|
||||
connmax = conn_max,
|
||||
conncount = conn_count,
|
||||
leases = stat.dhcp_leases(),
|
||||
leases6 = stat.dhcp6_leases(),
|
||||
wifinets = stat.wifi_networks()
|
||||
}
|
||||
|
||||
if wan then
|
||||
rv.wan = {
|
||||
ipaddr = wan:ipaddr(),
|
||||
gwaddr = wan:gwaddr(),
|
||||
netmask = wan:netmask(),
|
||||
dns = wan:dnsaddrs(),
|
||||
expires = wan:expires(),
|
||||
uptime = wan:uptime(),
|
||||
proto = wan:proto(),
|
||||
ifname = wan:ifname(),
|
||||
link = wan:adminlink()
|
||||
}
|
||||
end
|
||||
|
||||
if wan6 then
|
||||
rv.wan6 = {
|
||||
ip6addr = wan6:ip6addr(),
|
||||
gw6addr = wan6:gw6addr(),
|
||||
dns = wan6:dns6addrs(),
|
||||
ip6prefix = wan6:ip6prefix(),
|
||||
uptime = wan6:uptime(),
|
||||
proto = wan6:proto(),
|
||||
ifname = wan6:ifname(),
|
||||
link = wan6:adminlink()
|
||||
}
|
||||
end
|
||||
|
||||
if has_dsl then
|
||||
local dsl_stat = luci.sys.exec("/etc/init.d/dsl_control lucistat")
|
||||
local dsl_func = loadstring(dsl_stat)
|
||||
if dsl_func then
|
||||
rv.dsl = dsl_func()
|
||||
end
|
||||
end
|
||||
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(rv)
|
||||
|
||||
return
|
||||
elseif luci.http.formvalue("hosts") == "1" then
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(luci.sys.net.host_hints())
|
||||
|
||||
return
|
||||
end
|
||||
-%>
|
||||
|
||||
<%+header%>
|
||||
|
||||
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
function progressbar(v, m)
|
||||
{
|
||||
var vn = parseInt(v) || 0;
|
||||
var mn = parseInt(m) || 100;
|
||||
var pc = Math.floor((100 / mn) * vn);
|
||||
|
||||
return String.format(
|
||||
'<div style="width:200px; position:relative; border:1px solid #999999">' +
|
||||
'<div style="background-color:#CCCCCC; width:%d%%; height:15px">' +
|
||||
'<div style="position:absolute; left:0; top:0; text-align:center; width:100%%; color:#000000">' +
|
||||
'<small>%s / %s (%d%%)</small>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>', pc, v, m, pc
|
||||
);
|
||||
}
|
||||
|
||||
function wifirate(bss, rx) {
|
||||
var p = rx ? 'rx_' : 'tx_',
|
||||
s = '%.1f <%:Mbit/s%>, %d<%:MHz%>'
|
||||
.format(bss[p+'rate'] / 1000, bss[p+'mhz']),
|
||||
ht = bss[p+'ht'], vht = bss[p+'vht'],
|
||||
mhz = bss[p+'mhz'], nss = bss[p+'nss'],
|
||||
mcs = bss[p+'mcs'], sgi = bss[p+'short_gi'];
|
||||
|
||||
if (ht || vht) {
|
||||
if (vht) s += ', VHT-MCS %d'.format(mcs);
|
||||
if (nss) s += ', VHT-NSS %d'.format(nss);
|
||||
if (ht) s += ', MCS %s'.format(mcs);
|
||||
if (sgi) s += ', <%:Short GI%>';
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
function duid2mac(duid) {
|
||||
// DUID-LLT / Ethernet
|
||||
if (duid.length === 28 && duid.substr(0, 8) === '00010001')
|
||||
return duid.substr(16).replace(/(..)(?=..)/g, '$1:').toUpperCase();
|
||||
|
||||
// DUID-LL / Ethernet
|
||||
if (duid.length === 20 && duid.substr(0, 8) === '00030001')
|
||||
return duid.substr(8).replace(/(..)(?=..)/g, '$1:').toUpperCase();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
var npoll = 1;
|
||||
var hosts = <%=luci.http.write_json(luci.sys.net.host_hints())%>;
|
||||
|
||||
function updateHosts() {
|
||||
XHR.get('<%=REQUEST_URI%>', { hosts: 1 }, function(x, data) {
|
||||
hosts = data;
|
||||
});
|
||||
}
|
||||
|
||||
XHR.poll(5, '<%=REQUEST_URI%>', { status: 1 },
|
||||
function(x, info)
|
||||
{
|
||||
if (!(npoll++ % 5))
|
||||
updateHosts();
|
||||
|
||||
var si = document.getElementById('wan4_i');
|
||||
var ss = document.getElementById('wan4_s');
|
||||
var ifc = info.wan;
|
||||
|
||||
if (ifc && ifc.ifname && ifc.proto != 'none')
|
||||
{
|
||||
var s = String.format(
|
||||
'<strong><%:Type%>: </strong>%s<br />' +
|
||||
'<strong><%:Address%>: </strong>%s<br />' +
|
||||
'<strong><%:Netmask%>: </strong>%s<br />' +
|
||||
'<strong><%:Gateway%>: </strong>%s<br />',
|
||||
ifc.proto,
|
||||
(ifc.ipaddr) ? ifc.ipaddr : '0.0.0.0',
|
||||
(ifc.netmask && ifc.netmask != ifc.ipaddr) ? ifc.netmask : '255.255.255.255',
|
||||
(ifc.gwaddr) ? ifc.gwaddr : '0.0.0.0'
|
||||
);
|
||||
|
||||
for (var i = 0; i < ifc.dns.length; i++)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:DNS%> %d: </strong>%s<br />',
|
||||
i + 1, ifc.dns[i]
|
||||
);
|
||||
}
|
||||
|
||||
if (ifc.expires > -1)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Expires%>: </strong>%t<br />',
|
||||
ifc.expires
|
||||
);
|
||||
}
|
||||
|
||||
if (ifc.uptime > 0)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Connected%>: </strong>%t<br />',
|
||||
ifc.uptime
|
||||
);
|
||||
}
|
||||
|
||||
ss.innerHTML = String.format('<small>%s</small>', s);
|
||||
si.innerHTML = String.format(
|
||||
'<img src="<%=resource%>/icons/ethernet.png" />' +
|
||||
'<br /><small><a href="%s">%s</a></small>',
|
||||
ifc.link, ifc.ifname
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
si.innerHTML = '<img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small>';
|
||||
ss.innerHTML = '<em><%:Not connected%></em>';
|
||||
}
|
||||
|
||||
<% if has_ipv6 then %>
|
||||
var si6 = document.getElementById('wan6_i');
|
||||
var ss6 = document.getElementById('wan6_s');
|
||||
var ifc6 = info.wan6;
|
||||
|
||||
if (ifc6 && ifc6.ifname && ifc6.proto != 'none')
|
||||
{
|
||||
var s = String.format(
|
||||
'<strong><%:Type%>: </strong>%s%s<br />',
|
||||
ifc6.proto, (ifc6.ip6prefix) ? '-pd' : ''
|
||||
);
|
||||
|
||||
if (!ifc6.ip6prefix)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Address%>: </strong>%s<br />',
|
||||
(ifc6.ip6addr) ? ifc6.ip6addr : '::'
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Prefix Delegated%>: </strong>%s<br />',
|
||||
ifc6.ip6prefix
|
||||
);
|
||||
if (ifc6.ip6addr)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Address%>: </strong>%s<br />',
|
||||
ifc6.ip6addr
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
s += String.format(
|
||||
'<strong><%:Gateway%>: </strong>%s<br />',
|
||||
(ifc6.gw6addr) ? ifc6.gw6addr : '::'
|
||||
);
|
||||
|
||||
for (var i = 0; i < ifc6.dns.length; i++)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:DNS%> %d: </strong>%s<br />',
|
||||
i + 1, ifc6.dns[i]
|
||||
);
|
||||
}
|
||||
|
||||
if (ifc6.uptime > 0)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Connected%>: </strong>%t<br />',
|
||||
ifc6.uptime
|
||||
);
|
||||
}
|
||||
|
||||
ss6.innerHTML = String.format('<small>%s</small>', s);
|
||||
si6.innerHTML = String.format(
|
||||
'<img src="<%=resource%>/icons/ethernet.png" />' +
|
||||
'<br /><small><a href="%s">%s</a></small>',
|
||||
ifc6.link, ifc6.ifname
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
si6.innerHTML = '<img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small>';
|
||||
ss6.innerHTML = '<em><%:Not connected%></em>';
|
||||
}
|
||||
<% end %>
|
||||
|
||||
<% if has_dsl then %>
|
||||
var dsl_i = document.getElementById('dsl_i');
|
||||
var dsl_s = document.getElementById('dsl_s');
|
||||
|
||||
var s = String.format(
|
||||
'<strong><%:Status%>: </strong>%s<br />' +
|
||||
'<strong><%:Line State%>: </strong>%s [0x%x]<br />' +
|
||||
'<strong><%:Line Mode%>: </strong>%s<br />' +
|
||||
'<strong><%:Annex%>: </strong>%s<br />' +
|
||||
'<strong><%:Profile%>: </strong>%s<br />' +
|
||||
'<strong><%:Data Rate%>: </strong>%s/s / %s/s<br />' +
|
||||
'<strong><%:Max. Attainable Data Rate (ATTNDR)%>: </strong>%s/s / %s/s<br />' +
|
||||
'<strong><%:Latency%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Line Attenuation (LATN)%>: </strong>%s dB / %s dB<br />' +
|
||||
'<strong><%:Signal Attenuation (SATN)%>: </strong>%s dB / %s dB<br />' +
|
||||
'<strong><%:Noise Margin (SNR)%>: </strong>%s dB / %s dB<br />' +
|
||||
'<strong><%:Aggregate Transmit Power(ACTATP)%>: </strong>%s dB / %s dB<br />' +
|
||||
'<strong><%:Forward Error Correction Seconds (FECS)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Errored seconds (ES)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Severely Errored Seconds (SES)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Loss of Signal Seconds (LOSS)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Unavailable Seconds (UAS)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Header Error Code Errors (HEC)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Non Pre-emtive CRC errors (CRC_P)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Pre-emtive CRC errors (CRCP_P)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Line Uptime%>: </strong>%s<br />' +
|
||||
'<strong><%:ATU-C System Vendor ID%>: </strong>%s<br />' +
|
||||
'<strong><%:Power Management Mode%>: </strong>%s<br />',
|
||||
info.dsl.line_state, info.dsl.line_state_detail,
|
||||
info.dsl.line_state_num,
|
||||
info.dsl.line_mode_s,
|
||||
info.dsl.annex_s,
|
||||
info.dsl.profile_s,
|
||||
info.dsl.data_rate_down_s, info.dsl.data_rate_up_s,
|
||||
info.dsl.max_data_rate_down_s, info.dsl.max_data_rate_up_s,
|
||||
info.dsl.latency_num_down, info.dsl.latency_num_up,
|
||||
info.dsl.line_attenuation_down, info.dsl.line_attenuation_up,
|
||||
info.dsl.signal_attenuation_down, info.dsl.signal_attenuation_up,
|
||||
info.dsl.noise_margin_down, info.dsl.noise_margin_up,
|
||||
info.dsl.actatp_down, info.dsl.actatp_up,
|
||||
info.dsl.errors_fec_near, info.dsl.errors_fec_far,
|
||||
info.dsl.errors_es_near, info.dsl.errors_es_far,
|
||||
info.dsl.errors_ses_near, info.dsl.errors_ses_far,
|
||||
info.dsl.errors_loss_near, info.dsl.errors_loss_far,
|
||||
info.dsl.errors_uas_near, info.dsl.errors_uas_far,
|
||||
info.dsl.errors_hec_near, info.dsl.errors_hec_far,
|
||||
info.dsl.errors_crc_p_near, info.dsl.errors_crc_p_far,
|
||||
info.dsl.errors_crcp_p_near, info.dsl.errors_crcp_p_far,
|
||||
info.dsl.line_uptime_s,
|
||||
info.dsl.atuc_vendor_id,
|
||||
info.dsl.power_mode_s
|
||||
);
|
||||
|
||||
dsl_s.innerHTML = String.format('<small>%s</small>', s);
|
||||
dsl_i.innerHTML = String.format(
|
||||
'<img src="<%=resource%>/icons/ethernet.png" />' +
|
||||
'<br /><small>DSL</small>'
|
||||
);
|
||||
<% end %>
|
||||
|
||||
<% if has_dhcp then %>
|
||||
var ls = document.getElementById('lease_status_table');
|
||||
if (ls)
|
||||
{
|
||||
/* clear all rows */
|
||||
while( ls.rows.length > 1 )
|
||||
ls.rows[0].parentNode.deleteRow(1);
|
||||
|
||||
for( var i = 0; i < info.leases.length; i++ )
|
||||
{
|
||||
var timestr;
|
||||
|
||||
if (info.leases[i].expires === false)
|
||||
timestr = '<em><%:unlimited%></em>';
|
||||
else if (info.leases[i].expires <= 0)
|
||||
timestr = '<em><%:expired%></em>';
|
||||
else
|
||||
timestr = String.format('%t', info.leases[i].expires);
|
||||
|
||||
var tr = ls.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
|
||||
|
||||
tr.insertCell(-1).innerHTML = info.leases[i].hostname ? info.leases[i].hostname : '?';
|
||||
tr.insertCell(-1).innerHTML = info.leases[i].ipaddr;
|
||||
tr.insertCell(-1).innerHTML = info.leases[i].macaddr;
|
||||
tr.insertCell(-1).innerHTML = timestr;
|
||||
}
|
||||
|
||||
if( ls.rows.length == 1 )
|
||||
{
|
||||
var tr = ls.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row';
|
||||
|
||||
var td = tr.insertCell(-1);
|
||||
td.colSpan = 4;
|
||||
td.innerHTML = '<em><br /><%:There are no active leases.%></em>';
|
||||
}
|
||||
}
|
||||
|
||||
var ls6 = document.getElementById('lease6_status_table');
|
||||
if (ls6 && info.leases6)
|
||||
{
|
||||
ls6.parentNode.style.display = 'block';
|
||||
|
||||
/* clear all rows */
|
||||
while( ls6.rows.length > 1 )
|
||||
ls6.rows[0].parentNode.deleteRow(1);
|
||||
|
||||
for( var i = 0; i < info.leases6.length; i++ )
|
||||
{
|
||||
var timestr;
|
||||
|
||||
if (info.leases6[i].expires === false)
|
||||
timestr = '<em><%:unlimited%></em>';
|
||||
else if (info.leases6[i].expires <= 0)
|
||||
timestr = '<em><%:expired%></em>';
|
||||
else
|
||||
timestr = String.format('%t', info.leases6[i].expires);
|
||||
|
||||
var tr = ls6.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
|
||||
|
||||
var host = hosts[duid2mac(info.leases6[i].duid)];
|
||||
if (!info.leases6[i].hostname)
|
||||
tr.insertCell(-1).innerHTML =
|
||||
(host && (host.name || host.ipv4 || host.ipv6))
|
||||
? '<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space: nowrap">? (%h)</div>'.format(host.name || host.ipv4 || host.ipv6)
|
||||
: '?';
|
||||
else
|
||||
tr.insertCell(-1).innerHTML =
|
||||
(host && host.name && info.leases6[i].hostname != host.name)
|
||||
? '<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space: nowrap">%h (%h)</div>'.format(info.leases6[i].hostname, host.name)
|
||||
: info.leases6[i].hostname;
|
||||
|
||||
tr.insertCell(-1).innerHTML = info.leases6[i].ip6addr;
|
||||
tr.insertCell(-1).innerHTML = info.leases6[i].duid;
|
||||
tr.insertCell(-1).innerHTML = timestr;
|
||||
}
|
||||
|
||||
if( ls6.rows.length == 1 )
|
||||
{
|
||||
var tr = ls6.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row';
|
||||
|
||||
var td = tr.insertCell(-1);
|
||||
td.colSpan = 4;
|
||||
td.innerHTML = '<em><br /><%:There are no active leases.%></em>';
|
||||
}
|
||||
}
|
||||
<% end %>
|
||||
|
||||
<% if has_wifi then %>
|
||||
var assoclist = [ ];
|
||||
|
||||
var ws = document.getElementById('wifi_status_table');
|
||||
if (ws)
|
||||
{
|
||||
var wsbody = ws.rows[0].parentNode;
|
||||
while (ws.rows.length > 0)
|
||||
wsbody.deleteRow(0);
|
||||
|
||||
for (var didx = 0; didx < info.wifinets.length; didx++)
|
||||
{
|
||||
var dev = info.wifinets[didx];
|
||||
|
||||
var tr = wsbody.insertRow(-1);
|
||||
var td;
|
||||
|
||||
td = tr.insertCell(-1);
|
||||
td.width = "33%";
|
||||
td.innerHTML = dev.name;
|
||||
td.style.verticalAlign = "top";
|
||||
|
||||
td = tr.insertCell(-1);
|
||||
|
||||
var s = '';
|
||||
|
||||
for (var nidx = 0; nidx < dev.networks.length; nidx++)
|
||||
{
|
||||
var net = dev.networks[nidx];
|
||||
var is_assoc = (net.bssid != '00:00:00:00:00:00' && net.channel && !net.disabled);
|
||||
|
||||
var icon;
|
||||
if (!is_assoc)
|
||||
icon = "<%=resource%>/icons/signal-none.png";
|
||||
else if (net.quality == 0)
|
||||
icon = "<%=resource%>/icons/signal-0.png";
|
||||
else if (net.quality < 25)
|
||||
icon = "<%=resource%>/icons/signal-0-25.png";
|
||||
else if (net.quality < 50)
|
||||
icon = "<%=resource%>/icons/signal-25-50.png";
|
||||
else if (net.quality < 75)
|
||||
icon = "<%=resource%>/icons/signal-50-75.png";
|
||||
else
|
||||
icon = "<%=resource%>/icons/signal-75-100.png";
|
||||
|
||||
s += String.format(
|
||||
'<table><tr><td style="text-align:center; width:32px; padding:3px">' +
|
||||
'<img src="%s" title="<%:Signal%>: %d dBm / <%:Noise%>: %d dBm" />' +
|
||||
'<br /><small>%d%%</small>' +
|
||||
'</td><td style="text-align:left; padding:3px"><small>' +
|
||||
'<strong><%:SSID%>:</strong> <a href="%s">%h</a><br />' +
|
||||
'<strong><%:Mode%>:</strong> %s<br />' +
|
||||
'<strong><%:Channel%>:</strong> %d (%.3f <%:GHz%>)<br />' +
|
||||
'<strong><%:Bitrate%>:</strong> %s <%:Mbit/s%><br />',
|
||||
icon, net.signal, net.noise,
|
||||
net.quality,
|
||||
net.link, net.ssid || '?',
|
||||
net.mode,
|
||||
net.channel, net.frequency,
|
||||
net.bitrate || '?'
|
||||
);
|
||||
|
||||
if (is_assoc)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:BSSID%>:</strong> %s<br />' +
|
||||
'<strong><%:Encryption%>:</strong> %s',
|
||||
net.bssid || '?',
|
||||
net.encryption
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
s += '<em><%:Wireless is disabled or not associated%></em>';
|
||||
}
|
||||
|
||||
s += '</small></td></tr></table>';
|
||||
|
||||
for (var bssid in net.assoclist)
|
||||
{
|
||||
var bss = net.assoclist[bssid];
|
||||
|
||||
bss.bssid = bssid;
|
||||
bss.link = net.link;
|
||||
bss.name = net.name;
|
||||
bss.ifname = net.ifname;
|
||||
bss.radio = dev.name;
|
||||
|
||||
assoclist.push(bss);
|
||||
}
|
||||
}
|
||||
|
||||
if (!s)
|
||||
s = '<em><%:No information available%></em>';
|
||||
|
||||
td.innerHTML = s;
|
||||
}
|
||||
}
|
||||
|
||||
var ac = document.getElementById('wifi_assoc_table');
|
||||
if (ac)
|
||||
{
|
||||
/* clear all rows */
|
||||
while( ac.rows.length > 1 )
|
||||
ac.rows[0].parentNode.deleteRow(1);
|
||||
|
||||
assoclist.sort(function(a, b) {
|
||||
return (a.name == b.name)
|
||||
? (a.bssid < b.bssid)
|
||||
: (a.name > b.name )
|
||||
;
|
||||
});
|
||||
|
||||
for( var i = 0; i < assoclist.length; i++ )
|
||||
{
|
||||
var tr = ac.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row cbi-rowstyle-' + (1 + (i % 2));
|
||||
|
||||
var icon;
|
||||
var q = (-1 * (assoclist[i].noise - assoclist[i].signal)) / 5;
|
||||
if (q < 1)
|
||||
icon = "<%=resource%>/icons/signal-0.png";
|
||||
else if (q < 2)
|
||||
icon = "<%=resource%>/icons/signal-0-25.png";
|
||||
else if (q < 3)
|
||||
icon = "<%=resource%>/icons/signal-25-50.png";
|
||||
else if (q < 4)
|
||||
icon = "<%=resource%>/icons/signal-50-75.png";
|
||||
else
|
||||
icon = "<%=resource%>/icons/signal-75-100.png";
|
||||
|
||||
tr.insertCell(-1).innerHTML = String.format(
|
||||
'<span class="ifacebadge" title="%q"><img src="<%=resource%>/icons/wifi.png" /> %h</span>',
|
||||
assoclist[i].radio, assoclist[i].ifname
|
||||
);
|
||||
|
||||
tr.insertCell(-1).innerHTML = String.format(
|
||||
'<a href="%s">%s</a>',
|
||||
assoclist[i].link,
|
||||
'%h'.format(assoclist[i].name).nobr()
|
||||
);
|
||||
|
||||
tr.insertCell(-1).innerHTML = assoclist[i].bssid;
|
||||
|
||||
var host = hosts[assoclist[i].bssid];
|
||||
if (host)
|
||||
tr.insertCell(-1).innerHTML = String.format(
|
||||
'<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis">%s</div>',
|
||||
((host.name && (host.ipv4 || host.ipv6))
|
||||
? '%h (%s)'.format(host.name, host.ipv4 || host.ipv6)
|
||||
: '%h'.format(host.name || host.ipv4 || host.ipv6)).nobr()
|
||||
);
|
||||
else
|
||||
tr.insertCell(-1).innerHTML = '?';
|
||||
|
||||
tr.insertCell(-1).innerHTML = String.format(
|
||||
'<span class="ifacebadge" title="<%:Signal%>: %d <%:dBm%> / <%:Noise%>: %d <%:dBm%> / <%:SNR%>: %d"><img src="%s" /> %d / %d <%:dBm%></span>',
|
||||
assoclist[i].signal, assoclist[i].noise, assoclist[i].signal - assoclist[i].noise,
|
||||
icon,
|
||||
assoclist[i].signal, assoclist[i].noise
|
||||
);
|
||||
|
||||
tr.insertCell(-1).innerHTML = wifirate(assoclist[i], true).nobr() + '<br />' + wifirate(assoclist[i], false).nobr();
|
||||
}
|
||||
|
||||
if (ac.rows.length == 1)
|
||||
{
|
||||
var tr = ac.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row';
|
||||
|
||||
var td = tr.insertCell(-1);
|
||||
td.colSpan = 7;
|
||||
td.innerHTML = '<br /><em><%:No information available%></em>';
|
||||
}
|
||||
}
|
||||
<% end %>
|
||||
|
||||
var e;
|
||||
|
||||
if (e = document.getElementById('localtime'))
|
||||
e.innerHTML = info.localtime;
|
||||
|
||||
if (e = document.getElementById('uptime'))
|
||||
e.innerHTML = String.format('%t', info.uptime);
|
||||
|
||||
if (e = document.getElementById('userinfo'))
|
||||
e.innerHTML = info.userinfo;
|
||||
|
||||
if (e = document.getElementById('cpuusage'))
|
||||
e.innerHTML = info.cpuusage;
|
||||
|
||||
if (e = document.getElementById('cpuinfo'))
|
||||
e.innerHTML = info.cpuinfo;
|
||||
|
||||
if (e = document.getElementById('loadavg'))
|
||||
e.innerHTML = String.format(
|
||||
'%.02f, %.02f, %.02f',
|
||||
info.loadavg[0] / 65535.0,
|
||||
info.loadavg[1] / 65535.0,
|
||||
info.loadavg[2] / 65535.0
|
||||
);
|
||||
|
||||
if (e = document.getElementById('memtotal'))
|
||||
e.innerHTML = progressbar(
|
||||
Math.floor(((info.memory.free + info.memory.buffered) / 1048576) + (info.memcached / 1024)) + " <%:MB%>",
|
||||
Math.floor(info.memory.total / 1048576) + " <%:MB%>"
|
||||
);
|
||||
|
||||
if (e = document.getElementById('membuff'))
|
||||
e.innerHTML = progressbar(
|
||||
Math.floor(info.memory.buffered / 1048576) + " <%:MB%>",
|
||||
Math.floor(info.memory.total / 1048576) + " <%:MB%>"
|
||||
);
|
||||
|
||||
if (e = document.getElementById('swaptotal'))
|
||||
e.innerHTML = progressbar(
|
||||
Math.floor(info.swap.free / 1048576) + " <%:MB%>",
|
||||
Math.floor(info.swap.total / 1048576) + " <%:MB%>"
|
||||
);
|
||||
|
||||
if (e = document.getElementById('swapfree'))
|
||||
e.innerHTML = progressbar(
|
||||
Math.floor(info.swap.free / 1048576) + " <%:MB%>",
|
||||
Math.floor(info.swap.total / 1048576) + " <%:MB%>"
|
||||
);
|
||||
|
||||
if (e = document.getElementById('conns'))
|
||||
e.innerHTML = progressbar(info.conncount, info.connmax);
|
||||
|
||||
}
|
||||
);
|
||||
//]]></script>
|
||||
|
||||
<h2 name="content"><%:Status%></h2>
|
||||
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:System%></legend>
|
||||
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="33%"><%:Hostname%></td><td><%=luci.sys.hostname() or "?"%></td></tr>
|
||||
<tr><td width="33%"><%:Model%></td><td><%=pcdata(boardinfo.model or "?")%> <%=luci.sys.exec("cat /etc/bench.log") or ""%></td></tr>
|
||||
<tr><td width="33%"><%:Architecture%></td><td id="cpuinfo">-</td></tr>
|
||||
<% if has_temp then %>
|
||||
<tr><td width="33%"><%:Temperature%></td><td><%=luci.sys.exec("/sbin/tempinfo") or "?"%></td></tr>
|
||||
<% end %>
|
||||
<tr><td width="33%"><%:Firmware Version%></td><td>
|
||||
<%=pcdata(ver.distname)%> <%=pcdata(ver.distversion)%> /
|
||||
<%=pcdata(ver.luciname)%> (<%=pcdata(ver.luciversion)%>)
|
||||
</td></tr>
|
||||
<tr><td width="33%"><%:Kernel Version%></td><td><%=unameinfo.release or "?"%></td></tr>
|
||||
<tr><td width="33%"><%:Local Time%></td><td id="localtime">-</td></tr>
|
||||
<tr><td width="33%"><%:Uptime%></td><td id="uptime">-</td></tr>
|
||||
<tr><td width="33%"><%:Load Average%></td><td id="loadavg">-</td></tr>
|
||||
<tr><td width="33%"><%:CPU usage (%)%></td><td id="cpuusage">-</td></tr>
|
||||
<tr><td width="33%"><%:Source Code%></td><td><a href="https://github.com/immortalwrt" target="_blank">
|
||||
Project ImmortalWrt</a> / <a href="https://github.com/immortalwrt/immortalwrt" target="_blank">ImmortalWrt Core</a>
|
||||
</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Memory%></legend>
|
||||
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="33%"><%:Total Available%></td><td id="memtotal">-</td></tr>
|
||||
<tr><td width="33%"><%:Buffered%></td><td id="membuff">-</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<% if swapinfo.total > 0 then %>
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Swap%></legend>
|
||||
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="33%"><%:Total Available%></td><td id="swaptotal">-</td></tr>
|
||||
<tr><td width="33%"><%:Free%></td><td id="swapfree">-</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Network%></legend>
|
||||
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="33%" style="vertical-align:top"><%:IPv4 WAN Status%></td><td>
|
||||
<table><tr>
|
||||
<td id="wan4_i" style="width:16px; text-align:center; padding:3px"><img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small></td>
|
||||
<td id="wan4_s" style="vertical-align:middle; padding: 3px"><em><%:Collecting data...%></em></td>
|
||||
</tr></table>
|
||||
</td></tr>
|
||||
<% if has_ipv6 then %>
|
||||
<tr><td width="33%" style="vertical-align:top"><%:IPv6 WAN Status%></td><td>
|
||||
<table><tr>
|
||||
<td id="wan6_i" style="width:16px; text-align:center; padding:3px"><img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small></td>
|
||||
<td id="wan6_s" style="vertical-align:middle; padding: 3px"><em><%:Collecting data...%></em></td>
|
||||
</tr></table>
|
||||
</td></tr>
|
||||
<% end %>
|
||||
<tr><td width="33%"><%:Online Users%></td><td id="userinfo">0</td></tr>
|
||||
<tr><td width="33%"><%:Active Connections%></td><td id="conns">-</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<% if has_dhcp then %>
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:DHCP Leases%></legend>
|
||||
|
||||
<table class="cbi-section-table" id="lease_status_table">
|
||||
<tr class="cbi-section-table-titles">
|
||||
<th class="cbi-section-table-cell"><%:Hostname%></th>
|
||||
<th class="cbi-section-table-cell"><%:IPv4-Address%></th>
|
||||
<th class="cbi-section-table-cell"><%:MAC-Address%></th>
|
||||
<th class="cbi-section-table-cell"><%:Leasetime remaining%></th>
|
||||
</tr>
|
||||
<tr class="cbi-section-table-row">
|
||||
<td colspan="4"><em><br /><%:Collecting data...%></em></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<% if has_ipv6 then %>
|
||||
<fieldset class="cbi-section" style="display:none">
|
||||
<legend><%:DHCPv6 Leases%></legend>
|
||||
|
||||
<table class="cbi-section-table" id="lease6_status_table">
|
||||
<tr class="cbi-section-table-titles">
|
||||
<th class="cbi-section-table-cell"><%:Host%></th>
|
||||
<th class="cbi-section-table-cell"><%:IPv6-Address%></th>
|
||||
<th class="cbi-section-table-cell"><%:DUID%></th>
|
||||
<th class="cbi-section-table-cell"><%:Leasetime remaining%></th>
|
||||
</tr>
|
||||
<tr class="cbi-section-table-row">
|
||||
<td colspan="4"><em><br /><%:Collecting data...%></em></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if has_dsl then %>
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:DSL%></legend>
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="33%" style="vertical-align:top"><%:DSL Status%></td><td>
|
||||
<table><tr>
|
||||
<td id="dsl_i" style="width:16px; text-align:center; padding:3px"><img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small></td>
|
||||
<td id="dsl_s" style="vertical-align:middle; padding: 3px"><em><%:Collecting data...%></em></td>
|
||||
</tr></table>
|
||||
</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<% if has_wifi then %>
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Wireless%></legend>
|
||||
|
||||
<table id="wifi_status_table" width="100%" cellspacing="10">
|
||||
<tr><td><em><%:Collecting data...%></em></td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<%+footer%>
|
||||
@ -1,35 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
cpu_arch="$(cat "/proc/cpuinfo" | grep "model name" | sed -n "1p" | awk -F ': ' '{print $2}')"
|
||||
[ -z "${cpu_arch}" ] && cpu_arch="?"
|
||||
cpu_cores="$(cat "/proc/cpuinfo" | grep "processor" | wc -l)"
|
||||
|
||||
if grep -q "bcm27xx" "/etc/openwrt_release"; then
|
||||
cpu_freq="$(expr $(vcgencmd measure_clock arm | awk -F '=' '{print $2}') / 1000000)Mhz"
|
||||
elif grep -q "bcm53xx" "/etc/openwrt_release"; then
|
||||
cpu_freq="$(nvram get clkfreq | awk -F ',' '{print $1}')MHz"
|
||||
elif grep -q "mvebu" "/etc/openwrt_release"; then
|
||||
cpu_freq="$(cat "/proc/cpuinfo" | grep "BogoMIPS" | sed -n "1p" | awk -F ': ' '{print $2}')MHz"
|
||||
elif [ -e "/sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq" ]; then
|
||||
cpu_freq="$(expr $(cat "/sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq") / 1000)MHz"
|
||||
fi
|
||||
if [ -e "/sys/devices/system/cpu/cpufreq/policy4/cpuinfo_cur_freq" ]; then
|
||||
big_cpu_freq="$(expr $(cat "/sys/devices/system/cpu/cpufreq/policy4/cpuinfo_cur_freq") / 1000)MHz "
|
||||
fi
|
||||
|
||||
if grep -q "bcm27xx" "/etc/openwrt_release"; then
|
||||
cpu_temp="$(vcgencmd measure_temp | awk -F '=' '{print $2}' | awk -F "'" '{print $1}')°C"
|
||||
else
|
||||
[ -e "/sys/class/thermal/thermal_zone0/temp" ] && \
|
||||
cpu_temp="$(awk '{printf("%.1f°C", $0 / 1000)}' /sys/class/thermal/thermal_zone0/temp)"
|
||||
fi
|
||||
|
||||
if [ -z "${cpu_freq}" ] && [ -z "${cpu_temp}" ]; then
|
||||
echo -n "${cpu_arch} x ${cpu_cores}"
|
||||
elif [ -z "${cpu_temp}" ] || grep -q "ipq" "/etc/openwrt_release"; then
|
||||
echo -n "${cpu_arch} x ${cpu_cores} (${cpu_freq})"
|
||||
elif [ -z "${cpu_freq}" ]; then
|
||||
echo -n "${cpu_arch} x ${cpu_cores} (${cpu_temp})"
|
||||
else
|
||||
echo -n "${cpu_arch} x ${cpu_cores} (${big_cpu_freq}${cpu_freq}, ${cpu_temp})"
|
||||
fi
|
||||
@ -1,15 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
mt76_path="/sys/kernel/debug/ieee80211/phy0/mt76/temperature"
|
||||
if [ -e "${mt76_path}" ]; then
|
||||
mt76_temp=" $(cat "${mt76_path}" | awk -F ': ' '{print $2}')°C"
|
||||
fi
|
||||
|
||||
sys_temp="$(sensors | grep -Eo '\+[0-9]+.+C' | grep -Ev 'high' | sed ':a;N;$!ba;s/\n/ /g;s/+//g')"
|
||||
|
||||
if grep -q "ipq40xx" "/etc/openwrt_release"; then
|
||||
echo -n "WiFi:${mt76_temp} ${sys_temp}"
|
||||
else
|
||||
cpu_temp="$(awk "BEGIN{printf (\"%.1f\n\",$(cat /sys/class/thermal/thermal_zone0/temp)/1000) }")°C"
|
||||
echo -n "CPU: ${cpu_temp}, WiFi: ${sys_temp}"
|
||||
fi
|
||||
@ -1,52 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2017 lean <coolsnowwolf@gmail.com>
|
||||
|
||||
START=99
|
||||
|
||||
start()
|
||||
{
|
||||
rfc=4096
|
||||
cc=$(grep -c processor /proc/cpuinfo)
|
||||
rsfe=$(echo $cc*$rfc | bc)
|
||||
sysctl -w net.core.rps_sock_flow_entries=$rsfe >/dev/null
|
||||
for fileRps in $(ls /sys/class/net/eth*/queues/rx-*/rps_cpus)
|
||||
do
|
||||
echo $cc > $fileRps
|
||||
done
|
||||
|
||||
for fileRfc in $(ls /sys/class/net/eth*/queues/rx-*/rps_flow_cnt)
|
||||
do
|
||||
echo $rfc > $fileRfc
|
||||
done
|
||||
|
||||
uci set network.@globals[0].packet_steering=1
|
||||
uci commit network
|
||||
|
||||
a=$(cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq)
|
||||
b=$(echo -n ' : ')
|
||||
c=$(cat /proc/cpuinfo | grep 'core id' | sort -u | wc -l)
|
||||
d=$(echo -n ' Core ')
|
||||
e=$(cat /proc/cpuinfo | grep 'processor' | wc -l)
|
||||
f=$(echo -n ' Thread ')
|
||||
g=${a}${b}${c}${d}${e}${f}
|
||||
|
||||
mkdir -p /tmp/sysinfo
|
||||
echo $g > /tmp/sysinfo/model
|
||||
|
||||
a=$(ip address | grep ^[0-9] | awk -F: '{print $2}' | sed "s/ //g" | grep '^[e]' | grep -v "@" | grep -v "\.")
|
||||
b=$(echo "$a" | wc -l)
|
||||
for i in $(seq 1 $b)
|
||||
do
|
||||
c=$(echo "$a" | sed -n ${i}p)
|
||||
ethtool -K $c rx-checksum on >/dev/null 2>&1
|
||||
ethtool -K $c tx-checksum-ip-generic on >/dev/null 2>&1 || (
|
||||
ethtool -K $c tx-checksum-ipv4 on >/dev/null 2>&1
|
||||
ethtool -K $c tx-checksum-ipv6 on >/dev/null 2>&1)
|
||||
ethtool -K $c tx-scatter-gather on >/dev/null 2>&1
|
||||
ethtool -K $c gso on >/dev/null 2>&1
|
||||
ethtool -K $c tso on >/dev/null 2>&1
|
||||
ethtool -K $c ufo on >/dev/null 2>&1
|
||||
done
|
||||
|
||||
[ -f /etc/index.htm ] && mv /etc/index.htm /usr/lib/lua/luci/view/admin_status/index.htm
|
||||
}
|
||||
@ -1,843 +0,0 @@
|
||||
<%#
|
||||
Copyright 2008 Steven Barth <steven@midlink.org>
|
||||
Copyright 2008-2011 Jo-Philipp Wich <jow@openwrt.org>
|
||||
Licensed to the public under the Apache License 2.0.
|
||||
-%>
|
||||
|
||||
<%
|
||||
local fs = require "nixio.fs"
|
||||
local util = require "luci.util"
|
||||
local stat = require "luci.tools.status"
|
||||
local ver = require "luci.version"
|
||||
|
||||
local has_ipv6 = fs.access("/usr/sbin/ip6tables")
|
||||
local has_dhcp = fs.access("/etc/config/dhcp")
|
||||
local has_wifi = ((fs.stat("/etc/config/wireless", "size") or 0) > 0)
|
||||
|
||||
local sysinfo = luci.util.ubus("system", "info") or { }
|
||||
local boardinfo = luci.util.ubus("system", "board") or { }
|
||||
local unameinfo = nixio.uname() or { }
|
||||
|
||||
local meminfo = sysinfo.memory or {
|
||||
total = 0,
|
||||
free = 0,
|
||||
buffered = 0,
|
||||
shared = 0
|
||||
}
|
||||
|
||||
local mem_cached = luci.sys.exec("sed -e '/^Cached: /!d; s#Cached: *##; s# kB##g' /proc/meminfo")
|
||||
|
||||
local swapinfo = sysinfo.swap or {
|
||||
total = 0,
|
||||
free = 0
|
||||
}
|
||||
|
||||
local has_dsl = fs.access("/etc/init.d/dsl_control")
|
||||
|
||||
if luci.http.formvalue("status") == "1" then
|
||||
local ntm = require "luci.model.network".init()
|
||||
local wan = ntm:get_wannet()
|
||||
local wan6 = ntm:get_wan6net()
|
||||
|
||||
local conn_count = tonumber(
|
||||
fs.readfile("/proc/sys/net/netfilter/nf_conntrack_count") or "") or 0
|
||||
|
||||
local conn_max = tonumber(luci.sys.exec(
|
||||
"sysctl -n -e net.nf_conntrack_max net.ipv4.netfilter.ip_conntrack_max"
|
||||
):match("%d+")) or 4096
|
||||
|
||||
local cpu_info = luci.sys.exec("cpuinfo")
|
||||
|
||||
local eth_info = luci.sys.exec("ethinfo")
|
||||
|
||||
local user_info = luci.sys.exec("cat /proc/net/arp | grep '0x2' | wc -l") or 0
|
||||
|
||||
local cpu_usage = luci.sys.exec("top -n1 | awk '/^CPU/ {printf(\"%d%%\", 100 - $8)}'") or "6%"
|
||||
|
||||
local rv = {
|
||||
cpuusage = cpu_usage,
|
||||
cpuinfo = cpu_info,
|
||||
ethinfo = eth_info,
|
||||
userinfo = user_info,
|
||||
uptime = sysinfo.uptime or 0,
|
||||
localtime = os.date(),
|
||||
loadavg = sysinfo.load or { 0, 0, 0 },
|
||||
memory = meminfo,
|
||||
memcached = mem_cached,
|
||||
swap = swapinfo,
|
||||
connmax = conn_max,
|
||||
conncount = conn_count,
|
||||
leases = stat.dhcp_leases(),
|
||||
leases6 = stat.dhcp6_leases(),
|
||||
wifinets = stat.wifi_networks()
|
||||
}
|
||||
|
||||
if wan then
|
||||
rv.wan = {
|
||||
ipaddr = wan:ipaddr(),
|
||||
gwaddr = wan:gwaddr(),
|
||||
netmask = wan:netmask(),
|
||||
dns = wan:dnsaddrs(),
|
||||
expires = wan:expires(),
|
||||
uptime = wan:uptime(),
|
||||
proto = wan:proto(),
|
||||
ifname = wan:ifname(),
|
||||
link = wan:adminlink()
|
||||
}
|
||||
end
|
||||
|
||||
if wan6 then
|
||||
rv.wan6 = {
|
||||
ip6addr = wan6:ip6addr(),
|
||||
gw6addr = wan6:gw6addr(),
|
||||
dns = wan6:dns6addrs(),
|
||||
ip6prefix = wan6:ip6prefix(),
|
||||
uptime = wan6:uptime(),
|
||||
proto = wan6:proto(),
|
||||
ifname = wan6:ifname(),
|
||||
link = wan6:adminlink()
|
||||
}
|
||||
end
|
||||
|
||||
if has_dsl then
|
||||
local dsl_stat = luci.sys.exec("/etc/init.d/dsl_control lucistat")
|
||||
local dsl_func = loadstring(dsl_stat)
|
||||
if dsl_func then
|
||||
rv.dsl = dsl_func()
|
||||
end
|
||||
end
|
||||
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(rv)
|
||||
|
||||
return
|
||||
elseif luci.http.formvalue("hosts") == "1" then
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(luci.sys.net.host_hints())
|
||||
|
||||
return
|
||||
end
|
||||
-%>
|
||||
|
||||
<%+header%>
|
||||
|
||||
<script type="text/javascript" src="<%=resource%>/cbi.js?v=git-19.167.54478-71e2af4"></script>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
function progressbar(v, m)
|
||||
{
|
||||
var vn = parseInt(v) || 0;
|
||||
var mn = parseInt(m) || 100;
|
||||
var pc = Math.floor((100 / mn) * vn);
|
||||
|
||||
return String.format(
|
||||
'<div style="width:200px; position:relative; border:1px solid #999999">' +
|
||||
'<div style="background-color:#CCCCCC; width:%d%%; height:15px">' +
|
||||
'<div style="position:absolute; left:0; top:0; text-align:center; width:100%%; color:#000000">' +
|
||||
'<small>%s / %s (%d%%)</small>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>', pc, v, m, pc
|
||||
);
|
||||
}
|
||||
|
||||
function wifirate(bss, rx) {
|
||||
var p = rx ? 'rx_' : 'tx_',
|
||||
s = '%.1f <%:Mbit/s%>, %d<%:MHz%>'
|
||||
.format(bss[p+'rate'] / 1000, bss[p+'mhz']),
|
||||
ht = bss[p+'ht'], vht = bss[p+'vht'],
|
||||
mhz = bss[p+'mhz'], nss = bss[p+'nss'],
|
||||
mcs = bss[p+'mcs'], sgi = bss[p+'short_gi'];
|
||||
|
||||
if (ht || vht) {
|
||||
if (vht) s += ', VHT-MCS %d'.format(mcs);
|
||||
if (nss) s += ', VHT-NSS %d'.format(nss);
|
||||
if (ht) s += ', MCS %s'.format(mcs);
|
||||
if (sgi) s += ', <%:Short GI%>';
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
function duid2mac(duid) {
|
||||
// DUID-LLT / Ethernet
|
||||
if (duid.length === 28 && duid.substr(0, 8) === '00010001')
|
||||
return duid.substr(16).replace(/(..)(?=..)/g, '$1:').toUpperCase();
|
||||
|
||||
// DUID-LL / Ethernet
|
||||
if (duid.length === 20 && duid.substr(0, 8) === '00030001')
|
||||
return duid.substr(8).replace(/(..)(?=..)/g, '$1:').toUpperCase();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
var npoll = 1;
|
||||
var hosts = <%=luci.http.write_json(luci.sys.net.host_hints())%>;
|
||||
|
||||
function updateHosts() {
|
||||
XHR.get('<%=REQUEST_URI%>', { hosts: 1 }, function(x, data) {
|
||||
hosts = data;
|
||||
});
|
||||
}
|
||||
|
||||
XHR.poll(1, '<%=REQUEST_URI%>', { status: 1 },
|
||||
function(x, info)
|
||||
{
|
||||
if (!(npoll++ % 5))
|
||||
updateHosts();
|
||||
|
||||
var si = document.getElementById('wan4_i');
|
||||
var ss = document.getElementById('wan4_s');
|
||||
var ifc = info.wan;
|
||||
|
||||
if (ifc && ifc.ifname && ifc.proto != 'none')
|
||||
{
|
||||
var s = String.format(
|
||||
'<strong><%:Type%>: </strong>%s<br />' +
|
||||
'<strong><%:Address%>: </strong>%s<br />' +
|
||||
'<strong><%:Netmask%>: </strong>%s<br />' +
|
||||
'<strong><%:Gateway%>: </strong>%s<br />',
|
||||
ifc.proto,
|
||||
(ifc.ipaddr) ? ifc.ipaddr : '0.0.0.0',
|
||||
(ifc.netmask && ifc.netmask != ifc.ipaddr) ? ifc.netmask : '255.255.255.255',
|
||||
(ifc.gwaddr) ? ifc.gwaddr : '0.0.0.0'
|
||||
);
|
||||
|
||||
for (var i = 0; i < ifc.dns.length; i++)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:DNS%> %d: </strong>%s<br />',
|
||||
i + 1, ifc.dns[i]
|
||||
);
|
||||
}
|
||||
|
||||
if (ifc.expires > -1)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Expires%>: </strong>%t<br />',
|
||||
ifc.expires
|
||||
);
|
||||
}
|
||||
|
||||
if (ifc.uptime > 0)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Connected%>: </strong>%t<br />',
|
||||
ifc.uptime
|
||||
);
|
||||
}
|
||||
|
||||
ss.innerHTML = String.format('<small>%s</small>', s);
|
||||
si.innerHTML = String.format(
|
||||
'<img src="<%=resource%>/icons/ethernet.png" />' +
|
||||
'<br /><small><a href="%s">%s</a></small>',
|
||||
ifc.link, ifc.ifname
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
si.innerHTML = '<img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small>';
|
||||
ss.innerHTML = '<em><%:Not connected%></em>';
|
||||
}
|
||||
|
||||
<% if has_ipv6 then %>
|
||||
var si6 = document.getElementById('wan6_i');
|
||||
var ss6 = document.getElementById('wan6_s');
|
||||
var ifc6 = info.wan6;
|
||||
|
||||
if (ifc6 && ifc6.ifname && ifc6.proto != 'none')
|
||||
{
|
||||
var s = String.format(
|
||||
'<strong><%:Type%>: </strong>%s%s<br />',
|
||||
ifc6.proto, (ifc6.ip6prefix) ? '-pd' : ''
|
||||
);
|
||||
|
||||
if (!ifc6.ip6prefix)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Address%>: </strong>%s<br />',
|
||||
(ifc6.ip6addr) ? ifc6.ip6addr : '::'
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Prefix Delegated%>: </strong>%s<br />',
|
||||
ifc6.ip6prefix
|
||||
);
|
||||
if (ifc6.ip6addr)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Address%>: </strong>%s<br />',
|
||||
ifc6.ip6addr
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
s += String.format(
|
||||
'<strong><%:Gateway%>: </strong>%s<br />',
|
||||
(ifc6.gw6addr) ? ifc6.gw6addr : '::'
|
||||
);
|
||||
|
||||
for (var i = 0; i < ifc6.dns.length; i++)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:DNS%> %d: </strong>%s<br />',
|
||||
i + 1, ifc6.dns[i]
|
||||
);
|
||||
}
|
||||
|
||||
if (ifc6.uptime > 0)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Connected%>: </strong>%t<br />',
|
||||
ifc6.uptime
|
||||
);
|
||||
}
|
||||
|
||||
ss6.innerHTML = String.format('<small>%s</small>', s);
|
||||
si6.innerHTML = String.format(
|
||||
'<img src="<%=resource%>/icons/ethernet.png" />' +
|
||||
'<br /><small><a href="%s">%s</a></small>',
|
||||
ifc6.link, ifc6.ifname
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
si6.innerHTML = '<img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small>';
|
||||
ss6.innerHTML = '<em><%:Not connected%></em>';
|
||||
}
|
||||
<% end %>
|
||||
|
||||
<% if has_dsl then %>
|
||||
var dsl_i = document.getElementById('dsl_i');
|
||||
var dsl_s = document.getElementById('dsl_s');
|
||||
|
||||
var s = String.format(
|
||||
'<strong><%:Status%>: </strong>%s<br />' +
|
||||
'<strong><%:Line State%>: </strong>%s [0x%x]<br />' +
|
||||
'<strong><%:Line Mode%>: </strong>%s<br />' +
|
||||
'<strong><%:Annex%>: </strong>%s<br />' +
|
||||
'<strong><%:Profile%>: </strong>%s<br />' +
|
||||
'<strong><%:Data Rate%>: </strong>%s/s / %s/s<br />' +
|
||||
'<strong><%:Max. Attainable Data Rate (ATTNDR)%>: </strong>%s/s / %s/s<br />' +
|
||||
'<strong><%:Latency%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Line Attenuation (LATN)%>: </strong>%s dB / %s dB<br />' +
|
||||
'<strong><%:Signal Attenuation (SATN)%>: </strong>%s dB / %s dB<br />' +
|
||||
'<strong><%:Noise Margin (SNR)%>: </strong>%s dB / %s dB<br />' +
|
||||
'<strong><%:Aggregate Transmit Power(ACTATP)%>: </strong>%s dB / %s dB<br />' +
|
||||
'<strong><%:Forward Error Correction Seconds (FECS)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Errored seconds (ES)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Severely Errored Seconds (SES)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Loss of Signal Seconds (LOSS)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Unavailable Seconds (UAS)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Header Error Code Errors (HEC)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Non Pre-emtive CRC errors (CRC_P)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Pre-emtive CRC errors (CRCP_P)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Line Uptime%>: </strong>%s<br />' +
|
||||
'<strong><%:ATU-C System Vendor ID%>: </strong>%s<br />' +
|
||||
'<strong><%:Power Management Mode%>: </strong>%s<br />',
|
||||
info.dsl.line_state, info.dsl.line_state_detail,
|
||||
info.dsl.line_state_num,
|
||||
info.dsl.line_mode_s,
|
||||
info.dsl.annex_s,
|
||||
info.dsl.profile_s,
|
||||
info.dsl.data_rate_down_s, info.dsl.data_rate_up_s,
|
||||
info.dsl.max_data_rate_down_s, info.dsl.max_data_rate_up_s,
|
||||
info.dsl.latency_num_down, info.dsl.latency_num_up,
|
||||
info.dsl.line_attenuation_down, info.dsl.line_attenuation_up,
|
||||
info.dsl.signal_attenuation_down, info.dsl.signal_attenuation_up,
|
||||
info.dsl.noise_margin_down, info.dsl.noise_margin_up,
|
||||
info.dsl.actatp_down, info.dsl.actatp_up,
|
||||
info.dsl.errors_fec_near, info.dsl.errors_fec_far,
|
||||
info.dsl.errors_es_near, info.dsl.errors_es_far,
|
||||
info.dsl.errors_ses_near, info.dsl.errors_ses_far,
|
||||
info.dsl.errors_loss_near, info.dsl.errors_loss_far,
|
||||
info.dsl.errors_uas_near, info.dsl.errors_uas_far,
|
||||
info.dsl.errors_hec_near, info.dsl.errors_hec_far,
|
||||
info.dsl.errors_crc_p_near, info.dsl.errors_crc_p_far,
|
||||
info.dsl.errors_crcp_p_near, info.dsl.errors_crcp_p_far,
|
||||
info.dsl.line_uptime_s,
|
||||
info.dsl.atuc_vendor_id,
|
||||
info.dsl.power_mode_s
|
||||
);
|
||||
|
||||
dsl_s.innerHTML = String.format('<small>%s</small>', s);
|
||||
dsl_i.innerHTML = String.format(
|
||||
'<img src="<%=resource%>/icons/ethernet.png" />' +
|
||||
'<br /><small>DSL</small>'
|
||||
);
|
||||
<% end %>
|
||||
|
||||
<% if has_dhcp then %>
|
||||
var ls = document.getElementById('lease_status_table');
|
||||
if (ls)
|
||||
{
|
||||
/* clear all rows */
|
||||
while( ls.rows.length > 1 )
|
||||
ls.rows[0].parentNode.deleteRow(1);
|
||||
|
||||
for( var i = 0; i < info.leases.length; i++ )
|
||||
{
|
||||
var timestr;
|
||||
|
||||
if (info.leases[i].expires === false)
|
||||
timestr = '<em><%:unlimited%></em>';
|
||||
else if (info.leases[i].expires <= 0)
|
||||
timestr = '<em><%:expired%></em>';
|
||||
else
|
||||
timestr = String.format('%t', info.leases[i].expires);
|
||||
|
||||
var tr = ls.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
|
||||
|
||||
tr.insertCell(-1).innerHTML = info.leases[i].hostname ? info.leases[i].hostname : '?';
|
||||
tr.insertCell(-1).innerHTML = info.leases[i].ipaddr;
|
||||
tr.insertCell(-1).innerHTML = info.leases[i].macaddr;
|
||||
tr.insertCell(-1).innerHTML = timestr;
|
||||
}
|
||||
|
||||
if( ls.rows.length == 1 )
|
||||
{
|
||||
var tr = ls.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row';
|
||||
|
||||
var td = tr.insertCell(-1);
|
||||
td.colSpan = 4;
|
||||
td.innerHTML = '<em><br /><%:There are no active leases.%></em>';
|
||||
}
|
||||
}
|
||||
|
||||
var ls6 = document.getElementById('lease6_status_table');
|
||||
if (ls6 && info.leases6)
|
||||
{
|
||||
ls6.parentNode.style.display = 'block';
|
||||
|
||||
/* clear all rows */
|
||||
while( ls6.rows.length > 1 )
|
||||
ls6.rows[0].parentNode.deleteRow(1);
|
||||
|
||||
for( var i = 0; i < info.leases6.length; i++ )
|
||||
{
|
||||
var timestr;
|
||||
|
||||
if (info.leases6[i].expires === false)
|
||||
timestr = '<em><%:unlimited%></em>';
|
||||
else if (info.leases6[i].expires <= 0)
|
||||
timestr = '<em><%:expired%></em>';
|
||||
else
|
||||
timestr = String.format('%t', info.leases6[i].expires);
|
||||
|
||||
var tr = ls6.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
|
||||
|
||||
var host = hosts[duid2mac(info.leases6[i].duid)];
|
||||
if (!info.leases6[i].hostname)
|
||||
tr.insertCell(-1).innerHTML =
|
||||
(host && (host.name || host.ipv4 || host.ipv6))
|
||||
? '<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space: nowrap">? (%h)</div>'.format(host.name || host.ipv4 || host.ipv6)
|
||||
: '?';
|
||||
else
|
||||
tr.insertCell(-1).innerHTML =
|
||||
(host && host.name && info.leases6[i].hostname != host.name)
|
||||
? '<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space: nowrap">%h (%h)</div>'.format(info.leases6[i].hostname, host.name)
|
||||
: info.leases6[i].hostname;
|
||||
|
||||
tr.insertCell(-1).innerHTML = info.leases6[i].ip6addr;
|
||||
tr.insertCell(-1).innerHTML = info.leases6[i].duid;
|
||||
tr.insertCell(-1).innerHTML = timestr;
|
||||
}
|
||||
|
||||
if( ls6.rows.length == 1 )
|
||||
{
|
||||
var tr = ls6.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row';
|
||||
|
||||
var td = tr.insertCell(-1);
|
||||
td.colSpan = 4;
|
||||
td.innerHTML = '<em><br /><%:There are no active leases.%></em>';
|
||||
}
|
||||
}
|
||||
<% end %>
|
||||
|
||||
<% if has_wifi then %>
|
||||
var assoclist = [ ];
|
||||
|
||||
var ws = document.getElementById('wifi_status_table');
|
||||
if (ws)
|
||||
{
|
||||
var wsbody = ws.rows[0].parentNode;
|
||||
while (ws.rows.length > 0)
|
||||
wsbody.deleteRow(0);
|
||||
|
||||
for (var didx = 0; didx < info.wifinets.length; didx++)
|
||||
{
|
||||
var dev = info.wifinets[didx];
|
||||
|
||||
var tr = wsbody.insertRow(-1);
|
||||
var td;
|
||||
|
||||
td = tr.insertCell(-1);
|
||||
td.width = "33%";
|
||||
td.innerHTML = dev.name;
|
||||
td.style.verticalAlign = "top";
|
||||
|
||||
td = tr.insertCell(-1);
|
||||
|
||||
var s = '';
|
||||
|
||||
for (var nidx = 0; nidx < dev.networks.length; nidx++)
|
||||
{
|
||||
var net = dev.networks[nidx];
|
||||
var is_assoc = (net.bssid != '00:00:00:00:00:00' && net.channel && !net.disabled);
|
||||
|
||||
var icon;
|
||||
if (!is_assoc)
|
||||
icon = "<%=resource%>/icons/signal-none.png";
|
||||
else if (net.quality == 0)
|
||||
icon = "<%=resource%>/icons/signal-0.png";
|
||||
else if (net.quality < 25)
|
||||
icon = "<%=resource%>/icons/signal-0-25.png";
|
||||
else if (net.quality < 50)
|
||||
icon = "<%=resource%>/icons/signal-25-50.png";
|
||||
else if (net.quality < 75)
|
||||
icon = "<%=resource%>/icons/signal-50-75.png";
|
||||
else
|
||||
icon = "<%=resource%>/icons/signal-75-100.png";
|
||||
|
||||
s += String.format(
|
||||
'<table><tr><td style="text-align:center; width:32px; padding:3px">' +
|
||||
'<img src="%s" title="<%:Signal%>: %d dBm / <%:Noise%>: %d dBm" />' +
|
||||
'<br /><small>%d%%</small>' +
|
||||
'</td><td style="text-align:left; padding:3px"><small>' +
|
||||
'<strong><%:SSID%>:</strong> <a href="%s">%h</a><br />' +
|
||||
'<strong><%:Mode%>:</strong> %s<br />' +
|
||||
'<strong><%:Channel%>:</strong> %d (%.3f <%:GHz%>)<br />' +
|
||||
'<strong><%:Bitrate%>:</strong> %s <%:Mbit/s%><br />',
|
||||
icon, net.signal, net.noise,
|
||||
net.quality,
|
||||
net.link, net.ssid || '?',
|
||||
net.mode,
|
||||
net.channel, net.frequency,
|
||||
net.bitrate || '?'
|
||||
);
|
||||
|
||||
if (is_assoc)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:BSSID%>:</strong> %s<br />' +
|
||||
'<strong><%:Encryption%>:</strong> %s',
|
||||
net.bssid || '?',
|
||||
net.encryption
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
s += '<em><%:Wireless is disabled or not associated%></em>';
|
||||
}
|
||||
|
||||
s += '</small></td></tr></table>';
|
||||
|
||||
for (var bssid in net.assoclist)
|
||||
{
|
||||
var bss = net.assoclist[bssid];
|
||||
|
||||
bss.bssid = bssid;
|
||||
bss.link = net.link;
|
||||
bss.name = net.name;
|
||||
bss.ifname = net.ifname;
|
||||
bss.radio = dev.name;
|
||||
|
||||
assoclist.push(bss);
|
||||
}
|
||||
}
|
||||
|
||||
if (!s)
|
||||
s = '<em><%:No information available%></em>';
|
||||
|
||||
td.innerHTML = s;
|
||||
}
|
||||
}
|
||||
|
||||
var ac = document.getElementById('wifi_assoc_table');
|
||||
if (ac)
|
||||
{
|
||||
/* clear all rows */
|
||||
while( ac.rows.length > 1 )
|
||||
ac.rows[0].parentNode.deleteRow(1);
|
||||
|
||||
assoclist.sort(function(a, b) {
|
||||
return (a.name == b.name)
|
||||
? (a.bssid < b.bssid)
|
||||
: (a.name > b.name )
|
||||
;
|
||||
});
|
||||
|
||||
for( var i = 0; i < assoclist.length; i++ )
|
||||
{
|
||||
var tr = ac.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row cbi-rowstyle-' + (1 + (i % 2));
|
||||
|
||||
var icon;
|
||||
var q = (-1 * (assoclist[i].noise - assoclist[i].signal)) / 5;
|
||||
if (q < 1)
|
||||
icon = "<%=resource%>/icons/signal-0.png";
|
||||
else if (q < 2)
|
||||
icon = "<%=resource%>/icons/signal-0-25.png";
|
||||
else if (q < 3)
|
||||
icon = "<%=resource%>/icons/signal-25-50.png";
|
||||
else if (q < 4)
|
||||
icon = "<%=resource%>/icons/signal-50-75.png";
|
||||
else
|
||||
icon = "<%=resource%>/icons/signal-75-100.png";
|
||||
|
||||
tr.insertCell(-1).innerHTML = String.format(
|
||||
'<span class="ifacebadge" title="%q"><img src="<%=resource%>/icons/wifi.png" /> %h</span>',
|
||||
assoclist[i].radio, assoclist[i].ifname
|
||||
);
|
||||
|
||||
tr.insertCell(-1).innerHTML = String.format(
|
||||
'<a href="%s">%s</a>',
|
||||
assoclist[i].link,
|
||||
'%h'.format(assoclist[i].name).nobr()
|
||||
);
|
||||
|
||||
tr.insertCell(-1).innerHTML = assoclist[i].bssid;
|
||||
|
||||
var host = hosts[assoclist[i].bssid];
|
||||
if (host)
|
||||
tr.insertCell(-1).innerHTML = String.format(
|
||||
'<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis">%s</div>',
|
||||
((host.name && (host.ipv4 || host.ipv6))
|
||||
? '%h (%s)'.format(host.name, host.ipv4 || host.ipv6)
|
||||
: '%h'.format(host.name || host.ipv4 || host.ipv6)).nobr()
|
||||
);
|
||||
else
|
||||
tr.insertCell(-1).innerHTML = '?';
|
||||
|
||||
tr.insertCell(-1).innerHTML = String.format(
|
||||
'<span class="ifacebadge" title="<%:Signal%>: %d <%:dBm%> / <%:Noise%>: %d <%:dBm%> / <%:SNR%>: %d"><img src="%s" /> %d / %d <%:dBm%></span>',
|
||||
assoclist[i].signal, assoclist[i].noise, assoclist[i].signal - assoclist[i].noise,
|
||||
icon,
|
||||
assoclist[i].signal, assoclist[i].noise
|
||||
);
|
||||
|
||||
tr.insertCell(-1).innerHTML = wifirate(assoclist[i], true).nobr() + '<br />' + wifirate(assoclist[i], false).nobr();
|
||||
}
|
||||
|
||||
if (ac.rows.length == 1)
|
||||
{
|
||||
var tr = ac.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row';
|
||||
|
||||
var td = tr.insertCell(-1);
|
||||
td.colSpan = 7;
|
||||
td.innerHTML = '<br /><em><%:No information available%></em>';
|
||||
}
|
||||
}
|
||||
<% end %>
|
||||
|
||||
var e;
|
||||
|
||||
if (e = document.getElementById('ethinfo')) {
|
||||
var ports = eval('(' + info.ethinfo + ')');
|
||||
var tmp = "";
|
||||
for (var i in ports)
|
||||
{
|
||||
tmp = tmp + String.format(
|
||||
'<td style="text-align:center"><span style="line-height:25px">%s</span><br /><small><img src="<%=resource%>/icons/%s" /><br />%s<br />%s</small></td>', ports[i].name,
|
||||
ports[i].status ? 'port_up.png' : 'port_down.png',
|
||||
ports[i].speed,
|
||||
ports[i].duplex ? '<%:full-duplex%>' : '<%:half-duplex%>');
|
||||
};
|
||||
e.innerHTML = "<tr>" + tmp + "</tr>";
|
||||
}
|
||||
|
||||
if (e = document.getElementById('localtime'))
|
||||
e.innerHTML = info.localtime;
|
||||
|
||||
if (e = document.getElementById('uptime'))
|
||||
e.innerHTML = String.format('%t', info.uptime);
|
||||
|
||||
if (e = document.getElementById('userinfo'))
|
||||
e.innerHTML = info.userinfo;
|
||||
|
||||
if (e = document.getElementById('cpuinfo'))
|
||||
e.innerHTML = info.cpuinfo;
|
||||
|
||||
if (e = document.getElementById('cpuusage'))
|
||||
e.innerHTML = info.cpuusage;
|
||||
|
||||
if (e = document.getElementById('loadavg'))
|
||||
e.innerHTML = String.format(
|
||||
'%.02f, %.02f, %.02f',
|
||||
info.loadavg[0] / 65535.0,
|
||||
info.loadavg[1] / 65535.0,
|
||||
info.loadavg[2] / 65535.0
|
||||
);
|
||||
|
||||
if (e = document.getElementById('memtotal'))
|
||||
e.innerHTML = progressbar(
|
||||
Math.floor(((info.memory.free + info.memory.buffered) / 1048576) + (info.memcached / 1024)) + " <%:MB%>",
|
||||
Math.floor(info.memory.total / 1048576) + " <%:MB%>"
|
||||
);
|
||||
|
||||
if (e = document.getElementById('membuff'))
|
||||
e.innerHTML = progressbar(
|
||||
Math.floor(info.memory.buffered / 1048576) + " <%:MB%>",
|
||||
Math.floor(info.memory.total / 1048576) + " <%:MB%>"
|
||||
);
|
||||
|
||||
if (e = document.getElementById('swaptotal'))
|
||||
e.innerHTML = progressbar(
|
||||
Math.floor(info.swap.free / 1048576) + " <%:MB%>",
|
||||
Math.floor(info.swap.total / 1048576) + " <%:MB%>"
|
||||
);
|
||||
|
||||
if (e = document.getElementById('swapfree'))
|
||||
e.innerHTML = progressbar(
|
||||
Math.floor(info.swap.free / 1048576) + " <%:MB%>",
|
||||
Math.floor(info.swap.total / 1048576) + " <%:MB%>"
|
||||
);
|
||||
|
||||
if (e = document.getElementById('conns'))
|
||||
e.innerHTML = progressbar(info.conncount, info.connmax);
|
||||
|
||||
}
|
||||
);
|
||||
//]]></script>
|
||||
|
||||
<h2 name="content"><%:Status%></h2>
|
||||
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:System%></legend>
|
||||
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="33%"><%:Hostname%></td><td><%=luci.sys.hostname() or "?"%></td></tr>
|
||||
<tr><td width="33%"><%:Model%></td><td><%=pcdata(boardinfo.model or "?")%> <%=luci.sys.exec("cat /etc/bench.log") or " "%></td></tr>
|
||||
<tr><td width="33%"><%:CPU Info%></td><td id="cpuinfo">-</td></tr>
|
||||
<tr><td width="33%"><%:Firmware Version%></td><td>
|
||||
<%=pcdata(ver.distname)%> <%=pcdata(ver.distversion)%> /
|
||||
<%=pcdata(ver.luciname)%> (<%=pcdata(ver.luciversion)%>)
|
||||
</td></tr>
|
||||
<tr><td width="33%"><%:Kernel Version%></td><td><%=unameinfo.release or "?"%></td></tr>
|
||||
<tr><td width="33%"><%:Local Time%></td><td id="localtime">-</td></tr>
|
||||
<tr><td width="33%"><%:Uptime%></td><td id="uptime">-</td></tr>
|
||||
<tr><td width="33%"><%:Load Average%></td><td id="loadavg">-</td></tr>
|
||||
<tr><td width="33%"><%:CPU usage (%)%></td><td id="cpuusage">-</td></tr>
|
||||
<tr><td width="33%"><%:Source Code%></td><td><a href="https://github.com/immortalwrt" target="_blank">
|
||||
Project ImmortalWrt</a> / <a href="https://github.com/immortalwrt/immortalwrt" target="_blank">ImmortalWrt Core</a>
|
||||
</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Memory%></legend>
|
||||
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="33%"><%:Total Available%></td><td id="memtotal">-</td></tr>
|
||||
<tr><td width="33%"><%:Buffered%></td><td id="membuff">-</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<% if swapinfo.total > 0 then %>
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Swap%></legend>
|
||||
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="33%"><%:Total Available%></td><td id="swaptotal">-</td></tr>
|
||||
<tr><td width="33%"><%:Free%></td><td id="swapfree">-</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Interfaces%></legend>
|
||||
|
||||
<table width="100%" cellspacing="10" id="ethinfo">
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Network%></legend>
|
||||
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="33%" style="vertical-align:top"><%:IPv4 WAN Status%></td><td>
|
||||
<table><tr>
|
||||
<td id="wan4_i" style="width:16px; text-align:center; padding:3px"><img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small></td>
|
||||
<td id="wan4_s" style="vertical-align:middle; padding: 3px"><em><%:Collecting data...%></em></td>
|
||||
</tr></table>
|
||||
</td></tr>
|
||||
<% if has_ipv6 then %>
|
||||
<tr><td width="33%" style="vertical-align:top"><%:IPv6 WAN Status%></td><td>
|
||||
<table><tr>
|
||||
<td id="wan6_i" style="width:16px; text-align:center; padding:3px"><img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small></td>
|
||||
<td id="wan6_s" style="vertical-align:middle; padding: 3px"><em><%:Collecting data...%></em></td>
|
||||
</tr></table>
|
||||
</td></tr>
|
||||
<% end %>
|
||||
<tr><td width="33%"><%:Online Users%></td><td id="userinfo">0</td></tr>
|
||||
<tr><td width="33%"><%:Active Connections%></td><td id="conns">-</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<% if has_dhcp then %>
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:DHCP Leases%></legend>
|
||||
|
||||
<table class="cbi-section-table" id="lease_status_table">
|
||||
<tr class="cbi-section-table-titles">
|
||||
<th class="cbi-section-table-cell"><%:Hostname%></th>
|
||||
<th class="cbi-section-table-cell"><%:IPv4-Address%></th>
|
||||
<th class="cbi-section-table-cell"><%:MAC-Address%></th>
|
||||
<th class="cbi-section-table-cell"><%:Leasetime remaining%></th>
|
||||
</tr>
|
||||
<tr class="cbi-section-table-row">
|
||||
<td colspan="4"><em><br /><%:Collecting data...%></em></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<% if has_ipv6 then %>
|
||||
<fieldset class="cbi-section" style="display:none">
|
||||
<legend><%:DHCPv6 Leases%></legend>
|
||||
|
||||
<table class="cbi-section-table" id="lease6_status_table">
|
||||
<tr class="cbi-section-table-titles">
|
||||
<th class="cbi-section-table-cell"><%:Host%></th>
|
||||
<th class="cbi-section-table-cell"><%:IPv6-Address%></th>
|
||||
<th class="cbi-section-table-cell"><%:DUID%></th>
|
||||
<th class="cbi-section-table-cell"><%:Leasetime remaining%></th>
|
||||
</tr>
|
||||
<tr class="cbi-section-table-row">
|
||||
<td colspan="4"><em><br /><%:Collecting data...%></em></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if has_dsl then %>
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:DSL%></legend>
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="33%" style="vertical-align:top"><%:DSL Status%></td><td>
|
||||
<table><tr>
|
||||
<td id="dsl_i" style="width:16px; text-align:center; padding:3px"><img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small></td>
|
||||
<td id="dsl_s" style="vertical-align:middle; padding: 3px"><em><%:Collecting data...%></em></td>
|
||||
</tr></table>
|
||||
</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<% if has_wifi then %>
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Wireless%></legend>
|
||||
|
||||
<table id="wifi_status_table" width="100%" cellspacing="10">
|
||||
<tr><td><em><%:Collecting data...%></em></td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<%+footer%>
|
||||
@ -1,5 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
MHz=`grep 'MHz' /proc/cpuinfo | cut -c11- |sed -n '1p'`
|
||||
TEMP=`sensors 2>/dev/null | grep 'Core 0' | cut -c12-`
|
||||
echo "$MHz MHz $TEMP "
|
||||
@ -1,39 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
a=$(ip address | grep ^[0-9] | awk -F: '{print $2}' | sed "s/ //g" | grep '^[e]' | grep -v "@" | grep -v "\.")
|
||||
b=$(echo "$a" | wc -l)
|
||||
rm -f /tmp/state/ethinfo
|
||||
|
||||
echo -n "[" > /tmp/state/ethinfo
|
||||
|
||||
for i in $(seq 1 $b)
|
||||
do
|
||||
h=$(echo '{"name":' )
|
||||
c=$(echo "$a" | sed -n ${i}p)
|
||||
d=$(ethtool $c)
|
||||
|
||||
e=$(echo "$d" | grep "Link detected" | awk -F: '{printf $2}' | sed 's/^[ \t]*//g')
|
||||
if [ $e = yes ]; then
|
||||
l=1
|
||||
else
|
||||
l=0
|
||||
fi
|
||||
|
||||
f=$(echo "$d" | grep "Speed" | awk -F: '{printf $2}' | sed 's/^[ \t]*//g' | tr -d "Unknown!")
|
||||
[ -z "$f" ] && f=" - "
|
||||
|
||||
g=$(echo "$d" | grep "Duplex" | awk -F: '{printf $2}' | sed 's/^[ \t]*//g')
|
||||
if [ "$g" == "Full" ]; then
|
||||
x=1
|
||||
else
|
||||
x=0
|
||||
fi
|
||||
|
||||
echo -n "$h \"$c\", \"status\": $l, \"speed\": \"$f\", \"duplex\": $x}," >> /tmp/state/ethinfo
|
||||
done
|
||||
|
||||
sed -i 's/.$//' /tmp/state/ethinfo
|
||||
|
||||
echo -n "]" >> /tmp/state/ethinfo
|
||||
|
||||
cat /tmp/state/ethinfo
|
||||
@ -1,8 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ $(busybox ps -w | grep getcpu | grep -v grep | wc -l) -le 2 ]; then
|
||||
AT=$(cat /proc/stat | grep "^cpu " | awk '{print $2+$3+$4+$5+$6+$7+$8 " " $2+$3+$4+$7+$8}')
|
||||
sleep 1
|
||||
BT=$(cat /proc/stat | grep "^cpu " | awk '{print $2+$3+$4+$5+$6+$7+$8 " " $2+$3+$4+$7+$8}')
|
||||
printf "%.01f%%" $(echo $AT $BT | awk '{print (($4-$2)/($3-$1))*100}') >/tmp/cpuusage
|
||||
fi
|
||||
@ -1,38 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2010-2011 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=automount
|
||||
PKG_VERSION:=1
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/automount
|
||||
TITLE:=Mount autoconfig hotplug script.
|
||||
MAINTAINER:=Lean
|
||||
DEPENDS:=+block-mount +kmod-usb-storage +kmod-usb-storage-extras +!TARGET_ramips:kmod-usb-storage-uas \
|
||||
+kmod-fs-vfat +kmod-fs-ext4 +LINUX_5_4:kmod-fs-exfat0 +!LINUX_5_4:kmod-fs-exfat +ntfs-3g
|
||||
PKGARCH:=all
|
||||
endef
|
||||
|
||||
define Package/automount/description
|
||||
A usb autoconfig hotplug script.
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
true
|
||||
endef
|
||||
|
||||
define Package/automount/install
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/15-automount $(1)/etc/15-automount
|
||||
$(INSTALL_BIN) ./files/zzz-move-automount $(1)/etc/uci-defaults/zzz-move-automount
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,automount))
|
||||
@ -1,27 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (C) 2015 OpenWrt.org
|
||||
|
||||
# 0 yes blockdevice handles this - 1 no it is not there
|
||||
blkdev=`dirname $DEVPATH`
|
||||
basename=`basename $blkdev`
|
||||
device=`basename $DEVPATH`
|
||||
skip=`block info | sed 's/\(.*\): .*/\1/' | grep -q $device ; echo $?`
|
||||
path=$DEVPATH
|
||||
|
||||
if [ $basename != "block" ] && [ -z "${device##sd*}" ] && [ $skip -eq 1 ]; then
|
||||
mntpnt=$device
|
||||
case "$ACTION" in
|
||||
add)
|
||||
mkdir -p /mnt/$mntpnt
|
||||
chmod 777 /mnt/$mntpnt
|
||||
# Try to be gentle on solid state devices
|
||||
mount -o rw,noatime,discard /dev/$device /mnt/$mntpnt
|
||||
;;
|
||||
remove)
|
||||
# Once the device is removed, the /dev entry disappear. We need mountpoint
|
||||
mountpoint=`mount |grep /dev/$device | sed 's/.* on \(.*\) type.*/\1/'`
|
||||
umount -l $mountpoint
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
sleep 15
|
||||
mv /etc/15-automount /etc/hotplug.d/block/
|
||||
@ -1,36 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2010-2011 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=autosamba
|
||||
PKG_VERSION:=1
|
||||
PKG_RELEASE:=12
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/autosamba
|
||||
TITLE:=Samba autoconfig hotplug script.
|
||||
MAINTAINER:=Lean
|
||||
DEPENDS:=+luci-app-samba +wsdd2
|
||||
PKGARCH:=all
|
||||
endef
|
||||
|
||||
define Package/autosamba/description
|
||||
A hotplug script to config Samba share automatically.
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
true
|
||||
endef
|
||||
|
||||
define Package/autosamba/install
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/block
|
||||
$(INSTALL_BIN) ./files/20-smb $(1)/etc/hotplug.d/block/20-smb
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,autosamba))
|
||||
@ -1,105 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# D-Team Technology Co.,Ltd. ShenZhen
|
||||
# 作者:Vic
|
||||
#
|
||||
# 警告:对着屏幕的哥们,我们允许你使用此脚本,但不允许你抹去作者的信息,请保留这段话。
|
||||
#
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/service.sh
|
||||
|
||||
global=0
|
||||
config_file="/etc/config/samba"
|
||||
|
||||
wait_for_init() {
|
||||
for i in `seq 30`
|
||||
do
|
||||
[ -e /tmp/procd.done ] || {
|
||||
sleep 1; continue;
|
||||
}
|
||||
return
|
||||
done
|
||||
}
|
||||
|
||||
smb_handle() {
|
||||
config_get path $1 path
|
||||
if [ "$path" = "$2" ] ;then
|
||||
global=1
|
||||
fi
|
||||
}
|
||||
|
||||
chk_en() {
|
||||
config_get_bool autoshare $1 autoshare 1
|
||||
[ $autoshare -eq 0 ] && exit
|
||||
}
|
||||
|
||||
config_load samba
|
||||
config_foreach chk_en samba
|
||||
|
||||
device=`basename $DEVPATH`
|
||||
|
||||
case "$ACTION" in
|
||||
add)
|
||||
|
||||
case "$device" in
|
||||
sd*);;
|
||||
md*);;
|
||||
hd*);;
|
||||
mmcblk*);;
|
||||
*) return;;
|
||||
esac
|
||||
|
||||
path="/dev/$device"
|
||||
|
||||
wait_for_init
|
||||
|
||||
cat /proc/mounts | while read j
|
||||
do
|
||||
str=${j%% *}
|
||||
if [ "$str" == $path ];then
|
||||
strr=${j#* }
|
||||
target=${strr%% *}
|
||||
global=0
|
||||
config_foreach smb_handle sambashare $target
|
||||
name=${target#*/mnt/}
|
||||
|
||||
if [ $global -eq 0 ] ;then
|
||||
echo -e "\n\nconfig sambashare" >> $config_file
|
||||
echo -e "\toption auto '1'" >> $config_file
|
||||
echo -e "\toption name '$name'" >> $config_file
|
||||
echo -e "\toption path '$target'" >> $config_file
|
||||
echo -e "\toption read_only 'no'" >> $config_file
|
||||
echo -e "\toption guest_ok 'yes'" >> $config_file
|
||||
echo -e "\toption create_mask '0666'" >> $config_file
|
||||
echo -e "\toption dir_mask '0777'" >> $config_file
|
||||
echo -e "\toption device '$device'" >> $config_file
|
||||
/etc/init.d/samba reload
|
||||
return
|
||||
fi
|
||||
fi
|
||||
done
|
||||
;;
|
||||
|
||||
remove)
|
||||
i=0
|
||||
while true
|
||||
do
|
||||
dev=`uci get samba.@sambashare[$i].device`
|
||||
[ $? -ne 0 ] && break
|
||||
|
||||
[ "$dev" = "$device" ] && {
|
||||
auto=`uci get samba.@sambashare[$i].auto`
|
||||
[ $auto = "1" ] && {
|
||||
mount_dir=`uci get samba.@sambashare[$i].name`
|
||||
uci delete samba.@sambashare[$i]
|
||||
uci commit
|
||||
/etc/init.d/samba reload
|
||||
return
|
||||
}
|
||||
}
|
||||
let i+=1
|
||||
done
|
||||
;;
|
||||
esac
|
||||
@ -1,41 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2018 TDT AG <development@tdt.de>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See https://www.gnu.org/licenses/gpl-2.0.txt for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=proto-bonding
|
||||
PKG_VERSION:=2018-06-11
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_LICENSE_FILES:=
|
||||
|
||||
PKG_MAINTAINER:=Helge Mader <ma@dev.tdt.de>
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/proto-bonding
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Link Aggregation (Channel Bonding) proto handler
|
||||
DEPENDS:=+kmod-bonding
|
||||
endef
|
||||
|
||||
define Package/proto-bonding/description
|
||||
This package contains the channel bonding proto handler for netifd
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/proto-bonding/install
|
||||
$(INSTALL_DIR) $(1)/lib/netifd/proto/
|
||||
$(INSTALL_BIN) ./files/lib/netifd/proto/bonding.sh \
|
||||
$(1)/lib/netifd/proto/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,proto-bonding))
|
||||
@ -1,211 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2018 TDT AG <development@tdt.de>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See https://www.gnu.org/licenses/gpl-2.0.txt for more information.
|
||||
#
|
||||
|
||||
. /lib/functions.sh
|
||||
. ../netifd-proto.sh
|
||||
|
||||
init_proto "$@"
|
||||
|
||||
INCLUDE_ONLY=1
|
||||
|
||||
BONDING_MASTERS="/sys/class/net/bonding_masters"
|
||||
|
||||
set_driver_values() {
|
||||
local varname
|
||||
|
||||
for varname in "$@"; do
|
||||
local value
|
||||
json_get_var value "$varname"
|
||||
|
||||
[ -n "$value" ] && echo "$value" > /sys/class/net/"$link"/bonding/"$varname"
|
||||
done
|
||||
}
|
||||
|
||||
proto_bonding_init_config() {
|
||||
no_device=1
|
||||
available=1
|
||||
|
||||
proto_config_add_string "ifname"
|
||||
|
||||
proto_config_add_string "ipaddr"
|
||||
proto_config_add_string "netmask"
|
||||
|
||||
proto_config_add_string "bonding_policy"
|
||||
proto_config_add_string "link_monitoring"
|
||||
proto_config_add_string "slaves"
|
||||
proto_config_add_string "all_slaves_active"
|
||||
|
||||
proto_config_add_string "min_links"
|
||||
proto_config_add_string "ad_actor_sys_prio"
|
||||
proto_config_add_string "ad_actor_system"
|
||||
proto_config_add_string "ad_select"
|
||||
proto_config_add_string "lacp_rate"
|
||||
proto_config_add_string "packets_per_slave"
|
||||
proto_config_add_string "xmit_hash_policy"
|
||||
proto_config_add_string "primary"
|
||||
proto_config_add_string "primary_reselect"
|
||||
proto_config_add_string "lp_interval"
|
||||
proto_config_add_string "tlb_dynamic_lb"
|
||||
proto_config_add_string "resend_igmp"
|
||||
proto_config_add_string "fail_over_mac"
|
||||
proto_config_add_string "num_grat_arp__num_unsol_na"
|
||||
|
||||
proto_config_add_string "arp_interval"
|
||||
proto_config_add_string "arp_ip_target"
|
||||
proto_config_add_string "arp_all_targets"
|
||||
proto_config_add_string "arp_validate"
|
||||
|
||||
proto_config_add_string "miimon"
|
||||
proto_config_add_string "downdelay"
|
||||
proto_config_add_string "updelay"
|
||||
proto_config_add_string "use_carrier"
|
||||
}
|
||||
|
||||
proto_bonding_setup() {
|
||||
local cfg="$1"
|
||||
local link="bonding-$cfg"
|
||||
|
||||
# Check for loaded kernel bonding driver (/sys/class/net/bonding_masters exists)
|
||||
[ -f "$BONDING_MASTERS" ] || {
|
||||
echo "$cfg" "setup: bonding_masters does not exist in sysfs (kernel module not loaded?)"
|
||||
proto_notify_error "$cfg" "setup: bonding_masters does not exist in sysfs (kernel module not loaded?)"
|
||||
proto_block_restart "$cfg"
|
||||
return
|
||||
}
|
||||
|
||||
# Add bonding interface to system
|
||||
echo "+$link" > "$BONDING_MASTERS"
|
||||
|
||||
# Set bonding policy (with corresponding parameters)
|
||||
local bonding_policy
|
||||
json_get_vars bonding_policy
|
||||
|
||||
case "$bonding_policy" in
|
||||
|
||||
802.3ad)
|
||||
echo "$bonding_policy" > /sys/class/net/"$link"/bonding/mode
|
||||
set_driver_values min_links ad_actor_sys_prio ad_actor_system ad_select lacp_rate
|
||||
;;
|
||||
|
||||
balance-rr)
|
||||
echo "$bonding_policy" > /sys/class/net/"$link"/bonding/mode
|
||||
set_driver_values packets_per_slave xmit_hash_policy
|
||||
;;
|
||||
|
||||
balance-tlb)
|
||||
echo "$bonding_policy" > /sys/class/net/"$link"/bonding/mode
|
||||
set_driver_values primary primary_reselect lp_interval tlb_dynamic_lb resend_igmp xmit_hash_policy
|
||||
;;
|
||||
|
||||
balance-alb)
|
||||
echo "$bonding_policy" > /sys/class/net/"$link"/bonding/mode
|
||||
set_driver_values primary primary_reselect lp_interval tlb_dynamic_lb resend_igmp xmit_hash_policy
|
||||
;;
|
||||
|
||||
active-backup)
|
||||
echo "$bonding_policy" > /sys/class/net/"$link"/bonding/mode
|
||||
set_driver_values primary primary_reselect fail_over_mac num_grat_arp__num_unsol_na xmit_hash_policy
|
||||
;;
|
||||
esac
|
||||
|
||||
# Set link monitoring (with corresponding parameters)
|
||||
local link_monitoring
|
||||
json_get_vars link_monitoring
|
||||
|
||||
case "$link_monitoring" in
|
||||
|
||||
arp)
|
||||
local arp_interval arp_ip_target arp_all_targets arp_validate
|
||||
json_get_vars arp_interval arp_ip_target arp_all_targets arp_validate
|
||||
|
||||
[ -n "$arp_interval" -a "$arp_interval" != 0 ] && echo "$arp_interval" > /sys/class/net/"$link"/bonding/arp_interval
|
||||
|
||||
IFS=' '
|
||||
for target in $arp_ip_target; do
|
||||
echo "+$target" > /sys/class/net/"$link"/bonding/arp_ip_target
|
||||
done
|
||||
|
||||
[ -n "$arp_all_targets" ] && echo "$arp_all_targets" > /sys/class/net/"$link"/bonding/arp_all_targets
|
||||
[ -n "$arp_validate" ] && echo "$arp_validate" > /sys/class/net/"$link"/bonding/arp_validate
|
||||
;;
|
||||
|
||||
mii)
|
||||
local miimon downdelay updelay use_carrier
|
||||
json_get_vars miimon downdelay updelay use_carrier
|
||||
|
||||
[ -n "$miimon" -a "$miimon" != 0 ] && echo "$miimon" > /sys/class/net/"$link"/bonding/miimon
|
||||
[ -n "$downdelay" ] && echo "$downdelay" > /sys/class/net/"$link"/bonding/downdelay
|
||||
[ -n "$updelay" ] && echo "$updelay" > /sys/class/net/"$link"/bonding/updelay
|
||||
[ -n "$use_carrier" ] && echo "$use_carrier" > /sys/class/net/"$link"/bonding/use_carrier
|
||||
;;
|
||||
esac
|
||||
|
||||
# Add slaves to bonding interface
|
||||
local slaves
|
||||
json_get_vars slaves
|
||||
|
||||
for slave in $slaves; do
|
||||
|
||||
if [ "$(cat /proc/net/dev |grep "$slave")" == "" ]; then
|
||||
echo "$cfg" "ERROR IN CONFIGURATION - $slave: No such device"
|
||||
proto_notify_error "$cfg" "ERROR IN CONFIGURATION - $slave: No such device"
|
||||
proto_block_restart "$cfg"
|
||||
return
|
||||
fi
|
||||
|
||||
ifconfig "$slave" down
|
||||
|
||||
sleep 1
|
||||
|
||||
echo "+$slave" > /sys/class/net/"$link"/bonding/slaves
|
||||
|
||||
ifconfig "$slave" up
|
||||
done
|
||||
|
||||
[ -n "$all_slaves_active" ] && echo "$all_slaves_active" > /sys/class/net/"$link"/bonding/all_slaves_active
|
||||
|
||||
local ipaddr netmask
|
||||
json_get_vars ipaddr netmask
|
||||
|
||||
# ATTENTION
|
||||
#All json vars have to be read before the line below, as the
|
||||
# json object will be overwritten by proto_init_update
|
||||
# ATTENTION
|
||||
|
||||
proto_init_update "$link" 1
|
||||
|
||||
# For static configuration we _MUST_ have an IP address
|
||||
[ -z "$ipaddr" ] && {
|
||||
echo "$cfg" "INVALID LOCAL ADDRESS"
|
||||
proto_notify_error "$cfg" "INVALID_LOCAL_ADDRESS"
|
||||
proto_block_restart "$cfg"
|
||||
return
|
||||
}
|
||||
|
||||
proto_add_ipv4_address "$ipaddr" "$netmask"
|
||||
|
||||
proto_send_update "$cfg"
|
||||
}
|
||||
|
||||
proto_bonding_teardown() {
|
||||
local cfg="$1"
|
||||
local link="bonding-$cfg"
|
||||
|
||||
# Check for loaded kernel bonding driver (/sys/class/net/bonding_masters exists)
|
||||
[ -f "$BONDING_MASTERS" ] || {
|
||||
echo "$cfg" "teardown: bonding_masters does not exist in sysfs (kernel module not loaded?)"
|
||||
proto_notify_error "$cfg" "teardown: bonding_masters does not exist in sysfs (kernel module not loaded?)"
|
||||
proto_block_restart "$cfg"
|
||||
return
|
||||
}
|
||||
|
||||
echo "-$link" > /sys/class/net/bonding_masters
|
||||
logger "bonding_teardown($1): $2"
|
||||
}
|
||||
|
||||
add_protocol bonding
|
||||
@ -1,41 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=csstidy
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=https://github.com/jow-/csstidy-cpp.git
|
||||
PKG_SOURCE_DATE:=2018-12-20
|
||||
PKG_SOURCE_VERSION:=1d5620149ae35c0d49fb2014d4e63a23ecfb6f69
|
||||
PKG_MIRROR_HASH:=3210d475f6ae966d4dfcd3e1f7fcbf0ad9507a37878d50de015ffe795c1d160e
|
||||
|
||||
PKG_LICENSE:=LGPL-2.1
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
|
||||
|
||||
HOST_BUILD_PARALLEL:=1
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/csstidy
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=CSSTidy parser and optimiser
|
||||
DEPENDS:=+libstdcpp
|
||||
endef
|
||||
|
||||
define Package/csstidy/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/csstidy/csstidy $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
|
||||
define Host/Install
|
||||
$(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin/
|
||||
$(INSTALL_BIN) $(HOST_BUILD_DIR)/csstidy/csstidy $(1)/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
$(eval $(call BuildPackage,csstidy))
|
||||
@ -1,72 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ddns-scripts_aliyun
|
||||
PKG_VERSION:=1.0.3
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_MAINTAINER:=Sense <sensec@gmail.com>
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=IP Addresses and Names
|
||||
TITLE:=DDNS extension for AliYun.com
|
||||
PKGARCH:=all
|
||||
DEPENDS:=+ddns-scripts +wget-ssl +openssl-util
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
Dynamic DNS Client scripts extension for AliYun.com
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(CP) ./*.sh $(PKG_BUILD_DIR)
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/preinst
|
||||
#!/bin/sh
|
||||
# if NOT run buildroot then stop service
|
||||
[ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1
|
||||
exit 0 # suppress errors
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ddns
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/update_aliyun_com.sh $(1)/usr/lib/ddns
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/postinst
|
||||
#!/bin/sh
|
||||
# remove old services file entries
|
||||
/bin/sed -i '/aliyun\.com/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
|
||||
/bin/sed -i '/aliyun\.com/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1
|
||||
# and create new
|
||||
printf "%s\\t\\t%s\\n" '"aliyun.com"' '"update_aliyun_com.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services
|
||||
printf "%s\\t\\t%s\\n" '"aliyun.com"' '"update_aliyun_com.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services_ipv6
|
||||
# on real system restart service if enabled
|
||||
[ -z "$${IPKG_INSTROOT}" ] && {
|
||||
/etc/init.d/ddns enabled && \
|
||||
/etc/init.d/ddns start >/dev/null 2>&1
|
||||
}
|
||||
exit 0 # suppress errors
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/prerm
|
||||
#!/bin/sh
|
||||
# if NOT run buildroot then stop service
|
||||
[ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1
|
||||
# remove services file entries
|
||||
/bin/sed -i '/aliyun\.com/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
|
||||
/bin/sed -i '/aliyun\.com/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1
|
||||
exit 0 # suppress errors
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
@ -1,247 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# 用于阿里云解析的DNS更新脚本
|
||||
# 2017-2018 Sense <sensec at gmail dot com>
|
||||
# 阿里云解析API文档 https://help.aliyun.com/document_detail/29739.html
|
||||
#
|
||||
# 本脚本由 dynamic_dns_functions.sh 内的函数 send_update() 调用
|
||||
#
|
||||
# 需要在 /etc/config/ddns 中设置的选项
|
||||
# option username - 阿里云API访问账号 Access Key ID。可通过 aliyun.com 帐号管理的 accesskeys 获取, 或者访问 https://ak-console.aliyun.com
|
||||
# option password - 阿里云API访问密钥 Access Key Secret
|
||||
# option domain - 完整的域名。建议主机与域名之间使用 @符号 分隔,否则将以第一个 .符号 之前的内容作为主机名
|
||||
#
|
||||
|
||||
# 检查传入参数
|
||||
[ -z "$username" ] && write_log 14 "配置错误!保存阿里云API访问账号的'用户名'不能为空"
|
||||
[ -z "$password" ] && write_log 14 "配置错误!保存阿里云API访问密钥的'密码'不能为空"
|
||||
|
||||
# 检查外部调用工具
|
||||
[ -n "$WGET_SSL" ] || write_log 13 "使用阿里云API需要 GNU Wget 支持,请先安装"
|
||||
command -v sed >/dev/null 2>&1 || write_log 13 "使用阿里云API需要 sed 支持,请先安装"
|
||||
command -v openssl >/dev/null 2>&1 || write_log 13 "使用阿里云API需要 openssl-util 支持,请先安装"
|
||||
|
||||
# 包含用于解析 JSON 格式返回值的函数
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
# 变量声明
|
||||
local __HOST __DOMAIN __TYPE __URLBASE __CMDBASE __URLARGS __SEPARATOR __RECID
|
||||
[ $use_https -eq 0 ] && __URLBASE="http://alidns.aliyuncs.com/" || __URLBASE="https://alidns.aliyuncs.com/"
|
||||
__SEPARATOR="&"
|
||||
|
||||
# 从 $domain 分离主机和域名
|
||||
[ "${domain:0:2}" == "@." ] && domain="${domain/./}" # 主域名处理
|
||||
[ "$domain" == "${domain/@/}" ] && domain="${domain/./@}" # 未找到分隔符,兼容常用域名格式
|
||||
__HOST="${domain%%@*}"
|
||||
__DOMAIN="${domain#*@}"
|
||||
[ -z "$__HOST" -o "$__HOST" == "$__DOMAIN" ] && __HOST="@"
|
||||
|
||||
# 设置记录类型
|
||||
[ $use_ipv6 -eq 0 ] && __TYPE="A" || __TYPE="AAAA"
|
||||
|
||||
# 构造基本通信命令
|
||||
build_command() {
|
||||
__CMDBASE="$WGET_SSL --no-hsts -nv -t 1 -O $DATFILE -o $ERRFILE"
|
||||
# 绑定用于通信的主机/IP
|
||||
if [ -n "$bind_network" ]; then
|
||||
local bind_ip run_prog
|
||||
[ $use_ipv6 -eq 0 ] && run_prog="network_get_ipaddr" || run_prog="network_get_ipaddr6"
|
||||
eval "$run_prog bind_ip $bind_network" || \
|
||||
write_log 13 "无法使用 '$run_prog $bind_network' 获取本地IP地址 - 错误代码: '$?'"
|
||||
write_log 7 "强制使用IP '$bind_ip' 通信"
|
||||
__CMDBASE="$__CMDBASE --bind-address=$bind_ip"
|
||||
fi
|
||||
# 强制设定IP版本
|
||||
if [ $force_ipversion -eq 1 ]; then
|
||||
[ $use_ipv6 -eq 0 ] && __CMDBASE="$__CMDBASE -4" || __CMDBASE="$__CMDBASE -6"
|
||||
fi
|
||||
# 设置CA证书参数
|
||||
if [ $use_https -eq 1 ]; then
|
||||
if [ "$cacert" = "IGNORE" ]; then
|
||||
__CMDBASE="$__CMDBASE --no-check-certificate"
|
||||
elif [ -f "$cacert" ]; then
|
||||
__CMDBASE="$__CMDBASE --ca-certificate=${cacert}"
|
||||
elif [ -d "$cacert" ]; then
|
||||
__CMDBASE="$__CMDBASE --ca-directory=${cacert}"
|
||||
elif [ -n "$cacert" ]; then
|
||||
write_log 14 "在 '$cacert' 中未找到用于 HTTPS 通信的有效证书"
|
||||
fi
|
||||
fi
|
||||
# 如果没有设置,禁用代理 (这可能是 .wgetrc 或环境设置错误)
|
||||
[ -z "$proxy" ] && __CMDBASE="$__CMDBASE --no-proxy"
|
||||
}
|
||||
|
||||
# 用于阿里云API的通信函数
|
||||
aliyun_transfer() {
|
||||
local __PARAM=$*
|
||||
local __CNT=0
|
||||
local __RUNPROG __ERR PID_SLEEP
|
||||
|
||||
[ $# -eq 0 ] && write_log 12 "'aliyun_transfer()' 出错 - 参数数量错误"
|
||||
|
||||
while : ; do
|
||||
build_Request $__PARAM
|
||||
__RUNPROG="$__CMDBASE '${__URLBASE}?${__URLARGS}'"
|
||||
|
||||
write_log 7 "#> $__RUNPROG"
|
||||
eval $__RUNPROG
|
||||
__ERR=$?
|
||||
[ $__ERR -eq 0 ] && return 0
|
||||
|
||||
write_log 3 "wget 错误代码: '$__ERR'"
|
||||
write_log 7 "$(cat $ERRFILE)"
|
||||
|
||||
if [ $VERBOSE -gt 1 ]; then
|
||||
write_log 4 "传输失败 - 详细模式: $VERBOSE - 出错后不再重试"
|
||||
return 1
|
||||
fi
|
||||
|
||||
__CNT=$(( $__CNT + 1 ))
|
||||
[ $retry_count -gt 0 -a $__CNT -gt $retry_count ] && \
|
||||
write_log 14 "$retry_count 次重试后传输还是失败"
|
||||
|
||||
write_log 4 "传输失败 - $__CNT/$retry_count 在 $RETRY_SECONDS 秒后重试"
|
||||
sleep $RETRY_SECONDS &
|
||||
PID_SLEEP=$!
|
||||
wait $PID_SLEEP
|
||||
PID_SLEEP=0
|
||||
done
|
||||
}
|
||||
|
||||
# 百分号编码
|
||||
percentEncode() {
|
||||
if [ -z "${1//[A-Za-z0-9_.~-]/}" ]; then
|
||||
echo -n "$1"
|
||||
else
|
||||
local string=$1; local i=0; local ret chr
|
||||
while [ $i -lt ${#string} ]; do
|
||||
chr=${string:$i:1}
|
||||
[ -z "${chr#[^A-Za-z0-9_.~-]}" ] && chr=$(printf '%%%02X' "'$chr")
|
||||
ret="$ret$chr"
|
||||
i=$(( $i + 1 ))
|
||||
done
|
||||
echo -n "$ret"
|
||||
fi
|
||||
}
|
||||
|
||||
# 构造阿里云解析请求参数
|
||||
build_Request() {
|
||||
local args=$*; local string
|
||||
local HTTP_METHOD="GET"
|
||||
|
||||
# 添加请求参数
|
||||
__URLARGS=
|
||||
for string in $args; do
|
||||
case "${string%%=*}" in
|
||||
Format|TTL|Version|AccessKeyId|SignatureMethod|Timestamp|SignatureVersion|SignatureNonce|Signature) ;; # 过滤公共参数
|
||||
*) __URLARGS="$__URLARGS${__SEPARATOR}"$(percentEncode "${string%%=*}")"="$(percentEncode "${string#*=}");;
|
||||
esac
|
||||
done
|
||||
__URLARGS="${__URLARGS:1}"
|
||||
|
||||
# 附加公共参数
|
||||
string="Format=JSON"; __URLARGS="$__URLARGS${__SEPARATOR}"$(percentEncode "${string%%=*}")"="$(percentEncode "${string#*=}")
|
||||
string="TTL=600";__URLARGS="$__URLARGS${__SEPARATOR}"$(percentEncode "${string%%=*}")"="$(percentEncode "${string#*=}")
|
||||
string="Version=2015-01-09"; __URLARGS="$__URLARGS${__SEPARATOR}"$(percentEncode "${string%%=*}")"="$(percentEncode "${string#*=}")
|
||||
string="AccessKeyId=$username"; __URLARGS="$__URLARGS${__SEPARATOR}"$(percentEncode "${string%%=*}")"="$(percentEncode "${string#*=}")
|
||||
string="SignatureMethod=HMAC-SHA1"; __URLARGS="$__URLARGS${__SEPARATOR}"$(percentEncode "${string%%=*}")"="$(percentEncode "${string#*=}")
|
||||
string="Timestamp="$(date -u '+%Y-%m-%dT%H:%M:%SZ'); __URLARGS="$__URLARGS${__SEPARATOR}"$(percentEncode "${string%%=*}")"="$(percentEncode "${string#*=}")
|
||||
string="SignatureVersion=1.0"; __URLARGS="$__URLARGS${__SEPARATOR}"$(percentEncode "${string%%=*}")"="$(percentEncode "${string#*=}")
|
||||
string="SignatureNonce="$(cat '/proc/sys/kernel/random/uuid'); __URLARGS="$__URLARGS${__SEPARATOR}"$(percentEncode "${string%%=*}")"="$(percentEncode "${string#*=}")
|
||||
|
||||
# 对请求参数进行排序,用于生成签名
|
||||
string=$(echo -n "$__URLARGS" | sed 's/\'"${__SEPARATOR}"'/\n/g' | sort | sed ':label; N; s/\n/\'"${__SEPARATOR}"'/g; b label')
|
||||
# 构造用于计算签名的字符串
|
||||
string="${HTTP_METHOD}${__SEPARATOR}"$(percentEncode "/")"${__SEPARATOR}"$(percentEncode "$string")
|
||||
# 字符串计算签名HMAC值
|
||||
local signature=$(echo -n "$string" | openssl dgst -sha1 -hmac "${password}&" -binary)
|
||||
# HMAC值编码成字符串,得到签名值
|
||||
signature=$(echo -n "$signature" | openssl base64)
|
||||
|
||||
# 附加签名参数
|
||||
string="Signature=$signature"; __URLARGS="$__URLARGS${__SEPARATOR}"$(percentEncode "${string%%=*}")"="$(percentEncode "${string#*=}")
|
||||
}
|
||||
|
||||
# 添加解析记录
|
||||
add_domain() {
|
||||
local value
|
||||
aliyun_transfer "Action=AddDomainRecord" "DomainName=${__DOMAIN}" "RR=${__HOST}" "Type=${__TYPE}" "Value=${__IP}" || write_log 14 "服务器通信失败"
|
||||
json_cleanup; json_load "$(cat "$DATFILE" 2> /dev/null)" >/dev/null 2>&1
|
||||
json_get_var value "RecordId"
|
||||
[ -z "$value" ] && write_log 14 "添加新解析记录失败"
|
||||
write_log 7 "添加新解析记录成功"
|
||||
return 0
|
||||
}
|
||||
|
||||
# 修改解析记录
|
||||
update_domain() {
|
||||
local value
|
||||
aliyun_transfer "Action=UpdateDomainRecord" "RecordId=${__RECID}" "RR=${__HOST}" "Type=${__TYPE}" "Value=${__IP}" || write_log 14 "服务器通信失败"
|
||||
json_cleanup; json_load "$(cat "$DATFILE" 2> /dev/null)" >/dev/null 2>&1
|
||||
json_get_var value "RecordId"
|
||||
[ -z "$value" ] && write_log 14 "修改解析记录失败"
|
||||
write_log 7 "修改解析记录成功"
|
||||
return 0
|
||||
}
|
||||
|
||||
# 启用解析记录
|
||||
enable_domain() {
|
||||
local value
|
||||
aliyun_transfer "Action=SetDomainRecordStatus" "RecordId=${__RECID}" "Status=Enable" || write_log 14 "服务器通信失败"
|
||||
json_cleanup; json_load "$(cat "$DATFILE" 2> /dev/null)" >/dev/null 2>&1
|
||||
json_get_var value "Status"
|
||||
[ "$value" != "Enable" ] && write_log 14 "启用解析记录失败"
|
||||
write_log 7 "启用解析记录成功"
|
||||
return 0
|
||||
}
|
||||
|
||||
# 获取子域名解析记录列表
|
||||
describe_domain() {
|
||||
local count value; local ret=0
|
||||
aliyun_transfer "Action=DescribeSubDomainRecords" "SubDomain=${__HOST}.${__DOMAIN}" || write_log 14 "服务器通信失败"
|
||||
write_log 7 "获取到解析记录: $(cat "$DATFILE" 2> /dev/null)"
|
||||
json_cleanup; json_load "$(cat "$DATFILE" 2> /dev/null)" >/dev/null 2>&1
|
||||
json_get_var count "TotalCount"
|
||||
if [ $count -eq 0 ]; then
|
||||
write_log 7 "解析记录不存在"
|
||||
ret=1
|
||||
else
|
||||
local i=1;
|
||||
while [ $i -le $count ]; do
|
||||
json_cleanup; json_load "$(cat "$DATFILE" 2> /dev/null)" >/dev/null 2>&1
|
||||
json_select "DomainRecords" >/dev/null 2>&1
|
||||
json_select "Record" >/dev/null 2>&1
|
||||
json_select $i >/dev/null 2>&1
|
||||
i=$(( $i + 1 ))
|
||||
json_get_var value "Type"
|
||||
if [ "$value" != "${__TYPE}" ]; then
|
||||
write_log 7 "当前解析类型: ${__TYPE}, 获得不匹配类型: $value"
|
||||
ret=1; continue
|
||||
else
|
||||
ret=0
|
||||
json_get_var __RECID "RecordId"
|
||||
write_log 7 "获得解析记录ID: ${__RECID}, 类型: $value"
|
||||
json_get_var value "Locked"
|
||||
[ $value -ne 0 ] && write_log 14 "解析记录被锁定"
|
||||
json_get_var value "Status"
|
||||
[ "$value" != "ENABLE" ] && ret=$(( $ret | 2 )) && write_log 7 "解析记录被禁用"
|
||||
json_get_var value "Value"
|
||||
[ "$value" != "${__IP}" ] && ret=$(( $ret | 4 )) && write_log 7 "地址需要修改"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
return $ret
|
||||
}
|
||||
|
||||
build_command
|
||||
describe_domain
|
||||
ret=$?
|
||||
if [ $ret -eq 1 ]; then
|
||||
sleep 3 && add_domain
|
||||
else
|
||||
[ $(( $ret & 2 )) -ne 0 ] && sleep 3 && enable_domain
|
||||
[ $(( $ret & 4 )) -ne 0 ] && sleep 3 && update_domain
|
||||
fi
|
||||
|
||||
return 0
|
||||
@ -1,78 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ddns-scripts_dnspod
|
||||
PKG_VERSION:=1.0.2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_MAINTAINER:=Small_5
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=IP Addresses and Names
|
||||
TITLE:=DDNS extension for Dnspod.com/Dnspod.cn
|
||||
PKGARCH:=all
|
||||
DEPENDS:=+ddns-scripts +wget-ssl +ca-certificates
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
Dynamic DNS Client scripts extension for Dnspod.com/Dnspod.cn
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(CP) ./*.sh $(PKG_BUILD_DIR)
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/preinst
|
||||
#!/bin/sh
|
||||
# if NOT run buildroot then stop service
|
||||
[ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1
|
||||
exit 0 # suppress errors
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ddns
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/*.sh $(1)/usr/lib/ddns
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/postinst
|
||||
#!/bin/sh
|
||||
# remove old services file entries
|
||||
/bin/sed -i '/dnspod\.com/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
|
||||
/bin/sed -i '/dnspod\.cn/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
|
||||
/bin/sed -i '/dnspod\.com/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1
|
||||
/bin/sed -i '/dnspod\.cn/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1
|
||||
# and create new
|
||||
printf "%s\\t\\t%s\\n" '"dnspod.com"' '"update_dnspod_com.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services
|
||||
printf "%s\\t\\t%s\\n" '"dnspod.cn"' '"update_dnspod_cn.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services
|
||||
printf "%s\\t\\t%s\\n" '"dnspod.com"' '"update_dnspod_com.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services_ipv6
|
||||
printf "%s\\t\\t%s\\n" '"dnspod.cn"' '"update_dnspod_cn.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services_ipv6
|
||||
# on real system restart service if enabled
|
||||
[ -z "$${IPKG_INSTROOT}" ] && {
|
||||
/etc/init.d/ddns enabled && \
|
||||
/etc/init.d/ddns start >/dev/null 2>&1
|
||||
}
|
||||
exit 0 # suppress errors
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/prerm
|
||||
#!/bin/sh
|
||||
# if NOT run buildroot then stop service
|
||||
[ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1
|
||||
# remove services file entries
|
||||
/bin/sed -i '/dnspod\.com/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
|
||||
/bin/sed -i '/dnspod\.cn/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
|
||||
/bin/sed -i '/dnspod\.com/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1
|
||||
/bin/sed -i '/dnspod\.cn/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1
|
||||
exit 0 # suppress errors
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
@ -1,154 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
#检查传入参数
|
||||
[ -z "$username" ] && write_log 14 "Configuration error! [User name] cannot be empty"
|
||||
[ -z "$password" ] && write_log 14 "Configuration error! [Password] cannot be empty"
|
||||
|
||||
#检查外部调用工具
|
||||
[ -n "$WGET_SSL" ] || write_log 13 "GNU Wget support is required to use dnspod API. Please install first"
|
||||
|
||||
# 变量声明
|
||||
local __URLBASE __HOST __DOMAIN __TYPE __CMDBASE __POST __POST1 __RECIP __RECID __value __TTL
|
||||
__URLBASE="https://dnsapi.cn/"
|
||||
|
||||
# 从 $domain 分离主机和域名
|
||||
[ "${domain:0:2}" == "@." ] && domain="${domain/./}" # 主域名处理
|
||||
[ "$domain" == "${domain/@/}" ] && domain="${domain/./@}" # 未找到分隔符,兼容常用域名格式
|
||||
__HOST="${domain%%@*}"
|
||||
__DOMAIN="${domain#*@}"
|
||||
[ -z "$__HOST" -o "$__HOST" == "$__DOMAIN" ] && __HOST="@"
|
||||
|
||||
# 设置记录类型
|
||||
[ $use_ipv6 -eq 0 ] && __TYPE="A" || __TYPE="AAAA"
|
||||
|
||||
# 构造基本通信命令
|
||||
build_command() {
|
||||
__CMDBASE="$WGET_SSL --no-hsts -nv -t 1 -O $DATFILE -o $ERRFILE"
|
||||
# 绑定用于通信的主机/IP
|
||||
if [ -n "$bind_network" ]; then
|
||||
local bind_ip run_prog
|
||||
[ $use_ipv6 -eq 0 ] && run_prog="network_get_ipaddr" || run_prog="network_get_ipaddr6"
|
||||
eval "$run_prog bind_ip $bind_network" || \
|
||||
write_log 13 "Unable to get local IP address with '$run_prog $ bind_network' - error code: '$?'"
|
||||
write_log 7 "Forced use of IP '$bind_ip' communication"
|
||||
__CMDBASE="$__CMDBASE --bind-address=$bind_ip"
|
||||
fi
|
||||
# 强制设定IP版本
|
||||
if [ $force_ipversion -eq 1 ]; then
|
||||
[ $use_ipv6 -eq 0 ] && __CMDBASE="$__CMDBASE -4" || __CMDBASE="$__CMDBASE -6"
|
||||
fi
|
||||
# 设置CA证书参数
|
||||
if [ $use_https -eq 1 ]; then
|
||||
if [ "$cacert" = "IGNORE" ]; then
|
||||
__CMDBASE="$__CMDBASE --no-check-certificate"
|
||||
elif [ -f "$cacert" ]; then
|
||||
__CMDBASE="$__CMDBASE --ca-certificate=${cacert}"
|
||||
elif [ -d "$cacert" ]; then
|
||||
__CMDBASE="$__CMDBASE --ca-directory=${cacert}"
|
||||
elif [ -n "$cacert" ]; then
|
||||
write_log 14 "A valid certificate for HTTPS communication was not found in '$cacert'"
|
||||
fi
|
||||
fi
|
||||
# 如果没有设置,禁用代理 (这可能是 .wgetrc 或环境设置错误)
|
||||
[ -z "$proxy" ] && __CMDBASE="$__CMDBASE --no-proxy"
|
||||
__CMDBASE="$__CMDBASE --post-data"
|
||||
}
|
||||
|
||||
# 用于Dnspod API的通信函数
|
||||
dnspod_transfer() {
|
||||
local __A=$1
|
||||
local __CNT=0
|
||||
local __ERR=0
|
||||
local __B PID_SLEEP
|
||||
case "$__A" in
|
||||
0)
|
||||
__B="$__CMDBASE '$__POST' ${__URLBASE}Record.List"
|
||||
;;
|
||||
1)
|
||||
__B="$__CMDBASE '$__POST1' ${__URLBASE}Record.Create"
|
||||
;;
|
||||
2)
|
||||
__B="$__CMDBASE '$__POST1&record_id=$__RECID&ttl=$__TTL' ${__URLBASE}Record.Modify"
|
||||
;;
|
||||
esac
|
||||
|
||||
while : ; do
|
||||
write_log 7 "#> $__B"
|
||||
eval $__B
|
||||
__ERR=`jsonfilter -i $DATFILE -e "@.status.code"`
|
||||
|
||||
[ $__ERR -eq 1 ] && return 0
|
||||
[ $__A -eq 0 ] && [ $__ERR -eq 10 ] && return 0
|
||||
write_log 3 "Error message:[$(jsonfilter -i $DATFILE -e "@.status.message")]"
|
||||
|
||||
if [ $VERBOSE -gt 1 ]; then
|
||||
write_log 4 "Transfer failed - detailed mode: $VERBOSE - Do not try again after an error"
|
||||
return 1
|
||||
fi
|
||||
|
||||
__CNT=$(( $__CNT + 1 ))
|
||||
[ $retry_count -gt 0 -a $__CNT -gt $retry_count ] && write_log 14 "Transfer failed after $retry_count retries"
|
||||
|
||||
write_log 4 "Transfer failed - $__CNT Try again in $RETRY_SECONDS seconds"
|
||||
sleep $RETRY_SECONDS &
|
||||
PID_SLEEP=$!
|
||||
wait $PID_SLEEP
|
||||
PID_SLEEP=0
|
||||
done
|
||||
}
|
||||
|
||||
#添加解析记录
|
||||
add_domain() {
|
||||
dnspod_transfer 1
|
||||
write_log 7 "Add new parsing record [${__HOST}.${__DOMAIN}],[type:$__TYPE],[ip:$__IP] successfully!"
|
||||
return 0
|
||||
}
|
||||
|
||||
#修改解析记录
|
||||
update_domain() {
|
||||
dnspod_transfer 2
|
||||
write_log 7 "Modify new parsing record [${__HOST}.${__DOMAIN}],[type:$__TYPE],[ip:$__IP],[TTL:$__TTL] successfully!"
|
||||
return 0
|
||||
}
|
||||
|
||||
#获取域名解析记录
|
||||
describe_domain() {
|
||||
ret=0
|
||||
__POST="login_token=$username,$password&format=json&domain=$__DOMAIN&sub_domain=$__HOST&record_type=$__TYPE"
|
||||
__POST1="$__POST&value=$__IP&record_type=$__TYPE&record_line_id=0"
|
||||
dnspod_transfer 0
|
||||
__TMP=`jsonfilter -i $DATFILE -e "@.records[@.type!='NS']"`
|
||||
__value=`jsonfilter -s "$__TMP" -e "@.name"`
|
||||
if [ "$__value" == "" ]; then
|
||||
write_log 7 "Parsing record:[${__HOST}.${__DOMAIN}] does not exist"
|
||||
ret=1
|
||||
else
|
||||
__RECID=`jsonfilter -s "$__TMP" -e "@.id"`
|
||||
__value=`jsonfilter -s "$__TMP" -e "@.type"`
|
||||
__TTL=`jsonfilter -s "$__TMP" -e "@.ttl"`
|
||||
write_log 7 "Get parsing recordID:[$__RECID]"
|
||||
if [ "$__value" != "$__TYPE" ]; then
|
||||
write_log 7 "Current parsing [type:$__TYPE], get mismatched [type:$__value]"
|
||||
write_log 7 "Address needs to be modified, local address:[$__IP]"
|
||||
ret=2
|
||||
else
|
||||
__RECIP=`jsonfilter -s "$__TMP" -e "@.value"`
|
||||
if [ "$__RECIP" != "$__IP" ]; then
|
||||
write_log 7 "Address needs to be modified, local address:[$__IP]"
|
||||
ret=2
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
build_command
|
||||
describe_domain
|
||||
if [ $ret == 1 ];then
|
||||
sleep 3 && add_domain
|
||||
elif [ $ret == 2 ];then
|
||||
sleep 3 && update_domain
|
||||
else
|
||||
write_log 7 "Local IP:[$__IP] parsing records IP:[$__RECIP] address does not need to be modified"
|
||||
fi
|
||||
|
||||
return 0
|
||||
@ -1,164 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
#检查传入参数
|
||||
[ -z "$username" ] && write_log 14 "Configuration error! [User name] cannot be empty"
|
||||
[ -z "$password" ] && write_log 14 "Configuration error! [Password] cannot be empty"
|
||||
|
||||
#检查外部调用工具
|
||||
[ -n "$WGET_SSL" ] || write_log 13 "GNU Wget support is required to use Alibaba Cloud API. Please install first"
|
||||
|
||||
# 变量声明
|
||||
local __URLBASE __HOST __DOMAIN __TYPE __CMDBASE __TOKEN __POST __POST1 __RECIP __RECID __value __TTL
|
||||
__URLBASE="https://api.dnspod.com/"
|
||||
|
||||
# 从 $domain 分离主机和域名
|
||||
[ "${domain:0:2}" == "@." ] && domain="${domain/./}" # 主域名处理
|
||||
[ "$domain" == "${domain/@/}" ] && domain="${domain/./@}" # 未找到分隔符,兼容常用域名格式
|
||||
__HOST="${domain%%@*}"
|
||||
__DOMAIN="${domain#*@}"
|
||||
[ -z "$__HOST" -o "$__HOST" == "$__DOMAIN" ] && __HOST="@"
|
||||
|
||||
# 设置记录类型
|
||||
[ $use_ipv6 -eq 0 ] && __TYPE="A" || __TYPE="AAAA"
|
||||
|
||||
# 构造基本通信命令
|
||||
build_command() {
|
||||
__CMDBASE="$WGET_SSL --no-hsts -nv -t 1 -O $DATFILE -o $ERRFILE"
|
||||
# 绑定用于通信的主机/IP
|
||||
if [ -n "$bind_network" ]; then
|
||||
local bind_ip run_prog
|
||||
[ $use_ipv6 -eq 0 ] && run_prog="network_get_ipaddr" || run_prog="network_get_ipaddr6"
|
||||
eval "$run_prog bind_ip $bind_network" || \
|
||||
write_log 13 "Unable to get local IP address with '$run_prog $ bind_network' - error code: '$?'"
|
||||
write_log 7 "Forced use of IP '$bind_ip' communication"
|
||||
__CMDBASE="$__CMDBASE --bind-address=$bind_ip"
|
||||
fi
|
||||
# 强制设定IP版本
|
||||
if [ $force_ipversion -eq 1 ]; then
|
||||
[ $use_ipv6 -eq 0 ] && __CMDBASE="$__CMDBASE -4" || __CMDBASE="$__CMDBASE -6"
|
||||
fi
|
||||
# 设置CA证书参数
|
||||
if [ $use_https -eq 1 ]; then
|
||||
if [ "$cacert" = "IGNORE" ]; then
|
||||
__CMDBASE="$__CMDBASE --no-check-certificate"
|
||||
elif [ -f "$cacert" ]; then
|
||||
__CMDBASE="$__CMDBASE --ca-certificate=${cacert}"
|
||||
elif [ -d "$cacert" ]; then
|
||||
__CMDBASE="$__CMDBASE --ca-directory=${cacert}"
|
||||
elif [ -n "$cacert" ]; then
|
||||
write_log 14 "A valid certificate for HTTPS communication was not found in '$cacert'"
|
||||
fi
|
||||
fi
|
||||
# 如果没有设置,禁用代理 (这可能是 .wgetrc 或环境设置错误)
|
||||
[ -z "$proxy" ] && __CMDBASE="$__CMDBASE --no-proxy"
|
||||
__CMDBASE="$__CMDBASE --post-data"
|
||||
}
|
||||
|
||||
# 用于Dnspod API的通信函数
|
||||
dnspod_transfer() {
|
||||
local __A=$1
|
||||
local __CNT=0
|
||||
local __ERR=0
|
||||
local __B __C PID_SLEEP
|
||||
case "$__A" in
|
||||
0)
|
||||
__B="$__CMDBASE 'login_email=$username&login_password=$password&format=json' ${__URLBASE}Auth"
|
||||
__C=$__B
|
||||
;;
|
||||
1)
|
||||
__B="$__CMDBASE '$__POST' ${__URLBASE}Record.List"
|
||||
__C=1
|
||||
;;
|
||||
2)
|
||||
__B="$__CMDBASE '$__POST1' ${__URLBASE}Record.Create"
|
||||
__C=1
|
||||
;;
|
||||
3)
|
||||
__B="$__CMDBASE '$__POST1&record_id=$__RECID&ttl=$__TTL' ${__URLBASE}Record.Modify"
|
||||
__C=1
|
||||
;;
|
||||
esac
|
||||
|
||||
while : ; do
|
||||
[ $__C -eq 1 ] && __C=$(echo -e "$__B" | sed -e "s/${__TOKEN#*,}/***PW***/g")
|
||||
write_log 7 "#> $__C"
|
||||
eval $__B
|
||||
__ERR=`jsonfilter -i $DATFILE -e "@.status.code"`
|
||||
|
||||
[ $__ERR -eq 1 ] && return 0
|
||||
[ $__A -eq 1 ] && [ $__ERR -eq 10 ] && return 0
|
||||
write_log 3 "Error message:[$(jsonfilter -i $DATFILE -e "@.status.message")]"
|
||||
|
||||
if [ $VERBOSE -gt 1 ]; then
|
||||
write_log 4 "Transfer failed - detailed mode: $VERBOSE - Do not try again after an error"
|
||||
return 1
|
||||
fi
|
||||
|
||||
__CNT=$(( $__CNT + 1 ))
|
||||
[ $retry_count -gt 0 -a $__CNT -gt $retry_count ] && write_log 14 "Transfer failed after $retry_count retries"
|
||||
|
||||
write_log 4 "Transfer failed - $__CNT Try again in $RETRY_SECONDS seconds"
|
||||
sleep $RETRY_SECONDS &
|
||||
PID_SLEEP=$!
|
||||
wait $PID_SLEEP
|
||||
PID_SLEEP=0
|
||||
done
|
||||
}
|
||||
|
||||
#添加解析记录
|
||||
add_domain() {
|
||||
dnspod_transfer 2
|
||||
write_log 7 "Add new parsing record [${__HOST}.${__DOMAIN}],[type:$__TYPE],[ip:$__IP] successfully!"
|
||||
return 0
|
||||
}
|
||||
|
||||
#修改解析记录
|
||||
update_domain() {
|
||||
dnspod_transfer 3
|
||||
write_log 7 "Modify new parsing record [${__HOST}.${__DOMAIN}],[type:$__TYPE],[ip:$__IP],[TTL:$__TTL] successfully!"
|
||||
return 0
|
||||
}
|
||||
|
||||
#获取域名解析记录
|
||||
describe_domain() {
|
||||
ret=0
|
||||
dnspod_transfer 0
|
||||
__TOKEN=`jsonfilter -i $DATFILE -e "@.user_token"`
|
||||
__POST="user_token=$__TOKEN&format=json&domain=$__DOMAIN&sub_domain=$__HOST"
|
||||
__POST1="$__POST&value=$__IP&record_type=$__TYPE&record_line=default"
|
||||
dnspod_transfer 1
|
||||
__TMP=`jsonfilter -i $DATFILE -e "@.records[@.type!='NS']"`
|
||||
__value=`jsonfilter -s "$__TMP" -e "@.name"`
|
||||
if [ "$__value" == "" ]; then
|
||||
write_log 7 "Parsing record:[${__HOST}.${__DOMAIN}] does not exist"
|
||||
ret=1
|
||||
else
|
||||
__RECID=`jsonfilter -s "$__TMP" -e "@.id"`
|
||||
__value=`jsonfilter -s "$__TMP" -e "@.type"`
|
||||
__TTL=`jsonfilter -s "$__TMP" -e "@.ttl"`
|
||||
write_log 7 "Get parsing recordID:[$__RECID]"
|
||||
if [ "$__value" != "$__TYPE" ]; then
|
||||
write_log 7 "Current parsing [type:$__TYPE], get mismatched [type:$__value]"
|
||||
write_log 7 "Address needs to be modified, local address:[$__IP]"
|
||||
ret=2
|
||||
else
|
||||
__RECIP=`jsonfilter -s "$__TMP" -e "@.value"`
|
||||
if [ "$__RECIP" != "$__IP" ]; then
|
||||
write_log 7 "Address needs to be modified, local address:[$__IP]"
|
||||
ret=2
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
build_command
|
||||
describe_domain
|
||||
if [ $ret == 1 ];then
|
||||
sleep 3 && add_domain
|
||||
elif [ $ret == 2 ];then
|
||||
sleep 3 && update_domain
|
||||
else
|
||||
write_log 7 "Local IP:[$__IP] parsing records IP:[$__RECIP] address does not need to be modified"
|
||||
fi
|
||||
|
||||
return 0
|
||||
@ -1,49 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2021 Lean <coolsnowwolf@gmail.com>
|
||||
#
|
||||
# Copyright (C) 2021 ImmortalWrt
|
||||
# <https://immortalwrt.org>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=default-settings
|
||||
PKG_VERSION:=1.1
|
||||
PKG_RELEASE:=61
|
||||
PKG_LICENSE:=GPLv3
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/default-settings
|
||||
SECTION:=luci
|
||||
CATEGORY:=LuCI
|
||||
TITLE:=LuCI support for Default Settings
|
||||
PKGARCH:=all
|
||||
DEPENDS:=+luci-base +@LUCI_LANG_en +@LUCI_LANG_zh-cn
|
||||
endef
|
||||
|
||||
define Package/default-settings/description
|
||||
Language Support Packages.
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
true
|
||||
endef
|
||||
|
||||
define Package/default-settings/install
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(INSTALL_DATA) ./files/openwrt_banner $(1)/etc/openwrt_banner
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/zzz-default-settings $(1)/etc/uci-defaults/99-default-settings
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n
|
||||
po2lmo ./i18n/default.zh-cn.po $(1)/usr/lib/lua/luci/i18n/default.zh-cn.lmo
|
||||
po2lmo ./i18n/more.zh-cn.po $(1)/usr/lib/lua/luci/i18n/more.zh-cn.lmo
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,default-settings))
|
||||
@ -1,11 +0,0 @@
|
||||
[0;1;34;94m┌────────────[0;34m────────────[0;37m─────────────[0;1;30;90m────────┐[0m
|
||||
[0;1;34;94m│[0m [0;1;30;90m│[0m
|
||||
[0;1;34;94m│[0m [0;1;34;94mmmmmm[0m [0;37mm[0m [0;1;30;90m""#[0m [0;34m│[0m
|
||||
[0;1;34;94m│[0m [0;34m#[0m [0;34mmmmmm[0m [0;34mm[0;37mmmmm[0m [0;37mmmm[0m [0;37mm[0m[0;1;30;90mmm[0m [0;1;30;90mmm#mm[0m [0;1;30;90mmmm[0m [0;1;34;94m#[0m [0;34m│[0m
|
||||
[0;37m│[0m [0;34m#[0m [0;37m#[0m [0;37m#[0m [0;37m#[0m [0;37m#[0m [0;37m#[0m [0;37m#[0m [0;37m#"[0m [0;1;30;90m"#[0m [0;1;30;90m#"[0m [0;1;30;90m"[0m [0;1;30;90m#[0m [0;1;34;94m"[0m [0;1;34;94m#[0m [0;1;34;94m#[0m [0;34m│[0m
|
||||
[0;37m│[0m [0;37m#[0m [0;37m#[0m [0;37m#[0m [0;37m#[0m [0;37m#[0m [0;1;30;90m#[0m [0;1;30;90m#[0m [0;1;30;90m#[0m [0;1;30;90m#[0m [0;1;30;90m#[0m [0;1;34;94m#[0m [0;1;34;94mm"""#[0m [0;34m#[0m [0;1;34;94m│[0m
|
||||
[0;37m│[0m [0;37mmm#mm[0m [0;1;30;90m#[0m [0;1;30;90m#[0m [0;1;30;90m#[0m [0;1;30;90m#[0m [0;1;30;90m#[0m [0;1;30;90m#[0m [0;1;30;90m"#[0;1;34;94mm#"[0m [0;1;34;94m#[0m [0;1;34;94m"m[0;34mm[0m [0;34m"mm"#[0m [0;34m"mm[0m [0;1;34;94m│[0m
|
||||
[0;1;30;90m│[0m [0;37m│[0m
|
||||
[0;1;30;90m│[0;34m───────────────────[0;1;34;94m────────────[0;37m──────────────│[0m
|
||||
[0;1;30;90m│[0m [0;1;34;94mImmortalWrt[0m [0;1;34;94m18.06[0m [0;37m│[0m
|
||||
[0;1;34;94m└[0;1;34;94m─────────────[0;34m──────────────[0;1;30;90m───────────[0;37m───────┘[0m
|
||||
@ -1,54 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci set luci.main.lang=auto
|
||||
uci commit luci
|
||||
|
||||
uci set system.@system[0].timezone=CST-8
|
||||
uci set system.@system[0].zonename=Asia/Shanghai
|
||||
uci commit system
|
||||
|
||||
uci set fstab.@global[0].anon_mount=1
|
||||
uci commit fstab
|
||||
|
||||
rm -f /usr/lib/lua/luci/view/admin_status/index/mwan.htm
|
||||
rm -f /usr/lib/lua/luci/view/admin_status/index/upnp.htm
|
||||
rm -f /usr/lib/lua/luci/view/admin_status/index/ddns.htm
|
||||
rm -f /usr/lib/lua/luci/view/admin_status/index/minidlna.htm
|
||||
|
||||
sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/aria2.lua
|
||||
sed -i 's/services/nas/g' /usr/lib/lua/luci/view/aria2/overview_status.htm
|
||||
sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/hd_idle.lua
|
||||
sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/samba.lua
|
||||
sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/minidlna.lua
|
||||
sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/transmission.lua
|
||||
sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/mjpg-streamer.lua
|
||||
sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/p910nd.lua
|
||||
sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/usb_printer.lua
|
||||
sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/xunlei.lua
|
||||
sed -i 's/services/nas/g' /usr/lib/lua/luci/view/minidlna_status.htm
|
||||
|
||||
ln -sf /sbin/ip /usr/bin/ip
|
||||
|
||||
sed -i 's#https://downloads.openwrt.org#https://mirrors.tencent.com/lede#g' /etc/opkg/distfeeds.conf
|
||||
sed -i '/openwrt_luci/ { s/snapshots/releases\/18.06.9/g; }' /etc/opkg/distfeeds.conf
|
||||
sed -i "s/# //g" /etc/opkg/distfeeds.conf
|
||||
|
||||
sed -i 's/root::0:0:99999:7:::/root:$1$V4UetPzk$CYXluq4wUazHjmCDBCqXF.:0:0:99999:7:::/g' /etc/shadow
|
||||
[ -f '/bin/bash' ] && sed -i 's|root:x:0:0:root:/root:/bin/ash|root:x:0:0:root:/root:/bin/bash|g' /etc/passwd
|
||||
|
||||
sed -i '/option disabled/d' /etc/config/wireless
|
||||
sed -i '/set wireless.radio${devidx}.disabled/d' /lib/wifi/mac80211.sh
|
||||
|
||||
sed -i '/log-facility/d' /etc/dnsmasq.conf
|
||||
echo "log-facility=/dev/null" >> /etc/dnsmasq.conf
|
||||
|
||||
sed -i 's/cbi.submit\"] = true/cbi.submit\"] = \"1\"/g' /usr/lib/lua/luci/dispatcher.lua
|
||||
|
||||
echo 'hsts=0' > /root/.wgetrc
|
||||
|
||||
rm -rf /tmp/luci-modulecache/
|
||||
rm -f /tmp/luci-indexcache
|
||||
|
||||
mv /etc/openwrt_banner /etc/banner
|
||||
|
||||
exit 0
|
||||
@ -1,73 +0,0 @@
|
||||
msgid "Processor"
|
||||
msgstr "处理器"
|
||||
|
||||
msgid "Architecture"
|
||||
msgstr "架构"
|
||||
|
||||
msgid "CPU Temperature"
|
||||
msgstr "CPU 温度"
|
||||
|
||||
msgid "CPU Info"
|
||||
msgstr "CPU 信息"
|
||||
|
||||
msgid "CPU Model"
|
||||
msgstr "处理器型号"
|
||||
|
||||
msgid "CPU frequency"
|
||||
msgstr "CPU 频率"
|
||||
|
||||
msgid "RAM frequency"
|
||||
msgstr "RAM 频率"
|
||||
|
||||
msgid "Flash Size"
|
||||
msgstr "闪存大小"
|
||||
|
||||
msgid "Free Memory"
|
||||
msgstr "释放内存"
|
||||
|
||||
msgid "RUNNING"
|
||||
msgstr "运行中"
|
||||
|
||||
msgid "NOT RUNNING"
|
||||
msgstr "未运行"
|
||||
|
||||
msgid "ZRam Settings"
|
||||
msgstr "ZRam 设置"
|
||||
|
||||
msgid "ZRam Compression Algorithm"
|
||||
msgstr "ZRam 压缩算法"
|
||||
|
||||
msgid "ZRam Compression Streams"
|
||||
msgstr "ZRam 压缩数据流线程数"
|
||||
|
||||
msgid "ZRam Size"
|
||||
msgstr "ZRam 大小"
|
||||
|
||||
msgid "Size of the ZRam device in megabytes"
|
||||
msgstr "划分给 ZRam 分区的内存大小(MB),推荐留空由系统自动管理"
|
||||
|
||||
msgid "Number of parallel threads used for compression"
|
||||
msgstr "用于压缩内存数据的CPU并发线程数"
|
||||
|
||||
msgid "Swap"
|
||||
msgstr "虚拟内存"
|
||||
|
||||
msgid "Base Setting"
|
||||
msgstr "基本设置"
|
||||
|
||||
msgid "Log"
|
||||
msgstr "日志"
|
||||
|
||||
msgid "Force 40MHz mode"
|
||||
msgstr "强制 40MHz 频宽"
|
||||
|
||||
msgid ""
|
||||
"Always use 40MHz channels even if the secondary channel overlaps. Using this "
|
||||
"option does not comply with IEEE 802.11n-2009!"
|
||||
msgstr "强制启用 40MHz 频宽并忽略辅助信道重叠。此选项可能不兼容某些无线硬件导致无法启用!"
|
||||
|
||||
msgid "Disassociate On Low Acknowledgement"
|
||||
msgstr "弱信号剔除"
|
||||
|
||||
msgid "Allow AP mode to disconnect STAs based on low ACK condition"
|
||||
msgstr "允许 AP 模式基于低 ACK 条件判断剔除弱信号的客户端"
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,61 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2021 ImmortalWrt
|
||||
# <https://immortalwrt.org>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dnsforwarder
|
||||
PKG_VERSION:=6.1.15
|
||||
PKG_RELEASE:=11
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/1715173329/dnsforwarder.git
|
||||
PKG_SOURCE_DATE:=2018-06-26
|
||||
PKG_SOURCE_VERSION:=587e61ae4d75dc976f538088b715a3c8ee26c144
|
||||
PKG_MIRROR_HASH:=7c141040ae384d254d90b3c3ee502d87330c9fdcd201ff29a669336a27b176d4
|
||||
|
||||
PKG_LICENSE:=GPL-3.0
|
||||
PKG_LICENSE_FILE:=LICENSE
|
||||
PKG_MAINTAINER:=Dennis <openwrt@tossp.com>
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/dnsforwarder
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=A simple DNS forwarder
|
||||
URL:=https://github.com/holmium/dnsforwarder
|
||||
DEPENDS:=+coreutils +coreutils-base64 +dnsmasq-full +libpthread +wget-ssl
|
||||
endef
|
||||
|
||||
define Package/dnsforwarder/description
|
||||
Forwarding queries to customized domains (and their subdomains) to specified servers
|
||||
over a specified protocol (UDP or TCP). non-standard ports are supported.
|
||||
endef
|
||||
|
||||
CONFIGURE_ARGS+= --enable-downloader=wget
|
||||
|
||||
define Package/dnsforwarder/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/dnsforwarder $(1)/usr/bin/dnsforwarder
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) files/etc/config/dnsforwarder $(1)/etc/config/dnsforwarder
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) files/etc/init.d/dnsforwarder $(1)/etc/init.d/dnsforwarder
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/dnsforwarder
|
||||
$(INSTALL_CONF) files/etc/dnsforwarder/gfw.txt $(1)/etc/dnsforwarder/gfw.txt
|
||||
$(INSTALL_DIR) $(1)/usr/share/dnsforwarder
|
||||
$(INSTALL_BIN) files/usr/share/dnsforwarder/gfwlist.sh $(1)/usr/share/dnsforwarder/gfwlist.sh
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,dnsforwarder))
|
||||
@ -1,79 +0,0 @@
|
||||
|
||||
config arguments
|
||||
option enabled '0'
|
||||
option addr '127.0.0.1:5053'
|
||||
|
||||
config config
|
||||
option cache 'true'
|
||||
option cache_size '102400'
|
||||
option cache_ignore 'false'
|
||||
option gfw 'true'
|
||||
list block_ip '74.125.127.102'
|
||||
list block_ip '74.125.155.102'
|
||||
list block_ip '74.125.39.102'
|
||||
list block_ip '74.125.39.113'
|
||||
list block_ip '209.85.229.138'
|
||||
list block_ip '128.121.126.139'
|
||||
list block_ip '159.106.121.75'
|
||||
list block_ip '169.132.13.103'
|
||||
list block_ip '192.67.198.6'
|
||||
list block_ip '202.106.1.2'
|
||||
list block_ip '202.181.7.85'
|
||||
list block_ip '203.161.230.171'
|
||||
list block_ip '203.98.7.65'
|
||||
list block_ip '207.12.88.98'
|
||||
list block_ip '208.56.31.43'
|
||||
list block_ip '209.145.54.50'
|
||||
list block_ip '209.220.30.174'
|
||||
list block_ip '209.36.73.33'
|
||||
list block_ip '211.94.66.147'
|
||||
list block_ip '213.169.251.35'
|
||||
list block_ip '216.221.188.182'
|
||||
list block_ip '216.234.179.13'
|
||||
list block_ip '243.185.187.39'
|
||||
list block_ip '37.61.54.158'
|
||||
list block_ip '4.36.66.178'
|
||||
list block_ip '46.82.174.68'
|
||||
list block_ip '59.24.3.173'
|
||||
list block_ip '64.33.88.161'
|
||||
list block_ip '64.33.99.47'
|
||||
list block_ip '64.66.163.251'
|
||||
list block_ip '65.104.202.252'
|
||||
list block_ip '65.160.219.113'
|
||||
list block_ip '66.45.252.237'
|
||||
list block_ip '69.55.52.253'
|
||||
list block_ip '72.14.205.104'
|
||||
list block_ip '72.14.205.99'
|
||||
list block_ip '78.16.49.15'
|
||||
list block_ip '8.7.198.45'
|
||||
list block_ip '93.46.8.89'
|
||||
list block_ip '37.61.54.158'
|
||||
list block_ip '243.185.187.39'
|
||||
list block_ip '190.93.247.4'
|
||||
list block_ip '190.93.246.4'
|
||||
list block_ip '190.93.245.4'
|
||||
list block_ip '190.93.244.4'
|
||||
list block_ip '65.49.2.178'
|
||||
list block_ip '189.163.17.5'
|
||||
list block_ip '23.89.5.60'
|
||||
list block_ip '49.2.123.56'
|
||||
list block_ip '54.76.135.1'
|
||||
list block_ip '77.4.7.92'
|
||||
list block_ip '118.5.49.6'
|
||||
list block_ip '159.24.3.173'
|
||||
list block_ip '188.5.4.96'
|
||||
list block_ip '197.4.4.12'
|
||||
list block_ip '220.250.64.24'
|
||||
list block_ip '243.185.187.30'
|
||||
list block_ip '249.129.46.48'
|
||||
list block_ip '253.157.14.165'
|
||||
option block_ipv6 'false'
|
||||
list cache_control 'tossp.com $orig'
|
||||
list cache_control '* fixed 3600'
|
||||
option log 'false'
|
||||
list udp_group '9.9.9.9,119.29.29.29,223.5.5.5,114.114.114.114 * on'
|
||||
option block_negative_resp 'true'
|
||||
list udp_local '0.0.0.0:5053'
|
||||
list udp_local '[::0]:5053'
|
||||
option domain_statistic 'false'
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,262 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=60
|
||||
|
||||
extra_command "makeconfig"
|
||||
extra_command "makegfwlist"
|
||||
extra_command "health"
|
||||
|
||||
CRON_FILE=/etc/crontabs/root
|
||||
PID_PATH=/var/run/dnsforwarder
|
||||
PID_FILE=${PID_PATH}/dns.pid
|
||||
DNSFORWARDER_CONF=/tmp/dnsforwarder.conf
|
||||
|
||||
add_cron()
|
||||
{
|
||||
sed -i '/dnsforwarder/d' $CRON_FILE
|
||||
echo '*/5 * * * * /etc/init.d/dnsforwarder health' >> $CRON_FILE
|
||||
echo '0 1 * * 0 /etc/init.d/dnsforwarder makegfwlist' >> $CRON_FILE
|
||||
crontab $CRON_FILE
|
||||
}
|
||||
|
||||
del_cron()
|
||||
{
|
||||
sed -i '/dnsforwarder/d' $CRON_FILE
|
||||
/etc/init.d/cron restart
|
||||
}
|
||||
|
||||
fixturboacc(){
|
||||
dns=$(uci get turboacc.config.dns_caching 2>/dev/null)
|
||||
if [ $dns -eq 1 ]; then
|
||||
uci set turboacc.config.dns_caching=0 && uci commit turboacc
|
||||
/etc/init.d/turboacc restart
|
||||
fi
|
||||
}
|
||||
|
||||
makelist() {
|
||||
[ -z "$2" ] && return
|
||||
local i
|
||||
local t="$1"; shift
|
||||
for i in "$@"
|
||||
do
|
||||
echo "$t $i"
|
||||
done
|
||||
}
|
||||
|
||||
health(){
|
||||
rm /var/log/dnsforwarder.log.* 2>/dev/null
|
||||
local pid=$(cat ${PID_FILE} 2>/dev/null)
|
||||
if [ -n "${pid}" -a -d /proc/$pid ]; then
|
||||
echo "[health] process exists ${pid}"
|
||||
else
|
||||
echo "[health] Dnsforwarder is not running ${pid}"
|
||||
start
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
makegfwlist(){
|
||||
local GFW_FILE='/etc/dnsforwarder/gfw.txt'
|
||||
local GFW_TMP_FILE='/tmp/dnsforwarder-gfw.old'
|
||||
local TSTIME=`date '+%Y-%m-%d %H:%M:%S'`
|
||||
touch ${GFW_TMP_FILE}
|
||||
cat /etc/config/gfw.list 2>/dev/null > /tmp/edf.ts
|
||||
cat /etc/dnsmasq.ssr/gfw_base.conf 2>/dev/null | awk -F '/' '{print $2}' | sed 's/^.//g' >> /tmp/edf.ts
|
||||
cat /etc/dnsmasq.ssr/gfw_list.conf 2>/dev/null | awk -F '/' '{print $2}' | sed 's/^.//g' >> /tmp/edf.ts
|
||||
sort /tmp/edf.ts | uniq > /tmp/edf.ts
|
||||
/usr/share/dnsforwarder/gfwlist.sh -i -l -o /tmp/dnsforwarder-gfw.tmp --extra-domain-file /tmp/edf.ts
|
||||
if [ $? != 0 ]; then
|
||||
echo 'Failed to fetch gfwlist'
|
||||
logger -t Failed to fetch gfwlist
|
||||
return 2
|
||||
fi
|
||||
local gfw=$(cat /tmp/dnsforwarder-gfw.tmp)
|
||||
echo "# GenerationAt TS_BUILD_TIME" > ${GFW_TMP_FILE}.new
|
||||
echo "protocol tcp" >> ${GFW_TMP_FILE}.new
|
||||
echo "server 8.8.8.8,8.8.4.4,1.1.1.1,1.0.0.1,208.67.222.222,208.67.220.220,209.244.0.3,209.244.0.4,8.26.56.26,8.20.247.20,156.154.70.1,156.154.71.1,199.85.126.10" >> ${GFW_TMP_FILE}.new
|
||||
echo -e 'proxy no\n\n\n' >> ${GFW_TMP_FILE}.new
|
||||
echo "${gfw}" >> ${GFW_TMP_FILE}.new
|
||||
if [ "`cat ${GFW_TMP_FILE}.new | md5sum`" == "`cat ${GFW_TMP_FILE} | md5sum`" ]; then
|
||||
printf "[\e[32m%s\e[0m]\n" "hold"
|
||||
else
|
||||
cp ${GFW_TMP_FILE}.new ${GFW_TMP_FILE}
|
||||
cp ${GFW_TMP_FILE} ${GFW_FILE}
|
||||
sed -i "s/TS_BUILD_TIME/${TSTIME}/g" ${GFW_FILE}
|
||||
printf "[\e[33m%s\e[0m]" "PID"
|
||||
restart
|
||||
fi
|
||||
}
|
||||
|
||||
makeconfig () {
|
||||
config_load dnsforwarder
|
||||
|
||||
local log=$(uci get dnsforwarder.@config[0].log 2>/dev/null)
|
||||
local log_size=$(uci get dnsforwarder.@config[0].log_size 2>/dev/null)
|
||||
|
||||
local gfw=$(uci get dnsforwarder.@config[0].gfw 2>/dev/null)
|
||||
|
||||
local udp_local=$(uci -d ',' get dnsforwarder.@config[0].udp_local 2>/dev/null)
|
||||
local udp_local_list=$(uci get dnsforwarder.@config[0].udp_local 2>/dev/null)
|
||||
local tcp_group=$(uci get dnsforwarder.@config[0].tcp_group 2>/dev/null)
|
||||
local udp_group=$(uci get dnsforwarder.@config[0].udp_group 2>/dev/null)
|
||||
local group_file=$(uci get dnsforwarder.@config[0].group_file 2>/dev/null)
|
||||
local block_ip=$(uci -d ',' get dnsforwarder.@config[0].block_ip 2>/dev/null)
|
||||
local ip_substituting=$(uci -d ',' get dnsforwarder.@config[0].ip_substituting 2>/dev/null)
|
||||
local block_negative_resp=$(uci get dnsforwarder.@config[0].block_negative_resp 2>/dev/null)
|
||||
local append_host=$(uci get dnsforwarder.@config[0].append_host 2>/dev/null)
|
||||
local block_ipv6=$(uci get dnsforwarder.@config[0].block_ipv6 2>/dev/null)
|
||||
|
||||
local cache=$(uci get dnsforwarder.@config[0].cache 2>/dev/null)
|
||||
local cache_size=$(uci get dnsforwarder.@config[0].cache_size 2>/dev/null)
|
||||
local cache_ignore=$(uci get dnsforwarder.@config[0].cache_ignore 2>/dev/null)
|
||||
local cache_control=$(uci get dnsforwarder.@config[0].cache_control 2>/dev/null)
|
||||
|
||||
local domain_statistic=$(uci get dnsforwarder.@config[0].domain_statistic 2>/dev/null)
|
||||
local udp_local_addr=$(uci get dnsforwarder.@arguments[0].addr 2>/dev/null)
|
||||
udp_local_addr=${udp_local_addr/:/#}
|
||||
|
||||
echo "LogOn ${log}" > $DNSFORWARDER_CONF
|
||||
if [ $log = "true" ]; then
|
||||
rm /var/log/dnsforwarder.log.* 2>/dev/null
|
||||
echo '' > /var/log/dnsforwarder.log
|
||||
echo "LogFileThresholdLength ${log_size}" >> $DNSFORWARDER_CONF
|
||||
echo "LogFileFolder /var/log" >> $DNSFORWARDER_CONF
|
||||
fi
|
||||
|
||||
[ -n "$udp_local" ] && echo "UDPLocal ${udp_local}" >> $DNSFORWARDER_CONF
|
||||
[ -n "$udp_local_addr" ] && eval "makelist 'server=' $udp_local_addr" > /tmp/dnsmasq.dnsforwarder.conf
|
||||
sed -i "s/ //g" /tmp/dnsmasq.dnsforwarder.conf
|
||||
|
||||
eval "makelist 'TCPGroup' $tcp_group" >> $DNSFORWARDER_CONF
|
||||
eval "makelist 'UDPGroup' $udp_group" >> $DNSFORWARDER_CONF
|
||||
eval "makelist 'GroupFile' $group_file" >> $DNSFORWARDER_CONF
|
||||
|
||||
if [ $gfw = "true" ]; then
|
||||
echo 'GroupFile /etc/dnsforwarder/gfw.txt' >> $DNSFORWARDER_CONF
|
||||
fi
|
||||
|
||||
echo "BlockIP ${block_ip}" >> $DNSFORWARDER_CONF
|
||||
eval "makelist 'IPSubstituting' $ip_substituting" >> $DNSFORWARDER_CONF
|
||||
echo "BlockNegativeResponse ${block_negative_resp}" >> $DNSFORWARDER_CONF
|
||||
eval "makelist 'AppendHosts' $append_host" >> $DNSFORWARDER_CONF
|
||||
echo "BlockIpv6WhenIpv4Exists ${block_ipv6}" >> $DNSFORWARDER_CONF
|
||||
|
||||
echo "UseCache ${cache}" >> $DNSFORWARDER_CONF
|
||||
if [ $cache = "true" ]; then
|
||||
echo "CacheSize ${cache_size}" >> $DNSFORWARDER_CONF
|
||||
echo "MemoryCache false" >> $DNSFORWARDER_CONF
|
||||
echo "CacheFile /tmp/dnsforwarder.cache" >> $DNSFORWARDER_CONF
|
||||
echo "IgnoreTTL ${cache_ignore}" >> $DNSFORWARDER_CONF
|
||||
eval "makelist 'CacheControl' $cache_control" >> $DNSFORWARDER_CONF
|
||||
echo "ReloadCache true" >> $DNSFORWARDER_CONF
|
||||
echo "OverwriteCache true" >> $DNSFORWARDER_CONF
|
||||
fi
|
||||
echo "DomainStatistic ${domain_statistic}" >> $DNSFORWARDER_CONF
|
||||
if [ $domain_statistic = "true" ]; then
|
||||
touch /tmp/dnsforwarder-statistic.html
|
||||
mkdir -p /root/.dnsforwarder
|
||||
rm /root/.dnsforwarder/statistic.html 2 > /dev/null
|
||||
ln -s /tmp/dnsforwarder-statistic.html /root/.dnsforwarder/statistic.html
|
||||
local domain_statistic_tag='<!-- TS DNSFORWARDER -->'
|
||||
echo "DomainStatisticTempletFile /tmp/dnsforwarder-statistic.html" >> $DNSFORWARDER_CONF
|
||||
echo "StatisticInsertionPosition ${domain_statistic_tag}" >> $DNSFORWARDER_CONF
|
||||
echo "StatisticUpdateInterval 60" >> $DNSFORWARDER_CONF
|
||||
echo "${domain_statistic_tag}" > /tmp/dnsforwarder-statistic.html
|
||||
fi
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
echo luci for dnsforwarder
|
||||
local vt_enabled=$(uci get dnsforwarder.@arguments[0].enabled 2>/dev/null)
|
||||
if [ $vt_enabled = 0 ]; then
|
||||
echo dnsforwarder is not enabled
|
||||
exit
|
||||
fi
|
||||
makeconfig
|
||||
fixturboacc
|
||||
dnsforwarder -f $DNSFORWARDER_CONF -d
|
||||
sleep 10
|
||||
mkdir -p ${PID_PATH}
|
||||
pid=$(ps | awk '$5 ~ /\[dnsforwarder\]/ {print $1}')
|
||||
echo "dnsforwarder running pid is ${pid}"
|
||||
logger -t The pid of dnsforwarder is ${PID_FILE} ${pid}
|
||||
echo ${pid} > ${PID_FILE}
|
||||
/etc/init.d/dnsforwarder enable
|
||||
local dnsmasq=$(uci get dnsforwarder.@arguments[0].dnsmasq 2>/dev/null)
|
||||
local addr=$(uci get dnsforwarder.@arguments[0].addr 2>/dev/null)
|
||||
[ -n "${addr}" ] && addr=${addr/:/#}
|
||||
|
||||
if [ "${dnsmasq}" = "1" ]; then
|
||||
uci delete dhcp.@dnsmasq[0].server 2>/dev/null
|
||||
# uci add_list dhcp.@dnsmasq[0].server=$addr
|
||||
uci delete dhcp.@dnsmasq[0].resolvfile 2>/dev/null
|
||||
uci set dhcp.@dnsmasq[0].noresolv=1
|
||||
uci set dhcp.@dnsmasq[0].serversfile=/tmp/dnsmasq.dnsforwarder.conf
|
||||
uci commit dhcp
|
||||
/etc/init.d/dnsmasq restart
|
||||
fi
|
||||
local dnsmasq_server_addr=$(uci get dhcp.@dnsmasq[0].server 2>/dev/null)
|
||||
if [ -n "${dnsmasq_server_addr}" ]; then
|
||||
uci set dhcp.@dnsmasq[0].noresolv=1
|
||||
uci commit dhcp
|
||||
/etc/init.d/dnsmasq restart
|
||||
fi
|
||||
add_cron
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
del_cron
|
||||
logger -t stopping dnsforwarder
|
||||
local addr=$(uci get dnsforwarder.@arguments[0].addr 2>/dev/null)
|
||||
local dnsmasq=$(uci get dnsforwarder.@arguments[0].dnsmasq 2>/dev/null)
|
||||
addr=${addr/:/#}
|
||||
if [ "${dnsmasq}" = "1" ]; then
|
||||
uci del_list dhcp.@dnsmasq[0].server=$addr 2>/dev/null
|
||||
fi
|
||||
uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.d/resolv.conf.auto 2>/dev/null
|
||||
uci delete dhcp.@dnsmasq[0].noresolv 2>/dev/null
|
||||
uci delete dhcp.@dnsmasq[0].serversfile 2>/dev/null
|
||||
uci commit dhcp
|
||||
/etc/init.d/dnsmasq restart
|
||||
[ -e ${PID_FILE} ] && {
|
||||
pid=$(cat ${PID_FILE})
|
||||
logger -t killing dnsforwarder pid ${pid}
|
||||
echo killing dnsforwarder pid ${pid}
|
||||
kill ${pid}
|
||||
rm -f ${PID_FILE}
|
||||
} || {
|
||||
logger -t Cannot find dnsforwarder pid file
|
||||
}
|
||||
}
|
||||
|
||||
restart()
|
||||
{
|
||||
pid=$(cat ${PID_FILE} 2>/dev/null)
|
||||
echo Dnsforwarder pid file is ${pid}
|
||||
[ -n "$pid" ] && {
|
||||
echo stopping pid ${pid}
|
||||
logger -t There is dnsforwarder pid ${pid}
|
||||
stop
|
||||
} || {
|
||||
logger -t Dnsforwarder is not running
|
||||
}
|
||||
sleep 7
|
||||
local vt_enabled=$(uci get dnsforwarder.@arguments[0].enabled 2>/dev/null)
|
||||
echo dnsforwarder status is ${vt_enabled}
|
||||
logger -t Dnsforwarder is initializing enabled is ${vt_enabled}
|
||||
if [ ${vt_enabled} = 1 ]; then
|
||||
[ -n "$pid" ] && {
|
||||
logger -t There is dnsforwarder pid ${pid}
|
||||
stop
|
||||
} || {
|
||||
logger -t Dnsforwarder is not running
|
||||
}
|
||||
|
||||
logger -t Restarting dnsforwarder
|
||||
start
|
||||
else
|
||||
/etc/init.d/dnsforwarder disable
|
||||
fi
|
||||
}
|
||||
@ -1,313 +0,0 @@
|
||||
#/bin/sh
|
||||
|
||||
# Name: gfwlist2dnsmasq.sh
|
||||
# Desription: A shell script which convert gfwlist into dnsmasq rules.
|
||||
# Version: 0.8.0 (2017.12.25)
|
||||
# Author: Cokebar Chi
|
||||
# Website: https://github.com/cokebar
|
||||
|
||||
_green() {
|
||||
printf '\033[1;31;32m'
|
||||
printf -- "%b" "$1"
|
||||
printf '\033[0m'
|
||||
}
|
||||
|
||||
_red() {
|
||||
printf '\033[1;31;31m'
|
||||
printf -- "%b" "$1"
|
||||
printf '\033[0m'
|
||||
}
|
||||
|
||||
_yellow() {
|
||||
printf '\033[1;31;33m'
|
||||
printf -- "%b" "$1"
|
||||
printf '\033[0m'
|
||||
}
|
||||
|
||||
usage() {
|
||||
cat <<-EOF
|
||||
|
||||
Name: gfwlist2dnsmasq.sh
|
||||
Desription: A shell script which convert gfwlist into dnsmasq rules.
|
||||
Version: 0.8.0 (2017.12.25)
|
||||
Author: Cokebar Chi
|
||||
Website: https://github.com/cokebar
|
||||
|
||||
Usage: sh gfwlist2dnsmasq.sh [options] -o FILE
|
||||
Valid options are:
|
||||
-d, --dns <dns_ip>
|
||||
DNS IP address for the GfwList Domains (Default: 127.0.0.1)
|
||||
-p, --port <dns_port>
|
||||
DNS Port for the GfwList Domains (Default: 5353)
|
||||
-s, --ipset <ipset_name>
|
||||
Ipset name for the GfwList domains
|
||||
(If not given, ipset rules will not be generated.)
|
||||
-o, --output <FILE>
|
||||
/path/to/output_filename
|
||||
-i, --insecure
|
||||
Force bypass certificate validation (insecure)
|
||||
-l, --domain-list
|
||||
Convert Gfwlist into domain list instead of dnsmasq rules
|
||||
(If this option is set, DNS IP/Port & ipset are not needed)
|
||||
--exclude-domain-file <FILE>
|
||||
Delete specific domains in the result from a domain list text file
|
||||
Please put one domain per line
|
||||
--extra-domain-file <FILE>
|
||||
Include extra domains to the result from a domain list text file
|
||||
This file will be processed after the exclude-domain-file
|
||||
Please put one domain per line
|
||||
-h, --help
|
||||
Usage
|
||||
EOF
|
||||
exit $1
|
||||
}
|
||||
|
||||
clean_and_exit(){
|
||||
# Clean up temp files
|
||||
printf 'Cleaning up... '
|
||||
rm -rf $TMP_DIR
|
||||
_green 'Done\n\n'
|
||||
[ $1 -eq 0 ] && _green 'Job Finished.\n\n' || _red 'Exit with Error code '$1'.\n'
|
||||
exit $1
|
||||
}
|
||||
|
||||
check_depends(){
|
||||
which sed base64 curl >/dev/null
|
||||
if [ $? != 0 ]; then
|
||||
_red 'Error: Missing Dependency.\nPlease check whether you have the following binaries on you system:\nwhich, sed, base64, curl.\n'
|
||||
exit 3
|
||||
fi
|
||||
|
||||
SYS_KERNEL=`uname -s`
|
||||
if [ $SYS_KERNEL = "Darwin" -o $SYS_KERNEL = "FreeBSD" ]; then
|
||||
BASE64_DECODE='base64 -D'
|
||||
SED_ERES='sed -E'
|
||||
else
|
||||
BASE64_DECODE='base64 -d'
|
||||
SED_ERES='sed -r'
|
||||
fi
|
||||
}
|
||||
|
||||
get_args(){
|
||||
OUT_TYPE='DNSMASQ_RULES'
|
||||
DNS_IP='127.0.0.1'
|
||||
DNS_PORT='5353'
|
||||
IPSET_NAME=''
|
||||
FILE_FULLPATH=''
|
||||
CURL_EXTARG=''
|
||||
WITH_IPSET=0
|
||||
EXTRA_DOMAIN_FILE=''
|
||||
EXCLUDE_DOMAIN_FILE=''
|
||||
IPV4_PATTERN='^((2[0-4][0-9]|25[0-5]|[01]?[0-9][0-9]?)\.){3}(2[0-4][0-9]|25[0-5]|[01]?[0-9][0-9]?)$'
|
||||
IPV6_PATTERN='^((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}))|:)))(%.+)?$'
|
||||
|
||||
while [ ${#} -gt 0 ]; do
|
||||
case "${1}" in
|
||||
--help | -h)
|
||||
usage 0
|
||||
;;
|
||||
--domain-list | -l)
|
||||
OUT_TYPE='DOMAIN_LIST'
|
||||
;;
|
||||
--insecure | -i)
|
||||
CURL_EXTARG='--insecure'
|
||||
;;
|
||||
--dns | -d)
|
||||
DNS_IP="$2"
|
||||
shift
|
||||
;;
|
||||
--port | -p)
|
||||
DNS_PORT="$2"
|
||||
shift
|
||||
;;
|
||||
--ipset | -s)
|
||||
IPSET_NAME="$2"
|
||||
shift
|
||||
;;
|
||||
--output | -o)
|
||||
OUT_FILE="$2"
|
||||
shift
|
||||
;;
|
||||
--extra-domain-file)
|
||||
EXTRA_DOMAIN_FILE="$2"
|
||||
shift
|
||||
;;
|
||||
--exclude-domain-file)
|
||||
EXCLUDE_DOMAIN_FILE="$2"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
_red "Invalid argument: $1"
|
||||
usage 1
|
||||
;;
|
||||
esac
|
||||
shift 1
|
||||
done
|
||||
|
||||
# Check path & file name
|
||||
if [ -z $OUT_FILE ]; then
|
||||
_red 'Error: Please specify the path to the output file(using -o/--output argument).\n'
|
||||
exit 1
|
||||
else
|
||||
if [ -z ${OUT_FILE##*/} ]; then
|
||||
_red 'Error: '$OUT_FILE' is a path, not a file.\n'
|
||||
exit 1
|
||||
else
|
||||
if [ ${OUT_FILE}a != ${OUT_FILE%/*}a ] && [ ! -d ${OUT_FILE%/*} ]; then
|
||||
_red 'Error: Folder do not exist: '${OUT_FILE%/*}'\n'
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $OUT_TYPE = 'DNSMASQ_RULES' ]; then
|
||||
# Check DNS IP
|
||||
IPV4_TEST=$(echo $DNS_IP | grep -E $IPV4_PATTERN)
|
||||
IPV6_TEST=$(echo $DNS_IP | grep -E $IPV6_PATTERN)
|
||||
if [ "$IPV4_TEST" != "$DNS_IP" -a "$IPV6_TEST" != "$DNS_IP" ]; then
|
||||
_red 'Error: Please enter a valid DNS server IP address.\n'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check DNS port
|
||||
if [ $DNS_PORT -lt 1 -o $DNS_PORT -gt 65535 ]; then
|
||||
_red 'Error: Please enter a valid DNS server port.\n'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check ipset name
|
||||
if [ -z $IPSET_NAME ]; then
|
||||
WITH_IPSET=0
|
||||
else
|
||||
IPSET_TEST=$(echo $IPSET_NAME | grep -E '^\w+$')
|
||||
if [ "$IPSET_TEST" != "$IPSET_NAME" ]; then
|
||||
_red 'Error: Please enter a valid IP set name.\n'
|
||||
exit 1
|
||||
else
|
||||
WITH_IPSET=1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -z $EXTRA_DOMAIN_FILE ] && [ ! -f $EXTRA_DOMAIN_FILE ]; then
|
||||
_yellow 'WARNING:\nExtra domain file does not exist, ignored.\n\n'
|
||||
EXTRA_DOMAIN_FILE=''
|
||||
fi
|
||||
|
||||
if [ ! -z $EXCLUDE_DOMAIN_FILE ] && [ ! -f $EXCLUDE_DOMAIN_FILE ]; then
|
||||
_yellow 'WARNING:\nExclude domain file does not exist, ignored.\n\n'
|
||||
EXCLUDE_DOMAIN_FILE=''
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
process(){
|
||||
# Set Global Var
|
||||
BASE_URL='https://github.com/gfwlist/gfwlist/raw/master/gfwlist.txt'
|
||||
TMP_DIR=`mktemp -d /tmp/gfwlist2dnsmasq.XXXXXX`
|
||||
BASE64_FILE="$TMP_DIR/base64.txt"
|
||||
GFWLIST_FILE="$TMP_DIR/gfwlist.txt"
|
||||
DOMAIN_TEMP_FILE="$TMP_DIR/gfwlist2domain.tmp"
|
||||
DOMAIN_FILE="$TMP_DIR/gfwlist2domain.txt"
|
||||
CONF_TMP_FILE="$TMP_DIR/gfwlist.conf.tmp"
|
||||
OUT_TMP_FILE="$TMP_DIR/gfwlist.out.tmp"
|
||||
|
||||
# Fetch GfwList and decode it into plain text
|
||||
printf 'Fetching GfwList... '
|
||||
local tscurl='curl -L --connect-timeout 5 -m 300 --retry 3 --retry-delay 1'
|
||||
$tscurl $CURL_EXTARG -o$BASE64_FILE $BASE_URL \
|
||||
|| $tscurl $CURL_EXTARG -o$BASE64_FILE https://gitlab.com/gfwlist/gfwlist/raw/master/gfwlist.txt \
|
||||
|| $tscurl $CURL_EXTARG -o$BASE64_FILE https://git.tuxfamily.org/gfwlist/gfwlist.git/plain/gfwlist.txt \
|
||||
|| $tscurl $CURL_EXTARG -o$BASE64_FILE https://pagure.io/gfwlist/raw/master/f/gfwlist.txt \
|
||||
|| $tscurl $CURL_EXTARG -o$BASE64_FILE http://repo.or.cz/gfwlist.git/blob_plain/HEAD:/gfwlist.txt \
|
||||
|| $tscurl $CURL_EXTARG -o$BASE64_FILE https://bitbucket.org/gfwlist/gfwlist/raw/HEAD/gfwlist.txt \
|
||||
|| $tscurl $CURL_EXTARG -o$BASE64_FILE $BASE_URL
|
||||
if [ $? != 0 ]; then
|
||||
_red '\nFailed to fetch gfwlist.txt. Please check your Internet connection.\n'
|
||||
clean_and_exit 2
|
||||
fi
|
||||
$BASE64_DECODE $BASE64_FILE > $GFWLIST_FILE || ( _red 'Failed to decode gfwlist.txt. Quit.\n'; clean_and_exit 2 )
|
||||
_green 'Done.\n\n'
|
||||
|
||||
# Convert
|
||||
IGNORE_PATTERN='^\!|\[|^@@|(https?://){0,1}[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+'
|
||||
HEAD_FILTER_PATTERN='s#^(\|\|?)?(https?://)?##g'
|
||||
TAIL_FILTER_PATTERN='s#/.*$|%2F.*$##g'
|
||||
DOMAIN_PATTERN='([a-zA-Z0-9][-a-zA-Z0-9]*(\.[a-zA-Z0-9][-a-zA-Z0-9]*)+)'
|
||||
HANDLE_WILDCARD_PATTERN='s#^(([a-zA-Z0-9]*\*[-a-zA-Z0-9]*)?(\.))?([a-zA-Z0-9][-a-zA-Z0-9]*(\.[a-zA-Z0-9][-a-zA-Z0-9]*)+)(\*)?#\4#g'
|
||||
|
||||
printf 'Converting GfwList to ' && _green $OUT_TYPE && printf ' ...\n'
|
||||
_yellow '\nWARNING:\nThe following lines in GfwList contain regex, and might be ignored:\n\n'
|
||||
cat $GFWLIST_FILE | grep -n '^/.*$'
|
||||
_yellow "\nThis script will try to convert some of the regex rules. But you should know this may not be a equivalent conversion.\nIf there's regex rules which this script do not deal with, you should add the domain manually to the list.\n\n"
|
||||
grep -vE $IGNORE_PATTERN $GFWLIST_FILE | $SED_ERES $HEAD_FILTER_PATTERN | $SED_ERES $TAIL_FILTER_PATTERN | grep -E $DOMAIN_PATTERN | $SED_ERES $HANDLE_WILDCARD_PATTERN > $DOMAIN_TEMP_FILE
|
||||
|
||||
printf 'google.com\ngoogle.ad\ngoogle.ae\ngoogle.com.af\ngoogle.com.ag\ngoogle.com.ai\ngoogle.al\ngoogle.am\ngoogle.co.ao\ngoogle.com.ar\ngoogle.as\ngoogle.at\ngoogle.com.au\ngoogle.az\ngoogle.ba\ngoogle.com.bd\ngoogle.be\ngoogle.bf\ngoogle.bg\ngoogle.com.bh\ngoogle.bi\ngoogle.bj\ngoogle.com.bn\ngoogle.com.bo\ngoogle.com.br\ngoogle.bs\ngoogle.bt\ngoogle.co.bw\ngoogle.by\ngoogle.com.bz\ngoogle.ca\ngoogle.cd\ngoogle.cf\ngoogle.cg\ngoogle.ch\ngoogle.ci\ngoogle.co.ck\ngoogle.cl\ngoogle.cm\ngoogle.cn\ngoogle.com.co\ngoogle.co.cr\ngoogle.com.cu\ngoogle.cv\ngoogle.com.cy\ngoogle.cz\ngoogle.de\ngoogle.dj\ngoogle.dk\ngoogle.dm\ngoogle.com.do\ngoogle.dz\ngoogle.com.ec\ngoogle.ee\ngoogle.com.eg\ngoogle.es\ngoogle.com.et\ngoogle.fi\ngoogle.com.fj\ngoogle.fm\ngoogle.fr\ngoogle.ga\ngoogle.ge\ngoogle.gg\ngoogle.com.gh\ngoogle.com.gi\ngoogle.gl\ngoogle.gm\ngoogle.gp\ngoogle.gr\ngoogle.com.gt\ngoogle.gy\ngoogle.com.hk\ngoogle.hn\ngoogle.hr\ngoogle.ht\ngoogle.hu\ngoogle.co.id\ngoogle.ie\ngoogle.co.il\ngoogle.im\ngoogle.co.in\ngoogle.iq\ngoogle.is\ngoogle.it\ngoogle.je\ngoogle.com.jm\ngoogle.jo\ngoogle.co.jp\ngoogle.co.ke\ngoogle.com.kh\ngoogle.ki\ngoogle.kg\ngoogle.co.kr\ngoogle.com.kw\ngoogle.kz\ngoogle.la\ngoogle.com.lb\ngoogle.li\ngoogle.lk\ngoogle.co.ls\ngoogle.lt\ngoogle.lu\ngoogle.lv\ngoogle.com.ly\ngoogle.co.ma\ngoogle.md\ngoogle.me\ngoogle.mg\ngoogle.mk\ngoogle.ml\ngoogle.com.mm\ngoogle.mn\ngoogle.ms\ngoogle.com.mt\ngoogle.mu\ngoogle.mv\ngoogle.mw\ngoogle.com.mx\ngoogle.com.my\ngoogle.co.mz\ngoogle.com.na\ngoogle.com.nf\ngoogle.com.ng\ngoogle.com.ni\ngoogle.ne\ngoogle.nl\ngoogle.no\ngoogle.com.np\ngoogle.nr\ngoogle.nu\ngoogle.co.nz\ngoogle.com.om\ngoogle.com.pa\ngoogle.com.pe\ngoogle.com.pg\ngoogle.com.ph\ngoogle.com.pk\ngoogle.pl\ngoogle.pn\ngoogle.com.pr\ngoogle.ps\ngoogle.pt\ngoogle.com.py\ngoogle.com.qa\ngoogle.ro\ngoogle.ru\ngoogle.rw\ngoogle.com.sa\ngoogle.com.sb\ngoogle.sc\ngoogle.se\ngoogle.com.sg\ngoogle.sh\ngoogle.si\ngoogle.sk\ngoogle.com.sl\ngoogle.sn\ngoogle.so\ngoogle.sm\ngoogle.sr\ngoogle.st\ngoogle.com.sv\ngoogle.td\ngoogle.tg\ngoogle.co.th\ngoogle.com.tj\ngoogle.tk\ngoogle.tl\ngoogle.tm\ngoogle.tn\ngoogle.to\ngoogle.com.tr\ngoogle.tt\ngoogle.com.tw\ngoogle.co.tz\ngoogle.com.ua\ngoogle.co.ug\ngoogle.co.uk\ngoogle.com.uy\ngoogle.co.uz\ngoogle.com.vc\ngoogle.co.ve\ngoogle.vg\ngoogle.co.vi\ngoogle.com.vn\ngoogle.vu\ngoogle.ws\ngoogle.rs\ngoogle.co.za\ngoogle.co.zm\ngoogle.co.zw\ngoogle.cat\n' >> $DOMAIN_TEMP_FILE
|
||||
printf 'Google search domains... ' && _green 'Added\n'
|
||||
|
||||
# Add blogspot domains
|
||||
printf 'blogspot.ca\nblogspot.co.uk\nblogspot.com\nblogspot.com.ar\nblogspot.com.au\nblogspot.com.br\nblogspot.com.by\nblogspot.com.co\nblogspot.com.cy\nblogspot.com.ee\nblogspot.com.eg\nblogspot.com.es\nblogspot.com.mt\nblogspot.com.ng\nblogspot.com.tr\nblogspot.com.uy\nblogspot.de\nblogspot.gr\nblogspot.in\nblogspot.mx\nblogspot.ch\nblogspot.fr\nblogspot.ie\nblogspot.it\nblogspot.pt\nblogspot.ro\nblogspot.sg\nblogspot.be\nblogspot.no\nblogspot.se\nblogspot.jp\nblogspot.in\nblogspot.ae\nblogspot.al\nblogspot.am\nblogspot.ba\nblogspot.bg\nblogspot.ch\nblogspot.cl\nblogspot.cz\nblogspot.dk\nblogspot.fi\nblogspot.gr\nblogspot.hk\nblogspot.hr\nblogspot.hu\nblogspot.ie\nblogspot.is\nblogspot.kr\nblogspot.li\nblogspot.lt\nblogspot.lu\nblogspot.md\nblogspot.mk\nblogspot.my\nblogspot.nl\nblogspot.no\nblogspot.pe\nblogspot.qa\nblogspot.ro\nblogspot.ru\nblogspot.se\nblogspot.sg\nblogspot.si\nblogspot.sk\nblogspot.sn\nblogspot.tw\nblogspot.ug\nblogspot.cat\n' >> $DOMAIN_TEMP_FILE
|
||||
printf 'Blogspot domains... ' && _green 'Added\n'
|
||||
|
||||
# Add twimg.edgesuite.net
|
||||
printf 'twimg.edgesuite.net\n' >> $DOMAIN_TEMP_FILE
|
||||
printf 'twimg.edgesuite.net... ' && _green 'Added\n'
|
||||
|
||||
# Delete exclude domains
|
||||
if [ ! -z $EXCLUDE_DOMAIN_FILE ]; then
|
||||
for line in $(cat $EXCLUDE_DOMAIN_FILE)
|
||||
do
|
||||
cat $DOMAIN_TEMP_FILE | grep -vF -f $EXCLUDE_DOMAIN_FILE > $DOMAIN_FILE
|
||||
done
|
||||
printf 'Domains in exclude domain file '$EXCLUDE_DOMAIN_FILE'... ' && _green 'Deleted\n'
|
||||
else
|
||||
cat $DOMAIN_TEMP_FILE > $DOMAIN_FILE
|
||||
fi
|
||||
|
||||
# Add extra domains
|
||||
if [ ! -z $EXTRA_DOMAIN_FILE ]; then
|
||||
cat $EXTRA_DOMAIN_FILE >> $DOMAIN_FILE
|
||||
printf 'Extra domain file '$EXTRA_DOMAIN_FILE'... ' && _green 'Added\n'
|
||||
fi
|
||||
|
||||
if [ $OUT_TYPE = 'DNSMASQ_RULES' ]; then
|
||||
# Convert domains into dnsmasq rules
|
||||
if [ $WITH_IPSET -eq 1 ]; then
|
||||
_green 'Ipset rules included.'
|
||||
sort -u $DOMAIN_FILE | $SED_ERES 's#(.+)#server=/\1/'$DNS_IP'\#'$DNS_PORT'\
|
||||
ipset=/\1/'$IPSET_NAME'#g' > $CONF_TMP_FILE
|
||||
else
|
||||
_green 'Ipset rules not included.'
|
||||
sort -u $DOMAIN_FILE | $SED_ERES 's#(.+)#server=/\1/'$DNS_IP'\#'$DNS_PORT'#g' > $CONF_TMP_FILE
|
||||
fi
|
||||
|
||||
# Generate output file
|
||||
echo '# dnsmasq rules generated by gfwlist' > $OUT_TMP_FILE
|
||||
echo "# Last Updated on $(date "+%Y-%m-%d %H:%M:%S")" >> $OUT_TMP_FILE
|
||||
echo '# ' >> $OUT_TMP_FILE
|
||||
cat $CONF_TMP_FILE >> $OUT_TMP_FILE
|
||||
cp $OUT_TMP_FILE $OUT_FILE
|
||||
else
|
||||
sort -u $DOMAIN_FILE > $OUT_TMP_FILE
|
||||
fi
|
||||
|
||||
cp $OUT_TMP_FILE $OUT_FILE
|
||||
printf '\nConverting GfwList to '$OUT_TYPE'... ' && _green 'Done\n\n'
|
||||
|
||||
# Clean up
|
||||
clean_and_exit 0
|
||||
}
|
||||
|
||||
main() {
|
||||
if [ -z "$1" ]; then
|
||||
usage 0
|
||||
else
|
||||
check_depends
|
||||
get_args "$@"
|
||||
_green '\nJob Started.\n\n'
|
||||
process
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@ -1,39 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2015-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dsmboot
|
||||
PKG_VERSION:=5.2
|
||||
PKG_RELEASE:=5967.1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/dsmboot
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Synology DSM pxeboot from TFTP
|
||||
endef
|
||||
|
||||
define Package/dsmboot/description
|
||||
DSM 5.2 boot from TFTP
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
true
|
||||
endef
|
||||
|
||||
define Package/dsmboot/install
|
||||
$(INSTALL_DIR) $(1)/root
|
||||
$(CP) ./files/dsm.iso $(1)/root/
|
||||
$(CP) ./files/menu.lst $(1)/root/
|
||||
$(CP) ./files/pxelinux.0 $(1)/root/
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/dsmboot $(1)/etc/uci-defaults/yyy-dsmboot
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,dsmboot))
|
||||
Binary file not shown.
@ -1,10 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
set dhcp.@dnsmasq[0].enable_tftp='1'
|
||||
set dhcp.@dnsmasq[0].dhcp_boot='pxelinux.0'
|
||||
set dhcp.@dnsmasq[0].tftp_root='/root'
|
||||
commit dhcp
|
||||
EOF
|
||||
|
||||
exit 0
|
||||
@ -1,9 +0,0 @@
|
||||
default 0
|
||||
timeout 0
|
||||
fallback 0
|
||||
|
||||
title Synology DSM
|
||||
map --mem (pd)/dsm.iso (hd32)
|
||||
map --hook
|
||||
chainloader (hd32)
|
||||
|
||||
Binary file not shown.
@ -1,70 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=fast-classifier
|
||||
PKG_RELEASE:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define KernelPackage/fast-classifier
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
SUBMENU:=Network Support
|
||||
TITLE:=Kernel driver for FAST Classifier
|
||||
FILES:=$(PKG_BUILD_DIR)/fast-classifier.ko
|
||||
KCONFIG:= \
|
||||
CONFIG_NF_CONNTRACK_CHAIN_EVENTS=y \
|
||||
CONFIG_NF_CONNTRACK_MARK=y
|
||||
DEPENDS:=+kmod-ipt-conntrack +kmod-shortcut-fe
|
||||
PROVIDES:=fast-classifier
|
||||
endef
|
||||
|
||||
define KernelPackage/fast-classifier/description
|
||||
FAST Classifier talks to SFE to make decisions about offloading connections
|
||||
endef
|
||||
|
||||
define Package/fast-classifier-example
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Example user space program for fast-classifier
|
||||
DEPENDS:=+kmod-fast-classifier +libnl
|
||||
endef
|
||||
|
||||
define Package/fast-classifier-example/description
|
||||
Example user space program that communicates with fast
|
||||
classifier kernel module.
|
||||
endef
|
||||
|
||||
SFE_MAKE_OPTS:=SFE_SUPPORT_IPV6=y
|
||||
|
||||
define Build/Compile
|
||||
+$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" $(strip $(SFE_MAKE_OPTS)) \
|
||||
$(KERNEL_MAKE_FLAGS) \
|
||||
$(PKG_MAKE_FLAGS) \
|
||||
M="$(PKG_BUILD_DIR)" \
|
||||
CONFIG_FAST_CLASSIFIER=m \
|
||||
EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
|
||||
modules
|
||||
|
||||
ifneq ($(CONFIG_PACKAGE_fast-classifier-example),)
|
||||
$(TARGET_CC) -o $(PKG_BUILD_DIR)/userspace_fast_classifier \
|
||||
-I $(PKG_BUILD_DIR) \
|
||||
-I$(STAGING_DIR)/usr/include/libnl \
|
||||
-I$(STAGING_DIR)/usr/include/libnl3 \
|
||||
-lnl-genl-3 -lnl-3 \
|
||||
$(PKG_BUILD_DIR)/nl_classifier_test.c
|
||||
endif
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(CP) $(PKG_BUILD_DIR)/fast-classifier.h $(1)/usr/include/
|
||||
endef
|
||||
|
||||
define Package/fast-classifier-example/install
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/userspace_fast_classifier $(1)/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,fast-classifier))
|
||||
$(eval $(call BuildPackage,fast-classifier-example))
|
||||
@ -1,10 +0,0 @@
|
||||
obj-$(CONFIG_FAST_CLASSIFIER) += fast-classifier.o
|
||||
|
||||
ifeq ($(SFE_SUPPORT_IPV6),)
|
||||
SFE_SUPPORT_IPV6=y
|
||||
endif
|
||||
ccflags-$(SFE_SUPPORT_IPV6) += -DSFE_SUPPORT_IPV6
|
||||
|
||||
ccflags-y += -I$(obj)/../shortcut-fe
|
||||
|
||||
obj ?= .
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,57 +0,0 @@
|
||||
/*
|
||||
* User space header to send message to the fast classifier
|
||||
*
|
||||
* Copyright (c) 2013,2016 The Linux Foundation. All rights reserved.
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
* above copyright notice and this permission notice appear in all copies.
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <linux/if_ether.h>
|
||||
|
||||
#define FAST_CLASSIFIER_GENL_VERSION (1)
|
||||
#define FAST_CLASSIFIER_GENL_NAME "FC"
|
||||
#define FAST_CLASSIFIER_GENL_MCGRP "FC_MCGRP"
|
||||
#define FAST_CLASSIFIER_GENL_HDRSIZE (0)
|
||||
|
||||
enum {
|
||||
FAST_CLASSIFIER_A_UNSPEC,
|
||||
FAST_CLASSIFIER_A_TUPLE,
|
||||
__FAST_CLASSIFIER_A_MAX,
|
||||
};
|
||||
|
||||
#define FAST_CLASSIFIER_A_MAX (__FAST_CLASSIFIER_A_MAX - 1)
|
||||
|
||||
enum {
|
||||
FAST_CLASSIFIER_C_UNSPEC,
|
||||
FAST_CLASSIFIER_C_OFFLOAD,
|
||||
FAST_CLASSIFIER_C_OFFLOADED,
|
||||
FAST_CLASSIFIER_C_DONE,
|
||||
__FAST_CLASSIFIER_C_MAX,
|
||||
};
|
||||
|
||||
#define FAST_CLASSIFIER_C_MAX (__FAST_CLASSIFIER_C_MAX - 1)
|
||||
|
||||
struct fast_classifier_tuple {
|
||||
unsigned short ethertype;
|
||||
unsigned char proto;
|
||||
union {
|
||||
struct in_addr in;
|
||||
struct in6_addr in6;
|
||||
} src_saddr;
|
||||
union {
|
||||
struct in_addr in;
|
||||
struct in6_addr in6;
|
||||
} dst_saddr;
|
||||
unsigned short sport;
|
||||
unsigned short dport;
|
||||
unsigned char smac[ETH_ALEN];
|
||||
unsigned char dmac[ETH_ALEN];
|
||||
};
|
||||
@ -1,281 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 The Linux Foundation. All rights reserved.
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
* above copyright notice and this permission notice appear in all copies.
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <netlink/genl/genl.h>
|
||||
#include <netlink/genl/ctrl.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#define NL_CLASSIFIER_GENL_VERSION 1
|
||||
#define NL_CLASSIFIER_GENL_FAMILY "FC"
|
||||
#define NL_CLASSIFIER_GENL_GROUP "FC_MCGRP"
|
||||
#define NL_CLASSIFIER_GENL_HDRSIZE 0
|
||||
|
||||
enum NL_CLASSIFIER_CMD {
|
||||
NL_CLASSIFIER_CMD_UNSPEC,
|
||||
NL_CLASSIFIER_CMD_ACCEL,
|
||||
NL_CLASSIFIER_CMD_ACCEL_OK,
|
||||
NL_CLASSIFIER_CMD_CONNECTION_CLOSED,
|
||||
NL_CLASSIFIER_CMD_MAX,
|
||||
};
|
||||
|
||||
enum NL_CLASSIFIER_ATTR {
|
||||
NL_CLASSIFIER_ATTR_UNSPEC,
|
||||
NL_CLASSIFIER_ATTR_TUPLE,
|
||||
NL_CLASSIFIER_ATTR_MAX,
|
||||
};
|
||||
|
||||
union nl_classifier_tuple_ip {
|
||||
struct in_addr in;
|
||||
struct in6_addr in6;
|
||||
};
|
||||
|
||||
struct nl_classifier_tuple {
|
||||
unsigned short af;
|
||||
unsigned char proto;
|
||||
union nl_classifier_tuple_ip src_ip;
|
||||
union nl_classifier_tuple_ip dst_ip;
|
||||
unsigned short sport;
|
||||
unsigned short dport;
|
||||
unsigned char smac[6];
|
||||
unsigned char dmac[6];
|
||||
};
|
||||
|
||||
struct nl_classifier_instance {
|
||||
struct nl_sock *sock;
|
||||
int family_id;
|
||||
int group_id;
|
||||
int stop;
|
||||
};
|
||||
|
||||
struct nl_classifier_instance nl_cls_inst;
|
||||
|
||||
static struct nla_policy nl_classifier_genl_policy[(NL_CLASSIFIER_ATTR_MAX+1)] = {
|
||||
[NL_CLASSIFIER_ATTR_TUPLE] = { .type = NLA_UNSPEC },
|
||||
};
|
||||
|
||||
void nl_classifier_dump_nl_tuple(struct nl_classifier_tuple *tuple)
|
||||
{
|
||||
char ip_str[64];
|
||||
|
||||
printf("protocol = %s\n", (tuple->proto == IPPROTO_UDP) ? "udp" : ((tuple->proto == IPPROTO_TCP) ? "tcp" : "unknown"));
|
||||
printf("source ip = %s\n", inet_ntop(tuple->af, &tuple->src_ip, ip_str, sizeof(ip_str)));
|
||||
printf("destination ip = %s\n", inet_ntop(tuple->af, &tuple->dst_ip, ip_str, sizeof(ip_str)));
|
||||
printf("source port = %d\n", ntohs(tuple->sport));
|
||||
printf("destination port = %d\n", ntohs(tuple->dport));
|
||||
}
|
||||
|
||||
int nl_classifier_msg_recv(struct nl_msg *msg, void *arg)
|
||||
{
|
||||
struct nlmsghdr *nlh = nlmsg_hdr(msg);
|
||||
struct genlmsghdr *gnlh = nlmsg_data(nlh);
|
||||
struct nlattr *attrs[(NL_CLASSIFIER_ATTR_MAX+1)];
|
||||
|
||||
genlmsg_parse(nlh, NL_CLASSIFIER_GENL_HDRSIZE, attrs, NL_CLASSIFIER_ATTR_MAX, nl_classifier_genl_policy);
|
||||
|
||||
switch (gnlh->cmd) {
|
||||
case NL_CLASSIFIER_CMD_ACCEL_OK:
|
||||
printf("Acceleration successful:\n");
|
||||
nl_classifier_dump_nl_tuple(nla_data(attrs[NL_CLASSIFIER_ATTR_TUPLE]));
|
||||
return NL_OK;
|
||||
case NL_CLASSIFIER_CMD_CONNECTION_CLOSED:
|
||||
printf("Connection is closed:\n");
|
||||
nl_classifier_dump_nl_tuple(nla_data(attrs[NL_CLASSIFIER_ATTR_TUPLE]));
|
||||
return NL_OK;
|
||||
default:
|
||||
printf("nl classifier received unknow message %d\n", gnlh->cmd);
|
||||
}
|
||||
|
||||
return NL_SKIP;
|
||||
}
|
||||
|
||||
void nl_classifier_offload(struct nl_classifier_instance *inst,
|
||||
unsigned char proto, unsigned long *src_saddr,
|
||||
unsigned long *dst_saddr, unsigned short sport,
|
||||
unsigned short dport, int af)
|
||||
{
|
||||
struct nl_msg *msg;
|
||||
int ret;
|
||||
struct nl_classifier_tuple classifier_msg;
|
||||
|
||||
memset(&classifier_msg, 0, sizeof(classifier_msg));
|
||||
classifier_msg.af = af;
|
||||
classifier_msg.proto = proto;
|
||||
memcpy(&classifier_msg.src_ip, src_saddr, (af == AF_INET ? 4 : 16));
|
||||
memcpy(&classifier_msg.dst_ip, dst_saddr, (af == AF_INET ? 4 : 16));
|
||||
classifier_msg.sport = sport;
|
||||
classifier_msg.dport = dport;
|
||||
|
||||
msg = nlmsg_alloc();
|
||||
if (!msg) {
|
||||
printf("Unable to allocate message\n");
|
||||
return;
|
||||
}
|
||||
|
||||
genlmsg_put(msg, NL_AUTO_PID, NL_AUTO_SEQ, inst->family_id,
|
||||
NL_CLASSIFIER_GENL_HDRSIZE, NLM_F_REQUEST,
|
||||
NL_CLASSIFIER_CMD_ACCEL, NL_CLASSIFIER_GENL_VERSION);
|
||||
nla_put(msg, NL_CLASSIFIER_ATTR_TUPLE, sizeof(classifier_msg), &classifier_msg);
|
||||
|
||||
ret = nl_send_auto(inst->sock, msg);
|
||||
if (ret < 0) {
|
||||
printf("send netlink message failed.\n");
|
||||
nlmsg_free(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
nlmsg_free(msg);
|
||||
printf("nl classifier offload connection successful\n");
|
||||
}
|
||||
|
||||
int nl_classifier_init(struct nl_classifier_instance *inst)
|
||||
{
|
||||
int ret;
|
||||
|
||||
inst->sock = nl_socket_alloc();
|
||||
if (!inst->sock) {
|
||||
printf("Unable to allocation socket.\n");
|
||||
return -1;
|
||||
}
|
||||
genl_connect(inst->sock);
|
||||
|
||||
inst->family_id = genl_ctrl_resolve(inst->sock, NL_CLASSIFIER_GENL_FAMILY);
|
||||
if (inst->family_id < 0) {
|
||||
printf("Unable to resolve family %s\n", NL_CLASSIFIER_GENL_FAMILY);
|
||||
goto init_failed;
|
||||
}
|
||||
|
||||
inst->group_id = genl_ctrl_resolve_grp(inst->sock, NL_CLASSIFIER_GENL_FAMILY, NL_CLASSIFIER_GENL_GROUP);
|
||||
if (inst->group_id < 0) {
|
||||
printf("Unable to resolve mcast group %s\n", NL_CLASSIFIER_GENL_GROUP);
|
||||
goto init_failed;
|
||||
}
|
||||
|
||||
ret = nl_socket_add_membership(inst->sock, inst->group_id);
|
||||
if (ret < 0) {
|
||||
printf("Unable to add membership\n");
|
||||
goto init_failed;
|
||||
}
|
||||
|
||||
nl_socket_disable_seq_check(inst->sock);
|
||||
nl_socket_modify_cb(inst->sock, NL_CB_VALID, NL_CB_CUSTOM, nl_classifier_msg_recv, NULL);
|
||||
|
||||
printf("nl classifier init successful\n");
|
||||
return 0;
|
||||
|
||||
init_failed:
|
||||
if (inst->sock) {
|
||||
nl_close(inst->sock);
|
||||
nl_socket_free(inst->sock);
|
||||
inst->sock = NULL;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void nl_classifier_exit(struct nl_classifier_instance *inst)
|
||||
{
|
||||
if (inst->sock) {
|
||||
nl_close(inst->sock);
|
||||
nl_socket_free(inst->sock);
|
||||
inst->sock = NULL;
|
||||
}
|
||||
printf("nl classifier exit successful\n");
|
||||
}
|
||||
|
||||
int nl_classifier_parse_arg(int argc, char *argv[], unsigned char *proto, unsigned long *src_saddr,
|
||||
unsigned long *dst_saddr, unsigned short *sport, unsigned short *dport, int *af)
|
||||
{
|
||||
int ret;
|
||||
unsigned short port;
|
||||
|
||||
if (argc < 7) {
|
||||
printf("help: nl_classifier <v4|v6> <udp|tcp> <source ip> <destination ip> <source port> <destination port>\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (0 == strncmp(argv[1], "v4", 2)) {
|
||||
*af = AF_INET;
|
||||
} else if (0 == strncmp(argv[1], "v6", 2)) {
|
||||
*af = AF_INET6;
|
||||
} else {
|
||||
printf("Address family is not supported");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (0 == strncmp(argv[2], "udp", 3)) {
|
||||
*proto = IPPROTO_UDP;
|
||||
} else if (0 == strncmp(argv[2], "tcp", 3)) {
|
||||
*proto = IPPROTO_TCP;
|
||||
} else {
|
||||
printf("Protocol is not supported");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = inet_pton(*af, argv[3], src_saddr);
|
||||
if (ret <= 0) {
|
||||
printf("source ip has wrong format\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = inet_pton(*af, argv[4], dst_saddr);
|
||||
if (ret <= 0) {
|
||||
printf("destination ip has wrong format\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
port = strtol(argv[5], NULL, 0);
|
||||
*sport = htons(port);
|
||||
port = strtol(argv[6], NULL, 0);
|
||||
*dport = htons(port);
|
||||
|
||||
printf("nl classifier parse arguments successful\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct nl_classifier_instance *inst = &nl_cls_inst;
|
||||
unsigned char proto;
|
||||
unsigned long src_addr[4];
|
||||
unsigned long dst_addr[4];
|
||||
unsigned short sport;
|
||||
unsigned short dport;
|
||||
int af;
|
||||
int ret;
|
||||
|
||||
ret = nl_classifier_parse_arg(argc, argv, &proto, src_addr, dst_addr, &sport, &dport, &af);
|
||||
if (ret < 0) {
|
||||
printf("Failed to parse arguments\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = nl_classifier_init(inst);
|
||||
if (ret < 0) {
|
||||
printf("Unable to init generic netlink\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
nl_classifier_offload(inst, proto, src_addr, dst_addr, sport, dport, af);
|
||||
|
||||
/* main loop to listen on message */
|
||||
while (!inst->stop) {
|
||||
nl_recvmsgs_default(inst->sock);
|
||||
}
|
||||
|
||||
nl_classifier_exit(inst);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1,232 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2013,2016 The Linux Foundation. All rights reserved.
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
* above copyright notice and this permission notice appear in all copies.
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <netlink/genl/genl.h>
|
||||
#include <netlink/genl/ctrl.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <fast-classifier.h>
|
||||
|
||||
static struct nl_sock *sock;
|
||||
static struct nl_sock *sock_event;
|
||||
static int family;
|
||||
static int grp_id;
|
||||
|
||||
static struct nla_policy fast_classifier_genl_policy[FAST_CLASSIFIER_A_MAX + 1] = {
|
||||
[FAST_CLASSIFIER_A_TUPLE] = { .type = NLA_UNSPEC },
|
||||
};
|
||||
|
||||
void dump_fc_tuple(struct fast_classifier_tuple *fc_msg)
|
||||
{
|
||||
char src_str[INET_ADDRSTRLEN];
|
||||
char dst_str[INET_ADDRSTRLEN];
|
||||
|
||||
printf("TUPLE: %d, %s, %s, %d, %d"
|
||||
" SMAC=%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
" DMAC=%02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
fc_msg->proto,
|
||||
inet_ntop(AF_INET,
|
||||
&fc_msg->src_saddr.in.s_addr,
|
||||
src_str,
|
||||
INET_ADDRSTRLEN),
|
||||
inet_ntop(AF_INET,
|
||||
&fc_msg->dst_saddr.in.s_addr,
|
||||
dst_str,
|
||||
INET_ADDRSTRLEN),
|
||||
fc_msg->sport, fc_msg->dport,
|
||||
fc_msg->smac[0], fc_msg->smac[1], fc_msg->smac[2],
|
||||
fc_msg->smac[3], fc_msg->smac[4], fc_msg->smac[5],
|
||||
fc_msg->dmac[0], fc_msg->dmac[1], fc_msg->dmac[2],
|
||||
fc_msg->dmac[3], fc_msg->dmac[4], fc_msg->dmac[5]);
|
||||
}
|
||||
|
||||
static int parse_cb(struct nl_msg *msg, void *arg)
|
||||
{
|
||||
struct nlmsghdr *nlh = nlmsg_hdr(msg);
|
||||
struct genlmsghdr *gnlh = nlmsg_data(nlh);
|
||||
struct nlattr *attrs[FAST_CLASSIFIER_A_MAX];
|
||||
|
||||
genlmsg_parse(nlh, 0, attrs, FAST_CLASSIFIER_A_MAX, fast_classifier_genl_policy);
|
||||
|
||||
switch (gnlh->cmd) {
|
||||
case FAST_CLASSIFIER_C_OFFLOADED:
|
||||
printf("Got a offloaded message\n");
|
||||
dump_fc_tuple(nla_data(attrs[FAST_CLASSIFIER_A_TUPLE]));
|
||||
return NL_OK;
|
||||
case FAST_CLASSIFIER_C_DONE:
|
||||
printf("Got a done message\n");
|
||||
dump_fc_tuple(nla_data(attrs[FAST_CLASSIFIER_A_TUPLE]));
|
||||
return NL_OK;
|
||||
}
|
||||
|
||||
return NL_SKIP;
|
||||
}
|
||||
|
||||
int fast_classifier_init(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
sock = nl_socket_alloc();
|
||||
if (!sock) {
|
||||
printf("Unable to allocation socket.\n");
|
||||
return -1;
|
||||
}
|
||||
genl_connect(sock);
|
||||
|
||||
sock_event = nl_socket_alloc();
|
||||
if (!sock_event) {
|
||||
nl_close(sock);
|
||||
nl_socket_free(sock);
|
||||
printf("Unable to allocation socket.\n");
|
||||
return -1;
|
||||
}
|
||||
genl_connect(sock_event);
|
||||
|
||||
family = genl_ctrl_resolve(sock, FAST_CLASSIFIER_GENL_NAME);
|
||||
if (family < 0) {
|
||||
nl_close(sock_event);
|
||||
nl_close(sock);
|
||||
nl_socket_free(sock);
|
||||
nl_socket_free(sock_event);
|
||||
printf("Unable to resolve family\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
grp_id = genl_ctrl_resolve_grp(sock, FAST_CLASSIFIER_GENL_NAME,
|
||||
FAST_CLASSIFIER_GENL_MCGRP);
|
||||
if (grp_id < 0) {
|
||||
printf("Unable to resolve mcast group\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
err = nl_socket_add_membership(sock_event, grp_id);
|
||||
if (err < 0) {
|
||||
printf("Unable to add membership\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
nl_socket_disable_seq_check(sock_event);
|
||||
nl_socket_modify_cb(sock_event, NL_CB_VALID, NL_CB_CUSTOM, parse_cb, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void fast_classifier_close(void)
|
||||
{
|
||||
nl_close(sock_event);
|
||||
nl_close(sock);
|
||||
nl_socket_free(sock_event);
|
||||
nl_socket_free(sock);
|
||||
}
|
||||
|
||||
void fast_classifier_ipv4_offload(unsigned char proto, unsigned long src_saddr,
|
||||
unsigned long dst_saddr, unsigned short sport,
|
||||
unsigned short dport)
|
||||
{
|
||||
struct nl_msg *msg;
|
||||
int ret;
|
||||
#ifdef DEBUG
|
||||
char src_str[INET_ADDRSTRLEN];
|
||||
char dst_str[INET_ADDRSTRLEN];
|
||||
#endif
|
||||
struct fast_classifier_tuple fc_msg;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("DEBUG: would offload: %d, %s, %s, %d, %d\n", proto,
|
||||
inet_ntop(AF_INET, &src_saddr, src_str, INET_ADDRSTRLEN),
|
||||
inet_ntop(AF_INET, &dst_saddr, dst_str, INET_ADDRSTRLEN),
|
||||
sport, dport);
|
||||
#endif
|
||||
|
||||
fc_msg.proto = proto;
|
||||
fc_msg.src_saddr.in.s_addr = src_saddr;
|
||||
fc_msg.dst_saddr.in.s_addr = dst_saddr;
|
||||
fc_msg.sport = sport;
|
||||
fc_msg.dport = dport;
|
||||
fc_msg.smac[0] = 'a';
|
||||
fc_msg.smac[1] = 'b';
|
||||
fc_msg.smac[2] = 'c';
|
||||
fc_msg.smac[3] = 'd';
|
||||
fc_msg.smac[4] = 'e';
|
||||
fc_msg.smac[5] = 'f';
|
||||
fc_msg.dmac[0] = 'f';
|
||||
fc_msg.dmac[1] = 'e';
|
||||
fc_msg.dmac[2] = 'd';
|
||||
fc_msg.dmac[3] = 'c';
|
||||
fc_msg.dmac[4] = 'b';
|
||||
fc_msg.dmac[5] = 'a';
|
||||
|
||||
if (fast_classifier_init() < 0) {
|
||||
printf("Unable to init generic netlink\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
msg = nlmsg_alloc();
|
||||
if (!msg) {
|
||||
nl_socket_free(sock);
|
||||
printf("Unable to allocate message\n");
|
||||
return;
|
||||
}
|
||||
|
||||
genlmsg_put(msg, NL_AUTO_PID, NL_AUTO_SEQ, family,
|
||||
FAST_CLASSIFIER_GENL_HDRSIZE, NLM_F_REQUEST,
|
||||
FAST_CLASSIFIER_C_OFFLOAD, FAST_CLASSIFIER_GENL_VERSION);
|
||||
nla_put(msg, 1, sizeof(fc_msg), &fc_msg);
|
||||
|
||||
ret = nl_send_auto_complete(sock, msg);
|
||||
|
||||
nlmsg_free(msg);
|
||||
if (ret < 0) {
|
||||
printf("nlmsg_free failed");
|
||||
nl_close(sock);
|
||||
nl_socket_free(sock);
|
||||
return;
|
||||
}
|
||||
|
||||
ret = nl_wait_for_ack(sock);
|
||||
if (ret < 0) {
|
||||
printf("wait for ack failed");
|
||||
nl_close(sock);
|
||||
nl_socket_free(sock);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void fast_classifier_listen_for_messages(void)
|
||||
{
|
||||
printf("waiting for netlink events\n");
|
||||
|
||||
while (1) {
|
||||
nl_recvmsgs_default(sock_event);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if (fast_classifier_init() < 0) {
|
||||
printf("Unable to init generic netlink\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fast_classifier_ipv4_offload('a', 0, 0, 0, 0);
|
||||
|
||||
/* this never returns */
|
||||
fast_classifier_listen_for_messages();
|
||||
|
||||
fast_classifier_close();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1,68 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2019 Xingwang Liao
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=frp
|
||||
PKG_VERSION:=0.36.2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/fatedier/frp/tar.gz/v$(PKG_VERSION)?
|
||||
PKG_HASH:=b9dca438385ddbbcc4c7dade3d5e940e1b61b27dd45a012876eaaa41ec2da2a9
|
||||
|
||||
PKG_LICENSE:=Apache-2.0
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_MAINTAINER:=Xingwang Liao <kuoruan@gmail.com>
|
||||
|
||||
PKG_BUILD_DEPENDS:=golang/host
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
|
||||
GO_PKG:=github.com/fatedier/frp
|
||||
GO_PKG_BUILD_PKG:=github.com/fatedier/frp/cmd/...
|
||||
|
||||
GO_PKG_LDFLAGS:=-s -w
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
|
||||
|
||||
define frp/templates
|
||||
define Package/$(1)
|
||||
TITLE:=A fast reverse proxy ($(1))
|
||||
URL:=https://github.com/fatedier/frp
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Web Servers/Proxies
|
||||
DEPENDS:=$$(GO_ARCH_DEPENDS)
|
||||
endef
|
||||
|
||||
define Package/$(1)/description
|
||||
frp is a fast reverse proxy to help you expose a local server behind a NAT or firewall
|
||||
to the internet. As of now, it supports tcp & udp, as well as http and https protocols,
|
||||
where requests can be forwarded to internal services by domain name.
|
||||
|
||||
This package contains the $(1).
|
||||
endef
|
||||
|
||||
define Package/$(1)/install
|
||||
$$(call GoPackage/Package/Install/Bin,$$(PKG_INSTALL_DIR))
|
||||
|
||||
$$(INSTALL_DIR) $$(1)/usr/bin
|
||||
$$(INSTALL_BIN) $$(PKG_INSTALL_DIR)/usr/bin/$(1) $$(1)/usr/bin/
|
||||
|
||||
$(STAGING_DIR_HOST)/bin/upx --lzma --best $$(1)/usr/bin/$(1)
|
||||
endef
|
||||
endef
|
||||
|
||||
FRP_COMPONENTS:=frpc frps
|
||||
|
||||
$(foreach component,$(FRP_COMPONENTS), \
|
||||
$(eval $(call frp/templates,$(component))) \
|
||||
$(eval $(call GoBinPackage,$(component))) \
|
||||
$(eval $(call BuildPackage,$(component))) \
|
||||
)
|
||||
@ -1,54 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2020 Lean <coolsnowwolf@gmail.com>
|
||||
#
|
||||
# Copyright (C) 2021 ImmortalWrt
|
||||
# <https://immortalwrt.org>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=gmediarender
|
||||
PKG_VERSION:=0.0.8
|
||||
PKG_RELEASE=2
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/hzeller/gmrender-resurrect.git
|
||||
PKG_SOURCE_DATE:=2021-01-15
|
||||
PKG_SOURCE_VERSION:=7cd74525e89a1dcd8869b8f6f67f2565afa59abe
|
||||
PKG_MIRROR_HASH:=98514528690a6bcf0d6611c12f1dd498e795943085e916501f5442c19d98e162
|
||||
|
||||
PKG_REMOVE_FILES:=autogen.sh aclocal.m4
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/nls.mk
|
||||
|
||||
define Package/gmediarender
|
||||
SECTION:=multimedia
|
||||
CATEGORY:=Multimedia
|
||||
TITLE:=A Headless UPnP Renderer
|
||||
DEPENDS:=+glib2 +gstreamer1 +libgstreamer1 +gstreamer1-libs +libupnp
|
||||
endef
|
||||
|
||||
define Package/gmediarender/description
|
||||
gmediarender implements the server component that provides UPnP
|
||||
controllers a means to render media content (audio, video and images)
|
||||
from a UPnP media server.
|
||||
endef
|
||||
|
||||
CONFIGURE_ARGS+= \
|
||||
CFLAGS="$(TARGET_CFLAGS) -std=gnu99" \
|
||||
--with-build-cc="$(HOSTCC)" \
|
||||
--prefix="\usr"
|
||||
|
||||
define Package/gmediarender/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gmediarender $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,gmediarender))
|
||||
@ -1,41 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2015 Justin Liu
|
||||
# Author: Justin Liu <rssnsj@gmail.com>
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ipset-lists
|
||||
PKG_VERSION:=20181104
|
||||
PKG_RELEASE:=2
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ipset-lists
|
||||
CATEGORY:=Network
|
||||
TITLE:=Service for IPSET address tables
|
||||
MAINTAINER:=Justin Liu <rssnsj@gmail.com>
|
||||
DEPENDS:=+ipset
|
||||
endef
|
||||
|
||||
define Package/ipset-lists/conffiles
|
||||
/etc/gfwlist/china-banned
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
true
|
||||
endef
|
||||
|
||||
define Package/ipset-lists/install
|
||||
$(CP) files/* $(1)/
|
||||
endef
|
||||
|
||||
define Package/ipset-lists/postinst
|
||||
#!/bin/sh
|
||||
if [ -e /etc/openwrt_release ]; then
|
||||
/etc/init.d/ipset.sh restart
|
||||
/etc/init.d/ipset.sh enable || :
|
||||
fi
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ipset-lists))
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,95 +0,0 @@
|
||||
v.youku.com
|
||||
api.youku.com
|
||||
v2.tudou.com
|
||||
www.tudou.com
|
||||
s.plcloud.music.qq.com
|
||||
i.y.qq.com
|
||||
hot.vrs.sohu.com
|
||||
live.tv.sohu.com
|
||||
pad.tv.sohu.com
|
||||
my.tv.sohu.com
|
||||
hot.vrs.letv.com
|
||||
data.video.qiyi.com
|
||||
cache.video.qiyi.com
|
||||
cache.vip.qiyi.com
|
||||
vv.video.qq.com
|
||||
tt.video.qq.com
|
||||
ice.video.qq.com
|
||||
tjsa.video.qq.com
|
||||
a10.video.qq.com
|
||||
xyy.video.qq.com
|
||||
vcq.video.qq.com
|
||||
vsh.video.qq.com
|
||||
vbj.video.qq.com
|
||||
bobo.video.qq.com
|
||||
flvs.video.qq.com
|
||||
bkvv.video.qq.com
|
||||
info.zb.qq.com
|
||||
geo.js.kankan.xunlei.com
|
||||
web-play.pptv.com
|
||||
web-play.pplive.cn
|
||||
dyn.ugc.pps.tv
|
||||
v.pps.tv
|
||||
inner.kandian.com
|
||||
ipservice.163.com
|
||||
so.open.163.com
|
||||
zb.s.qq.com
|
||||
ip.kankan.xunlei.com
|
||||
vxml.56.com
|
||||
music.sina.com.cn
|
||||
play.baidu.com
|
||||
v.iask.com
|
||||
tv.weibo.com
|
||||
wtv.v.iask.com
|
||||
video.sina.com.cn
|
||||
www.yinyuetai.com
|
||||
api.letv.com
|
||||
live.gslb.letv.com
|
||||
static.itv.letv.com
|
||||
ip.apps.cntv.cn
|
||||
vdn.apps.cntv.cn
|
||||
vdn.live.cntv.cn
|
||||
vip.sports.cntv.cn
|
||||
a.play.api.3g.youku.com
|
||||
i.play.api.3g.youku.com
|
||||
api.3g.youku.com
|
||||
tv.api.3g.youku.com
|
||||
play.api.3g.youku.com
|
||||
play.api.3g.tudou.com
|
||||
tv.api.3g.tudou.com
|
||||
api.3g.tudou.com
|
||||
api.tv.sohu.com
|
||||
access.tv.sohu.com
|
||||
iface.iqiyi.com
|
||||
iface2.iqiyi.com
|
||||
cache.m.iqiyi.com
|
||||
dynamic.app.m.letv.com
|
||||
dynamic.meizi.app.m.letv.com
|
||||
dynamic.search.app.m.letv.com
|
||||
dynamic.live.app.m.letv.com
|
||||
listso.m.areainfo.ppstream.com
|
||||
epg.api.pptv.com
|
||||
play.api.pptv.com
|
||||
m.letv.com
|
||||
interface.bilibili.com
|
||||
3g.music.qq.com
|
||||
mqqplayer.3g.qq.com
|
||||
proxy.music.qq.com
|
||||
proxymc.qq.com
|
||||
ip2.kugou.com
|
||||
ip.kugou.com
|
||||
client.api.ttpod.com
|
||||
mobi.kuwo.cn
|
||||
mobilefeedback.kugou.com
|
||||
tingapi.ting.baidu.com
|
||||
music.baidu.com
|
||||
serviceinfo.sdk.duomi.com
|
||||
music.163.com
|
||||
www.xiami.com
|
||||
spark.api.xiami.com
|
||||
iplocation.geo.qiyi.com
|
||||
sns.video.qq.com
|
||||
v5.pc.duomi.com
|
||||
tms.is.ysten.com
|
||||
internal.check.duokanbox.com
|
||||
openapi.youku.com
|
||||
@ -1,28 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2014 Justin Liu <rssnsj@gmail.com>
|
||||
|
||||
START=21
|
||||
|
||||
start()
|
||||
{
|
||||
local file
|
||||
for file in /etc/ipset/*; do
|
||||
[ -f $file ] || continue
|
||||
ipset restore < $file
|
||||
done
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
local file
|
||||
for file in /etc/ipset/*; do
|
||||
[ -f $file ] || continue
|
||||
ipset destroy `basename $file`
|
||||
done
|
||||
}
|
||||
|
||||
restart()
|
||||
{
|
||||
stop >/dev/null 2>&1
|
||||
start
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,6 +0,0 @@
|
||||
create local hash:net family inet hashsize 1024 maxelem 65536
|
||||
add local 10.0.0.0/8
|
||||
add local 127.0.0.0/8
|
||||
add local 172.16.0.0/12
|
||||
add local 192.168.0.0/16
|
||||
add local 224.0.0.0/3
|
||||
@ -1,8 +0,0 @@
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=UTF-8"
|
||||
|
||||
msgid "Domain Lists Settings"
|
||||
msgstr "域名列表设置"
|
||||
|
||||
msgid "Domain Lists"
|
||||
msgstr "域名列表"
|
||||
@ -1,3 +0,0 @@
|
||||
update:
|
||||
./gen-china-routes.sh > ../files/etc/ipset/china
|
||||
./gen-gfwlist.sh > ../files/etc/gfwlist/china-banned
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,83 +0,0 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
#
|
||||
# Script for generating China IPv4 route table by merging APNIC.net data and IPIP.net data
|
||||
#
|
||||
|
||||
china_routes_ipip()
|
||||
{
|
||||
[ -f ipip.txt ] || wget -4 https://cdn.jsdelivr.net/gh/17mon/china_ip_list/china_ip_list.txt -O ipip.txt >&2 || exit 1
|
||||
cat ipip.txt | xargs netmask | awk '{print $1}'
|
||||
}
|
||||
|
||||
china_routes_apnic()
|
||||
{
|
||||
[ -f apnic.txt ] || wget -4 http://ftp.apnic.net/stats/apnic/delegated-apnic-latest -O apnic.txt >&2 || exit 1
|
||||
|
||||
cat apnic.txt | awk -F'|' -vc=CN '
|
||||
function tobits(c) { for(n=0; c>=2; c/=2) n++; return 32-n; }
|
||||
$2==c&&$3=="ipv4" { printf("%s/%d\n", $4, tobits($5)) }' |
|
||||
xargs netmask | awk '{print $1}'
|
||||
}
|
||||
|
||||
china_routes_merged()
|
||||
{
|
||||
[ -x ./ipv4-merger ] || gcc ipv4_merger.c -o ipv4-merger >&2
|
||||
|
||||
china_routes_apnic > china.apnic
|
||||
china_routes_ipip > china.ipip
|
||||
|
||||
# Merge them together
|
||||
cat china.apnic china.ipip | ./ipv4-merger | sed 's/\-/:/g' |
|
||||
xargs netmask | awk '{print $1}' | awk -F/ '$2<=24' > china.merged
|
||||
|
||||
cat china.merged
|
||||
}
|
||||
|
||||
# $1: ipset name
|
||||
convert_routes_to_ipset()
|
||||
{
|
||||
local ipset_name="$1"
|
||||
echo "create $ipset_name hash:net family inet hashsize 1024 maxelem 65536"
|
||||
awk -vt="$ipset_name" '{ printf("add %s %s\n", t, $0) }'
|
||||
}
|
||||
|
||||
generate_china_ipset()
|
||||
{
|
||||
china_routes_merged | convert_routes_to_ipset china
|
||||
}
|
||||
|
||||
generate_inverted_china_routes()
|
||||
{
|
||||
(
|
||||
china_routes_merged
|
||||
echo 0.0.0.0/8 10.0.0.0/8 100.64.0.0/10 127.0.0.0/8 172.16.0.0/12 192.168.0.0/16 224.0.0.0/3
|
||||
) |
|
||||
xargs netmask -r | awk '{print $1}' |
|
||||
awk -F- '
|
||||
function iptoint(ip) { split(ip,arr,"."); n=0; for(i=1;i<=4;i++) n=n*256+arr[i]; return n; }
|
||||
function inttoip(n) { a=int(n/16777216); b=int(n%16777216/65536); c=int(n%65536/256); d=n%256; return a "." b "." c "." d; }
|
||||
BEGIN { st=0 }
|
||||
{ x=st; y=iptoint($1); st=iptoint($2)+1; if(y>x) { print inttoip(x) ":" inttoip(y-1); } }' |
|
||||
xargs netmask | awk '{print $1}'
|
||||
}
|
||||
|
||||
##
|
||||
case "$1" in
|
||||
"")
|
||||
generate_china_ipset
|
||||
;;
|
||||
-c)
|
||||
china_routes_merged
|
||||
;;
|
||||
-r)
|
||||
generate_inverted_china_routes
|
||||
;;
|
||||
*)
|
||||
echo "Usage:"
|
||||
echo " $0 generate China routes in ipset format"
|
||||
echo " $0 -c generate China routes in IP/prefix format"
|
||||
echo " $0 -r generate invert China routes"
|
||||
;;
|
||||
*)
|
||||
esac
|
||||
@ -1,27 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
generate_china_banned()
|
||||
{
|
||||
if [ ! -f gfwlist.txt ]; then
|
||||
wget https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt -O gfwlist.b64 >&2
|
||||
cat gfwlist.b64 | base64 -d > gfwlist.txt
|
||||
rm -f gfwlist.b64
|
||||
fi
|
||||
|
||||
cat gfwlist.txt base-gfwlist.txt | sort -u |
|
||||
sed 's#!.\+##; s#|##g; s#@##g; s#http:\/\/##; s#https:\/\/##;' |
|
||||
sed '/\*/d; /apple\.com/d; /sina\.cn/d; /sina\.com\.cn/d; /baidu\.com/d; /qq\.com/d' |
|
||||
sed '/^[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+$/d' |
|
||||
grep '^[0-9a-zA-Z\.-]\+$' | grep '\.' | sed 's#^\.\+##' | rev | sort -u |
|
||||
awk '
|
||||
BEGIN { prev = "________"; } {
|
||||
cur = $0;
|
||||
if (index(cur, prev) == 1 && substr(cur, 1 + length(prev) ,1) == ".") {
|
||||
} else {
|
||||
print cur;
|
||||
prev = cur;
|
||||
}
|
||||
}' | rev | sort -u
|
||||
}
|
||||
|
||||
generate_china_banned
|
||||
@ -1,338 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
typedef u_int32_t u32;
|
||||
typedef int bool;
|
||||
#define true 1
|
||||
#define false 0
|
||||
typedef unsigned gfp_t;
|
||||
|
||||
static inline char *ipv4_hltos(u32 u, char *s)
|
||||
{
|
||||
static char ss[20];
|
||||
if (!s)
|
||||
s = ss;
|
||||
sprintf(s, "%d.%d.%d.%d",
|
||||
(int)(u >> 24) & 0xff, (int)(u >> 16) & 0xff,
|
||||
(int)(u >> 8) & 0xff, (int)u & 0xff );
|
||||
return s;
|
||||
}
|
||||
|
||||
static inline u32 ipv4_stohl(const char *s)
|
||||
{
|
||||
int u[4];
|
||||
if (sscanf(s, "%d.%d.%d.%d", &u[0], &u[1], &u[2], &u[3]) == 4) {
|
||||
return (((u32)u[0] & 0xff) << 24) |
|
||||
(((u32)u[1] & 0xff) << 16) |
|
||||
(((u32)u[2] & 0xff) << 8) |
|
||||
(((u32)u[3] & 0xff));
|
||||
} else
|
||||
return 0xffffffff;
|
||||
}
|
||||
|
||||
static inline bool is_ipv4_addr(const char *s)
|
||||
{
|
||||
int u[4];
|
||||
if (sscanf(s, "%d.%d.%d.%d", &u[0], &u[1], &u[2], &u[3]) == 4)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
struct ipv4_range {
|
||||
u32 start;
|
||||
u32 end;
|
||||
};
|
||||
|
||||
struct sa_open_data {
|
||||
struct ipv4_range *tmp_base;
|
||||
size_t tmp_size;
|
||||
size_t tmp_length;
|
||||
int errors;
|
||||
};
|
||||
|
||||
static int __touch_tmp_base(struct sa_open_data *od, gfp_t gfp)
|
||||
{
|
||||
if (!od->tmp_base) {
|
||||
/**
|
||||
* Allocate a temporary table with twice the size of the previous
|
||||
* table or at least 100, on which new entries can be inserted.
|
||||
*/
|
||||
if (od->tmp_size < 100)
|
||||
od->tmp_size = 100;
|
||||
od->tmp_base = (struct ipv4_range *)malloc(
|
||||
sizeof(struct ipv4_range) * od->tmp_size /*, gfp*/ );
|
||||
if (!od->tmp_base) {
|
||||
fprintf(stderr,
|
||||
"salist: cannot allocate the temporary list for enlarging it.\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
od->tmp_length = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ipv4_list_add_range(struct sa_open_data *od, u32 start,
|
||||
u32 end, gfp_t gfp)
|
||||
{
|
||||
struct ipv4_range *cur;
|
||||
int ret;
|
||||
|
||||
/* Ignore a new range if it or a larger range already exists */
|
||||
//if (salist_check_ipv4(od->table, start, end))
|
||||
// return 0;
|
||||
|
||||
if ((ret = __touch_tmp_base(od, gfp)) < 0)
|
||||
return ret;
|
||||
|
||||
/* Check if the size is efficient. Enlarge it if needed. */
|
||||
if (od->tmp_length + 1 >= od->tmp_size) {
|
||||
size_t old_size = od->tmp_size;
|
||||
struct ipv4_range *old_base = od->tmp_base;
|
||||
|
||||
od->tmp_size *= 2;
|
||||
od->tmp_base = (struct ipv4_range *)realloc(od->tmp_base,
|
||||
sizeof(struct ipv4_range) * od->tmp_size);
|
||||
if (!od->tmp_base) {
|
||||
od->tmp_size = old_size;
|
||||
od->tmp_base = old_base;
|
||||
return -ENOMEM;
|
||||
}
|
||||
}
|
||||
|
||||
cur = &od->tmp_base[od->tmp_length++];
|
||||
cur->start = start;
|
||||
cur->end = end;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int ipv4_list_add_netmask(struct sa_open_data *od,
|
||||
u32 net, u32 net_mask, gfp_t gfp)
|
||||
{
|
||||
u32 start = net & net_mask;
|
||||
u32 end = net | ~net_mask;
|
||||
|
||||
return ipv4_list_add_range(od, start, end, gfp);
|
||||
}
|
||||
|
||||
static int ipv4_list_add_net(struct sa_open_data *od, u32 net,
|
||||
int net_bits, gfp_t gfp)
|
||||
{
|
||||
u32 net_mask;
|
||||
|
||||
if(net_bits == 0)
|
||||
net_mask = 0x00000000;
|
||||
else
|
||||
net_mask = ~(((u32)1 << (32 - net_bits)) - 1);
|
||||
//printf("%d: %08x, %08x\n", net_bits, net_mask, net_size);
|
||||
|
||||
return ipv4_list_add_netmask(od, net, net_mask, gfp);
|
||||
}
|
||||
|
||||
static int salist_cmd_parse(struct sa_open_data *od, char *cmd, gfp_t gfp)
|
||||
{
|
||||
char *a1 = NULL, *a2 = NULL;
|
||||
char *sep;
|
||||
char sc;
|
||||
int n = 32;
|
||||
|
||||
/* Case 3: Append an item */
|
||||
|
||||
/* Check IP description part: network segment or range? */
|
||||
if ((sep = strchr(cmd, '/'))) { }
|
||||
else if ((sep = strchr(cmd, '-'))) { }
|
||||
else if ((sep = strchr(cmd, ':'))) { }
|
||||
|
||||
if (sep) {
|
||||
/* Describes a subnet or range. */
|
||||
sc = *sep;
|
||||
*sep = '\0';
|
||||
|
||||
a1 = cmd;
|
||||
a2 = sep + 1;
|
||||
|
||||
if (*a2 == '\0') {
|
||||
fprintf(stderr, "Nothing after '%c'.\n", sc);
|
||||
return -EINVAL;
|
||||
}
|
||||
} else {
|
||||
/* Describes a single IP. */
|
||||
sc = '\0';
|
||||
a1 = cmd;
|
||||
}
|
||||
|
||||
switch (sc) {
|
||||
case '/':
|
||||
/* 10.10.20.0/24 */
|
||||
/* ------------------------------------ */
|
||||
if (is_ipv4_addr(a2)) {
|
||||
ipv4_list_add_netmask(od, ipv4_stohl(a1), ipv4_stohl(a2), gfp);
|
||||
} else {
|
||||
sscanf(a2, "%d", &n);
|
||||
ipv4_list_add_net(od, ipv4_stohl(a1), n, gfp);
|
||||
}
|
||||
/* ------------------------------------ */
|
||||
break;
|
||||
case ':':
|
||||
case '-':
|
||||
/* 10.10.20.0-10.20.0.255 */
|
||||
/* ------------------------------------ */
|
||||
ipv4_list_add_range(od, ipv4_stohl(a1), ipv4_stohl(a2), gfp);
|
||||
/* ------------------------------------ */
|
||||
break;
|
||||
default:
|
||||
if (is_ipv4_addr(a1)) {
|
||||
/* Single IP address. */
|
||||
u32 ip = ipv4_stohl(a1);
|
||||
/* ------------------------------------ */
|
||||
ipv4_list_add_range(od, ip, ip, gfp);
|
||||
/* ------------------------------------ */
|
||||
} else {
|
||||
fprintf(stderr, "Invalid IP address '%s'.\n", a1);
|
||||
return -EINVAL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ipv4_range_sort_cmp(const void *a, const void *b)
|
||||
{
|
||||
struct ipv4_range *ra = (struct ipv4_range *)a;
|
||||
struct ipv4_range *rb = (struct ipv4_range *)b;
|
||||
|
||||
if (ra->start > rb->start) {
|
||||
return 1;
|
||||
} else if (ra->start < rb->start) {
|
||||
return -1;
|
||||
} else if (ra->end > rb->end) {
|
||||
return 1;
|
||||
} else if (ra->end < rb->end) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void ipv4_range_swap(void *a, void *b, int size)
|
||||
{
|
||||
struct ipv4_range *ra = (struct ipv4_range *)a;
|
||||
struct ipv4_range *rb = (struct ipv4_range *)b;
|
||||
struct ipv4_range tmp;
|
||||
tmp = *ra;
|
||||
*ra = *rb;
|
||||
*rb = tmp;
|
||||
}
|
||||
|
||||
static struct sa_open_data *salist_open(void)
|
||||
{
|
||||
struct sa_open_data *od = NULL;
|
||||
|
||||
od = (struct sa_open_data *)malloc(sizeof(*od));
|
||||
if (!od) {
|
||||
fprintf(stderr, "salist: cannot allocate sa_open_data.\n");
|
||||
return NULL;
|
||||
}
|
||||
memset(od, 0, sizeof(*od));
|
||||
od->errors = 0;
|
||||
|
||||
return od;
|
||||
}
|
||||
|
||||
static int salist_close(struct sa_open_data *od)
|
||||
{
|
||||
size_t ri, wi;
|
||||
struct ipv4_range *old_base;
|
||||
|
||||
/* Flush the table if any modification has been done */
|
||||
if (od->tmp_base) {
|
||||
/* Sort the table and merge entries as many as possible. */
|
||||
if (od->tmp_length >= 2) {
|
||||
qsort(od->tmp_base, od->tmp_length, sizeof(struct ipv4_range),
|
||||
ipv4_range_sort_cmp);
|
||||
|
||||
for (wi = 0, ri = 1; ri < od->tmp_length; ri++) {
|
||||
/* NOTICE: 0xffffffff + 1 ? */
|
||||
if (od->tmp_base[wi].end == (u32)(-1)) {
|
||||
/* Nothing */
|
||||
} else if (od->tmp_base[ri].start <= od->tmp_base[wi].end + 1) {
|
||||
/* The two ranges overlap, so merge the 2nd to the 1st one */
|
||||
if (od->tmp_base[ri].end > od->tmp_base[wi].end)
|
||||
od->tmp_base[wi].end = od->tmp_base[ri].end;
|
||||
} else {
|
||||
wi++;
|
||||
if (wi < ri)
|
||||
od->tmp_base[wi] = od->tmp_base[ri];
|
||||
}
|
||||
}
|
||||
|
||||
od->tmp_length = wi + 1;
|
||||
}
|
||||
|
||||
/* Reduce the size */
|
||||
if (od->tmp_length < od->tmp_size) {
|
||||
struct ipv4_range *__tmp = od->tmp_base;
|
||||
od->tmp_base = (struct ipv4_range *)malloc(
|
||||
sizeof(struct ipv4_range) * (od->tmp_length ? od->tmp_length : 1));
|
||||
if (od->tmp_base) {
|
||||
memcpy(od->tmp_base, __tmp,
|
||||
sizeof(struct ipv4_range) * od->tmp_length);
|
||||
free(__tmp);
|
||||
} else {
|
||||
fprintf(stderr, "[%s:%d] Failed to allocate temporary table.\n",
|
||||
__FUNCTION__, __LINE__);
|
||||
/* If failed to allocate new memory, do not reduce it. */
|
||||
od->tmp_base = __tmp;
|
||||
}
|
||||
}
|
||||
|
||||
/* Dump the table instead */
|
||||
}
|
||||
|
||||
if (od->errors) {
|
||||
fprintf(stderr, "[%s] %d errors detected during table operation.\n",
|
||||
__FUNCTION__, od->errors);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void sa_open_data_dump(struct sa_open_data *od)
|
||||
{
|
||||
size_t i;
|
||||
char s1[20], s2[20];
|
||||
|
||||
for (i = 0; i < od->tmp_length; i++) {
|
||||
printf("%s-%s\n", ipv4_hltos(od->tmp_base[i].start, s1),
|
||||
ipv4_hltos(od->tmp_base[i].end, s2));
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct sa_open_data *od;
|
||||
char lbuf[128];
|
||||
|
||||
od = salist_open();
|
||||
|
||||
while (fgets(lbuf, sizeof(lbuf), stdin)) {
|
||||
size_t llen = strlen(lbuf);
|
||||
if (llen > 0 && lbuf[llen - 1] == '\n')
|
||||
lbuf[--llen] = '\0';
|
||||
if (llen > 0 && lbuf[llen - 1] == '\r')
|
||||
lbuf[--llen] = '\0';
|
||||
if (llen == 0)
|
||||
continue;
|
||||
salist_cmd_parse(od, lbuf, 0);
|
||||
}
|
||||
|
||||
salist_close(od);
|
||||
|
||||
sa_open_data_dump(od);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1,45 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2015 OpenWrt-dist
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ipv6helper
|
||||
PKG_VERSION:=1.0
|
||||
PKG_RELEASE:=4
|
||||
|
||||
PKG_LICENSE:=GPLv3
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_MAINTAINER:=LEAN
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ipv6helper
|
||||
SECTION:=ipv6
|
||||
TITLE:=IPv6 Helper and Dynamic Update he.net of ip
|
||||
DEPENDS:=+luci-proto-ipv6 +wget-ssl +libip6tc +ip6tables +ip6tables-mod-nat \
|
||||
+kmod-ipt-nat6 +kmod-nf-nat6 +odhcpd-ipv6only +odhcp6c +6in4
|
||||
PKGARCH:=all
|
||||
endef
|
||||
|
||||
define Package/ipv6helper/description
|
||||
IPv6 Helper and Dynamic Update he.net of ip
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
true
|
||||
endef
|
||||
|
||||
define Package/ipv6helper/install
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
|
||||
$(INSTALL_BIN) ./files/60-6in4 $(1)/etc/hotplug.d/iface/60-6in4
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/60-ipv6-hybrid $(1)/etc/uci-defaults/60-ipv6-hybrid
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ipv6helper))
|
||||
@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
. /lib/functions.sh
|
||||
if [ "$ACTION" != "ifup" ]; then
|
||||
exit
|
||||
fi
|
||||
config_load network
|
||||
config_get tunnelid $INTERFACE tunnelid
|
||||
config_get username $INTERFACE username
|
||||
config_get password $INTERFACE password
|
||||
if [ "$tunnelid" != "" ]; then
|
||||
wget -O - https://$username:$password@ipv4.tunnelbroker.net/nic/update?hostname=$tunnelid --no-check-certificate
|
||||
fi
|
||||
@ -1,9 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci set dhcp.lan.ra='hybrid'
|
||||
uci set dhcp.lan.ndp='hybrid'
|
||||
uci set dhcp.lan.dhcpv6='hybrid'
|
||||
uci set dhcp.lan.ra_management='1'
|
||||
uci commit dhcp
|
||||
|
||||
exit 0
|
||||
@ -1,67 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2019 Xingwang Liao
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=kcptun
|
||||
PKG_VERSION:=20210103
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/xtaci/kcptun/tar.gz/v$(PKG_VERSION)?
|
||||
PKG_HASH:=0821b61b92041b764a1d621f750c1c693d913eed43051d3c109bd303d8f02472
|
||||
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=LICENSE.md
|
||||
PKG_MAINTAINER:=Xingwang Liao <kuoruan@gmail.com>
|
||||
|
||||
PKG_BUILD_DEPENDS:=golang/host
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
|
||||
GO_PKG:=github.com/xtaci/kcptun
|
||||
|
||||
GO_PKG_LDFLAGS:=-s -w -X 'main.VERSION=$(PKG_VERSION)-$(PKG_RELEASE) for OpenWrt'
|
||||
|
||||
# Can't use GO_PKG_LDFLAGS_X to define X args with space
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
|
||||
|
||||
define Package/kcptun/Default
|
||||
define Package/kcptun-$(1)
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Web Servers/Proxies
|
||||
DEPENDS:=$$(GO_ARCH_DEPENDS)
|
||||
TITLE:=Simple UDP Tunnel Based On KCP ($1)
|
||||
URL:=https://github.com/xtaci/kcptun
|
||||
endef
|
||||
|
||||
define Package/kcptun-$(1)/description
|
||||
A Stable & Secure Tunnel Based On KCP with N:M Multiplexing.
|
||||
|
||||
This package contains the kcptun $(1).
|
||||
endef
|
||||
|
||||
define Package/kcptun-$(1)/install
|
||||
$$(call GoPackage/Package/Install/Bin,$$(PKG_INSTALL_DIR))
|
||||
|
||||
$(STAGING_DIR_HOST)/bin/upx --lzma --best $$(PKG_INSTALL_DIR)/usr/bin/$(1)
|
||||
|
||||
$$(INSTALL_DIR) $$(1)/usr/bin
|
||||
$$(INSTALL_BIN) $$(PKG_INSTALL_DIR)/usr/bin/$(1) $$(1)/usr/bin/kcptun-$(1)
|
||||
endef
|
||||
endef
|
||||
|
||||
KCPTUN_COMPONENTS:=client server
|
||||
|
||||
$(foreach component,$(KCPTUN_COMPONENTS), \
|
||||
$(eval $(call Package/kcptun/Default,$(component))) \
|
||||
$(eval $(call GoBinPackage,kcptun-$(component))) \
|
||||
$(eval $(call BuildPackage,kcptun-$(component))) \
|
||||
)
|
||||
@ -1,58 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2021 ImmortalWrt
|
||||
# <https://immortalwrt.org>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libcryptopp
|
||||
PKG_VERSION:=8.3.0
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE:=cryptopp$(subst .,,$(PKG_VERSION)).zip
|
||||
PKG_SOURCE_URL:=https://www.cryptopp.com/
|
||||
PKG_HASH:=db38a15a6b1c337c665e2ebeb731dd0754b05e45504897d0f2fe4ae9f5ee589a
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
UNZIP_CMD:=unzip -q -d $(PKG_BUILD_DIR) $(DL_DIR)/$(PKG_SOURCE)
|
||||
|
||||
define Package/libcryptopp
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=Crypto++ is library for creating C++ programs which use cryptographic algorithms
|
||||
URL:=https://packages.debian.org/sid/libcrypto++-dev
|
||||
DEPENDS:=+libpthread +libstdcpp
|
||||
endef
|
||||
|
||||
define Package/package/libcryptopp
|
||||
Crypto++ is library for creating C++ programs which use cryptographic algorithms.
|
||||
The library uses a Pipes & Filters architecture with heavy use of templates and
|
||||
abstract base classes.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
$(Build/Prepare/Default)
|
||||
cd $(PKG_BUILD_DIR); rm -f GNUmakefile GNUmakefile-cross
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include/cryptopp
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/cryptopp/* $(1)/usr/include/cryptopp/
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libcryptopp.{a,so*} $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/libcryptopp/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libcryptopp.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,libcryptopp))
|
||||
@ -1,592 +0,0 @@
|
||||
## Makefile.am - Autotools configuration file for Crypto++.
|
||||
## written and placed in public domain by Jeffrey Walton.
|
||||
## based on Debian Makefile.am by László Böszörményi.
|
||||
##
|
||||
## The GNUmakefile can generate the list of lib headers, lib sources,
|
||||
## test headers and test sources. Generate the list of files with
|
||||
## 'make sources'. Remove the SIMD files for libothers_la_SOURCES.
|
||||
## Thanks to steeldriver on U&L.SE for help with the sed.
|
||||
##
|
||||
## make sources | sed 's|cryptlib.cpp cpu.cpp integer.cpp ||g' | \
|
||||
## sed -e 's|[[:alnum:]]*_simd.cpp ||g' | \
|
||||
## sed -e 's|[[:alnum:]]*_sse.cpp ||g' | \
|
||||
## sed -e 's|[[:alnum:]]*_avx.cpp ||g' | \
|
||||
## sed -e 's|[[:alnum:]]*_armv4.cpp ||g' | \
|
||||
## sed -e 's|ppc_power[[:alnum:]]*.cpp ||g' | \
|
||||
## fold -s -w 72
|
||||
##
|
||||
## The command `make sources | sed ... | fold` will create the source file
|
||||
## list that can be used with `libothers_la_SOURCES` below.
|
||||
##
|
||||
## The list of header files can be built with 'make sources', too.
|
||||
##
|
||||
## make sources | sed -e 's|[[:alnum:]]*_armv4.h ||g' \
|
||||
## fold -s -w 72
|
||||
##
|
||||
## Note: configure.ac deletes GNUmakefile. You can get it back with:
|
||||
##
|
||||
## git checkout GNUmakefile
|
||||
##
|
||||
|
||||
## Automake does not support "specific flags for certain source files"
|
||||
## natively, so we hack it. The hack include building 20 or so
|
||||
## libraries and then combining them into an archive or shared object.
|
||||
## Also see https://lists.gnu.org/archive/html/automake/2017-11/msg00000.html
|
||||
## https://www.gnu.org/software/automake/manual/html_node/Per_002dObject-Flags.html.
|
||||
##
|
||||
## Visit the link below for the original Debian Autotools files
|
||||
## https://sources.debian.net/src/libcrypto++/5.6.4-8/debian/autotools/
|
||||
##
|
||||
|
||||
## TODO:
|
||||
##
|
||||
## - Figure out how to include TestPrograms/ in the dist tarball
|
||||
## TestPrograms/ is unique because it is included in dist tarball but not installed
|
||||
##
|
||||
## - Figure out what's going on with DragonFly and dependencies
|
||||
##
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
AM_DEFAULT_SOURCE_EXT = .cpp
|
||||
|
||||
## libcryptopp.la is created from disjoint libraries due to object file
|
||||
## ordering and per-object file flags requirements. libcryptopp.la is
|
||||
## named as the primary library, and the object files with special needs
|
||||
## are listed as EXTRA_LTLIBRARIES. Also see
|
||||
## https://lists.gnu.org/archive/html/automake/2017-11/msg00000.html.
|
||||
|
||||
lib_LTLIBRARIES = \
|
||||
libcryptopp.la
|
||||
|
||||
EXTRA_LTLIBRARIES = \
|
||||
libcryptlib.la \
|
||||
libcpu.la \
|
||||
libinteger.la \
|
||||
libaria_simd.la \
|
||||
libblake2s_simd.la \
|
||||
libblake2b_simd.la \
|
||||
libchacha_simd.la \
|
||||
libchacha_avx.la \
|
||||
libcham_simd.la \
|
||||
libcrc_simd.la \
|
||||
libdonna_sse.la \
|
||||
libgcm_simd.la \
|
||||
libgf2n_simd.la \
|
||||
libkeccak_simd.la \
|
||||
liblea_simd.la \
|
||||
libneon_simd.la \
|
||||
libppc_simd.la \
|
||||
libppc_power7.la \
|
||||
libppc_power8.la \
|
||||
libppc_power9.la \
|
||||
librijndael_simd.la \
|
||||
libsha_simd.la \
|
||||
libshacal2_simd.la \
|
||||
libsimon128_simd.la \
|
||||
libspeck128_simd.la \
|
||||
libsm4_simd.la \
|
||||
libsse_simd.la
|
||||
|
||||
## ARMv7-a AES and SHA by Andy Polyakov
|
||||
if CRYPTOGAMS_ARM_SOURCES
|
||||
EXTRA_LTLIBRARIES += libaes_armv4.la
|
||||
EXTRA_LTLIBRARIES += libsha1_armv4.la
|
||||
EXTRA_LTLIBRARIES += libsha256_armv4.la
|
||||
EXTRA_LTLIBRARIES += libsha512_armv4.la
|
||||
endif
|
||||
|
||||
## The remainder of the source files
|
||||
EXTRA_LTLIBRARIES += libothers.la
|
||||
|
||||
## libcryptopp_la_SOURCES is empty because we need to create the library
|
||||
## artifact from disjoint libraries due to object file ordering and
|
||||
## per-object file flags requriements. Actually, the adhoc.cpp file is
|
||||
## due to an automake issue of assuming C sources when the list is empty.
|
||||
## https://lists.gnu.org/archive/html/automake/2017-11/msg00000.html.
|
||||
|
||||
libcryptopp_la_SOURCES = \
|
||||
adhoc.cpp
|
||||
|
||||
## Don't use EXTRA_ prefix for libcryptopp_la_LIBADD. It breaks Solaris.
|
||||
|
||||
libcryptopp_la_LIBADD = \
|
||||
$(libcryptlib_la_OBJECTS) \
|
||||
$(libcpu_la_OBJECTS) \
|
||||
$(libinteger_la_OBJECTS) \
|
||||
$(libaria_simd_la_OBJECTS) \
|
||||
$(libblake2s_simd_la_OBJECTS) \
|
||||
$(libblake2b_simd_la_OBJECTS) \
|
||||
$(libchacha_simd_la_OBJECTS) \
|
||||
$(libchacha_avx_la_OBJECTS) \
|
||||
$(libcham_simd_la_OBJECTS) \
|
||||
$(libcrc_simd_la_OBJECTS) \
|
||||
$(libdonna_sse_la_OBJECTS) \
|
||||
$(libgcm_simd_la_OBJECTS) \
|
||||
$(libgf2n_simd_la_OBJECTS) \
|
||||
$(libkeccak_simd_la_OBJECTS) \
|
||||
$(liblea_simd_la_OBJECTS) \
|
||||
$(libneon_simd_la_OBJECTS) \
|
||||
$(libppc_simd_la_OBJECTS) \
|
||||
$(libppc_power7_la_OBJECTS) \
|
||||
$(libppc_power8_la_OBJECTS) \
|
||||
$(libppc_power9_la_OBJECTS) \
|
||||
$(librijndael_simd_la_OBJECTS) \
|
||||
$(libsha_simd_la_OBJECTS) \
|
||||
$(libshacal2_simd_la_OBJECTS) \
|
||||
$(libsimon128_simd_la_OBJECTS) \
|
||||
$(libspeck128_simd_la_OBJECTS) \
|
||||
$(libsm4_simd_la_OBJECTS) \
|
||||
$(libsse_simd_la_OBJECTS)
|
||||
|
||||
## ARMv7-a AES and SHA by Andy Polyakov
|
||||
if CRYPTOGAMS_ARM_SOURCES
|
||||
libcryptopp_la_LIBADD += $(libaes_armv4_la_OBJECTS)
|
||||
libcryptopp_la_LIBADD += $(libsha1_armv4_la_OBJECTS)
|
||||
libcryptopp_la_LIBADD += $(libsha256_armv4_la_OBJECTS)
|
||||
libcryptopp_la_LIBADD += $(libsha512_armv4_la_OBJECTS)
|
||||
endif
|
||||
|
||||
## cpufeatures library on Android
|
||||
if ANDROID_CPU_FEATURES
|
||||
libcryptopp_la_LIBADD += $(libcpu_features_la_OBJECTS)
|
||||
endif
|
||||
|
||||
## The remainder of the object files
|
||||
libcryptopp_la_LIBADD += $(libothers_la_OBJECTS)
|
||||
|
||||
## Don't use EXTRA_ prefix for libcryptopp_la_DEPENDENCIES. It breaks Solaris.
|
||||
|
||||
libcryptopp_la_DEPENDENCIES = \
|
||||
$(libcryptlib_la_OBJECTS) \
|
||||
$(libcpu_la_OBJECTS) \
|
||||
$(libinteger_la_OBJECTS) \
|
||||
$(libaria_simd_la_OBJECTS) \
|
||||
$(libblake2s_simd_la_OBJECTS) \
|
||||
$(libblake2b_simd_la_OBJECTS) \
|
||||
$(libchacha_simd_la_OBJECTS) \
|
||||
$(libchacha_avx_la_OBJECTS) \
|
||||
$(libcham_simd_la_OBJECTS) \
|
||||
$(libcrc_simd_la_OBJECTS) \
|
||||
$(libdonna_sse_la_OBJECTS) \
|
||||
$(libkeccak_simd_la_OBJECTS) \
|
||||
$(liblea_simd_la_OBJECTS) \
|
||||
$(libgcm_simd_la_OBJECTS) \
|
||||
$(libgf2n_simd_la_OBJECTS) \
|
||||
$(libneon_simd_la_OBJECTS) \
|
||||
$(libppc_simd_la_OBJECTS) \
|
||||
$(libppc_power7_la_OBJECTS) \
|
||||
$(libppc_power8_la_OBJECTS) \
|
||||
$(libppc_power9_la_OBJECTS) \
|
||||
$(librijndael_simd_la_OBJECTS) \
|
||||
$(libsha_simd_la_OBJECTS) \
|
||||
$(libshacal2_simd_la_OBJECTS) \
|
||||
$(libsimon128_simd_la_OBJECTS) \
|
||||
$(libspeck128_simd_la_OBJECTS) \
|
||||
$(libsm4_simd_la_OBJECTS) \
|
||||
$(libsse_simd_la_OBJECTS)
|
||||
|
||||
## ARMv7-a AES and SHA by Andy Polyakov
|
||||
if CRYPTOGAMS_ARM_SOURCES
|
||||
libcryptopp_la_DEPENDENCIES += $(libaes_armv4_la_OBJECTS)
|
||||
libcryptopp_la_DEPENDENCIES += $(libsha1_armv4_la_OBJECTS)
|
||||
libcryptopp_la_DEPENDENCIES += $(libsha256_armv4_la_OBJECTS)
|
||||
libcryptopp_la_DEPENDENCIES += $(libsha512_armv4_la_OBJECTS)
|
||||
endif
|
||||
|
||||
## cpufeatures library on Android
|
||||
if ANDROID_CPU_FEATURES
|
||||
libcryptopp_la_DEPENDENCIES += $(libcpu_features_la_OBJECTS)
|
||||
endif
|
||||
|
||||
## The remainder of the object files
|
||||
libcryptopp_la_DEPENDENCIES += $(libothers_la_OBJECTS)
|
||||
|
||||
## Man, did Autotools fuck this up royally...
|
||||
## https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
|
||||
libcryptopp_la_LDFLAGS = $(AM_LDFLAGS) -release 8.3.0 -version-info 8:3
|
||||
|
||||
## Source files with special needs
|
||||
libcryptlib_la_SOURCES = cryptlib.cpp
|
||||
libcryptlib_la_CXXFLAGS = $(AM_CXXFLAGS)
|
||||
|
||||
libcpu_la_SOURCES = cpu.cpp
|
||||
libcpu_la_CXXFLAGS = $(AM_CXXFLAGS)
|
||||
|
||||
libinteger_la_SOURCES = integer.cpp
|
||||
libinteger_la_CXXFLAGS = $(AM_CXXFLAGS)
|
||||
|
||||
libaria_simd_la_SOURCES = aria_simd.cpp
|
||||
libaria_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_ARIA_FLAG)
|
||||
|
||||
libblake2s_simd_la_SOURCES = blake2s_simd.cpp
|
||||
libblake2s_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_BLAKE2S_FLAG)
|
||||
|
||||
libblake2b_simd_la_SOURCES = blake2b_simd.cpp
|
||||
libblake2b_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_BLAKE2B_FLAG)
|
||||
|
||||
libchacha_simd_la_SOURCES = chacha_simd.cpp
|
||||
libchacha_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_CHACHA_FLAG)
|
||||
|
||||
libchacha_avx_la_SOURCES = chacha_avx.cpp
|
||||
libchacha_avx_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_CHACHA_AVX2_FLAG)
|
||||
|
||||
libcham_simd_la_SOURCES = cham_simd.cpp
|
||||
libcham_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_CHAM_FLAG)
|
||||
|
||||
libcrc_simd_la_SOURCES = crc_simd.cpp
|
||||
libcrc_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_CRC_FLAG)
|
||||
|
||||
libdonna_sse_la_SOURCES = donna_sse.cpp
|
||||
libdonna_sse_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_DONNA_FLAG)
|
||||
|
||||
libgcm_simd_la_SOURCES = gcm_simd.cpp
|
||||
libgcm_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_GCM_FLAG)
|
||||
|
||||
libgf2n_simd_la_SOURCES = gf2n_simd.cpp
|
||||
libgf2n_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_GF2N_FLAG)
|
||||
|
||||
libkeccak_simd_la_SOURCES = keccak_simd.cpp
|
||||
libkeccak_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_KECCAK_FLAG)
|
||||
|
||||
liblea_simd_la_SOURCES = lea_simd.cpp
|
||||
liblea_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_LEA_FLAG)
|
||||
|
||||
libneon_simd_la_SOURCES = neon_simd.cpp
|
||||
libneon_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_NEON_FLAG)
|
||||
|
||||
libppc_simd_la_SOURCES = ppc_simd.cpp
|
||||
libppc_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_ALTIVEC_FLAG)
|
||||
|
||||
libppc_power7_la_SOURCES = ppc_power7.cpp
|
||||
libppc_power7_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_POWER7_FLAG)
|
||||
|
||||
libppc_power8_la_SOURCES = ppc_power8.cpp
|
||||
libppc_power8_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_POWER8_FLAG)
|
||||
|
||||
# Do not use CRYPTOPP_POWER9_FLAG. See https://github.com/weidai11/cryptopp/issues/986
|
||||
libppc_power9_la_SOURCES = ppc_power9.cpp
|
||||
# libppc_power9_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_POWER9_FLAG)
|
||||
libppc_power9_la_CXXFLAGS = $(AM_CXXFLAGS)
|
||||
|
||||
librijndael_simd_la_SOURCES = rijndael_simd.cpp
|
||||
librijndael_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_AES_FLAG)
|
||||
|
||||
libsha_simd_la_SOURCES = sha_simd.cpp
|
||||
libsha_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_SHA_FLAG)
|
||||
|
||||
libshacal2_simd_la_SOURCES = shacal2_simd.cpp
|
||||
libshacal2_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_SHA_FLAG)
|
||||
|
||||
libsimon128_simd_la_SOURCES = simon128_simd.cpp
|
||||
libsimon128_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_SIMON128_FLAG)
|
||||
|
||||
libspeck128_simd_la_SOURCES = speck128_simd.cpp
|
||||
libspeck128_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_SPECK128_FLAG)
|
||||
|
||||
libsm4_simd_la_SOURCES = sm4_simd.cpp
|
||||
libsm4_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_SM4_FLAG)
|
||||
|
||||
libsse_simd_la_SOURCES = sse_simd.cpp
|
||||
libsse_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_SSE2_FLAG)
|
||||
|
||||
## ARMv7-a AES and SHA by Andy Polyakov
|
||||
## Also see https://stackoverflow.com/q/51575580/608639
|
||||
if CRYPTOGAMS_ARM_SOURCES
|
||||
libaes_armv4_la_SOURCES = aes_armv4.S
|
||||
libsha1_armv4_la_SOURCES = sha1_armv4.S
|
||||
libsha256_armv4_la_SOURCES = sha256_armv4.S
|
||||
libsha512_armv4_la_SOURCES = sha512_armv4.S
|
||||
libaes_armv4_la_CCASFLAGS = $(AM_CXXFLAGS) $(CRYPTOPGAMS_ARMV4_THUMB_FLAG)
|
||||
libsha1_armv4_la_CCASFLAGS = $(AM_CXXFLAGS) $(CRYPTOPGAMS_ARMV4_FLAG)
|
||||
libsha256_armv4_la_CCASFLAGS = $(AM_CXXFLAGS) $(CRYPTOPGAMS_ARMV4_FLAG)
|
||||
libsha512_armv4_la_CCASFLAGS = $(AM_CXXFLAGS) $(CRYPTOPGAMS_ARMV4_FLAG)
|
||||
endif
|
||||
|
||||
## cpufeatures library on Android
|
||||
if ANDROID_CPU_FEATURES
|
||||
libcpu_features_la_SOURCES = cpu-features.c
|
||||
endif
|
||||
|
||||
# This is the list of remaining sources files that don't need special order
|
||||
# and don't need special flags. It is formed by removing cryptlib.cpp,
|
||||
# cpu.cpp, integer.cpp, *_avx.cpp and *_simd.cpp files. It is sorted in
|
||||
# alphabetical order for deterministic builds.
|
||||
|
||||
# To build this list, see the head notes.
|
||||
libothers_la_SOURCES = \
|
||||
3way.cpp adler32.cpp algebra.cpp algparam.cpp allocate.cpp arc4.cpp \
|
||||
aria.cpp ariatab.cpp asn.cpp authenc.cpp base32.cpp base64.cpp \
|
||||
basecode.cpp bfinit.cpp blake2.cpp blowfish.cpp blumshub.cpp \
|
||||
camellia.cpp cast.cpp casts.cpp cbcmac.cpp ccm.cpp chacha.cpp \
|
||||
chachapoly.cpp cham.cpp channels.cpp cmac.cpp crc.cpp darn.cpp \
|
||||
default.cpp des.cpp dessp.cpp dh.cpp dh2.cpp dll.cpp donna_32.cpp \
|
||||
donna_64.cpp dsa.cpp eax.cpp ec2n.cpp eccrypto.cpp ecp.cpp elgamal.cpp \
|
||||
emsa2.cpp eprecomp.cpp esign.cpp files.cpp filters.cpp fips140.cpp \
|
||||
fipstest.cpp gcm.cpp gf256.cpp gf2_32.cpp gf2n.cpp gfpcrypt.cpp \
|
||||
gost.cpp gzip.cpp hc128.cpp hc256.cpp hex.cpp hight.cpp hmac.cpp \
|
||||
hrtimer.cpp ida.cpp idea.cpp iterhash.cpp kalyna.cpp kalynatab.cpp \
|
||||
keccak.cpp keccak_core.cpp lea.cpp luc.cpp mars.cpp marss.cpp md2.cpp \
|
||||
md4.cpp md5.cpp misc.cpp modes.cpp mqueue.cpp mqv.cpp nbtheory.cpp \
|
||||
oaep.cpp osrng.cpp padlkrng.cpp panama.cpp pkcspad.cpp poly1305.cpp \
|
||||
polynomi.cpp pssr.cpp pubkey.cpp queue.cpp rabbit.cpp rabin.cpp \
|
||||
randpool.cpp rc2.cpp rc5.cpp rc6.cpp rdrand.cpp rdtables.cpp \
|
||||
rijndael.cpp ripemd.cpp rng.cpp rsa.cpp rw.cpp safer.cpp salsa.cpp \
|
||||
scrypt.cpp seal.cpp seed.cpp serpent.cpp sha.cpp sha3.cpp shacal2.cpp \
|
||||
shake.cpp shark.cpp sharkbox.cpp simeck.cpp simon.cpp skipjack.cpp \
|
||||
sm3.cpp sm4.cpp sosemanuk.cpp speck.cpp square.cpp squaretb.cpp \
|
||||
strciphr.cpp tea.cpp tftables.cpp threefish.cpp tiger.cpp tigertab.cpp \
|
||||
ttmac.cpp tweetnacl.cpp twofish.cpp vmac.cpp wake.cpp whrlpool.cpp \
|
||||
xed25519.cpp xtr.cpp xtrcrypt.cpp xts.cpp zdeflate.cpp zinflate.cpp \
|
||||
zlib.cpp
|
||||
|
||||
# To build this list, see the head notes.
|
||||
pkginclude_HEADERS = \
|
||||
3way.h adler32.h adv_simd.h aes.h algebra.h algparam.h allocate.h \
|
||||
arc4.h argnames.h aria.h arm_simd.h asn.h authenc.h base32.h base64.h \
|
||||
basecode.h blake2.h blowfish.h blumshub.h camellia.h cast.h cbcmac.h \
|
||||
ccm.h chacha.h chachapoly.h cham.h channels.h cmac.h config.h \
|
||||
config_align.h config_asm.h config_cpu.h config_cxx.h config_dll.h \
|
||||
config_int.h config_misc.h config_ns.h config_os.h config_ver.h cpu.h \
|
||||
crc.h cryptlib.h darn.h default.h des.h dh.h dh2.h dll.h dmac.h donna.h \
|
||||
donna_32.h donna_64.h donna_sse.h drbg.h dsa.h eax.h ec2n.h eccrypto.h \
|
||||
ecp.h ecpoint.h elgamal.h emsa2.h eprecomp.h esign.h fhmqv.h files.h \
|
||||
filters.h fips140.h fltrimpl.h gcm.h gf256.h gf2_32.h gf2n.h gfpcrypt.h \
|
||||
gost.h gzip.h hashfwd.h hc128.h hc256.h hex.h hight.h hkdf.h hmac.h \
|
||||
hmqv.h hrtimer.h ida.h idea.h integer.h iterhash.h kalyna.h keccak.h \
|
||||
lea.h local.h lubyrack.h luc.h mars.h md2.h md4.h md5.h mdc.h \
|
||||
mersenne.h misc.h modarith.h modes.h modexppc.h mqueue.h mqv.h \
|
||||
naclite.h nbtheory.h nr.h oaep.h oids.h osrng.h ossig.h padlkrng.h \
|
||||
panama.h pch.h pkcspad.h poly1305.h polynomi.h ppc_simd.h pssr.h \
|
||||
pubkey.h pwdbased.h queue.h rabbit.h rabin.h randpool.h rc2.h rc5.h \
|
||||
rc6.h rdrand.h rijndael.h ripemd.h rng.h rsa.h rw.h safer.h salsa.h \
|
||||
scrypt.h seal.h secblock.h secblockfwd.h seckey.h seed.h serpent.h \
|
||||
serpentp.h sha.h sha3.h shacal2.h shake.h shark.h simeck.h simon.h \
|
||||
simple.h siphash.h skipjack.h sm3.h sm4.h smartptr.h sosemanuk.h \
|
||||
speck.h square.h stdcpp.h strciphr.h tea.h threefish.h tiger.h trap.h \
|
||||
trunhash.h ttmac.h tweetnacl.h twofish.h vmac.h wake.h whrlpool.h \
|
||||
words.h xed25519.h xtr.h xtrcrypt.h xts.h zdeflate.h zinflate.h zlib.h
|
||||
|
||||
noinst_HEADERS = \
|
||||
local.h \
|
||||
bench.h \
|
||||
factory.h \
|
||||
resource.h \
|
||||
validate.h \
|
||||
aes_armv4.h \
|
||||
sha1_armv4.h \
|
||||
sha256_armv4.h \
|
||||
sha512_armv4.h
|
||||
|
||||
bin_PROGRAMS = cryptest$(EXEEXT)
|
||||
|
||||
cryptest_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTEST_CXXFLAGS) -DCRYPTOPP_DATA_DIR='"${pkgdatadir}/"'
|
||||
cryptest_SOURCES = \
|
||||
test.cpp bench1.cpp bench2.cpp bench3.cpp datatest.cpp \
|
||||
dlltest.cpp fipsalgt.cpp validat0.cpp validat1.cpp validat2.cpp \
|
||||
validat3.cpp validat4.cpp validat5.cpp validat6.cpp validat7.cpp \
|
||||
validat8.cpp validat9.cpp validat10.cpp regtest1.cpp regtest2.cpp \
|
||||
regtest3.cpp regtest4.cpp
|
||||
|
||||
nodist_cryptest_SOURCES = adhoc.cpp
|
||||
cryptest_LDADD = $(lib_LTLIBRARIES)
|
||||
|
||||
CLEANFILES = adhoc.cpp
|
||||
|
||||
## Copy the TestVectors/ and TestData/ to ${pkgdatadir}.
|
||||
## TestPrograms/ is included in the tarball but not installed.
|
||||
## https://www.gnu.org/software/automake/manual/html_node/Data.html
|
||||
|
||||
# Create with 'ls TestVectors/*.dat'. These files get installed.
|
||||
testdata_FILES = \
|
||||
TestData/3desval.dat TestData/fhmqv160.dat TestData/rc2val.dat \
|
||||
TestData/3wayval.dat TestData/fhmqv256.dat TestData/rc5val.dat \
|
||||
TestData/aria.dat TestData/fhmqv384.dat TestData/rc6val.dat \
|
||||
TestData/camellia.dat TestData/fhmqv512.dat TestData/rijndael.dat \
|
||||
TestData/cast128v.dat TestData/gostval.dat TestData/rsa1024.dat \
|
||||
TestData/cast256v.dat TestData/hmqv160.dat TestData/rsa2048a.dat \
|
||||
TestData/defdmac1.bin TestData/hmqv256.dat TestData/rsa2048.dat \
|
||||
TestData/defdmac2.bin TestData/hmqv384.dat TestData/rsa400pb.dat \
|
||||
TestData/descert.dat TestData/hmqv512.dat TestData/rsa400pv.dat \
|
||||
TestData/dh1024.dat TestData/ideaval.dat TestData/rsa512a.dat \
|
||||
TestData/dh2048.dat TestData/luc1024.dat TestData/rw1024.dat \
|
||||
TestData/dlie1024.dat TestData/luc2048.dat TestData/rw2048.dat \
|
||||
TestData/dlie2048.dat TestData/lucc1024.dat TestData/saferval.dat \
|
||||
TestData/dsa1024b.dat TestData/lucc512.dat TestData/serpentv.dat \
|
||||
TestData/dsa1024.dat TestData/lucd1024.dat TestData/shacal2v.dat \
|
||||
TestData/dsa512.dat TestData/lucd512.dat TestData/sharkval.dat \
|
||||
TestData/ecies_p160.dat TestData/lucs1024.dat TestData/skipjack.dat \
|
||||
TestData/ecies_t163.dat TestData/lucs512.dat TestData/squareva.dat \
|
||||
TestData/ed25519.dat TestData/marsval.dat TestData/twofishv.dat \
|
||||
TestData/ed25519v0.dat TestData/mqv1024.dat TestData/usage.dat \
|
||||
TestData/ed25519v1.dat TestData/mqv2048.dat TestData/x25519.dat \
|
||||
TestData/elgc1024.dat TestData/nr1024.dat TestData/x25519v0.dat \
|
||||
TestData/esig1023.dat TestData/nr2048.dat TestData/x25519v1.dat \
|
||||
TestData/esig1536.dat TestData/rabi1024.dat TestData/xtrdh171.dat \
|
||||
TestData/esig2046.dat TestData/rabi2048.dat TestData/xtrdh342.dat
|
||||
|
||||
# Create with 'ls TestVectors/*.txt'. These files get installed.
|
||||
testvector_FILES = \
|
||||
TestVectors/aead.txt TestVectors/rsa_pss.txt \
|
||||
TestVectors/aes.txt TestVectors/rw.txt \
|
||||
TestVectors/all.txt TestVectors/salsa.txt \
|
||||
TestVectors/aria.txt TestVectors/seal.txt \
|
||||
TestVectors/blake2b.txt TestVectors/seed.txt \
|
||||
TestVectors/blake2s.txt TestVectors/sha1_160_fips_180.txt \
|
||||
TestVectors/blake2.txt TestVectors/sha1_fips_180.txt \
|
||||
TestVectors/camellia.txt TestVectors/sha2_224_fips_180.txt \
|
||||
TestVectors/ccm.txt TestVectors/sha2_256_fips_180.txt \
|
||||
TestVectors/chacha20poly1305.txt TestVectors/sha2_384_fips_180.txt \
|
||||
TestVectors/chacha_tls.txt TestVectors/sha2_512_fips_180.txt \
|
||||
TestVectors/chacha.txt TestVectors/sha2_fips_180.txt \
|
||||
TestVectors/cham.txt TestVectors/sha2.txt \
|
||||
TestVectors/cmac.txt TestVectors/sha3_224_fips_202.txt \
|
||||
TestVectors/dlies.txt TestVectors/sha3_256_fips_202.txt \
|
||||
TestVectors/dsa_1363.txt TestVectors/sha3_384_fips_202.txt \
|
||||
TestVectors/dsa_rfc6979.txt TestVectors/sha3_512_fips_202.txt \
|
||||
TestVectors/dsa.txt TestVectors/sha3_fips_202.txt \
|
||||
TestVectors/eax.txt TestVectors/sha3.txt \
|
||||
TestVectors/esign.txt TestVectors/shacal2.txt \
|
||||
TestVectors/gcm.txt TestVectors/shake.txt \
|
||||
TestVectors/hc128.txt TestVectors/sha.txt \
|
||||
TestVectors/hc256.txt TestVectors/simeck.txt \
|
||||
TestVectors/hight.txt TestVectors/simon.txt \
|
||||
TestVectors/hkdf.txt TestVectors/siphash.txt \
|
||||
TestVectors/hmac.txt TestVectors/skipjack.txt \
|
||||
TestVectors/kalyna.txt TestVectors/sm3.txt \
|
||||
TestVectors/keccak.txt TestVectors/sm4.txt \
|
||||
TestVectors/lea.txt TestVectors/sosemanuk.txt \
|
||||
TestVectors/mars.txt TestVectors/speck.txt \
|
||||
TestVectors/nr.txt TestVectors/tea.txt \
|
||||
TestVectors/panama.txt TestVectors/threefish.txt \
|
||||
TestVectors/poly1305aes.txt TestVectors/ttmac.txt \
|
||||
TestVectors/poly1305_tls.txt TestVectors/vmac.txt \
|
||||
TestVectors/rabbit.txt TestVectors/wake.txt \
|
||||
TestVectors/Readme.txt TestVectors/whrlpool.txt \
|
||||
TestVectors/rsa_oaep.txt TestVectors/xchacha.txt \
|
||||
TestVectors/rsa_pkcs1_1_5.txt TestVectors/xts.txt
|
||||
|
||||
# Create with 'ls TestPrograms/test_*.cxx'. These files do not get installed.
|
||||
# They exist so the feature tests can be run from the configure directory.
|
||||
testprogs_FILES= \
|
||||
TestPrograms/test_32bit.cxx
|
||||
TestPrograms/test_64bit.cxx
|
||||
TestPrograms/test_arm_acle_header.cxx
|
||||
TestPrograms/test_arm_aes.cxx
|
||||
TestPrograms/test_arm_asimd.cxx
|
||||
TestPrograms/test_arm_crc.cxx
|
||||
TestPrograms/test_arm_neon.cxx
|
||||
TestPrograms/test_arm_neon_header.cxx
|
||||
TestPrograms/test_arm_pmull.cxx
|
||||
TestPrograms/test_arm_sha1.cxx
|
||||
TestPrograms/test_arm_sha256.cxx
|
||||
TestPrograms/test_arm_sha3.cxx
|
||||
TestPrograms/test_arm_sha512.cxx
|
||||
TestPrograms/test_arm_sm3.cxx
|
||||
TestPrograms/test_arm_sm4.cxx
|
||||
TestPrograms/test_asm_mixed.cxx
|
||||
TestPrograms/test_cxx11_alignas.cxx
|
||||
TestPrograms/test_cxx11_alignof.cxx
|
||||
TestPrograms/test_cxx11_assert.cxx
|
||||
TestPrograms/test_cxx11_atomic.cxx
|
||||
TestPrograms/test_cxx11_auto.cxx
|
||||
TestPrograms/test_cxx11_constexpr.cxx
|
||||
TestPrograms/test_cxx11.cxx
|
||||
TestPrograms/test_cxx11_deletefn.cxx
|
||||
TestPrograms/test_cxx11_enumtype.cxx
|
||||
TestPrograms/test_cxx11_initializer.cxx
|
||||
TestPrograms/test_cxx11_lambda.cxx
|
||||
TestPrograms/test_cxx11_noexcept.cxx
|
||||
TestPrograms/test_cxx11_nullptr.cxx
|
||||
TestPrograms/test_cxx11_staticinit.cxx
|
||||
TestPrograms/test_cxx11_sync.cxx
|
||||
TestPrograms/test_cxx11_vartemplates.cxx
|
||||
TestPrograms/test_cxx14.cxx
|
||||
TestPrograms/test_cxx17_assert.cxx
|
||||
TestPrograms/test_cxx17.cxx
|
||||
TestPrograms/test_cxx17_exceptions.cxx
|
||||
TestPrograms/test_cxx98_exception.cxx
|
||||
TestPrograms/test_cxx.cxx
|
||||
TestPrograms/test_glibc.cxx
|
||||
TestPrograms/test_newlib.cxx
|
||||
TestPrograms/test_ppc_aes.cxx
|
||||
TestPrograms/test_ppc_altivec.cxx
|
||||
TestPrograms/test_ppc_power7.cxx
|
||||
TestPrograms/test_ppc_power8.cxx
|
||||
TestPrograms/test_ppc_power9.cxx
|
||||
TestPrograms/test_ppc_sha.cxx
|
||||
TestPrograms/test_ppc_vmull.cxx
|
||||
TestPrograms/test_pthreads.cxx
|
||||
TestPrograms/test_x86_aes.cxx
|
||||
TestPrograms/test_x86_avx2.cxx
|
||||
TestPrograms/test_x86_avx512.cxx
|
||||
TestPrograms/test_x86_avx.cxx
|
||||
TestPrograms/test_x86_clmul.cxx
|
||||
TestPrograms/test_x86_cpuid.cxx
|
||||
TestPrograms/test_x86_rdrand.cxx
|
||||
TestPrograms/test_x86_rdseed.cxx
|
||||
TestPrograms/test_x86_sha.cxx
|
||||
TestPrograms/test_x86_sse2.cxx
|
||||
TestPrograms/test_x86_sse3.cxx
|
||||
TestPrograms/test_x86_sse41.cxx
|
||||
TestPrograms/test_x86_sse42.cxx
|
||||
TestPrograms/test_x86_ssse3.cxx
|
||||
TestPrograms/test_x86_via_aes.cxx
|
||||
TestPrograms/test_x86_via_rng.cxx
|
||||
TestPrograms/test_x86_via_sha.cxx
|
||||
|
||||
nobase_dist_pkgdata_DATA = \
|
||||
$(testdata_FILES) \
|
||||
$(testvector_FILES)
|
||||
|
||||
# Can't seem to get this to work, despite the fiddling attempts.
|
||||
# https://www.gnu.org/software/automake/manual/html_node/Uniform.html and
|
||||
# https://www.gnu.org/software/automake/manual/html_node/Program-and-Library-Variables.html
|
||||
#nobase_noinst_data_DATA = \
|
||||
# $(testprogs_FILES)
|
||||
|
||||
# Workaround Automake bug. We can't seem to include the TestProgram/ data
|
||||
# in the tarball without installation using their Uniform Naming Scheme
|
||||
# https://www.gnu.org/software/automake/manual/html_node/Uniform.html and
|
||||
# https://www.gnu.org/software/automake/manual/html_node/Program-and-Library-Variables.html
|
||||
dist-hook:
|
||||
chmod -R u+w $(distdir)
|
||||
cp -r TestPrograms/ $(distdir)
|
||||
rm -f $(distdir)/TestPrograms/dump2def.cxx
|
||||
|
||||
## Automake bug workaround. If libcryptopp_la_SOURCES is an empty list, Automake assumes
|
||||
## C source files and drives link through the C compiler. We provide the empty adhoc.cpp
|
||||
## to get things back on course, so adhoc.cpp must always be copied.
|
||||
|
||||
adhoc.cpp:
|
||||
cp adhoc.cpp.proto adhoc.cpp
|
||||
touch adhoc.cpp
|
||||
|
||||
## Remove doc directory if present
|
||||
distclean-local:
|
||||
-rm -rf html-docs doxyfile.stamp
|
||||
|
||||
## Automake does not properly uninstall the library test data and vectors
|
||||
uninstall-hook:
|
||||
-rm -rf ${pkgdatadir}
|
||||
-rm -rf ${pkghtmldir}
|
||||
|
||||
## Doxygen is available but not built by default
|
||||
## TODO: copy docs to ${pkghtmldir} if built
|
||||
if CRYPTOPP_DOXYGEN_AVAILABLE
|
||||
|
||||
## PHONY targets. Automake can only handle one of them...
|
||||
.PHONY: doc docs html htmldoc checkout reset
|
||||
|
||||
doc docs html htmldoc:
|
||||
$(DOXYGEN) Doxyfile -d CRYPTOPP_DOXYGEN_PROCESSING
|
||||
|
||||
endif
|
||||
|
||||
# Restore GNUmakefile
|
||||
checkout:
|
||||
git checkout master -f
|
||||
|
||||
# Restore GNUmakefile
|
||||
reset:
|
||||
git reset --hard HEAD
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user