mirror of
https://github.com/coolsnowwolf/packages
synced 2025-01-07 07:07:02 +08:00
dns2tcp: add package
This commit is contained in:
parent
07ee39846d
commit
5e161cbd02
82
net/chinadns-ng/Makefile
Normal file
82
net/chinadns-ng/Makefile
Normal file
@ -0,0 +1,82 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
#
|
||||
# Copyright (C) 2023 ImmortalWrt.org
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=chinadns-ng
|
||||
PKG_VERSION:=2024.10.14
|
||||
PKG_RELEASE:=1
|
||||
|
||||
ifeq ($(ARCH),aarch64)
|
||||
PKG_SOURCE_URL_FILE:=$(PKG_NAME)+wolfssl_noasm@aarch64-linux-musl@generic+v8a@fast+lto
|
||||
PKG_HASH:=914e8b66805b1804f6688dfcda3b67c7c45e5fc5e05afff4837450f8b67a8372
|
||||
else ifeq ($(ARCH),arm)
|
||||
# Referred to golang/golang-values.mk
|
||||
ARM_CPU_FEATURES:=$(word 2,$(subst +,$(space),$(call qstrip,$(CONFIG_CPU_TYPE))))
|
||||
ifeq ($(ARM_CPU_FEATURES),)
|
||||
PKG_SOURCE_URL_FILE:=$(PKG_NAME)+wolfssl@arm-linux-musleabi@generic+v5t+soft_float@fast+lto
|
||||
PKG_HASH:=9adfe309a41f21156cc5597333c42c36bc9e4e42eb1a71d18b92c39aed0340b2
|
||||
else ifneq ($(filter $(ARM_CPU_FEATURES),vfp vfpv2),)
|
||||
PKG_SOURCE_URL_FILE:=$(PKG_NAME)+wolfssl@arm-linux-musleabi@generic+v6+soft_float@fast+lto
|
||||
PKG_HASH:=4881e4dc20a1a4b21bc0cc3c378da8d8004274929e5900d5246aece230eea4f8
|
||||
else
|
||||
PKG_SOURCE_URL_FILE:=$(PKG_NAME)+wolfssl@arm-linux-musleabihf@generic+v7a@fast+lto
|
||||
PKG_HASH:=5a47e56ef6fac90d22eabc766ffb817cb15fa3875b03ea2a4cd8a684b25b401a
|
||||
endif
|
||||
else ifeq ($(ARCH),i386)
|
||||
ifneq ($(CONFIG_TARGET_x86_geode)$(CONFIG_TARGET_x86_legacy),)
|
||||
PKG_SOURCE_URL_FILE:=$(PKG_NAME)+wolfssl@i386-linux-musl@i686@fast+lto
|
||||
PKG_HASH:=f29853387f51bdb4a993504a31933ece538f99365f3f3b46794caa75a3b653ba
|
||||
else
|
||||
PKG_SOURCE_URL_FILE:=$(PKG_NAME)+wolfssl@i386-linux-musl@pentium4@fast+lto
|
||||
PKG_HASH:=279415d9fab1e49bb4bf819270da0d57a9dcdc078cbd4b725b0b7cf3c52d2aba
|
||||
endif
|
||||
else ifeq ($(ARCH),mips)
|
||||
PKG_SOURCE_URL_FILE:=$(PKG_NAME)+wolfssl@mips-linux-musl@mips32+soft_float@fast+lto
|
||||
PKG_HASH:=b57f9ba76ff4a7c52d1cfbe75de47f6f0e8a1bf8f2a293a39c10b5d94c99cc0f
|
||||
else ifeq ($(ARCH),mipsel)
|
||||
ifeq ($(CONFIG_HAS_FPU),)
|
||||
PKG_SOURCE_URL_FILE:=$(PKG_NAME)+wolfssl@mipsel-linux-musl@mips32+soft_float@fast+lto
|
||||
PKG_HASH:=f0ca46e7ca83711ae24a6c0d7c71400d994dc7289cae599412fd8e654b198f3e
|
||||
else
|
||||
PKG_SOURCE_URL_FILE:=$(PKG_NAME)+wolfssl@mipsel-linux-musl@mips32@fast+lto
|
||||
PKG_HASH:=48eecd536e1f4cb7d3fa44cdc23d996acfbc75004d8e16b405a7ee148523696e
|
||||
endif
|
||||
else ifeq ($(ARCH),x86_64)
|
||||
PKG_SOURCE_URL_FILE:=$(PKG_NAME)+wolfssl@x86_64-linux-musl@x86_64@fast+lto
|
||||
PKG_HASH:=6928e28f1c6c41099b6ce8ab1ce38a98cc9da75ff9533f8644f67be455463d0e
|
||||
else
|
||||
PKG_SOURCE_URL_FILE:=dummy
|
||||
PKG_HASH:=dummy
|
||||
endif
|
||||
|
||||
PKG_SOURCE:=$(subst $(PKG_NAME),$(PKG_NAME)-$(PKG_VERSION),$(PKG_SOURCE_URL_FILE))
|
||||
PKG_SOURCE_URL:=https://github.com/zfl9/chinadns-ng/releases/download/$(PKG_VERSION)/
|
||||
|
||||
PKG_LICENSE:=AGPL-3.0-only
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
PKG_UNPACK:=:
|
||||
|
||||
define Package/chinadns-ng
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=IP Addresses and Names
|
||||
TITLE:=ChinaDNS next generation, refactoring with epoll and ipset.
|
||||
URL:=https://github.com/zfl9/chinadns-ng
|
||||
DEPENDS:=@(aarch64||arm||i386||mips||mipsel||x86_64)
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/chinadns-ng/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(DL_DIR)/$(PKG_SOURCE) $(1)/usr/bin/chinadns-ng
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,chinadns-ng))
|
27
net/chinadns-ng/update.sh
Normal file
27
net/chinadns-ng/update.sh
Normal file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -x
|
||||
|
||||
function urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
|
||||
|
||||
export CURDIR="$(cd "$(dirname $0)"; pwd)"
|
||||
|
||||
TAG_INFO="$(curl -H "Authorization: $GITHUB_TOKEN" -sL "https://api.github.com/repos/zfl9/chinadns-ng/releases/latest")"
|
||||
[ -n "$TAG_INFO" ] || exit 1
|
||||
|
||||
VERSION="$(jq -r ".tag_name" <<< "$TAG_INFO")"
|
||||
PKG_VERSION="$(awk -F "PKG_VERSION:=" '{print $2}' "$CURDIR/Makefile" | xargs)"
|
||||
[ "$PKG_VERSION" != "$VERSION" ] || exit 0
|
||||
|
||||
for i in $(jq -r '.assets[].browser_download_url | select(contains("chinadns-ng%2B"))' <<< "$TAG_INFO"); do
|
||||
i="$(urldecode "$i")"
|
||||
|
||||
arch="$(awk -F '@' '{printf "%s@%s", $2, $3}' <<< "$i")"
|
||||
line="$(sed -n "/PKG_SOURCE_URL_FILE:=.*$arch@/=" "$CURDIR/Makefile")"
|
||||
[ -n "$line" ] || continue
|
||||
|
||||
sha256="$(curl -fsSL "$i" | sha256sum | awk '{print $1}')" || exit 1
|
||||
sed -i "$((line + 1))s/PKG_HASH:=.*/PKG_HASH:=$sha256/" "$CURDIR/Makefile"
|
||||
done
|
||||
|
||||
sed -i "s,PKG_VERSION:=.*,PKG_VERSION:=$VERSION,g" "$CURDIR/Makefile"
|
53
net/dns2socks/Makefile
Normal file
53
net/dns2socks/Makefile
Normal file
@ -0,0 +1,53 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
#
|
||||
# Copyright (C) 2021 ImmortalWrt.org
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dns2socks
|
||||
PKG_VERSION:=2.1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE:=SourceCode.zip
|
||||
PKG_SOURCE_URL:=@SF/dns2socks
|
||||
PKG_SOURCE_DATE:=2020-02-18
|
||||
PKG_HASH:=406b5003523577d39da66767adfe54f7af9b701374363729386f32f6a3a995f4
|
||||
|
||||
PKG_MAINTAINER:=ghostmaker
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
UNZIP_CMD:=unzip -q -d $(PKG_BUILD_DIR) $(DL_DIR)/$(PKG_SOURCE)
|
||||
|
||||
define Package/dns2socks
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=IP Addresses and Names
|
||||
TITLE:=DNS to SOCKS or HTTP proxy
|
||||
URL:=http://dns2socks.sourceforge.net/
|
||||
DEPENDS:=+libpthread
|
||||
endef
|
||||
|
||||
define Package/dns2socks/description
|
||||
This is a command line utility to resolve DNS requests via
|
||||
a SOCKS tunnel like Tor or a HTTP proxy.
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(TARGET_CC) \
|
||||
$(TARGET_CFLAGS) \
|
||||
$(TARGET_CPPFLAGS) \
|
||||
$(FPIC) \
|
||||
-o $(PKG_BUILD_DIR)/DNS2SOCKS/dns2socks \
|
||||
$(PKG_BUILD_DIR)/DNS2SOCKS/DNS2SOCKS.c \
|
||||
$(TARGET_LDFLAGS) -pthread
|
||||
endef
|
||||
|
||||
define Package/dns2socks/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/DNS2SOCKS/dns2socks $(1)/usr/bin/dns2socks
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,dns2socks))
|
42
net/dns2tcp/Makefile
Normal file
42
net/dns2tcp/Makefile
Normal file
@ -0,0 +1,42 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
#
|
||||
# Copyright (C) 2022 ImmortalWrt.org
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dns2tcp
|
||||
PKG_VERSION:=1.1.2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/zfl9/dns2tcp/tar.gz/v$(PKG_VERSION)?
|
||||
PKG_HASH:=5e8c6302a1d32c16ae7d4b8e39cd9aad1f2d7e68fe18813e76cb1e48ec5940d2
|
||||
|
||||
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
|
||||
PKG_LICENSE:=AGPL-3.0-only
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_BUILD_FLAGS:=no-mips16 gc-sections lto
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/dns2tcp
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=IP Addresses and Names
|
||||
TITLE:=utility to convert dns query from udp to tcp
|
||||
URL:=https://github.com/zfl9/dns2tcp
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS+= $(FPIC)
|
||||
MAKE_FLAGS+= \
|
||||
CFLAGS="-std=c99 $(TARGET_CFLAGS)" \
|
||||
EVCFLAGS="$(TARGET_CFLAGS)"
|
||||
|
||||
define Package/dns2tcp/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/dns2tcp $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,dns2tcp))
|
47
net/microsocks/Makefile
Normal file
47
net/microsocks/Makefile
Normal file
@ -0,0 +1,47 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=microsocks
|
||||
PKG_VERSION:=1.0.4
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/rofl0r/microsocks/tar.gz/v$(PKG_VERSION)?
|
||||
PKG_HASH:=130127a87f55870f18fbe47a64d9b9533020e2900802d36a0f6fd2b074313deb
|
||||
|
||||
PKG_MAINTAINER:=Mateusz Korniak <matkorgithubcom@ant.gliwice.pl>
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
|
||||
PKG_BUILD_FLAGS:=lto
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/microsocks
|
||||
SECTION:=net
|
||||
SUBMENU:=Web Servers/Proxies
|
||||
CATEGORY:=Network
|
||||
TITLE:=SOCKS5 TCP/IP only proxy
|
||||
endef
|
||||
|
||||
define Package/microsocks/description
|
||||
Low resource SOCKS5 proxy.
|
||||
Supports only SOCKS5 protocol and forwarding only TCP/IP connections.
|
||||
endef
|
||||
|
||||
define Package/microsocks/conffiles
|
||||
/etc/config/microsocks
|
||||
endef
|
||||
|
||||
TARGET_LDFLAGS+= -Wl,--gc-sections,--as-needed
|
||||
|
||||
define Package/microsocks/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/microsocks $(1)/usr/bin
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) ./files/microsocks.config $(1)/etc/config/microsocks
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/microsocks.init $(1)/etc/init.d/microsocks
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,microsocks))
|
14
net/microsocks/files/microsocks.config
Normal file
14
net/microsocks/files/microsocks.config
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
config microsocks 'config'
|
||||
option enabled '0'
|
||||
option bindaddr ''
|
||||
option listenip '::'
|
||||
option port '1080'
|
||||
option user ''
|
||||
option password ''
|
||||
# Boolean, must be used together with user/pass
|
||||
option auth_once '0'
|
||||
# Boolean, auto setup firewall rule so you can access it from Internet
|
||||
option internet_access '0'
|
||||
option quiet '1'
|
||||
|
74
net/microsocks/files/microsocks.init
Executable file
74
net/microsocks/files/microsocks.init
Executable file
@ -0,0 +1,74 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
USE_PROCD=1
|
||||
START=95
|
||||
|
||||
CONF="microsocks"
|
||||
|
||||
start_service() {
|
||||
config_load "$CONF"
|
||||
|
||||
local _enabled
|
||||
config_get_bool _enabled "config" "enabled" "0"
|
||||
[ "$_enabled" -eq "1" ] || return 1
|
||||
|
||||
local _port _listenip _bindaddr
|
||||
local _user _password
|
||||
local _auth_once _internet_access
|
||||
local _quiet
|
||||
|
||||
config_get _port "config" "port"
|
||||
config_get _listenip "config" "listenip"
|
||||
config_get _bindaddr "config" "bindaddr"
|
||||
config_get _user "config" "user"
|
||||
config_get _password "config" "password"
|
||||
config_get_bool _auth_once "config" "auth_once" 0
|
||||
config_get_bool _internet_access "config" "internet_access" 0
|
||||
config_get_bool _quiet "config" "quiet" 0
|
||||
|
||||
procd_open_instance "$CONF"
|
||||
procd_set_param command /usr/bin/microsocks
|
||||
[ -z "$_port" ] || procd_append_param command -p "${_port}"
|
||||
[ -z "$_listenip" ] || procd_append_param command -i "${_listenip}"
|
||||
[ -z "$_bindaddr" ] || procd_append_param command -b "${_bindaddr}"
|
||||
[ -z "$_user" ] || procd_append_param command -u "${_user}"
|
||||
[ -z "$_password" ] || procd_append_param command -P "${_password}"
|
||||
[ "$_auth_once" -eq "0" ] || procd_append_param command -1
|
||||
[ "$_quiet" -eq "0" ] || procd_append_param command -q
|
||||
|
||||
procd_set_param limits core="unlimited"
|
||||
procd_set_param limits nofile="1000000 1000000"
|
||||
procd_set_param respawn
|
||||
procd_set_param stderr 1
|
||||
# TODO: Make it dependable on some verbose/debug config setting?
|
||||
# procd_set_param stdout 1
|
||||
|
||||
[ "$_internet_access" -eq "0" ] || {
|
||||
procd_open_data
|
||||
json_add_array firewall
|
||||
json_add_object ""
|
||||
json_add_string type rule
|
||||
json_add_string name "Allow-access-microsocks-at-$_port"
|
||||
json_add_string src "*"
|
||||
json_add_string dest_port "$_port"
|
||||
json_add_string proto tcp
|
||||
json_add_string target ACCEPT
|
||||
json_close_object
|
||||
json_close_array
|
||||
procd_close_data
|
||||
}
|
||||
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
service_started() {
|
||||
procd_set_config_changed firewall
|
||||
}
|
||||
|
||||
service_stopped() {
|
||||
procd_set_config_changed firewall
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "$CONF"
|
||||
}
|
Loading…
Reference in New Issue
Block a user