update 2025-08-05 09:43:13

This commit is contained in:
actions-user 2025-08-05 09:43:13 +08:00
parent 718d6b6e26
commit f8fae4af0e
7 changed files with 179 additions and 16 deletions

View File

@ -624,7 +624,7 @@ function renderNodeSettings(section, data, features, main_node, routing_mode) {
o.depends('type', 'ssh');
o.modalonly = true;
o = s.option(form.Value, 'ssh_priv_key', _('Private key'));
o = s.option(form.DynamicList, 'ssh_priv_key', _('Private key'));
o.password = true;
o.depends('type', 'ssh');
o.modalonly = true;

View File

@ -482,7 +482,7 @@ function main() {
map(nodes, (_, i) => nodes[i].nodetype = 'sip008');
} catch(e) {
nodes = decodeBase64Str(res);
nodes = nodes ? split(trim(replace(nodes, / /g, '_')), '\n') : {};
nodes = nodes ? split(trim(replace(nodes, / /g, '_')), '\n') : [];
}
let count = 0;

View File

@ -87,7 +87,8 @@ start_service() {
EOF
;;
"gfwlist")
[ "$ipv6_support" -eq "0" ] || local gfw_nftset_v6=",6#inet#fw4#homeproxy_gfw_list_v6"
local gfw_nftset_v6
[ "$ipv6_support" -eq "0" ] || gfw_nftset_v6=",6#inet#fw4#homeproxy_gfw_list_v6"
sed -r -e "s/(.*)/server=\/\1\/127.0.0.1#$dns_port\nnftset=\/\1\\/4#inet#fw4#homeproxy_gfw_list_v4$gfw_nftset_v6/g" \
"$HP_DIR/resources/gfw_list.txt" > "$DNSMASQ_DIR/gfw_list.conf"
;;
@ -98,7 +99,8 @@ start_service() {
esac
if [ "$routing_mode" != "custom" ] && [ -s "$HP_DIR/resources/proxy_list.txt" ]; then
[ "$ipv6_support" -eq "0" ] || local wan_nftset_v6=",6#inet#fw4#homeproxy_wan_proxy_addr_v6"
local wan_nftset_v6
[ "$ipv6_support" -eq "0" ] || wan_nftset_v6=",6#inet#fw4#homeproxy_wan_proxy_addr_v6"
sed -r -e '/^\s*$/d' -e "s/(.*)/server=\/\1\/127.0.0.1#$dns_port\nnftset=\/\1\\/4#inet#fw4#homeproxy_wan_proxy_addr_v4$wan_nftset_v6/g" \
"$HP_DIR/resources/proxy_list.txt" > "$DNSMASQ_DIR/proxy_list.conf"
fi

View File

@ -6,7 +6,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-passwall
PKG_VERSION:=25.8.1
PKG_VERSION:=25.8.5
PKG_RELEASE:=1
PKG_CONFIG_DEPENDS:= \

View File

@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=sing-box
PKG_VERSION:=1.11.15
PKG_VERSION:=1.12.0
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/SagerNet/sing-box/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=97d58dd873d7cf9b5e4b4aca5516568f3b2e6f5c3dbc93241c82fff5e4a609fd
PKG_HASH:=1093254161d2dac2175a589eb0b43415b89b3e0c10bb2a09ac230f320d974c82
PKG_LICENSE:=GPL-3.0-or-later
PKG_LICENSE_FILES:=LICENSE
@ -20,7 +20,6 @@ PKG_CONFIG_DEPENDS:= \
CONFIG_SING_BOX_BUILD_ACME \
CONFIG_SING_BOX_BUILD_CLASH_API \
CONFIG_SING_BOX_BUILD_DHCP \
CONFIG_SING_BOX_BUILD_ECH \
CONFIG_SING_BOX_BUILD_EMBEDDED_TOR \
CONFIG_SING_BOX_BUILD_GRPC \
CONFIG_SING_BOX_BUILD_GVISOR \
@ -68,10 +67,6 @@ define Package/sing-box/config
config SING_BOX_BUILD_DHCP
bool "Build with DHCP support"
config SING_BOX_BUILD_ECH
bool "Build with TLS ECH extension support"
default y
config SING_BOX_BUILD_EMBEDDED_TOR
bool "Build with embedded Tor support"
@ -114,7 +109,6 @@ GO_PKG_TAGS:=$(subst $(space),$(comma),$(strip \
$(if $(CONFIG_SING_BOX_BUILD_ACME),with_acme) \
$(if $(CONFIG_SING_BOX_BUILD_CLASH_API),with_clash_api) \
$(if $(CONFIG_SING_BOX_BUILD_DHCP),with_dhcp) \
$(if $(CONFIG_SING_BOX_BUILD_ECH),with_ech) \
$(if $(CONFIG_SING_BOX_BUILD_EMBEDDED_TOR),with_embedded_tor) \
$(if $(CONFIG_SING_BOX_BUILD_GRPC),with_grpc) \
$(if $(CONFIG_SING_BOX_BUILD_GVISOR),with_gvisor) \

View File

@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=tcping
PKG_VERSION:=0.3
PKG_RELEASE:=$(AUTORELEASE)
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/Mattraks/tcping/tar.gz/$(PKG_VERSION)?
@ -27,8 +27,8 @@ define Package/tcping
endef
define Package/tcping/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/tcping $(1)/usr/sbin
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/tcping $(1)/usr/bin
endef
$(eval $(call BuildPackage,tcping))

View File

@ -0,0 +1,167 @@
From 60a751dc4220728692f441557e9cff977ee26ed1 Mon Sep 17 00:00:00 2001
From: sbwml <admin@cooluc.com>
Date: Mon, 4 Aug 2025 21:21:50 +0800
Subject: [PATCH] tcping: add IPv6 support
- Refactor connect_to to use getaddrinfo for dual-stack (IPv4/IPv6) support
- Remove gethostbyname usage in main.c, pass hostname as string
- tcping now works with both IPv4 and IPv6 addresses
Signed-off-by: sbwml <admin@cooluc.com>
---
main.c | 20 ++++++++++------
tcp.c | 75 ++++++++++++++++++++++++++--------------------------------
tcp.h | 2 +-
3 files changed, 48 insertions(+), 49 deletions(-)
--- a/main.c
+++ b/main.c
@@ -43,7 +43,6 @@ int main(int argc, char *argv[])
int wait = 1, quiet = 0;
int ok = 0, err = 0;
double min = 999999999999999.0, avg = 0.0, max = 0.0;
- struct hostent *hostdnsentries;
while((c = getopt(argc, argv, "p:c:i:t:fq?")) != -1)
{
@@ -87,12 +86,19 @@ int main(int argc, char *argv[])
}
hostname = argv[optind];
- hostdnsentries = gethostbyname(hostname);
- if (hostdnsentries == NULL)
- {
- fprintf(stderr, "%s: Name or service not known\n", hostname);
+ // domain name resolution
+ struct addrinfo hints, *res = NULL;
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = AF_UNSPEC;
+ hints.ai_socktype = SOCK_STREAM;
+ char portstr[16];
+ snprintf(portstr, sizeof(portstr), "%d", portnr);
+ int rv = getaddrinfo(hostname, portstr, &hints, &res);
+ if (rv != 0) {
+ fprintf(stderr, "%s: %s\n", hostname, gai_strerror(rv));
return 2;
}
+ freeaddrinfo(res);
if (!quiet)
printf("tcping %s:%d\n", hostname, portnr);
@@ -116,7 +122,7 @@ int main(int argc, char *argv[])
for(;;)
{
- fd = connect_to(hostdnsentries, portnr, timeout);
+ fd = connect_to(hostname, portnr, timeout);
if (fd == -1)
{
printf("error connecting to host: %s\n", strerror(errno));
@@ -141,7 +147,7 @@ int main(int argc, char *argv[])
min = min > ms ? ms : min;
max = max < ms ? ms : max;
- printf("connected to %s:%d, seq=%d time=%.2f ms\n", hostname, portnr, curncount, (dend - dstart) * 1000.0);
+ printf("connected to %s:%d, seq=%d time=%.2f ms\n", hostname, portnr, curncount, ms);
break;
}
--- a/tcp.c
+++ b/tcp.c
@@ -1,6 +1,5 @@
#include <sys/types.h>
#include <sys/socket.h>
-#include <netinet/in.h>
#include <netdb.h>
#include <errno.h>
#include <stdio.h>
@@ -10,50 +9,44 @@
#include <sys/time.h>
#include <fcntl.h>
-#include "tcp.h"
-
-#define incopy(a) *((struct in_addr *)a)
-
-int connect_to(struct hostent *host, int portnr, int timeout)
+int connect_to(const char *hostname, int portnr, int timeout)
{
- int fd;
- int loop;
- struct sockaddr_in addr;
+ int fd = -1;
+ int rv;
+ char portstr[16];
+ struct addrinfo hints, *servinfo, *p;
struct timeval tv;
- /* create socket */
- fd = socket(AF_INET, SOCK_STREAM, 0);
- if (fd == -1)
- {
- perror("problem creating socket ");
- exit(2);
+ snprintf(portstr, sizeof(portstr), "%d", portnr);
+
+ memset(&hints, 0, sizeof hints);
+ hints.ai_family = AF_UNSPEC; // Allow IPv4 or IPv6
+ hints.ai_socktype = SOCK_STREAM; // TCP
+
+ rv = getaddrinfo(hostname, portstr, &hints, &servinfo);
+ if (rv != 0) {
+ fprintf(stderr, "%s: %s\n", hostname, gai_strerror(rv));
+ return -1;
}
- /* Set Socket Read-Write Timeout */
- tv.tv_sec = timeout;
- tv.tv_usec = 0;
- setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
-
- /* initialize address structure */
- memset((void *)&addr, 0, sizeof(addr));
- addr.sin_port = htons(portnr);
- addr.sin_family = host -> h_addrtype;
-
- /* try to connect for each of the entries: */
- for(loop=0; ; loop++)
- {
- if ((host -> h_addr_list[loop]) == NULL)
- break;
-
- addr.sin_addr = incopy(host -> h_addr_list[loop]);
- /* connect to peer */
- if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) == 0)
- {
- /* connection made, return */
- return fd;
- }
+ for (p = servinfo; p != NULL; p = p->ai_next) {
+ fd = socket(p->ai_family, p->ai_socktype, p->ai_protocol);
+ if (fd == -1)
+ continue;
+
+ tv.tv_sec = timeout;
+ tv.tv_usec = 0;
+ setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
+ setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
+
+ if (connect(fd, p->ai_addr, p->ai_addrlen) == 0)
+ break;
+
+ close(fd);
+ fd = -1;
}
- close(fd);
- if (errno = EALREADY) errno = ETIMEDOUT;
- return -1;
+
+ freeaddrinfo(servinfo);
+
+ return fd;
}
--- a/tcp.h
+++ b/tcp.h
@@ -1 +1 @@
-int connect_to(struct hostent *host, int portnr, int timeout);
+int connect_to(const char *hostname, int portnr, int timeout);