import required dependencies

This commit is contained in:
sbwml 2022-04-28 05:39:39 +08:00
parent 1a951f7e41
commit 8302d0ed49
10 changed files with 433 additions and 10 deletions

View File

@ -1,11 +1,3 @@
# Psswall & SSRP 插件防炸上游备份
# Psswall & SSRP 插件防炸上游备份 - v2ray-core v4
## 所需依赖
```shell
svn co https://github.com/immortalwrt/packages/trunk/net/dns2socks package/helloworld-deps/dns2socks
svn co https://github.com/immortalwrt/packages/trunk/net/microsocks package/helloworld-deps/microsocks
svn co https://github.com/immortalwrt/packages/trunk/net/ipt2socks package/helloworld-deps/ipt2socks
svn co https://github.com/immortalwrt/packages/trunk/net/pdnsd-alt package/helloworld-deps/pdnsd
svn co https://github.com/immortalwrt/packages/trunk/net/redsocks2 package/helloworld-deps/redsocks2
```
## openwrt 21.02

53
dns2socks/Makefile Normal file
View 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_FILE:=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))

43
ipt2socks/Makefile Normal file
View File

@ -0,0 +1,43 @@
# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright (C) 2021 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_NAME:=ipt2socks
PKG_VERSION:=1.1.3
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/zfl9/ipt2socks/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=73a2498dc95934c225d358707e7f7d060b5ce81aa45260ada09cbd15207d27d1
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
PKG_LICENSE:=AGPL-3.0
PKG_LICENSE_FILE:=LICENSE
include $(INCLUDE_DIR)/package.mk
define Package/ipt2socks
SECTION:=net
CATEGORY:=Network
TITLE:=Convert iptables to socks5
URL:=https://github.com/zfl9/ipt2socks
DEPENDS:=+libpthread +libuv
endef
define Package/ipt2socks/description
Utility for converting iptables (redirect/tproxy) to socks5.
endef
TARGET_CFLAGS += $(FPIC) -flto
TARGET_LDFLAGS += -flto
define Package/ipt2socks/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/ipt2socks $(1)/usr/bin
endef
$(eval $(call BuildPackage,ipt2socks))

43
microsocks/Makefile Normal file
View File

@ -0,0 +1,43 @@
# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright (C) 2021 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_NAME:=microsocks
PKG_VERSION:=1.0.3
PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/rofl0r/microsocks/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=6801559b6f8e17240ed8eef17a36eea8643412b5a7476980fd4e24b02a021b82
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=COPYING
PKG_MAINTAINER:=lean
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/microsocks
SECTION:=net
CATEGORY:=Network
SUBMENU:=Web Servers/Proxies
TITLE:=Tiny, portable SOCKS5 server
URL:=https://github.com/rofl0r/microsocks
DEPENDS:=+libpthread
endef
define Package/microsocks/description
A SOCKS5 service that you can run on your remote boxes to tunnel connections
through them, if for some reason SSH doesn't cut it for you.
endef
define Package/microsocks/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/local/bin/microsocks $(1)/usr/bin/microsocks
endef
$(eval $(call BuildPackage,microsocks))

57
pdnsd/Makefile Normal file
View File

