mirror of
https://github.com/remittor/zapret-openwrt.git
synced 2026-01-30 22:30:36 +03:00
Compare commits
16 Commits
v72.202512
...
v72.202601
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
40a3605034 | ||
|
|
3227458422 | ||
|
|
54fdbe4d5e | ||
|
|
b714b629b7 | ||
|
|
354a71f6c5 | ||
|
|
f48488b21b | ||
|
|
a3c256c31a | ||
|
|
1d2d3c4b84 | ||
|
|
5b6fd0a1e6 | ||
|
|
791ea2d2b6 | ||
|
|
9d73b59640 | ||
|
|
b58cbafec6 | ||
|
|
a56b1e3f1c | ||
|
|
80f15e3da1 | ||
|
|
89bcec8a60 | ||
|
|
735575c7bc |
78
.github/ISSUE_TEMPLATE/help_wanted_en.yml
vendored
Normal file
78
.github/ISSUE_TEMPLATE/help_wanted_en.yml
vendored
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
---
|
||||||
|
name: 🆘 Help wanted
|
||||||
|
description: Ask for help or propose to help
|
||||||
|
title: "[HELP] "
|
||||||
|
labels: ["help wanted"]
|
||||||
|
assignees: []
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Before sending, please:
|
||||||
|
- Check [existing issues](https://github.com/remittor/zapret-openwrt/issues)
|
||||||
|
- Read [documentation](https://github.com/remittor/zapret-openwrt/wiki/)
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: description
|
||||||
|
attributes:
|
||||||
|
label: 📝 Problem description
|
||||||
|
description: What do you need help with?
|
||||||
|
placeholder: A clear and concise description of the problem
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: reproduction
|
||||||
|
attributes:
|
||||||
|
label: Steps to reproduce
|
||||||
|
description: Steps to reproduce the problem. If you're following a manual, please include a link to it.
|
||||||
|
placeholder: |
|
||||||
|
1.
|
||||||
|
2.
|
||||||
|
3.
|
||||||
|
4.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: expected
|
||||||
|
attributes:
|
||||||
|
label: ✅ Expected behavior
|
||||||
|
description: A clear and concise description of what was to happen
|
||||||
|
placeholder: Describe the expected behavior
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: environment
|
||||||
|
attributes:
|
||||||
|
label: 🖥️ System Information
|
||||||
|
description: |
|
||||||
|
Information about your system (fill in all that used)
|
||||||
|
value: |
|
||||||
|
- **OpenWrt version**:
|
||||||
|
- **Zapret version**:
|
||||||
|
- **Router model**:
|
||||||
|
render: markdown
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: strategy
|
||||||
|
attributes:
|
||||||
|
label: ✅ The NFQWS strategy used
|
||||||
|
description: All parameters of the NFQWS strategy, or its name
|
||||||
|
placeholder: If the problem is caused by the NFQWS strategy
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: config
|
||||||
|
attributes:
|
||||||
|
label: ⚙️ System Configurations
|
||||||
|
description: |
|
||||||
|
Relevant parts of the configuration (remove sensitive information!)
|
||||||
|
placeholder: |
|
||||||
|
For example:
|
||||||
|
- Contents of /etc/config/zapret
|
||||||
|
- Firewall configuration (Flow offloading, etc.)
|
||||||
|
- Additional configurations required for wireless/network/dhcp, etc.
|
||||||
|
render: shell
|
||||||
78
.github/ISSUE_TEMPLATE/help_wanted_ru.yml
vendored
Normal file
78
.github/ISSUE_TEMPLATE/help_wanted_ru.yml
vendored
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
---
|
||||||
|
name: 🆘 Нужна помощь
|
||||||
|
description: Нужна помощь
|
||||||
|
title: "[HELP] "
|
||||||
|
labels: ["help wanted"]
|
||||||
|
assignees: []
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Перед отправкой, пожалуйста:
|
||||||
|
- Проверьте [существующие issues](https://github.com/remittor/zapret-openwrt/issues)
|
||||||
|
- Просмотрите [документацию](https://github.com/remittor/zapret-openwrt/wiki/)
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: description
|
||||||
|
attributes:
|
||||||
|
label: 📝 Описание проблемы
|
||||||
|
description: В чём именно нужна помощь?
|
||||||
|
placeholder: Опишите проблему
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: reproduction
|
||||||
|
attributes:
|
||||||
|
label: Шаги для воспроизведения
|
||||||
|
description: Шаги для воспроизведения проблемы. Если вы настраваете что-то по какому либо мануалу, приложите ссылку на него.
|
||||||
|
placeholder: |
|
||||||
|
1.
|
||||||
|
2.
|
||||||
|
3.
|
||||||
|
4.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: expected
|
||||||
|
attributes:
|
||||||
|
label: ✅ Ожидаемое поведение
|
||||||
|
description: Четкое и краткое описание того, что должно было произойти
|
||||||
|
placeholder: Опишите ожидаемое поведение
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: environment
|
||||||
|
attributes:
|
||||||
|
label: 🖥️ Информация о системе
|
||||||
|
description: |
|
||||||
|
Информация о вашей системе (заполните всё применяемое)
|
||||||
|
value: |
|
||||||
|
- **OpenWrt версия**:
|
||||||
|
- **Zapret версия**:
|
||||||
|
- **Роутер модель**:
|
||||||
|
render: markdown
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: strategy
|
||||||
|
attributes:
|
||||||
|
label: ✅ Используемая стратегия NFQWS
|
||||||
|
description: Все параметры стратегии NFQWS, либо её название
|
||||||
|
placeholder: Если проблема вызвана стратегией NFQWS
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: config
|
||||||
|
attributes:
|
||||||
|
label: ⚙️ Конфигурация
|
||||||
|
description: |
|
||||||
|
Релевантные части конфигурации (удалите чувствительную информацию!)
|
||||||
|
placeholder: |
|
||||||
|
Например:
|
||||||
|
- Содержимое /etc/config/zapret
|
||||||
|
- Конфигурация файервола (опция Flow offloading и т.п.)
|
||||||
|
- Дополнительные конфиги, которые потребуются wireless/network/dhcp и т.д.
|
||||||
|
render: shell
|
||||||
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@@ -252,9 +252,9 @@ jobs:
|
|||||||
cat .config
|
cat .config
|
||||||
echo "------------- .config END -------------------"
|
echo "------------- .config END -------------------"
|
||||||
if [ "$ARCH" = "$LUCI_ARCH" ]; then
|
if [ "$ARCH" = "$LUCI_ARCH" ]; then
|
||||||
PKGLIST=`echo package/zapret-openwrt/{zapret,zapret-tpws,zapret-mdig,zapret-ip2net,luci-app-zapret}/compile`
|
PKGLIST=`echo package/zapret-openwrt/{zapret,luci-app-zapret}/compile`
|
||||||
else
|
else
|
||||||
PKGLIST=`echo package/zapret-openwrt/{zapret,zapret-tpws,zapret-mdig,zapret-ip2net}/compile`
|
PKGLIST=`echo package/zapret-openwrt/zapret/compile`
|
||||||
fi
|
fi
|
||||||
if [ "$MAX_SPEED" = "false" ]; then
|
if [ "$MAX_SPEED" = "false" ]; then
|
||||||
make $PKGLIST V=s CONFIG_CCACHE=1 BUILD_LOG=1
|
make $PKGLIST V=s CONFIG_CCACHE=1 BUILD_LOG=1
|
||||||
|
|||||||
@@ -2,13 +2,12 @@
|
|||||||
[](https://github.com/remittor/zapret-openwrt/releases)
|
[](https://github.com/remittor/zapret-openwrt/releases)
|
||||||
[](https://github.com/remittor/zapret-openwrt/releases)
|
[](https://github.com/remittor/zapret-openwrt/releases)
|
||||||
[](https://github.com/remittor/zapret-openwrt)
|
[](https://github.com/remittor/zapret-openwrt)
|
||||||
[](https://github.com/remittor/zapret-openwrt/releases)
|
|
||||||
[](https://github.com/remittor/donate)
|
[](https://github.com/remittor/donate)
|
||||||
# zapret-openwrt
|
# zapret-openwrt
|
||||||
|
|
||||||
Zapret is not a VPN! Zapret is an Anti-DPI utility!
|
Zapret is not a VPN! Zapret is an Anti-DPI utility!
|
||||||
|
|
||||||
[Instructions for installing](https://github.com/remittor/zapret-openwrt/wiki/Installing-zapret‐openwrt-package)
|
[Instructions for installing](https://github.com/remittor/zapret-openwrt/wiki)
|
||||||
|
|
||||||
[Download page](https://github.com/remittor/zapret-openwrt/releases)
|
[Download page](https://github.com/remittor/zapret-openwrt/releases)
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=luci-app-zapret
|
PKG_NAME:=luci-app-zapret
|
||||||
PKG_VERSION:=72.20251225
|
PKG_VERSION:=72.20260108
|
||||||
PKG_RELEASE:=2
|
PKG_RELEASE:=1
|
||||||
PKG_LICENSE:=MIT
|
PKG_LICENSE:=MIT
|
||||||
PKG_MAINTAINER:=remittor <https://github.com/remittor>
|
PKG_MAINTAINER:=remittor <https://github.com/remittor>
|
||||||
|
|
||||||
|
|||||||
@@ -404,13 +404,13 @@ return baseclass.extend({
|
|||||||
E('button', {
|
E('button', {
|
||||||
'id': 'btn_save',
|
'id': 'btn_save',
|
||||||
'class': 'btn cbi-button-positive important',
|
'class': 'btn cbi-button-positive important',
|
||||||
'click': ui.createHandlerFn(this, this.handleSave),
|
'click': ui.createHandlerFn(this, this.handleSaveAdv),
|
||||||
}, _('Save')),
|
}, _('Save')),
|
||||||
]),
|
]),
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleSave: function(ev) {
|
handleSaveAdv: function(ev) {
|
||||||
let txt = document.getElementById('widget.modal_content');
|
let txt = document.getElementById('widget.modal_content');
|
||||||
let value = txt.value.trim().replace(/\r\n/g, '\n') + '\n';
|
let value = txt.value.trim().replace(/\r\n/g, '\n') + '\n';
|
||||||
|
|
||||||
@@ -515,13 +515,13 @@ return baseclass.extend({
|
|||||||
E('button', {
|
E('button', {
|
||||||
'id': 'btn_save',
|
'id': 'btn_save',
|
||||||
'class': 'btn cbi-button-positive important',
|
'class': 'btn cbi-button-positive important',
|
||||||
'click': ui.createHandlerFn(this, this.handleSave),
|
'click': ui.createHandlerFn(this, this.handleSaveAdv),
|
||||||
}, _('Save')),
|
}, _('Save')),
|
||||||
]),
|
]),
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleSave: function(ev) {
|
handleSaveAdv: function(ev) {
|
||||||
let txt = document.getElementById('widget.modal_content');
|
let txt = document.getElementById('widget.modal_content');
|
||||||
let value = txt.value.trim();
|
let value = txt.value.trim();
|
||||||
if (this.multiline) {
|
if (this.multiline) {
|
||||||
@@ -544,19 +544,32 @@ return baseclass.extend({
|
|||||||
}
|
}
|
||||||
value = value.replace(/˂/g, '<');
|
value = value.replace(/˂/g, '<');
|
||||||
value = value.replace(/˃/g, '>');
|
value = value.replace(/˃/g, '>');
|
||||||
let elem = document.getElementById("cbi-zapret-" + this.cfgsec + "-_" + this.cfgparam);
|
try {
|
||||||
if (elem) {
|
let elem2 = null;
|
||||||
let val = value.trim();
|
let elem = document.getElementById("cbi-zapret-" + this.cfgsec + "-_" + this.cfgparam);
|
||||||
if (this.multiline) {
|
if (elem) {
|
||||||
val = val.replace(/</g, '˂');
|
if (!elem2) {
|
||||||
val = val.replace(/>/g, '˃');
|
elem2 = elem.querySelector('div');
|
||||||
val = val.replace(/\n/g, '<br/>');
|
}
|
||||||
elem.querySelector('div').innerHTML = val;
|
if (!elem2) {
|
||||||
} else {
|
elem2 = elem.querySelector('output');
|
||||||
elem.querySelector('div').textContent = val;
|
}
|
||||||
}
|
}
|
||||||
|
if (elem2) {
|
||||||
|
let val = value.trim();
|
||||||
|
if (this.multiline) {
|
||||||
|
val = val.replace(/</g, '˂');
|
||||||
|
val = val.replace(/>/g, '˃');
|
||||||
|
val = val.replace(/\n/g, '<br/>');
|
||||||
|
elem2.innerHTML = val;
|
||||||
|
} else {
|
||||||
|
elem2.textContent = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch(e) {
|
||||||
|
console.error('ERROR: cannot found elem for ' + this.cfgparam);
|
||||||
}
|
}
|
||||||
uci.set('zapret2', this.cfgsec, this.cfgparam, value);
|
uci.set('zapret', this.cfgsec, this.cfgparam, value);
|
||||||
uci.save().then(ui.hideModal);
|
uci.save().then(ui.hideModal);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -171,9 +171,13 @@ return baseclass.extend({
|
|||||||
this.setStage(999);
|
this.setStage(999);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
if (e.message?.includes('RPC call to file/exec failed with error -32000: Object not found')) {
|
||||||
|
console.warn('WARN: installUpdates: ' + e.message);
|
||||||
|
return; // goto next timer iteration
|
||||||
|
}
|
||||||
clearInterval(timer);
|
clearInterval(timer);
|
||||||
this.appendLog('ERROR: installUpdates: ' + e.message);
|
this.appendLog('ERROR: installUpdates: ' + e.message);
|
||||||
this.appendLog('ERROR: installUpdates: ' + e.stack?.trim().split('\n').pop());
|
this.appendLog('ERROR: installUpdates: ' + e.stack?.trim().split('\n')[0]);
|
||||||
this.setStage(999);
|
this.setStage(999);
|
||||||
} finally {
|
} finally {
|
||||||
timerBusy = false;
|
timerBusy = false;
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
|
||||||
|
|
||||||
PKG_NAME:=zapret-ip2net
|
|
||||||
PKG_VERSION:=72.20251225
|
|
||||||
PKG_RELEASE:=2
|
|
||||||
|
|
||||||
PKG_MAINTAINER:=bol-van
|
|
||||||
PKG_LICENSE:=MIT
|
|
||||||
PKG_LICENSE_FILES:=docs/LICENSE.txt
|
|
||||||
|
|
||||||
PKG_SOURCE_URL:=https://github.com/bol-van/zapret.git
|
|
||||||
PKG_SOURCE_PROTO:=git
|
|
||||||
PKG_SOURCE_VERSION:=e95a06c7eeff87e166a5f9ca71547b169c9852e0
|
|
||||||
PKG_SOURCE_DATE:=2025-12-25
|
|
||||||
|
|
||||||
#PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
|
||||||
#PKG_SOURCE_URL:=https://github.com/bol-van/zapret/archive/refs/tags/v$(PKG_VERSION).tar.gz?
|
|
||||||
#PKG_HASH:=skip
|
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
|
||||||
|
|
||||||
#TAR_OPTIONS:=--strip-components 1 $(TAR_OPTIONS)
|
|
||||||
#TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS)
|
|
||||||
|
|
||||||
MAKE_PATH:=ip2net
|
|
||||||
|
|
||||||
define Package/$(PKG_NAME)
|
|
||||||
SECTION:=net
|
|
||||||
CATEGORY:=Network
|
|
||||||
TITLE:=ip2net
|
|
||||||
SUBMENU:=Zapret
|
|
||||||
DEPENDS:=+zlib +zapret
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Build/Prepare
|
|
||||||
$(Build/Prepare/Default)
|
|
||||||
rm -f $(PKG_BUILD_DIR)/$(MAKE_PATH)/ip2net
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/$(PKG_NAME)/install
|
|
||||||
$(INSTALL_DIR) $(1)/opt/zapret/ip2net
|
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/$(MAKE_PATH)/ip2net $(1)/opt/zapret/ip2net/
|
|
||||||
endef
|
|
||||||
|
|
||||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
|
||||||
|
|
||||||
PKG_NAME:=zapret-mdig
|
|
||||||
PKG_VERSION:=72.20251225
|
|
||||||
PKG_RELEASE:=2
|
|
||||||
|
|
||||||
PKG_MAINTAINER:=bol-van
|
|
||||||
PKG_LICENSE:=MIT
|
|
||||||
PKG_LICENSE_FILES:=docs/LICENSE.txt
|
|
||||||
|
|
||||||
PKG_SOURCE_URL:=https://github.com/bol-van/zapret.git
|
|
||||||
PKG_SOURCE_PROTO:=git
|
|
||||||
PKG_SOURCE_VERSION:=e95a06c7eeff87e166a5f9ca71547b169c9852e0
|
|
||||||
PKG_SOURCE_DATE:=2025-12-25
|
|
||||||
|
|
||||||
#PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
|
||||||
#PKG_SOURCE_URL:=https://github.com/bol-van/zapret/archive/refs/tags/v$(PKG_VERSION).tar.gz?
|
|
||||||
#PKG_HASH:=skip
|
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
|
||||||
|
|
||||||
#TAR_OPTIONS:=--strip-components 1 $(TAR_OPTIONS)
|
|
||||||
#TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS)
|
|
||||||
|
|
||||||
MAKE_PATH:=mdig
|
|
||||||
|
|
||||||
define Package/$(PKG_NAME)
|
|
||||||
SECTION:=net
|
|
||||||
CATEGORY:=Network
|
|
||||||
TITLE:=mdig
|
|
||||||
SUBMENU:=Zapret
|
|
||||||
DEPENDS:=+zlib +zapret
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Build/Prepare
|
|
||||||
$(Build/Prepare/Default)
|
|
||||||
rm -f $(PKG_BUILD_DIR)/$(MAKE_PATH)/mdig
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/$(PKG_NAME)/install
|
|
||||||
$(INSTALL_DIR) $(1)/opt/zapret/mdig
|
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/$(MAKE_PATH)/mdig $(1)/opt/zapret/mdig/
|
|
||||||
endef
|
|
||||||
|
|
||||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
|
||||||
|
|
||||||
PKG_NAME:=zapret-tpws
|
|
||||||
PKG_VERSION:=72.20251225
|
|
||||||
PKG_RELEASE:=2
|
|
||||||
|
|
||||||
PKG_MAINTAINER:=bol-van
|
|
||||||
PKG_LICENSE:=MIT
|
|
||||||
PKG_LICENSE_FILES:=docs/LICENSE.txt
|
|
||||||
|
|
||||||
PKG_SOURCE_URL:=https://github.com/bol-van/zapret.git
|
|
||||||
PKG_SOURCE_PROTO:=git
|
|
||||||
PKG_SOURCE_VERSION:=e95a06c7eeff87e166a5f9ca71547b169c9852e0
|
|
||||||
PKG_SOURCE_DATE:=2025-12-25
|
|
||||||
|
|
||||||
#PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
|
||||||
#PKG_SOURCE_URL:=https://github.com/bol-van/zapret/archive/refs/tags/v$(PKG_VERSION).tar.gz?
|
|
||||||
#PKG_HASH:=skip
|
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
|
||||||
|
|
||||||
#TAR_OPTIONS:=--strip-components 1 $(TAR_OPTIONS)
|
|
||||||
#TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS)
|
|
||||||
|
|
||||||
MAKE_PATH:=tpws
|
|
||||||
|
|
||||||
define Package/$(PKG_NAME)
|
|
||||||
SECTION:=net
|
|
||||||
CATEGORY:=Network
|
|
||||||
TITLE:=tpws
|
|
||||||
SUBMENU:=Zapret
|
|
||||||
DEPENDS:=+zlib +libcap +zapret
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Build/Prepare
|
|
||||||
$(Build/Prepare/Default)
|
|
||||||
rm -f $(PKG_BUILD_DIR)/$(MAKE_PATH)/tpws
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/$(PKG_NAME)/install
|
|
||||||
$(INSTALL_DIR) $(1)/opt/zapret/tpws
|
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/$(MAKE_PATH)/tpws $(1)/opt/zapret/tpws/
|
|
||||||
endef
|
|
||||||
|
|
||||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
|
||||||
@@ -5,8 +5,8 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=zapret
|
PKG_NAME:=zapret
|
||||||
PKG_VERSION:=72.20251225
|
PKG_VERSION:=72.20260108
|
||||||
PKG_RELEASE:=2
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_MAINTAINER:=bol-van
|
PKG_MAINTAINER:=bol-van
|
||||||
PKG_LICENSE:=MIT
|
PKG_LICENSE:=MIT
|
||||||
@@ -14,8 +14,8 @@ PKG_LICENSE_FILES:=docs/LICENSE.txt
|
|||||||
|
|
||||||
PKG_SOURCE_URL:=https://github.com/bol-van/zapret.git
|
PKG_SOURCE_URL:=https://github.com/bol-van/zapret.git
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
PKG_SOURCE_VERSION:=e95a06c7eeff87e166a5f9ca71547b169c9852e0
|
PKG_SOURCE_VERSION:=16ac0587a4c7d823be4d947d2bbebdbf445d770c
|
||||||
PKG_SOURCE_DATE:=2025-12-25
|
PKG_SOURCE_DATE:=2026-01-08
|
||||||
|
|
||||||
#PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
#PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
#PKG_SOURCE_URL:=https://github.com/bol-van/zapret/archive/refs/tags/v$(PKG_VERSION).tar.gz?
|
#PKG_SOURCE_URL:=https://github.com/bol-van/zapret/archive/refs/tags/v$(PKG_VERSION).tar.gz?
|
||||||
@@ -43,13 +43,18 @@ endef
|
|||||||
define Build/Prepare
|
define Build/Prepare
|
||||||
$(Build/Prepare/Default)
|
$(Build/Prepare/Default)
|
||||||
rm -f $(PKG_BUILD_DIR)/$(MAKE_PATH)/nfqws
|
rm -f $(PKG_BUILD_DIR)/$(MAKE_PATH)/nfqws
|
||||||
|
rm -f $(PKG_BUILD_DIR)/ip2net/ip2net
|
||||||
|
rm -f $(PKG_BUILD_DIR)/mdig/mdig
|
||||||
endef
|
endef
|
||||||
|
|
||||||
#define Build/Configure
|
#define Build/Configure
|
||||||
#endef
|
#endef
|
||||||
|
|
||||||
#define Build/Compile
|
define Build/Compile
|
||||||
#endef
|
$(MAKE) -C $(PKG_BUILD_DIR)/$(MAKE_PATH) $(TARGET_CONFIGURE_OPTS)
|
||||||
|
$(MAKE) -C $(PKG_BUILD_DIR)/ip2net $(TARGET_CONFIGURE_OPTS)
|
||||||
|
$(MAKE) -C $(PKG_BUILD_DIR)/mdig $(TARGET_CONFIGURE_OPTS)
|
||||||
|
endef
|
||||||
|
|
||||||
define Package/$(PKG_NAME)/conffiles
|
define Package/$(PKG_NAME)/conffiles
|
||||||
/etc/config/zapret
|
/etc/config/zapret
|
||||||
@@ -61,7 +66,11 @@ endef
|
|||||||
define Package/$(PKG_NAME)/install
|
define Package/$(PKG_NAME)/install
|
||||||
$(INSTALL_DIR) $(1)/opt/zapret
|
$(INSTALL_DIR) $(1)/opt/zapret
|
||||||
$(INSTALL_DIR) $(1)/opt/zapret/$(MAKE_PATH)
|
$(INSTALL_DIR) $(1)/opt/zapret/$(MAKE_PATH)
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/$(MAKE_PATH)/nfqws $(1)/opt/zapret/$(MAKE_PATH)/
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/$(MAKE_PATH)/nfqws $(1)/opt/zapret/$(MAKE_PATH)/
|
||||||
|
$(INSTALL_DIR) $(1)/opt/zapret/ip2net
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ip2net/ip2net $(1)/opt/zapret/ip2net/
|
||||||
|
$(INSTALL_DIR) $(1)/opt/zapret/mdig
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/mdig/mdig $(1)/opt/zapret/mdig/
|
||||||
$(INSTALL_DIR) $(1)/opt/zapret/common
|
$(INSTALL_DIR) $(1)/opt/zapret/common
|
||||||
$(CP) $(PKG_BUILD_DIR)/common/* $(1)/opt/zapret/common/
|
$(CP) $(PKG_BUILD_DIR)/common/* $(1)/opt/zapret/common/
|
||||||
#$(INSTALL_DIR) $(1)/opt/zapret/docs
|
#$(INSTALL_DIR) $(1)/opt/zapret/docs
|
||||||
@@ -110,6 +119,9 @@ define Package/$(PKG_NAME)/install
|
|||||||
chmod 644 $(1)/opt/zapret/init.d/openwrt/custom.d/*.sh
|
chmod 644 $(1)/opt/zapret/init.d/openwrt/custom.d/*.sh
|
||||||
chmod 644 $(1)/opt/zapret/config.default
|
chmod 644 $(1)/opt/zapret/config.default
|
||||||
chmod 755 $(1)/opt/zapret/*.sh
|
chmod 755 $(1)/opt/zapret/*.sh
|
||||||
|
chmod 755 $(1)/opt/zapret/$(MAKE_PATH)/*
|
||||||
|
chmod 755 $(1)/opt/zapret/ip2net/*
|
||||||
|
chmod 755 $(1)/opt/zapret/mdig/*
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/$(PKG_NAME)/preinst
|
define Package/$(PKG_NAME)/preinst
|
||||||
|
|||||||
@@ -7,13 +7,16 @@ ZAPRET_BASE=/opt/zapret
|
|||||||
ZAPRET_INITD=/etc/init.d/zapret
|
ZAPRET_INITD=/etc/init.d/zapret
|
||||||
ZAPRET_ORIG_INITD="$ZAPRET_BASE/init.d/openwrt/zapret"
|
ZAPRET_ORIG_INITD="$ZAPRET_BASE/init.d/openwrt/zapret"
|
||||||
|
|
||||||
|
ZAP_LOG_TAG=ZAPRET
|
||||||
|
|
||||||
ZAPRET_CONFIG="$ZAPRET_BASE/config"
|
ZAPRET_CONFIG="$ZAPRET_BASE/config"
|
||||||
ZAPRET_CONFIG_NEW="$ZAPRET_BASE/config.new"
|
ZAPRET_CONFIG_NEW="$ZAPRET_BASE/config.new"
|
||||||
ZAPRET_CONFIG_DEF="$ZAPRET_BASE/config.default"
|
ZAPRET_CONFIG_DEF="$ZAPRET_BASE/config.default"
|
||||||
|
|
||||||
ZAPRET_CFG=/etc/config/zapret
|
ZAPRET_CFG=/etc/config/zapret
|
||||||
ZAPRET_CFG_NAME=zapret
|
ZAPRET_CFG_NAME=zapret
|
||||||
ZAPRET_CFG_SEC_NAME="$( uci -q get $ZAPRET_CFG_NAME.config )"
|
ZAPRET_CFG_SEC=$ZAPRET_CFG_NAME.config
|
||||||
|
ZAPRET_CFG_SEC_NAME="$( uci -q get $ZAPRET_CFG_SEC )"
|
||||||
|
|
||||||
. $ZAPRET_BASE/def-cfg.sh
|
. $ZAPRET_BASE/def-cfg.sh
|
||||||
|
|
||||||
@@ -148,7 +151,7 @@ function merge_cfg_with_def_values
|
|||||||
local cfgname=${1:-$ZAPRET_CFG_NAME}
|
local cfgname=${1:-$ZAPRET_CFG_NAME}
|
||||||
local force=$2
|
local force=$2
|
||||||
local cfgfile=/etc/config/$cfgname
|
local cfgfile=/etc/config/$cfgname
|
||||||
local NEWCFGNAME="zapret-default"
|
local NEWCFGNAME="$ZAPRET_CFG_NAME-default"
|
||||||
local NEWCFGFILE="/etc/config/$NEWCFGNAME"
|
local NEWCFGFILE="/etc/config/$NEWCFGNAME"
|
||||||
|
|
||||||
local cfg_sec_name="$( uci -q get $ZAPRET_CFG_NAME.config )"
|
local cfg_sec_name="$( uci -q get $ZAPRET_CFG_NAME.config )"
|
||||||
@@ -168,7 +171,7 @@ function merge_cfg_with_def_values
|
|||||||
function remove_cron_task_logs
|
function remove_cron_task_logs
|
||||||
{
|
{
|
||||||
if [ -f "$CRONTAB_FILE" ]; then
|
if [ -f "$CRONTAB_FILE" ]; then
|
||||||
sed -i "/-name 'zapret+\*.log' -size +/d" "$CRONTAB_FILE"
|
sed -i "/-name '$ZAPRET_CFG_NAME+\*.log' -size +/d" "$CRONTAB_FILE"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,8 +179,8 @@ function insert_cron_task_logs
|
|||||||
{
|
{
|
||||||
[ ! -f "$CRONTAB_FILE" ] && touch "$CRONTAB_FILE"
|
[ ! -f "$CRONTAB_FILE" ] && touch "$CRONTAB_FILE"
|
||||||
[ ! -f "$CRONTAB_FILE" ] && return 1
|
[ ! -f "$CRONTAB_FILE" ] && return 1
|
||||||
if ! grep -q -e "-name 'zapret\*\.log' -size \+" "$CRONTAB_FILE"; then
|
if ! grep -q -e "-name '$ZAPRET_CFG_NAME\*\.log' -size \+" "$CRONTAB_FILE"; then
|
||||||
echo "*/2 * * * * /usr/bin/find /tmp -maxdepth 1 -type f -name 'zapret+*.log' -size +2600k -exec rm -f {} \;" >> "$CRONTAB_FILE"
|
echo "*/2 * * * * /usr/bin/find /tmp -maxdepth 1 -type f -name '$ZAPRET_CFG_NAME+*.log' -size +2600k -exec rm -f {} \;" >> "$CRONTAB_FILE"
|
||||||
/etc/init.d/cron restart 2> /dev/null
|
/etc/init.d/cron restart 2> /dev/null
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
@@ -190,7 +193,7 @@ function init_before_start
|
|||||||
[ ! -f "$HOSTLIST_FN" ] && touch "$HOSTLIST_FN"
|
[ ! -f "$HOSTLIST_FN" ] && touch "$HOSTLIST_FN"
|
||||||
chmod 644 $ZAPRET_BASE/ipset/*.txt
|
chmod 644 $ZAPRET_BASE/ipset/*.txt
|
||||||
chmod 666 $ZAPRET_BASE/ipset/*.log
|
chmod 666 $ZAPRET_BASE/ipset/*.log
|
||||||
rm -f /tmp/zapret+*.log
|
rm -f /tmp/$ZAPRET_CFG_NAME+*.log
|
||||||
#*/
|
#*/
|
||||||
if [ "$DAEMON_LOG_ENABLE" = "1" ]; then
|
if [ "$DAEMON_LOG_ENABLE" = "1" ]; then
|
||||||
insert_cron_task_logs
|
insert_cron_task_logs
|
||||||
|
|||||||
@@ -247,6 +247,51 @@ function set_cfg_nfqws_strat
|
|||||||
commit $cfgname
|
commit $cfgname
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
if [ "$strat" = "v6_by_StressOzz" ]; then
|
||||||
|
uci batch <<-EOF
|
||||||
|
set $cfgname.config.NFQWS_PORTS_TCP='80,443,2053,2083,2087,2096,8443'
|
||||||
|
set $cfgname.config.NFQWS_PORTS_UDP='443,19294-19344,50000-50100'
|
||||||
|
set $cfgname.config.NFQWS_OPT="
|
||||||
|
# Strategy $strat
|
||||||
|
|
||||||
|
--filter-tcp=443
|
||||||
|
--hostlist=/opt/zapret/ipset/zapret-hosts-google.txt
|
||||||
|
--dpi-desync=multisplit
|
||||||
|
--dpi-desync-split-pos=1,sniext+1
|
||||||
|
--dpi-desync-split-seqovl=1
|
||||||
|
|
||||||
|
--new
|
||||||
|
--filter-tcp=443 ˂HOSTLIST˃
|
||||||
|
--dpi-desync=hostfakesplit
|
||||||
|
--dpi-desync-hostfakesplit-mod=host=rzd.ru
|
||||||
|
--dpi-desync-hostfakesplit-midhost=host-2
|
||||||
|
--dpi-desync-split-seqovl=726
|
||||||
|
--dpi-desync-fooling=badsum,badseq
|
||||||
|
--dpi-desync-badseq-increment=0
|
||||||
|
|
||||||
|
--new
|
||||||
|
--filter-udp=443 ˂HOSTLIST_NOAUTO˃
|
||||||
|
--dpi-desync=fake
|
||||||
|
--dpi-desync-repeats=6
|
||||||
|
--dpi-desync-fake-quic=/opt/zapret/files/fake/quic_initial_www_google_com.bin
|
||||||
|
|
||||||
|
--new
|
||||||
|
--filter-udp=19294-19344,50000-50100
|
||||||
|
--filter-l7=discord,stun
|
||||||
|
--dpi-desync=fake
|
||||||
|
--dpi-desync-repeats=6
|
||||||
|
|
||||||
|
--new
|
||||||
|
--filter-tcp=2053,2083,2087,2096,8443
|
||||||
|
--hostlist-domains=discord.media
|
||||||
|
--dpi-desync=multisplit
|
||||||
|
--dpi-desync-split-seqovl=652
|
||||||
|
--dpi-desync-split-pos=2
|
||||||
|
--dpi-desync-split-seqovl-pattern=/opt/zapret/files/fake/tls_clienthello_www_google_com.bin
|
||||||
|
"
|
||||||
|
commit $cfgname
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
if [ "$strat" = "ALT7_by_Flowseal" ]; then
|
if [ "$strat" = "ALT7_by_Flowseal" ]; then
|
||||||
uci batch <<-EOF
|
uci batch <<-EOF
|
||||||
set $cfgname.config.NFQWS_PORTS_TCP='80,443'
|
set $cfgname.config.NFQWS_PORTS_TCP='80,443'
|
||||||
@@ -331,7 +376,7 @@ function set_cfg_nfqws_strat
|
|||||||
function set_cfg_default_values
|
function set_cfg_default_values
|
||||||
{
|
{
|
||||||
local opt_flags=${1:--}
|
local opt_flags=${1:--}
|
||||||
local opt_strat=${2:-v2_by_StressOzz}
|
local opt_strat=${2:-v6_by_StressOzz}
|
||||||
local cfgname=${3:-$ZAPRET_CFG_NAME}
|
local cfgname=${3:-$ZAPRET_CFG_NAME}
|
||||||
|
|
||||||
if ! echo "$opt_flags" | grep -q "(skip_base)"; then
|
if ! echo "$opt_flags" | grep -q "(skip_base)"; then
|
||||||
|
|||||||
@@ -10,14 +10,14 @@ SCRIPT_FILENAME=$1
|
|||||||
. /opt/zapret/comfunc.sh
|
. /opt/zapret/comfunc.sh
|
||||||
|
|
||||||
if ! is_valid_config ; then
|
if ! is_valid_config ; then
|
||||||
logger -p err -t ZAPRET "Wrong main config: $ZAPRET_CONFIG"
|
logger -p err -t $ZAP_LOG_TAG "Wrong main config: $ZAPRET_CONFIG"
|
||||||
exit 91
|
exit 91
|
||||||
fi
|
fi
|
||||||
|
|
||||||
. $ZAPRET_ORIG_INITD
|
. $ZAPRET_ORIG_INITD
|
||||||
|
|
||||||
EXEDIR=/opt/zapret
|
EXEDIR=/opt/$ZAPRET_CFG_NAME
|
||||||
ZAPRET_BASE=/opt/zapret
|
ZAPRET_BASE=/opt/$ZAPRET_CFG_NAME
|
||||||
|
|
||||||
is_run_on_boot && IS_RUN_ON_BOOT=1 || IS_RUN_ON_BOOT=0
|
is_run_on_boot && IS_RUN_ON_BOOT=1 || IS_RUN_ON_BOOT=0
|
||||||
|
|
||||||
@@ -30,13 +30,13 @@ function enable
|
|||||||
if [ -n "$ZAPRET_CFG_SEC_NAME" ]; then
|
if [ -n "$ZAPRET_CFG_SEC_NAME" ]; then
|
||||||
run_on_boot=$( get_run_on_boot_option )
|
run_on_boot=$( get_run_on_boot_option )
|
||||||
if [ $run_on_boot != 1 ]; then
|
if [ $run_on_boot != 1 ]; then
|
||||||
logger -p notice -t ZAPRET "Attempt to enable service, but service blocked!"
|
logger -p notice -t $ZAP_LOG_TAG "Attempt to enable service, but service blocked!"
|
||||||
return 61
|
return 61
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ -n "$ZAPRET_CFG_SEC_NAME" ]; then
|
if [ -n "$ZAPRET_CFG_SEC_NAME" ]; then
|
||||||
uci set $ZAPRET_CFG_NAME.config.run_on_boot=1
|
uci set $ZAPRET_CFG_SEC.run_on_boot=1
|
||||||
uci commit
|
uci commit
|
||||||
fi
|
fi
|
||||||
/bin/sh /etc/rc.common $ZAPRET_ORIG_INITD enable
|
/bin/sh /etc/rc.common $ZAPRET_ORIG_INITD enable
|
||||||
@@ -49,7 +49,7 @@ function enabled
|
|||||||
run_on_boot=$( get_run_on_boot_option )
|
run_on_boot=$( get_run_on_boot_option )
|
||||||
if [ $run_on_boot != 1 ]; then
|
if [ $run_on_boot != 1 ]; then
|
||||||
if [ "$IS_RUN_ON_BOOT" = "1" ]; then
|
if [ "$IS_RUN_ON_BOOT" = "1" ]; then
|
||||||
logger -p notice -t ZAPRET "Service is blocked!"
|
logger -p notice -t $ZAP_LOG_TAG "Service is blocked!"
|
||||||
fi
|
fi
|
||||||
return 61
|
return 61
|
||||||
fi
|
fi
|
||||||
@@ -65,7 +65,7 @@ function boot
|
|||||||
if [ -n "$ZAPRET_CFG_SEC_NAME" ]; then
|
if [ -n "$ZAPRET_CFG_SEC_NAME" ]; then
|
||||||
run_on_boot=$( get_run_on_boot_option )
|
run_on_boot=$( get_run_on_boot_option )
|
||||||
if [ $run_on_boot != 1 ]; then
|
if [ $run_on_boot != 1 ]; then
|
||||||
logger -p notice -t ZAPRET "Attempt to run service on boot! Service is blocked!"
|
logger -p notice -t $ZAP_LOG_TAG "Attempt to run service on boot! Service is blocked!"
|
||||||
return 61
|
return 61
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Copyright (c) 2024 remittor
|
# Copyright (c) 2024 remittor
|
||||||
|
|
||||||
. /opt/zapret/comfunc.sh
|
EXE_DIR=$(cd "$(dirname "$0")" 2>/dev/null || exit 1; pwd)
|
||||||
|
|
||||||
|
. $EXE_DIR/comfunc.sh
|
||||||
|
|
||||||
merge_cfg_with_def_values
|
merge_cfg_with_def_values
|
||||||
|
|
||||||
@@ -12,5 +14,5 @@ CONFIGS_SYNC=0
|
|||||||
|
|
||||||
if [ "$CONFIGS_SYNC" = "1" ]; then
|
if [ "$CONFIGS_SYNC" = "1" ]; then
|
||||||
# renew main config
|
# renew main config
|
||||||
/opt/zapret/sync_config.sh
|
$ZAPRET_BASE/sync_config.sh
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Copyright (c) 2024 remittor
|
# Copyright (c) 2024 remittor
|
||||||
|
|
||||||
. /opt/zapret/comfunc.sh
|
EXE_DIR=$(cd "$(dirname "$0")" 2>/dev/null || exit 1; pwd)
|
||||||
|
|
||||||
cfg_run_on_boot="$( uci -q get zapret.config.run_on_boot )"
|
. $EXE_DIR/comfunc.sh
|
||||||
|
|
||||||
|
cfg_run_on_boot="$( uci -q get $ZAPRET_CFG_SEC.run_on_boot )"
|
||||||
|
|
||||||
opt_flags=${1:--}
|
opt_flags=${1:--}
|
||||||
opt_strat=$2
|
opt_strat=$2
|
||||||
@@ -15,7 +17,7 @@ fi
|
|||||||
create_default_cfg "$opt_flags" "$opt_strat"
|
create_default_cfg "$opt_flags" "$opt_strat"
|
||||||
|
|
||||||
if [ "$cfg_run_on_boot" = "1" ]; then
|
if [ "$cfg_run_on_boot" = "1" ]; then
|
||||||
uci set zapret.config.run_on_boot=1
|
uci set $ZAPRET_CFG_SEC.run_on_boot=1
|
||||||
uci commit
|
uci commit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -29,5 +31,5 @@ fi
|
|||||||
|
|
||||||
if [ "$ZAPRET_SYNC_CONFIG" = "1" ]; then
|
if [ "$ZAPRET_SYNC_CONFIG" = "1" ]; then
|
||||||
# renew main config
|
# renew main config
|
||||||
/opt/zapret/sync_config.sh
|
$ZAPRET_BASE/sync_config.sh
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Copyright (c) 2024 remittor
|
# Copyright (c) 2024 remittor
|
||||||
|
|
||||||
. /opt/zapret/comfunc.sh
|
EXE_DIR=$(cd "$(dirname "$0")" 2>/dev/null || exit 1; pwd)
|
||||||
|
|
||||||
|
. $EXE_DIR/comfunc.sh
|
||||||
|
|
||||||
function uncomment_param
|
function uncomment_param
|
||||||
{
|
{
|
||||||
@@ -41,7 +43,7 @@ function sync_param
|
|||||||
{
|
{
|
||||||
local param=$1
|
local param=$1
|
||||||
local vtype=$2
|
local vtype=$2
|
||||||
local value="$( uci -q get zapret.config.$param )"
|
local value="$( uci -q get $ZAPRET_CFG_SEC.$param )"
|
||||||
uncomment_param $param
|
uncomment_param $param
|
||||||
append_param $param
|
append_param $param
|
||||||
local TAB="$( echo -n -e '\t' )"
|
local TAB="$( echo -n -e '\t' )"
|
||||||
@@ -51,9 +53,15 @@ function sync_param
|
|||||||
if [ "$param" = "NFQWS_PORTS_TCP_KEEPALIVE" -o "$param" = "NFQWS_PORTS_UDP_KEEPALIVE" ]; then
|
if [ "$param" = "NFQWS_PORTS_TCP_KEEPALIVE" -o "$param" = "NFQWS_PORTS_UDP_KEEPALIVE" ]; then
|
||||||
[ "$value" = "0" ] && value=""
|
[ "$value" = "0" ] && value=""
|
||||||
fi
|
fi
|
||||||
|
if [ "$param" = "NFQWS2_PORTS_TCP_KEEPALIVE" -o "$param" = "NFQWS2_PORTS_UDP_KEEPALIVE" ]; then
|
||||||
|
[ "$value" = "0" ] && value=""
|
||||||
|
fi
|
||||||
if [ "$param" = "NFQWS_OPT" -a "$value" != "" ]; then
|
if [ "$param" = "NFQWS_OPT" -a "$value" != "" ]; then
|
||||||
value=$( echo -n "$value" | sed '/^#/d' )
|
value=$( echo -n "$value" | sed '/^#/d' )
|
||||||
fi
|
fi
|
||||||
|
if [ "$param" = "NFQWS2_OPT" -a "$value" != "" ]; then
|
||||||
|
value=$( echo -n "$value" | sed '/^#/d' )
|
||||||
|
fi
|
||||||
if [ "$vtype" = "str" ]; then
|
if [ "$vtype" = "str" ]; then
|
||||||
set_param_value_str $param "$value"
|
set_param_value_str $param "$value"
|
||||||
else
|
else
|
||||||
@@ -90,21 +98,42 @@ sync_param DAEMON_LOG_FILE str
|
|||||||
sync_param AUTOHOSTLIST_RETRANS_THRESHOLD
|
sync_param AUTOHOSTLIST_RETRANS_THRESHOLD
|
||||||
sync_param AUTOHOSTLIST_FAIL_THRESHOLD
|
sync_param AUTOHOSTLIST_FAIL_THRESHOLD
|
||||||
sync_param AUTOHOSTLIST_FAIL_TIME
|
sync_param AUTOHOSTLIST_FAIL_TIME
|
||||||
|
if [ $ZAPRET_CFG_NAME = "zapret2" ]; then
|
||||||
|
sync_param AUTOHOSTLIST_INCOMING_MAXSEQ
|
||||||
|
sync_param AUTOHOSTLIST_RETRANS_MAXSEQ
|
||||||
|
sync_param AUTOHOSTLIST_UDP_IN
|
||||||
|
sync_param AUTOHOSTLIST_UDP_OUT
|
||||||
|
fi
|
||||||
sync_param AUTOHOSTLIST_DEBUGLOG
|
sync_param AUTOHOSTLIST_DEBUGLOG
|
||||||
|
|
||||||
sync_param NFQWS_ENABLE
|
|
||||||
sync_param DESYNC_MARK
|
sync_param DESYNC_MARK
|
||||||
sync_param DESYNC_MARK_POSTNAT
|
sync_param DESYNC_MARK_POSTNAT
|
||||||
sync_param FILTER_MARK str
|
sync_param FILTER_MARK str
|
||||||
sync_param NFQWS_PORTS_TCP str
|
|
||||||
sync_param NFQWS_PORTS_UDP str
|
if [ $ZAPRET_CFG_NAME = "zapret" ]; then
|
||||||
sync_param NFQWS_TCP_PKT_OUT str
|
sync_param NFQWS_ENABLE
|
||||||
sync_param NFQWS_TCP_PKT_IN str
|
sync_param NFQWS_PORTS_TCP str
|
||||||
sync_param NFQWS_UDP_PKT_OUT str
|
sync_param NFQWS_PORTS_UDP str
|
||||||
sync_param NFQWS_UDP_PKT_IN str
|
sync_param NFQWS_TCP_PKT_OUT str
|
||||||
sync_param NFQWS_PORTS_TCP_KEEPALIVE str
|
sync_param NFQWS_TCP_PKT_IN str
|
||||||
sync_param NFQWS_PORTS_UDP_KEEPALIVE str
|
sync_param NFQWS_UDP_PKT_OUT str
|
||||||
sync_param NFQWS_OPT str
|
sync_param NFQWS_UDP_PKT_IN str
|
||||||
|
sync_param NFQWS_PORTS_TCP_KEEPALIVE str
|
||||||
|
sync_param NFQWS_PORTS_UDP_KEEPALIVE str
|
||||||
|
sync_param NFQWS_OPT str
|
||||||
|
fi
|
||||||
|
if [ $ZAPRET_CFG_NAME = "zapret2" ]; then
|
||||||
|
sync_param NFQWS2_ENABLE
|
||||||
|
sync_param NFQWS2_PORTS_TCP str
|
||||||
|
sync_param NFQWS2_PORTS_UDP str
|
||||||
|
sync_param NFQWS2_TCP_PKT_OUT str
|
||||||
|
sync_param NFQWS2_TCP_PKT_IN str
|
||||||
|
sync_param NFQWS2_UDP_PKT_OUT str
|
||||||
|
sync_param NFQWS2_UDP_PKT_IN str
|
||||||
|
sync_param NFQWS2_PORTS_TCP_KEEPALIVE str
|
||||||
|
sync_param NFQWS2_PORTS_UDP_KEEPALIVE str
|
||||||
|
sync_param NFQWS2_OPT str
|
||||||
|
fi
|
||||||
|
|
||||||
ZAPRET_CONFIG="$ZAPRET_CONFIG__SAVED"
|
ZAPRET_CONFIG="$ZAPRET_CONFIG__SAVED"
|
||||||
|
|
||||||
|
|||||||
@@ -4,14 +4,14 @@
|
|||||||
. /opt/zapret/comfunc.sh
|
. /opt/zapret/comfunc.sh
|
||||||
|
|
||||||
# create empty txt files into ipset directory
|
# create empty txt files into ipset directory
|
||||||
[ ! -f "/opt/zapret/ipset/zapret-hosts-google.txt" ] && touch "/opt/zapret/ipset/zapret-hosts-google.txt"
|
[ ! -f "$ZAPRET_BASE/ipset/zapret-hosts-google.txt" ] && touch "$ZAPRET_BASE/ipset/zapret-hosts-google.txt"
|
||||||
#[ ! -f "/opt/zapret/ipset/zapret-hosts-auto.txt" ] && touch "/opt/zapret/ipset/zapret-hosts-auto.txt"
|
#[ ! -f "$ZAPRET_BASE/ipset/zapret-hosts-auto.txt" ] && touch "$ZAPRET_BASE/ipset/zapret-hosts-auto.txt"
|
||||||
[ ! -f "/opt/zapret/ipset/zapret-hosts-user.txt" ] && touch "/opt/zapret/ipset/zapret-hosts-user.txt"
|
[ ! -f "$ZAPRET_BASE/ipset/zapret-hosts-user.txt" ] && touch "$ZAPRET_BASE/ipset/zapret-hosts-user.txt"
|
||||||
[ ! -f "/opt/zapret/ipset/zapret-hosts-user-ipban.txt" ] && touch "/opt/zapret/ipset/zapret-hosts-user-ipban.txt"
|
[ ! -f "$ZAPRET_BASE/ipset/zapret-hosts-user-ipban.txt" ] && touch "$ZAPRET_BASE/ipset/zapret-hosts-user-ipban.txt"
|
||||||
#[ ! -f "/opt/zapret/ipset/zapret-ip.txt" ] && touch "/opt/zapret/ipset/zapret-ip.txt"
|
#[ ! -f "$ZAPRET_BASE/ipset/zapret-ip.txt" ] && touch "$ZAPRET_BASE/ipset/zapret-ip.txt"
|
||||||
[ ! -f "/opt/zapret/ipset/zapret-ip-user.txt" ] && touch "/opt/zapret/ipset/zapret-ip-user.txt"
|
[ ! -f "$ZAPRET_BASE/ipset/zapret-ip-user.txt" ] && touch "$ZAPRET_BASE/ipset/zapret-ip-user.txt"
|
||||||
[ ! -f "/opt/zapret/ipset/zapret-ip-user-exclude.txt" ] && touch "/opt/zapret/ipset/zapret-ip-user-exclude.txt"
|
[ ! -f "$ZAPRET_BASE/ipset/zapret-ip-user-exclude.txt" ] && touch "$ZAPRET_BASE/ipset/zapret-ip-user-exclude.txt"
|
||||||
[ ! -f "/opt/zapret/ipset/zapret-ip-user-ipban.txt" ] && touch "/opt/zapret/ipset/zapret-ip-user-ipban.txt"
|
[ ! -f "$ZAPRET_BASE/ipset/zapret-ip-user-ipban.txt" ] && touch "$ZAPRET_BASE/ipset/zapret-ip-user-ipban.txt"
|
||||||
|
|
||||||
# create or merge uci-config
|
# create or merge uci-config
|
||||||
$ZAPRET_BASE/renew-cfg.sh
|
$ZAPRET_BASE/renew-cfg.sh
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Copyright (c) 2025 remittor
|
# Copyright (c) 2025 remittor
|
||||||
|
|
||||||
. /opt/zapret/comfunc.sh
|
EXE_DIR=$(cd "$(dirname "$0")" 2>/dev/null || exit 1; pwd)
|
||||||
. /usr/share/libubox/jshn.sh
|
|
||||||
. /etc/openwrt_release
|
|
||||||
|
|
||||||
opt_check=
|
opt_check=
|
||||||
opt_prerelease=
|
opt_prerelease=
|
||||||
@@ -14,14 +12,34 @@ opt_test=
|
|||||||
while getopts "cu:pft:" opt; do
|
while getopts "cu:pft:" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
c) opt_check=true;;
|
c) opt_check=true;;
|
||||||
p) opt_prerelease=true;;
|
p) opt_prerelease="true";;
|
||||||
u) opt_update="$OPTARG";;
|
u) opt_update="$OPTARG";;
|
||||||
f) opt_forced=true;;
|
f) opt_forced="true";;
|
||||||
t) opt_test="$OPTARG";;
|
t) opt_test="$OPTARG";;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
ZAP_PKG_DIR=/tmp/zapret_pkg
|
if [ "$EXE_DIR" = "/tmp" ]; then
|
||||||
|
ZAPRET_CFG_NAME="zapret"
|
||||||
|
if [ "$opt_update" = "1" ]; then
|
||||||
|
ZAPRET_CFG_NAME="zapret"
|
||||||
|
opt_update="@"
|
||||||
|
opt_forced="true"
|
||||||
|
fi
|
||||||
|
if [ "$opt_update" = "2" ]; then
|
||||||
|
ZAPRET_CFG_NAME="zapret2"
|
||||||
|
opt_update="@"
|
||||||
|
opt_forced="true"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
[ -f "$EXE_DIR/comfunc.sh" ] || { echo "ERROR: file $EXE_DIR/comfunc.sh not founded!"; exit 1; }
|
||||||
|
. $EXE_DIR/comfunc.sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
. /usr/share/libubox/jshn.sh
|
||||||
|
. /etc/openwrt_release
|
||||||
|
|
||||||
|
ZAP_PKG_DIR=/tmp/$ZAPRET_CFG_NAME-pkg
|
||||||
|
|
||||||
if [ "$opt_test" != "" ]; then
|
if [ "$opt_test" != "" ]; then
|
||||||
echo 1; sleep 2;
|
echo 1; sleep 2;
|
||||||
@@ -33,9 +51,14 @@ if [ "$opt_test" != "" ]; then
|
|||||||
return "$opt_test"
|
return "$opt_test"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ZAP_CPU_ARCH=$(get_cpu_arch)
|
ZAP_CPU_ARCH="$DISTRIB_ARCH"
|
||||||
ZAP_REL_URL="https://raw.githubusercontent.com/remittor/zapret-openwrt/gh-pages/releases/releases_zap1_$ZAP_CPU_ARCH.json"
|
|
||||||
|
|
||||||
|
if [ $ZAPRET_CFG_NAME = "zapret" ]; then
|
||||||
|
ZAP_REL_URL="https://raw.githubusercontent.com/remittor/zapret-openwrt/gh-pages/releases/releases_zap1_$ZAP_CPU_ARCH.json"
|
||||||
|
fi
|
||||||
|
if [ $ZAPRET_CFG_NAME = "zapret2" ]; then
|
||||||
|
ZAP_REL_URL="https://raw.githubusercontent.com/remittor/zapret-openwrt/gh-pages/releases/releases_zap2_$ZAP_CPU_ARCH.json"
|
||||||
|
fi
|
||||||
CURL_TIMEOUT=5
|
CURL_TIMEOUT=5
|
||||||
CURL_HEADER1="Accept: application/json"
|
CURL_HEADER1="Accept: application/json"
|
||||||
CURL_HEADER2="Cache-Control: no-cache"
|
CURL_HEADER2="Cache-Control: no-cache"
|
||||||
@@ -62,11 +85,73 @@ fi
|
|||||||
|
|
||||||
# -------------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
function download_json
|
function get_distrib_param
|
||||||
{
|
{
|
||||||
local url="$1"
|
local parname=$1
|
||||||
curl -s -L --max-time $CURL_TIMEOUT -H "$CURL_HEADER1" -H "$CURL_HEADER2" "$url" 2>/dev/null
|
local value="__unknown__"
|
||||||
return $?
|
if [ -f /etc/openwrt_release ]; then
|
||||||
|
while IFS='=' read -r key val; do
|
||||||
|
val="${val#\'}"
|
||||||
|
val="${val%\'}"
|
||||||
|
val="${val#\"}"
|
||||||
|
val="${val%\"}"
|
||||||
|
if [ "$key" = "$parname" ]; then
|
||||||
|
value="$val"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done < /etc/openwrt_release
|
||||||
|
fi
|
||||||
|
printf '%s' "$value"
|
||||||
|
}
|
||||||
|
|
||||||
|
function pkg_mgr_update
|
||||||
|
{
|
||||||
|
local forced=$1
|
||||||
|
if [ "$PKG_MGR" = "opkg" ]; then
|
||||||
|
PKG_TOTAL=$( opkg list | wc -l )
|
||||||
|
PKG_INSTALLED=$( opkg list-installed | wc -l )
|
||||||
|
if [ "$PKG_TOTAL" = "$PKG_INSTALLED" ]; then
|
||||||
|
echo ">>> OPKG update..."
|
||||||
|
opkg update
|
||||||
|
return $?
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
PKG_AVAIL=$( apk list --available 2>/dev/null | wc -l )
|
||||||
|
if [ "$PKG_AVAIL" -lt 100 ]; then
|
||||||
|
echo ">>> APK update..."
|
||||||
|
apk update
|
||||||
|
return $?
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function curl_install
|
||||||
|
{
|
||||||
|
if command -v curl >/dev/null 2>&1; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
pkg_mgr_update || { echo "ERROR: cannot update packages list"; return 1; }
|
||||||
|
echo ">>> Package curl not found, installing..."
|
||||||
|
if [ "$PKG_MGR" = "opkg" ]; then
|
||||||
|
opkg install curl
|
||||||
|
else
|
||||||
|
apk add curl
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function unzip_install
|
||||||
|
{
|
||||||
|
if command -v unzip >/dev/null 2>&1; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
pkg_mgr_update || { echo "ERROR: cannot update packages list"; return 1; }
|
||||||
|
echo ">>> Package unzip not found, installing..."
|
||||||
|
if [ "$PKG_MGR" = "opkg" ]; then
|
||||||
|
opkg install unzip
|
||||||
|
else
|
||||||
|
apk add unzip
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_pkg_version
|
function get_pkg_version
|
||||||
@@ -81,7 +166,7 @@ function get_pkg_version
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "$PKG_MGR" = apk ]; then
|
if [ "$PKG_MGR" = apk ]; then
|
||||||
line=$( apk info -e "$pkg_name" 2>/dev/null || true )
|
line=$( apk info -s "$pkg_name" 2>/dev/null | head -n 1 | awk '{print $1}' || true )
|
||||||
if [ -n "$line" ]; then
|
if [ -n "$line" ]; then
|
||||||
base=${line%-r[0-9]*}
|
base=${line%-r[0-9]*}
|
||||||
ver=${base##*-}
|
ver=${base##*-}
|
||||||
@@ -104,7 +189,8 @@ function normalize_version
|
|||||||
{
|
{
|
||||||
local ver="$1"
|
local ver="$1"
|
||||||
local base
|
local base
|
||||||
local major minor rel
|
local major minor build rel
|
||||||
|
local old_ifs
|
||||||
case "$ver" in
|
case "$ver" in
|
||||||
*-r[0-9]*)
|
*-r[0-9]*)
|
||||||
rel="${ver##*-r}"
|
rel="${ver##*-r}"
|
||||||
@@ -115,11 +201,17 @@ function normalize_version
|
|||||||
base="$ver"
|
base="$ver"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
major="${base%%.*}"
|
old_ifs="$IFS" ; IFS='.' ; set -- $base ; IFS="$old_ifs"
|
||||||
minor="${base#*.}"
|
rel=${rel:-1}
|
||||||
[ -z "$minor" ] && minor=0
|
major=${1:-0}
|
||||||
[ -z "$rel" ] && rel=1
|
minor=${2:-0}
|
||||||
echo "$major.$minor.$rel"
|
if [ $ZAPRET_CFG_NAME = "zapret" ]; then
|
||||||
|
echo "$major.$minor.$rel"
|
||||||
|
fi
|
||||||
|
if [ $ZAPRET_CFG_NAME = "zapret2" ]; then
|
||||||
|
build=${3:-0}
|
||||||
|
echo "$major.$minor.$build.$rel"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function pkg_version_cmp
|
function pkg_version_cmp
|
||||||
@@ -137,9 +229,22 @@ function pkg_version_cmp
|
|||||||
x2=$( echo "$ver2" | cut -d. -f2 )
|
x2=$( echo "$ver2" | cut -d. -f2 )
|
||||||
[ "$x1" -gt "$x2" ] && { echo -n "G"; return 0; }
|
[ "$x1" -gt "$x2" ] && { echo -n "G"; return 0; }
|
||||||
[ "$x1" -lt "$x2" ] && { echo -n "L"; return 0; }
|
[ "$x1" -lt "$x2" ] && { echo -n "L"; return 0; }
|
||||||
|
if [ $ZAPRET_CFG_NAME = "zapret2" ]; then
|
||||||
|
# build
|
||||||
|
x1=$( echo "$ver1" | cut -d. -f3 )
|
||||||
|
x2=$( echo "$ver2" | cut -d. -f3 )
|
||||||
|
[ "$x1" -gt "$x2" ] && { echo -n "G"; return 0; }
|
||||||
|
[ "$x1" -lt "$x2" ] && { echo -n "L"; return 0; }
|
||||||
|
fi
|
||||||
# release
|
# release
|
||||||
x1=$( echo "$ver1" | cut -d. -f3 )
|
if [ $ZAPRET_CFG_NAME = "zapret" ]; then
|
||||||
x2=$( echo "$ver2" | cut -d. -f3 )
|
x1=$( echo "$ver1" | cut -d. -f3 )
|
||||||
|
x2=$( echo "$ver2" | cut -d. -f3 )
|
||||||
|
fi
|
||||||
|
if [ $ZAPRET_CFG_NAME = "zapret2" ]; then
|
||||||
|
x1=$( echo "$ver1" | cut -d. -f4 )
|
||||||
|
x2=$( echo "$ver2" | cut -d. -f4 )
|
||||||
|
fi
|
||||||
[ "$x1" -gt "$x2" ] && { echo -n "G"; return 0; }
|
[ "$x1" -gt "$x2" ] && { echo -n "G"; return 0; }
|
||||||
[ "$x1" -lt "$x2" ] && { echo -n "L"; return 0; }
|
[ "$x1" -lt "$x2" ] && { echo -n "L"; return 0; }
|
||||||
echo -n "E"
|
echo -n "E"
|
||||||
@@ -147,18 +252,28 @@ function pkg_version_cmp
|
|||||||
|
|
||||||
function download_releases_info
|
function download_releases_info
|
||||||
{
|
{
|
||||||
local txt txtlen txtlines generated_at
|
local fname resp hdr txt txtlen txtlines generated_at
|
||||||
REL_JSON=
|
REL_JSON=
|
||||||
echo "Download releases info..."
|
echo "Download releases info..."
|
||||||
txt=$(download_json $ZAP_REL_URL)
|
fname="${ZAP_REL_URL##*/}"
|
||||||
|
resp=$( curl -s -D - --max-time $CURL_TIMEOUT -H "$CURL_HEADER1" -H "$CURL_HEADER2" "$ZAP_REL_URL" 2>/dev/null )
|
||||||
|
hdr="${resp%%$'\r\n\r\n'*}"
|
||||||
|
status=$( printf '%s\n' "$hdr" | head -n 1 | awk '{print $2}' )
|
||||||
|
if [ "$status" != 200 ]; then
|
||||||
|
echo "ERROR: Cannot download file \"$ZAP_REL_URL\" (status = $status)"
|
||||||
|
return 103
|
||||||
|
fi
|
||||||
|
txtlen=$( printf '%s\n' "$hdr" | awk -F': ' 'BEGIN{IGNORECASE=1} $1=="Content-Length"{print $2}' | tr -d '\r' )
|
||||||
|
echo "Content-Length: $txtlen bytes"
|
||||||
|
txt="${resp#*$'\r\n\r\n'}"
|
||||||
txtlen=${#txt}
|
txtlen=${#txt}
|
||||||
txtlines=$(printf '%s\n' "$txt" | wc -l)
|
txtlines=$(printf '%s\n' "$txt" | wc -l)
|
||||||
if [[ $txtlen -lt 64 ]]; then
|
if [[ $txtlen -lt 64 ]]; then
|
||||||
echo "ERROR: Cannot download releases info!"
|
echo "ERROR: Cannot download releases info! (size = $txtlen)"
|
||||||
return 104
|
return 104
|
||||||
fi
|
fi
|
||||||
echo "Releases info downloaded! Size = $txtlen, Lines = $txtlines"
|
echo "Releases info downloaded! Size = $txtlen, Lines = $txtlines"
|
||||||
generated_at=$(printf '%s\n' "$txt" | grep -m1 -o '"generated_at"[[:space:]]*:[[:space:]]*".*"' | cut -d'"' -f4)
|
generated_at=$( printf '%s\n' "$txt" | grep -m1 -o '"generated_at"[[:space:]]*:[[:space:]]*".*"' | cut -d'"' -f4 )
|
||||||
if [[ "$generated_at" = "" ]]; then
|
if [[ "$generated_at" = "" ]]; then
|
||||||
echo "ERROR: Cannot download releases info! (incorrect generated_at)"
|
echo "ERROR: Cannot download releases info! (incorrect generated_at)"
|
||||||
return 105
|
return 105
|
||||||
@@ -222,7 +337,7 @@ function get_actual_release
|
|||||||
done
|
done
|
||||||
json_cleanup
|
json_cleanup
|
||||||
echo "ERROR: latest release for arch \"$ZAP_CPU_ARCH\" not founded!"
|
echo "ERROR: latest release for arch \"$ZAP_CPU_ARCH\" not founded!"
|
||||||
return 1 # release not founded
|
return 150 # release not founded
|
||||||
}
|
}
|
||||||
|
|
||||||
# -------------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------------
|
||||||
@@ -238,11 +353,16 @@ fi
|
|||||||
|
|
||||||
#echo "DISTRIB_ID: $DISTRIB_ID"
|
#echo "DISTRIB_ID: $DISTRIB_ID"
|
||||||
echo "DISTRIB_RELEASE: $DISTRIB_RELEASE"
|
echo "DISTRIB_RELEASE: $DISTRIB_RELEASE"
|
||||||
echo "DISTRIB_DESCRIPTION:" $(get_distrib_param DISTRIB_DESCRIPTION)
|
echo "DISTRIB_DESCRIPTION:" $( get_distrib_param DISTRIB_DESCRIPTION )
|
||||||
echo "DISTRIB_ARCH:" $(get_distrib_param DISTRIB_ARCH)
|
echo "DISTRIB_ARCH:" $( get_distrib_param DISTRIB_ARCH )
|
||||||
|
|
||||||
if ! command -v curl >/dev/null 2>&1; then
|
if ! command -v curl >/dev/null 2>&1; then
|
||||||
echo "ERROR: package \"curl\" not installed!"
|
if [ "$opt_forced" = true ]; then
|
||||||
|
curl_install
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if ! command -v curl >/dev/null 2>&1; then
|
||||||
|
echo "ERROR: Required package \"curl\" not installed!"
|
||||||
return 10
|
return 10
|
||||||
fi
|
fi
|
||||||
CURL_INFO=$( curl -V )
|
CURL_INFO=$( curl -V )
|
||||||
@@ -264,6 +384,11 @@ if [ "$opt_check" = "true" ]; then
|
|||||||
fi
|
fi
|
||||||
get_actual_release
|
get_actual_release
|
||||||
ZAP_ERR=$?
|
ZAP_ERR=$?
|
||||||
|
if [ $ZAP_ERR = 150 ] && [ "$opt_prerelease" != true ] && [ "$opt_forced" = true ]; then
|
||||||
|
opt_prerelease="true"
|
||||||
|
get_actual_release
|
||||||
|
ZAP_ERR=$?
|
||||||
|
fi
|
||||||
if [ $ZAP_ERR -ne 0 ]; then
|
if [ $ZAP_ERR -ne 0 ]; then
|
||||||
echo "ERROR: Func get_actual_release return error code: $ZAP_ERR"
|
echo "ERROR: Func get_actual_release return error code: $ZAP_ERR"
|
||||||
return $ZAP_ERR
|
return $ZAP_ERR
|
||||||
@@ -279,7 +404,7 @@ ZAP_PKG_FN=
|
|||||||
ZAP_PKG_BASE_FN=
|
ZAP_PKG_BASE_FN=
|
||||||
ZAP_PKG_LUCI_FN=
|
ZAP_PKG_LUCI_FN=
|
||||||
|
|
||||||
ZAP_CUR_PKG_VER=$( get_pkg_version zapret )
|
ZAP_CUR_PKG_VER=$( get_pkg_version $ZAPRET_CFG_NAME )
|
||||||
echo "Current installed version: $ZAP_CUR_PKG_VER"
|
echo "Current installed version: $ZAP_CUR_PKG_VER"
|
||||||
|
|
||||||
if [ "$opt_update" = "" ]; then
|
if [ "$opt_update" = "" ]; then
|
||||||
@@ -334,8 +459,8 @@ if [ "$opt_update" != "" ]; then
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
ZAP_PKG_DIR=/tmp/zapret_pkg
|
ZAP_PKG_DIR=/tmp/$ZAPRET_CFG_NAME-pkg
|
||||||
rm -rf $ZAP_PKG_DIR
|
rm -rf $ZAP_PKG_DIR 2>/dev/null
|
||||||
ZAP_PKG_HDRS=$( curl -s -I -L --max-time $CURL_TIMEOUT -H "$CURL_HEADER2" "$ZAP_PKG_URL" )
|
ZAP_PKG_HDRS=$( curl -s -I -L --max-time $CURL_TIMEOUT -H "$CURL_HEADER2" "$ZAP_PKG_URL" )
|
||||||
ZAP_PKG_SIZE=$( echo "$ZAP_PKG_HDRS" | grep -i 'content-length: ' | tail -n1 | awk '{print $2}' | tr -d '\r' )
|
ZAP_PKG_SIZE=$( echo "$ZAP_PKG_HDRS" | grep -i 'content-length: ' | tail -n1 | awk '{print $2}' | tr -d '\r' )
|
||||||
echo "Downloded ZIP-file size = $ZAP_PKG_SIZE bytes"
|
echo "Downloded ZIP-file size = $ZAP_PKG_SIZE bytes"
|
||||||
@@ -356,42 +481,50 @@ if [ "$opt_update" != "" ]; then
|
|||||||
echo "ERROR: downloaded package is incorrect! (size = $ZAP_PKG_SZ)"
|
echo "ERROR: downloaded package is incorrect! (size = $ZAP_PKG_SZ)"
|
||||||
return 216
|
return 216
|
||||||
fi
|
fi
|
||||||
|
if ! command -v unzip >/dev/null 2>&1; then
|
||||||
|
if [ "$opt_forced" = true ]; then
|
||||||
|
unzip_install
|
||||||
|
fi
|
||||||
|
fi
|
||||||
if ! command -v unzip >/dev/null 2>&1; then
|
if ! command -v unzip >/dev/null 2>&1; then
|
||||||
echo "ERROR: package \"upzip\" not installed!"
|
echo "ERROR: package \"upzip\" not installed!"
|
||||||
return 218
|
return 218
|
||||||
fi
|
fi
|
||||||
unzip -q "$ZAP_PKG_FN" -d $ZAP_PKG_DIR
|
unzip -q "$ZAP_PKG_FN" -d $ZAP_PKG_DIR
|
||||||
rm -f "$ZAP_PKG_FN"
|
rm -f "$ZAP_PKG_FN" 2>/dev/null
|
||||||
if [ "$PKG_MGR" = "apk" ]; then
|
if [ "$PKG_MGR" = "apk" ]; then
|
||||||
if [ ! -d "$ZAP_PKG_DIR/apk" ]; then
|
if [ ! -d "$ZAP_PKG_DIR/apk" ]; then
|
||||||
echo "ERROR: APK-files not founded"
|
echo "ERROR: APK-files not founded"
|
||||||
return 221
|
return 221
|
||||||
fi
|
fi
|
||||||
rm -f "$ZAP_PKG_DIR/*.ipk"
|
rm -f $ZAP_PKG_DIR/*.ipk 2>/dev/null
|
||||||
mv "$ZAP_PKG_DIR/apk/*" "$ZAP_PKG_DIR/"
|
mv $ZAP_PKG_DIR/apk/* $ZAP_PKG_DIR/
|
||||||
else
|
else
|
||||||
rm -rf "$ZAP_PKG_DIR/apk"
|
rm -rf $ZAP_PKG_DIR/apk 2>/dev/null
|
||||||
fi
|
fi
|
||||||
ZAP_PKG_LIST=$( ls -1 "$ZAP_PKG_DIR" )
|
ZAP_PKG_LIST=$( ls -1 "$ZAP_PKG_DIR" )
|
||||||
echo "------ Downloaded packages:"
|
echo "------ Downloaded packages:"
|
||||||
echo "$ZAP_PKG_LIST"
|
echo "$ZAP_PKG_LIST"
|
||||||
echo "------"
|
echo "------"
|
||||||
if [ "$PKG_MGR" != "apk" ]; then
|
if [ "$PKG_MGR" != "apk" ]; then
|
||||||
ZAP_PKG_BASE_FN=$( find "$ZAP_PKG_DIR" -maxdepth 1 -type f -name "zapret_*.${ZAP_PKG_EXT}" | head -n 1 )
|
ZAP_PKG_BASE_FN=$( find "$ZAP_PKG_DIR" -maxdepth 1 -type f -name "${ZAPRET_CFG_NAME}_*.${ZAP_PKG_EXT}" | head -n 1 )
|
||||||
else
|
else
|
||||||
ZAP_PKG_BASE_FN=$( find "$ZAP_PKG_DIR" -maxdepth 1 -type f -name "zapret-[0-9]*.?*.${ZAP_PKG_EXT}" | head -n 1 )
|
ZAP_PKG_BASE_FN=$( find "$ZAP_PKG_DIR" -maxdepth 1 -type f -name "${ZAPRET_CFG_NAME}-[0-9]*.?*.${ZAP_PKG_EXT}" | head -n 1 )
|
||||||
fi
|
fi
|
||||||
ZAP_PKG_LUCI_FN=$( find "$ZAP_PKG_DIR" -maxdepth 1 -type f -name "luci-app-zapret2*.${ZAP_PKG_EXT}" | head -n 1 )
|
ZAP_PKG_LUCI_FN=$( find "$ZAP_PKG_DIR" -maxdepth 1 -type f -name "luci-app-${ZAPRET_CFG_NAME}*.${ZAP_PKG_EXT}" | head -n 1 )
|
||||||
if [ ! -f "$ZAP_PKG_BASE_FN" ]; then
|
if [ ! -f "$ZAP_PKG_BASE_FN" ]; then
|
||||||
echo "ERROR: File \"zapret*.${ZAP_PKG_EXT}\" not found!"
|
echo "ERROR: File \"${ZAPRET_CFG_NAME}*.${ZAP_PKG_EXT}\" not found!"
|
||||||
return 231
|
return 231
|
||||||
fi
|
fi
|
||||||
echo "ZAP_PKG_BASE_FN = $ZAP_PKG_BASE_FN"
|
echo "ZAP_PKG_BASE_FN = $ZAP_PKG_BASE_FN"
|
||||||
if [ ! -f "$ZAP_PKG_LUCI_FN" ]; then
|
if [ ! -f "$ZAP_PKG_LUCI_FN" ]; then
|
||||||
echo "ERROR: File \"luci-app-zapret*.${ZAP_PKG_EXT}\" not found!"
|
echo "ERROR: File \"luci-app-${ZAPRET_CFG_NAME}*.${ZAP_PKG_EXT}\" not found!"
|
||||||
return 232
|
return 232
|
||||||
fi
|
fi
|
||||||
echo "ZAP_PKG_LUCI_FN = $ZAP_PKG_LUCI_FN"
|
echo "ZAP_PKG_LUCI_FN = $ZAP_PKG_LUCI_FN"
|
||||||
|
if [ "$opt_forced" = true ]; then
|
||||||
|
pkg_mgr_update
|
||||||
|
fi
|
||||||
echo "Install downloaded packages..."
|
echo "Install downloaded packages..."
|
||||||
if [ "$PKG_MGR" != "apk" ]; then
|
if [ "$PKG_MGR" != "apk" ]; then
|
||||||
opkg install --force-reinstall "$ZAP_PKG_BASE_FN"
|
opkg install --force-reinstall "$ZAP_PKG_BASE_FN"
|
||||||
|
|||||||
Reference in New Issue
Block a user