Squashed 'fakehttp/' changes from 08f829e..dfc39f4
dfc39f4 update payload type name b359449 update for luci-app-fakehttp git-subtree-dir: fakehttp git-subtree-split: dfc39f4fe89fd74ff3cb10fc53bf86925405066c
This commit is contained in:
parent
ee5048aa89
commit
1f7a6294e4
7
Makefile
7
Makefile
|
@ -1,6 +1,6 @@
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
#
|
#
|
||||||
# Copyright (C) 2024-2025 Yuxi Yang <i@bgme.me>
|
# Copyright (C) 2025 Yuxi Yang <i@bgme.me>
|
||||||
|
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ PKG_UPSTREAM_NAME:=FakeHTTP
|
||||||
PKG_UPSTREAM_VERSION:=0.9.18
|
PKG_UPSTREAM_VERSION:=0.9.18
|
||||||
PKG_UPSTREAM_GITHASH:=
|
PKG_UPSTREAM_GITHASH:=
|
||||||
PKG_VERSION:=$(PKG_UPSTREAM_VERSION)$(if $(PKG_UPSTREAM_GITHASH),~$(call version_abbrev,$(PKG_UPSTREAM_GITHASH)))
|
PKG_VERSION:=$(PKG_UPSTREAM_VERSION)$(if $(PKG_UPSTREAM_GITHASH),~$(call version_abbrev,$(PKG_UPSTREAM_GITHASH)))
|
||||||
PKG_RELEASE:=2
|
PKG_RELEASE:=3
|
||||||
|
|
||||||
PKG_SOURCE_SUBDIR:=$(PKG_UPSTREAM_NAME)-$(PKG_UPSTREAM_VERSION)
|
PKG_SOURCE_SUBDIR:=$(PKG_UPSTREAM_NAME)-$(PKG_UPSTREAM_VERSION)
|
||||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
|
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
|
||||||
|
@ -57,6 +57,9 @@ define Package/$(PKG_NAME)/install
|
||||||
|
|
||||||
$(INSTALL_DIR) $(1)/etc/config/
|
$(INSTALL_DIR) $(1)/etc/config/
|
||||||
$(INSTALL_CONF) $(CURDIR)/files/fakehttp.config $(1)/etc/config/fakehttp
|
$(INSTALL_CONF) $(CURDIR)/files/fakehttp.config $(1)/etc/config/fakehttp
|
||||||
|
|
||||||
|
$(INSTALL_DIR) $(1)/etc/fakehttp/
|
||||||
|
$(INSTALL_CONF) $(CURDIR)/files/fakehtttp.payload $(1)/etc/fakehttp/example_payload
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
$(eval $(call BuildPackage,$(PKG_NAME)))
|
|
@ -4,16 +4,22 @@ config globals 'globals'
|
||||||
option silent '0'
|
option silent '0'
|
||||||
|
|
||||||
config payload
|
config payload
|
||||||
option type 'h'
|
option enabled '1'
|
||||||
option hostname 'node-36-250-1-90.speedtest.cn'
|
option type 'http'
|
||||||
|
option payload 'node-36-250-1-90.speedtest.cn'
|
||||||
|
option comment ''
|
||||||
|
|
||||||
#config payload
|
config payload
|
||||||
# option type 'e'
|
option enabled '0'
|
||||||
# option hostname 'node-36-250-1-90.speedtest.cn'
|
option type 'https'
|
||||||
#
|
option payload 'node-36-250-1-90.speedtest.cn'
|
||||||
#config payload
|
option comment ''
|
||||||
# option type 'b'
|
|
||||||
# option file '/tmp/fakehttp_payload'
|
config payload
|
||||||
|
option enabled '0'
|
||||||
|
option type 'binary'
|
||||||
|
option payload '/etc/fakehttp/example_payload'
|
||||||
|
option comment ''
|
||||||
|
|
||||||
config advanced 'advanced'
|
config advanced 'advanced'
|
||||||
# -f skip firewall rules
|
# -f skip firewall rules
|
||||||
|
|
|
@ -21,26 +21,26 @@ add_interface() {
|
||||||
add_payload() {
|
add_payload() {
|
||||||
local section="$1"
|
local section="$1"
|
||||||
|
|
||||||
local type
|
local enabled
|
||||||
config_get type "${section}" "type" ""
|
config_get_bool enabled "${section}" "enabled" "0"
|
||||||
|
|
||||||
case "${type}" in
|
if [ "${enabled}" -eq "1" ]
|
||||||
"h")
|
then
|
||||||
local hostname
|
local type payload
|
||||||
config_get hostname "${section}" "hostname" ""
|
config_get type "${section}" "type" ""
|
||||||
procd_append_param command "-h" "${hostname}"
|
config_get payload "${section}" "payload" ""
|
||||||
;;
|
case "${type}" in
|
||||||
"e")
|
"http")
|
||||||
local hostname
|
procd_append_param command "-h" "${payload}"
|
||||||
config_get hostname "${section}" "hostname" ""
|
;;
|
||||||
procd_append_param command "-e" "${hostname}"
|
"https")
|
||||||
;;
|
procd_append_param command "-e" "${payload}"
|
||||||
"b")
|
;;
|
||||||
local file
|
"binary")
|
||||||
config_get file "${section}" "file" ""
|
procd_append_param command "-b" "${payload}"
|
||||||
procd_append_param command "-b" "${file}"
|
;;
|
||||||
;;
|
esac
|
||||||
esac
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
test_bool_then_append() {
|
test_bool_then_append() {
|
||||||
|
|
19
files/fakehtttp.payload
Normal file
19
files/fakehtttp.payload
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
GET /download?size=25000000&r=0.8063093007466539 HTTP/1.1
|
||||||
|
Host: node-36-250-1-90.speedtest.cn:51090
|
||||||
|
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.7103.48 Safari/537.36
|
||||||
|
Accept: */*
|
||||||
|
Accept-Language: en-US,en;q=0.5
|
||||||
|
Accept-Encoding: gzip, deflate, br, zstd
|
||||||
|
Origin: https://www.speedtest.cn
|
||||||
|
DNT: 1
|
||||||
|
Sec-GPC: 1
|
||||||
|
Connection: keep-alive
|
||||||
|
Referer: https://www.speedtest.cn/
|
||||||
|
Sec-Fetch-Dest: empty
|
||||||
|
Sec-Fetch-Mode: cors
|
||||||
|
Sec-Fetch-Site: same-site
|
||||||
|
sec-ch-ua-platform: "Windows"
|
||||||
|
sec-ch-ua: "Not/A)Brand";v="8", "Chromium";v="136", "Google Chrome";v="136"
|
||||||
|
sec-ch-ua-mobile: ?0
|
||||||
|
Pragma: no-cache
|
||||||
|
Cache-Control: no-cache
|
Loading…
Reference in a new issue