@ -0,0 +1,57 @@
# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright (C) 2021 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_NAME:=pdnsd
PKG_VERSION:=1.2.9b-par
PKG_RELEASE:=3
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/shadowsocks/pdnsd.git
PKG_SOURCE_DATE:=2012-04-26
PKG_SOURCE_VERSION:=a8e46ccba7b0fa2230d6c42ab6dcd92926f6c21d
PKG_MIRROR_HASH:=e3e9c56cf91b12d8db73def2c247be2f726a052bed012f7a1e48946375f8e478
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/pdnsd-alt
SECTION:=net
CATEGORY:=Network
SUBMENU:=IP Addresses and Names
TITLE:=Proxy DNS Server
DEPENDS:=+libpthread
endef
define Package/pdnsd-alt/description
pdnsd, is an IPv6 capable proxy DNS server with permanent caching (the cache
contents are written to hard disk on exit) that is designed to cope with
unreachable or down DNS servers (for example in dial-in networking).
pdnsd can be used with applications that do dns lookups, eg on startup, and
can't be configured to change that behaviour, to prevent the often
minute-long hangs (or even crashes) that result from stalled dns queries.
endef
TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
CONFIGURE_ARGS += \
--with-cachedir=/var/pdnsd \
--with-target=Linux
define Package/pdnsd-alt/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/pdnsd $(1)/usr/sbin/pdnsd
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/pdnsd-ctl $(1)/usr/sbin/pdnsd-ctl
#$(INSTALL_DIR) $(1)/etc
#$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/pdnsd.conf.sample $(1)/etc/pdnsd.conf
#$(INSTALL_DIR) $(1)/etc/init.d
#$(INSTALL_BIN) ./files/pdnsd.init $(1)/etc/init.d/pdnsd
endef
$(eval $(call BuildPackage,pdnsd-alt))

46
pdnsd/files/pdnsd.init Executable file
View File

@ -0,0 +1,46 @@
#!/bin/sh /etc/rc.common
START=65
NAME=pdnsd
DESC="proxy DNS server"
DAEMON=/usr/sbin/pdnsd
PID_FILE=/var/run/$NAME.pid
CACHEDIR=/var/pdnsd
CACHE=$CACHEDIR/pdnsd.cache
USER=nobody
GROUP=nogroup
start() {
echo -n "Starting $DESC: $NAME"
gen_cache
$DAEMON --daemon -p $PID_FILE
echo " ."
}
stop() {
echo -n "Stopping $DESC: $NAME"
kill `cat $PID_FILE` > /dev/null 2>&1
rm -rf $PID_FILE
echo " ."
}
restart() {
echo "Restarting $DESC: $NAME... "
stop
sleep 2
start
}
gen_cache()
{
if ! test -f "$CACHE"; then
mkdir -p `dirname $CACHE`
dd if=/dev/zero of="$CACHE" bs=1 count=4 2> /dev/null
chown -R $USER.$GROUP $CACHEDIR
fi
}

View File

@ -0,0 +1,42 @@
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,5 @@
-SUBDIRS = src doc contrib
+SUBDIRS = src contrib
EXTRA_DIST = version ChangeLog.old COPYING.BSD README.par README.par.old PKGBUILD
--- a/Makefile.in
+++ b/Makefile.in
@@ -196,7 +196,7 @@ threadlib = @threadlib@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-SUBDIRS = src doc contrib
+SUBDIRS = src contrib
EXTRA_DIST = version ChangeLog.old COPYING.BSD README.par README.par.old PKGBUILD
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -15,7 +15,7 @@ EXTRA_DIST = make_rr_types_h.pl rr_types
## Try to do this last
-SUBDIRS = . pdnsd-ctl rc test
+SUBDIRS = . pdnsd-ctl
$(pdnsd_OBJECTS): rr_types.h
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -215,7 +215,7 @@ pdnsd_SOURCES = conf-parser.c conff.c co
freebsd_netinet_ip_icmp.h
EXTRA_DIST = make_rr_types_h.pl rr_types.in
-SUBDIRS = . pdnsd-ctl rc test
+SUBDIRS = . pdnsd-ctl
all: all-recursive
.SUFFIXES:

View File

@ -0,0 +1,66 @@
--- a/src/conff.h
+++ b/src/conff.h
@@ -32,7 +32,7 @@
#include <stdio.h>
#include <pthread.h>
#include <sys/socket.h>
-#include <net/if.h>
+#include <linux/if.h>
#include "ipvers.h"
#include "list.h"
--- a/src/dns.h
+++ b/src/dns.h
@@ -27,7 +27,7 @@
#include <config.h>
#include <arpa/inet.h>
#include <sys/socket.h>
-#include <net/if.h>
+#include <linux/if.h>
#include <sys/types.h>
#include <inttypes.h>
#include "rr_types.h"
--- a/src/dns_answer.c
+++ b/src/dns_answer.c
@@ -37,7 +37,7 @@
#include <sys/uio.h>
#include <sys/types.h>
#ifdef HAVE_SYS_POLL_H
-#include <sys/poll.h>
+#include <poll.h>
#endif
#include <sys/param.h>
#include <netdb.h>
--- a/src/dns_query.c
+++ b/src/dns_query.c
@@ -23,7 +23,7 @@
#include <config.h>
#include <sys/types.h>
#ifdef HAVE_SYS_POLL_H
-#include <sys/poll.h>
+#include <poll.h>
#endif
#include <stdlib.h>
#include <netdb.h>
--- a/src/icmp.c
+++ b/src/icmp.c
@@ -28,7 +28,7 @@
#include <config.h>
#ifdef HAVE_SYS_POLL_H
-#include <sys/poll.h>
+#include <poll.h>
#endif
#include <sys/time.h>
#include <stdlib.h>
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -59,7 +59,7 @@
#include "ipvers.h"
#include <sys/stat.h>
#include <sys/ioctl.h>
-#include <net/if.h>
+#include <linux/if.h>
#include <netdb.h>
#include <string.h>
#include <unistd.h>

48
redsocks2/Makefile Normal file
View File

@ -0,0 +1,48 @@
# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright (C) 2021 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_NAME:=redsocks2
PKG_VERSION:=0.67
PKG_RELEASE:=5
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/semigodking/redsocks.git
PKG_SOURCE_DATE:=2020-05-10
PKG_SOURCE_VERSION:=d94c245ea47859cda5b4b7373308589206b97bdc
PKG_MIRROR_HASH:=5ca32b2f849af7ebda2cab90bbe286bfd97a69de1a85dac09c8df2fbdd8c947c
PKG_MAINTAINER:=semigodking <semigodking@gmail.com>
PKG_LICENSE:=Apache-2.0
PKG_LICENSE_FILE:=LICENSE
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk
define Package/redsocks2
SECTION:=net
CATEGORY:=Network
SUBMENU:=Web Servers/Proxies
TITLE:=Redirect TCP connection to proxy server
URL:=https://github.com/semigodking/redsocks
DEPENDS:=+libevent2 +libopenssl
endef
define Package/redsocks2/description
This is a modified version of original redsocks.
Transparent redirector of any TCP/UDP connection to proxy.
endef
MAKE_VARS += DISABLE_SHADOWSOCKS=true
define Package/redsocks2/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/redsocks2 $(1)/usr/sbin
$(INSTALL_DIR) $(1)/etc/redsocks2
$(INSTALL_DATA) ./files/redsocks2.template $(1)/etc/redsocks2/config.template
endef
$(eval $(call BuildPackage,redsocks2))

View File

@ -0,0 +1,33 @@
base {
log_debug = off;
redirector = iptables;
reuseport = on;
}
redsocks {
local_ip = 192.168.1.1;
local_port = 1081;
ip = 192.168.1.1;
port = 9050;
type = socks5; // I use socks5 proxy for GFW'ed IP
autoproxy = 1; // I want autoproxy feature enabled on this section.
// timeout is meaningful when 'autoproxy' is non-zero.
// It specified timeout value when trying to connect to destination
// directly. Default is 10 seconds. When it is set to 0, default
// timeout value will be used.
// NOTE: decreasing the timeout value may lead increase of chance for
// normal IP to be misjudged.
timeout = 13;
//type = http-connect;
//login = username;
//password = passwd;
}
tcpdns {
// Transform UDP DNS requests into TCP DNS requests.
// You can also redirect connections to external TCP DNS server to
// REDSOCKS transparent proxy via iptables.
local_ip = 192.168.1.1; // Local server to act as DNS server
local_port = 1053; // UDP port to receive UDP DNS requests
tcpdns1 = 8.8.4.4; // DNS server that supports TCP DNS requests
tcpdns2 = 8.8.8.8; // DNS server that supports TCP DNS requests
timeout = 4; // Timeout value for TCP DNS requests
}