update 2022-06-06 08:53:44
This commit is contained in:
parent
465a5be2a9
commit
5555d5840d
File diff suppressed because it is too large
Load Diff
|
@ -2,13 +2,13 @@ include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=luci-app-ssr-plus
|
PKG_NAME:=luci-app-ssr-plus
|
||||||
PKG_VERSION:=185
|
PKG_VERSION:=185
|
||||||
PKG_RELEASE:=4
|
PKG_RELEASE:=5
|
||||||
|
|
||||||
PKG_CONFIG_DEPENDS:= \
|
PKG_CONFIG_DEPENDS:= \
|
||||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_DNS2TCP \
|
|
||||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun \
|
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun \
|
||||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_IPT2Socks \
|
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_IPT2Socks \
|
||||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy \
|
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy \
|
||||||
|
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_PDNSD \
|
||||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2 \
|
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2 \
|
||||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Client \
|
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Client \
|
||||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Server \
|
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Server \
|
||||||
|
@ -25,13 +25,13 @@ LUCI_TITLE:=SS/SSR/V2Ray/Trojan/NaiveProxy/Socks5/Tun LuCI interface
|
||||||
LUCI_PKGARCH:=all
|
LUCI_PKGARCH:=all
|
||||||
LUCI_DEPENDS:= \
|
LUCI_DEPENDS:= \
|
||||||
@(PACKAGE_libustream-mbedtls||PACKAGE_libustream-openssl||PACKAGE_libustream-wolfssl) \
|
@(PACKAGE_libustream-mbedtls||PACKAGE_libustream-openssl||PACKAGE_libustream-wolfssl) \
|
||||||
+coreutils +coreutils-base64 +dns2socks +dnsmasq-full +ipset +kmod-ipt-nat +ip-full \
|
+coreutils +coreutils-base64 +dns2socks +dns2tcp +dnsmasq-full +ipset +kmod-ipt-nat \
|
||||||
+iptables +iptables-mod-tproxy +lua +libuci-lua +microsocks +pdnsd-alt +tcping \
|
+ip-full +iptables +iptables-mod-tproxy +lua +libuci-lua +microsocks +tcping \
|
||||||
+resolveip +shadowsocksr-libev-ssr-check +uclient-fetch \
|
+resolveip +shadowsocksr-libev-ssr-check +uclient-fetch \
|
||||||
+PACKAGE_$(PKG_NAME)_INCLUDE_DNS2TCP:dns2tcp \
|
|
||||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun:kcptun-client \
|
+PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun:kcptun-client \
|
||||||
+PACKAGE_$(PKG_NAME)_INCLUDE_IPT2Socks:ipt2socks \
|
+PACKAGE_$(PKG_NAME)_INCLUDE_IPT2Socks:ipt2socks \
|
||||||
+PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy:naiveproxy \
|
+PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy:naiveproxy \
|
||||||
|
+PACKAGE_$(PKG_NAME)_INCLUDE_PDNSD:pdnsd-alt \
|
||||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2:redsocks2 \
|
+PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2:redsocks2 \
|
||||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Client:shadowsocks-libev-ss-local \
|
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Client:shadowsocks-libev-ss-local \
|
||||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Client:shadowsocks-libev-ss-redir \
|
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Client:shadowsocks-libev-ss-redir \
|
||||||
|
@ -48,10 +48,6 @@ LUCI_DEPENDS:= \
|
||||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Xray:xray-core
|
+PACKAGE_$(PKG_NAME)_INCLUDE_Xray:xray-core
|
||||||
|
|
||||||
define Package/$(PKG_NAME)/config
|
define Package/$(PKG_NAME)/config
|
||||||
config PACKAGE_$(PKG_NAME)_INCLUDE_DNS2TCP
|
|
||||||
bool "Include DNS2TCP"
|
|
||||||
default n
|
|
||||||
|
|
||||||
config PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun
|
config PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun
|
||||||
bool "Include Kcptun"
|
bool "Include Kcptun"
|
||||||
default n
|
default n
|
||||||
|
@ -65,6 +61,10 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_IPT2Socks
|
||||||
bool "Include ipt2socks"
|
bool "Include ipt2socks"
|
||||||
default n
|
default n
|
||||||
|
|
||||||
|
config PACKAGE_$(PKG_NAME)_INCLUDE_PDNSD
|
||||||
|
bool "Include PDNSD"
|
||||||
|
default n
|
||||||
|
|
||||||
config PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2
|
config PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2
|
||||||
bool "Include Redsocks2"
|
bool "Include Redsocks2"
|
||||||
default n
|
default n
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
-- Copyright (C) 2017 yushi studio <ywb94@qq.com> github.com/ywb94
|
-- Copyright (C) 2017 yushi studio <ywb94@qq.com> github.com/ywb94
|
||||||
-- Copyright (C) 2018 lean <coolsnowwolf@gmail.com> github.com/coolsnowwolf
|
-- Copyright (C) 2018 lean <coolsnowwolf@gmail.com> github.com/coolsnowwolf
|
||||||
-- Licensed to the public under the GNU General Public License v3.
|
-- Licensed to the public under the GNU General Public License v3.
|
||||||
local m, s, sec, o, kcp_enable
|
|
||||||
local uci = luci.model.uci.cursor()
|
|
||||||
m = Map("shadowsocksr", translate("ShadowSocksR Plus+ Settings"), translate("<h3>Support SS/SSR/V2RAY/XRAY/TROJAN/NAIVEPROXY/SOCKS5/TUN etc.</h3>"))
|
|
||||||
|
|
||||||
|
local m, s, sec, o
|
||||||
|
local uci = luci.model.uci.cursor()
|
||||||
|
|
||||||
|
m = Map("shadowsocksr", translate("ShadowSocksR Plus+ Settings"), translate("<h3>Support SS/SSR/V2RAY/XRAY/TROJAN/NAIVEPROXY/SOCKS5/TUN etc.</h3>"))
|
||||||
m:section(SimpleSection).template = "shadowsocksr/status"
|
m:section(SimpleSection).template = "shadowsocksr/status"
|
||||||
|
|
||||||
local server_table = {}
|
local server_table = {}
|
||||||
|
@ -84,10 +85,10 @@ o:value("2", translate("Only Common Ports"))
|
||||||
o.default = 1
|
o.default = 1
|
||||||
|
|
||||||
o = s:option(ListValue, "pdnsd_enable", translate("Resolve Dns Mode"))
|
o = s:option(ListValue, "pdnsd_enable", translate("Resolve Dns Mode"))
|
||||||
o:value("1", translate("Use Pdnsd tcp query and cache"))
|
o:value("1", translate("Use DNS2TCP query"))
|
||||||
o:value("2", translate("Use DNS2SOCKS query and cache"))
|
o:value("2", translate("Use DNS2SOCKS query and cache"))
|
||||||
if nixio.fs.access('/usr/bin/dns2tcp') then
|
if nixio.fs.access('/usr/sbin/pdnsd') then
|
||||||
o:value("3", translate("Use DNS2TCP query"))
|
o:value("3", translate("Use Pdnsd tcp query and cache"))
|
||||||
end
|
end
|
||||||
o:value("0", translate("Use Local DNS Service listen port 5335"))
|
o:value("0", translate("Use Local DNS Service listen port 5335"))
|
||||||
o.default = 1
|
o.default = 1
|
||||||
|
|
|
@ -424,15 +424,15 @@ msgstr "访问国外域名DNS服务器"
|
||||||
msgid "Custom DNS Server format as IP:PORT (default: 8.8.4.4:53)"
|
msgid "Custom DNS Server format as IP:PORT (default: 8.8.4.4:53)"
|
||||||
msgstr "格式为 IP:PORT (默认: 8.8.4.4:53)"
|
msgstr "格式为 IP:PORT (默认: 8.8.4.4:53)"
|
||||||
|
|
||||||
|
msgid "Use DNS2TCP query"
|
||||||
|
msgstr "使用 DNS2TCP 查询"
|
||||||
|
|
||||||
msgid "Use Pdnsd tcp query and cache"
|
msgid "Use Pdnsd tcp query and cache"
|
||||||
msgstr "使用PDNSD TCP查询并缓存"
|
msgstr "使用PDNSD TCP查询并缓存"
|
||||||
|
|
||||||
msgid "Use DNS2SOCKS query and cache"
|
msgid "Use DNS2SOCKS query and cache"
|
||||||
msgstr "使用 DNS2SOCKS 查询并缓存"
|
msgstr "使用 DNS2SOCKS 查询并缓存"
|
||||||
|
|
||||||
msgid "Use DNS2TCP query"
|
|
||||||
msgstr "使用 DNS2TCP 查询"
|
|
||||||
|
|
||||||
msgid "DNS Server IP:Port"
|
msgid "DNS Server IP:Port"
|
||||||
msgstr "DNS服务器 IP:Port"
|
msgstr "DNS服务器 IP:Port"
|
||||||
|
|
||||||
|
|
|
@ -213,7 +213,7 @@ start_dns() {
|
||||||
esac
|
esac
|
||||||
case "$ssrplus_dns" in
|
case "$ssrplus_dns" in
|
||||||
1)
|
1)
|
||||||
start_pdnsd $dnsserver $dnsport
|
ln_start_bin $(first_type dns2tcp) dns2tcp -L "127.0.0.1#$dns_port" -R "$dnsserver#$dnsport"
|
||||||
pdnsd_enable_flag=1
|
pdnsd_enable_flag=1
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
|
@ -222,7 +222,7 @@ start_dns() {
|
||||||
pdnsd_enable_flag=2
|
pdnsd_enable_flag=2
|
||||||
;;
|
;;
|
||||||
3)
|
3)
|
||||||
ln_start_bin $(first_type dns2tcp) dns2tcp -L "127.0.0.1#$dns_port" -R "$dnsserver#$dnsport"
|
start_pdnsd $dnsserver $dnsport
|
||||||
pdnsd_enable_flag=3
|
pdnsd_enable_flag=3
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -82,18 +82,17 @@ while [ "1" == "1" ]; do #死循环
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
#pdnsd
|
#dns2tcp
|
||||||
if [ "$pdnsd_process" -eq 1 ]; then
|
if [ "$pdnsd_process" -eq 1 ]; then
|
||||||
icount=$(busybox ps -w | grep $TMP_BIN_PATH/pdnsd | grep -v grep | wc -l)
|
icount=$(busybox ps -w | grep $TMP_BIN_PATH/dns2tcp | grep -v grep | wc -l)
|
||||||
if [ "$icount" -lt 1 ]; then #如果进程挂掉就重启它
|
if [ "$icount" -lt 1 ]; then #如果进程挂掉就重启它
|
||||||
logger -t "$NAME" "pdnsd tunnel error.restart!"
|
logger -t "$NAME" "dns2tcp tunnel error.restart!"
|
||||||
echolog "pdnsd tunnel error.restart!"
|
echolog "dns2tcp tunnel error.restart!"
|
||||||
if [ -f /var/run/pdnsd.pid ]; then
|
dnsstr=$(uci_get_by_type global tunnel_forward 8.8.4.4:53)
|
||||||
kill $(cat /var/run/pdnsd.pid) >/dev/null 2>&1
|
dnsserver=$(echo "$dnsstr" | awk -F ':' '{print $1}')
|
||||||
else
|
dnsport=$(echo "$dnsstr" | awk -F ':' '{print $2}')
|
||||||
kill -9 $(ps | grep $TMP_PATH/pdnsd.conf | grep -v grep | awk '{print $1}') >/dev/null 2>&1
|
kill -9 $(busybox ps -w | grep $TMP_BIN_PATH/dns2tcp | grep -v grep | awk '{print $1}') >/dev/null 2>&1
|
||||||
fi
|
ln_start_bin $(first_type dns2tcp) dns2tcp -L "127.0.0.1#$dns_port" -R "$dnsserver#$dnsport"
|
||||||
ln_start_bin $(first_type pdnsd) pdnsd -c $TMP_PATH/pdnsd.conf
|
|
||||||
fi
|
fi
|
||||||
#dns2socks
|
#dns2socks
|
||||||
elif [ "$pdnsd_process" -eq 2 ]; then
|
elif [ "$pdnsd_process" -eq 2 ]; then
|
||||||
|
@ -109,17 +108,18 @@ while [ "1" == "1" ]; do #死循环
|
||||||
ln_start_bin $(first_type microsocks) microsocks -i 127.0.0.1 -p $tmp_dns_port ssrplus-dns
|
ln_start_bin $(first_type microsocks) microsocks -i 127.0.0.1 -p $tmp_dns_port ssrplus-dns
|
||||||
ln_start_bin $(first_type dns2socks) dns2socks 127.0.0.1:$tmp_dns_port $dnsserver:$dnsport 127.0.0.1:$dns_port -q
|
ln_start_bin $(first_type dns2socks) dns2socks 127.0.0.1:$tmp_dns_port $dnsserver:$dnsport 127.0.0.1:$dns_port -q
|
||||||
fi
|
fi
|
||||||
#dns2tcp
|
#pdnsd
|
||||||
elif [ "$pdnsd_process" -eq 3 ]; then
|
elif [ "$pdnsd_process" -eq 3 ]; then
|
||||||
icount=$(busybox ps -w | grep $TMP_BIN_PATH/dns2tcp | grep -v grep | wc -l)
|
icount=$(busybox ps -w | grep $TMP_BIN_PATH/pdnsd | grep -v grep | wc -l)
|
||||||
if [ "$icount" -lt 1 ]; then #如果进程挂掉就重启它
|
if [ "$icount" -lt 1 ]; then #如果进程挂掉就重启它
|
||||||
logger -t "$NAME" "dns2tcp tunnel error.restart!"
|
logger -t "$NAME" "pdnsd tunnel error.restart!"
|
||||||
echolog "dns2tcp tunnel error.restart!"
|
echolog "pdnsd tunnel error.restart!"
|
||||||
dnsstr=$(uci_get_by_type global tunnel_forward 8.8.4.4:53)
|
if [ -f /var/run/pdnsd.pid ]; then
|
||||||
dnsserver=$(echo "$dnsstr" | awk -F ':' '{print $1}')
|
kill $(cat /var/run/pdnsd.pid) >/dev/null 2>&1
|
||||||
dnsport=$(echo "$dnsstr" | awk -F ':' '{print $2}')
|
else
|
||||||
kill -9 $(busybox ps -w | grep $TMP_BIN_PATH/dns2tcp | grep -v grep | awk '{print $1}') >/dev/null 2>&1
|
kill -9 $(ps | grep $TMP_PATH/pdnsd.conf | grep -v grep | awk '{print $1}') >/dev/null 2>&1
|
||||||
ln_start_bin $(first_type dns2tcp) dns2tcp -L "127.0.0.1#$dns_port" -R "$dnsserver#$dnsport"
|
fi
|
||||||
|
ln_start_bin $(first_type pdnsd) pdnsd -c $TMP_PATH/pdnsd.conf
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=Xray-core
|
PKG_NAME:=Xray-core
|
||||||
PKG_VERSION:=1.5.6
|
PKG_VERSION:=1.5.7
|
||||||
PKG_RELEASE:=$(AUTORELEASE)
|
PKG_RELEASE:=$(AUTORELEASE)
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:=https://codeload.github.com/XTLS/Xray-core/tar.gz/v$(PKG_VERSION)?
|
PKG_SOURCE_URL:=https://codeload.github.com/XTLS/Xray-core/tar.gz/v$(PKG_VERSION)?
|
||||||
PKG_HASH:=62f2f6574391cf600b6b18a6c9f0fd93c1da9775043bb2c7d81c8ce80b80f923
|
PKG_HASH:=6e1761b63da7fb17da98aa6cf74d224882467cd9825c12eb0ab28eacf8d92d19
|
||||||
|
|
||||||
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
|
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
|
||||||
PKG_LICENSE:=MPL-2.0
|
PKG_LICENSE:=MPL-2.0
|
||||||
|
|
|
@ -1,628 +0,0 @@
|
||||||
From f1d753f0693b3845ace8962bd9a34343f472631d Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= <i@sekai.icu>
|
|
||||||
Date: Tue, 31 May 2022 15:55:38 +0800
|
|
||||||
Subject: [PATCH] Fix build in legacy golang version
|
|
||||||
|
|
||||||
---
|
|
||||||
infra/conf/shadowsocks.go | 2 +
|
|
||||||
infra/conf/shadowsocks_legacy.go | 152 +++++++++++++++
|
|
||||||
proxy/shadowsocks_2022/inbound.go | 2 +
|
|
||||||
proxy/shadowsocks_2022/inbound_multi.go | 2 +
|
|
||||||
proxy/shadowsocks_2022/outbound.go | 2 +
|
|
||||||
proxy/shadowsocks_2022/shadowsocks_2022.go | 2 +
|
|
||||||
testing/scenarios/shadowsocks_2022_test.go | 209 +++++++++++++++++++++
|
|
||||||
testing/scenarios/shadowsocks_test.go | 190 -------------------
|
|
||||||
8 files changed, 371 insertions(+), 190 deletions(-)
|
|
||||||
create mode 100644 infra/conf/shadowsocks_legacy.go
|
|
||||||
create mode 100644 testing/scenarios/shadowsocks_2022_test.go
|
|
||||||
|
|
||||||
--- a/infra/conf/shadowsocks.go
|
|
||||||
+++ b/infra/conf/shadowsocks.go
|
|
||||||
@@ -1,3 +1,5 @@
|
|
||||||
+//go:build go1.18
|
|
||||||
+
|
|
||||||
package conf
|
|
||||||
|
|
||||||
import (
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/infra/conf/shadowsocks_legacy.go
|
|
||||||
@@ -0,0 +1,152 @@
|
|
||||||
+//go:build !go1.18
|
|
||||||
+package conf
|
|
||||||
+
|
|
||||||
+import (
|
|
||||||
+ "strings"
|
|
||||||
+
|
|
||||||
+ "github.com/golang/protobuf/proto"
|
|
||||||
+ "github.com/xtls/xray-core/common/protocol"
|
|
||||||
+ "github.com/xtls/xray-core/common/serial"
|
|
||||||
+ "github.com/xtls/xray-core/proxy/shadowsocks"
|
|
||||||
+)
|
|
||||||
+
|
|
||||||
+func cipherFromString(c string) shadowsocks.CipherType {
|
|
||||||
+ switch strings.ToLower(c) {
|
|
||||||
+ case "aes-128-gcm", "aead_aes_128_gcm":
|
|
||||||
+ return shadowsocks.CipherType_AES_128_GCM
|
|
||||||
+ case "aes-256-gcm", "aead_aes_256_gcm":
|
|
||||||
+ return shadowsocks.CipherType_AES_256_GCM
|
|
||||||
+ case "chacha20-poly1305", "aead_chacha20_poly1305", "chacha20-ietf-poly1305":
|
|
||||||
+ return shadowsocks.CipherType_CHACHA20_POLY1305
|
|
||||||
+ case "xchacha20-poly1305", "aead_xchacha20_poly1305", "xchacha20-ietf-poly1305":
|
|
||||||
+ return shadowsocks.CipherType_XCHACHA20_POLY1305
|
|
||||||
+ case "none", "plain":
|
|
||||||
+ return shadowsocks.CipherType_NONE
|
|
||||||
+ default:
|
|
||||||
+ return shadowsocks.CipherType_UNKNOWN
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+type ShadowsocksUserConfig struct {
|
|
||||||
+ Cipher string `json:"method"`
|
|
||||||
+ Password string `json:"password"`
|
|
||||||
+ Level byte `json:"level"`
|
|
||||||
+ Email string `json:"email"`
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+type ShadowsocksServerConfig struct {
|
|
||||||
+ Cipher string `json:"method"`
|
|
||||||
+ Password string `json:"password"`
|
|
||||||
+ Level byte `json:"level"`
|
|
||||||
+ Email string `json:"email"`
|
|
||||||
+ Users []*ShadowsocksUserConfig `json:"clients"`
|
|
||||||
+ NetworkList *NetworkList `json:"network"`
|
|
||||||
+ IVCheck bool `json:"ivCheck"`
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+func (v *ShadowsocksServerConfig) Build() (proto.Message, error) {
|
|
||||||
+ config := new(shadowsocks.ServerConfig)
|
|
||||||
+ config.Network = v.NetworkList.Build()
|
|
||||||
+
|
|
||||||
+ if v.Users != nil {
|
|
||||||
+ for _, user := range v.Users {
|
|
||||||
+ account := &shadowsocks.Account{
|
|
||||||
+ Password: user.Password,
|
|
||||||
+ CipherType: cipherFromString(user.Cipher),
|
|
||||||
+ IvCheck: v.IVCheck,
|
|
||||||
+ }
|
|
||||||
+ if account.Password == "" {
|
|
||||||
+ return nil, newError("Shadowsocks password is not specified.")
|
|
||||||
+ }
|
|
||||||
+ if account.CipherType < shadowsocks.CipherType_AES_128_GCM ||
|
|
||||||
+ account.CipherType > shadowsocks.CipherType_XCHACHA20_POLY1305 {
|
|
||||||
+ return nil, newError("unsupported cipher method: ", user.Cipher)
|
|
||||||
+ }
|
|
||||||
+ config.Users = append(config.Users, &protocol.User{
|
|
||||||
+ Email: user.Email,
|
|
||||||
+ Level: uint32(user.Level),
|
|
||||||
+ Account: serial.ToTypedMessage(account),
|
|
||||||
+ })
|
|
||||||
+ }
|
|
||||||
+ } else {
|
|
||||||
+ account := &shadowsocks.Account{
|
|
||||||
+ Password: v.Password,
|
|
||||||
+ CipherType: cipherFromString(v.Cipher),
|
|
||||||
+ IvCheck: v.IVCheck,
|
|
||||||
+ }
|
|
||||||
+ if account.Password == "" {
|
|
||||||
+ return nil, newError("Shadowsocks password is not specified.")
|
|
||||||
+ }
|
|
||||||
+ if account.CipherType == shadowsocks.CipherType_UNKNOWN {
|
|
||||||
+ return nil, newError("unknown cipher method: ", v.Cipher)
|
|
||||||
+ }
|
|
||||||
+ config.Users = append(config.Users, &protocol.User{
|
|
||||||
+ Email: v.Email,
|
|
||||||
+ Level: uint32(v.Level),
|
|
||||||
+ Account: serial.ToTypedMessage(account),
|
|
||||||
+ })
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return config, nil
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+type ShadowsocksServerTarget struct {
|
|
||||||
+ Address *Address `json:"address"`
|
|
||||||
+ Port uint16 `json:"port"`
|
|
||||||
+ Cipher string `json:"method"`
|
|
||||||
+ Password string `json:"password"`
|
|
||||||
+ Email string `json:"email"`
|
|
||||||
+ Level byte `json:"level"`
|
|
||||||
+ IVCheck bool `json:"ivCheck"`
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+type ShadowsocksClientConfig struct {
|
|
||||||
+ Servers []*ShadowsocksServerTarget `json:"servers"`
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+func (v *ShadowsocksClientConfig) Build() (proto.Message, error) {
|
|
||||||
+ if len(v.Servers) == 0 {
|
|
||||||
+ return nil, newError("0 Shadowsocks server configured.")
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ config := new(shadowsocks.ClientConfig)
|
|
||||||
+ serverSpecs := make([]*protocol.ServerEndpoint, len(v.Servers))
|
|
||||||
+ for idx, server := range v.Servers {
|
|
||||||
+ if server.Address == nil {
|
|
||||||
+ return nil, newError("Shadowsocks server address is not set.")
|
|
||||||
+ }
|
|
||||||
+ if server.Port == 0 {
|
|
||||||
+ return nil, newError("Invalid Shadowsocks port.")
|
|
||||||
+ }
|
|
||||||
+ if server.Password == "" {
|
|
||||||
+ return nil, newError("Shadowsocks password is not specified.")
|
|
||||||
+ }
|
|
||||||
+ account := &shadowsocks.Account{
|
|
||||||
+ Password: server.Password,
|
|
||||||
+ }
|
|
||||||
+ account.CipherType = cipherFromString(server.Cipher)
|
|
||||||
+ if account.CipherType == shadowsocks.CipherType_UNKNOWN {
|
|
||||||
+ return nil, newError("unknown cipher method: ", server.Cipher)
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ account.IvCheck = server.IVCheck
|
|
||||||
+
|
|
||||||
+ ss := &protocol.ServerEndpoint{
|
|
||||||
+ Address: server.Address.Build(),
|
|
||||||
+ Port: uint32(server.Port),
|
|
||||||
+ User: []*protocol.User{
|
|
||||||
+ {
|
|
||||||
+ Level: uint32(server.Level),
|
|
||||||
+ Email: server.Email,
|
|
||||||
+ Account: serial.ToTypedMessage(account),
|
|
||||||
+ },
|
|
||||||
+ },
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ serverSpecs[idx] = ss
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ config.Server = serverSpecs
|
|
||||||
+
|
|
||||||
+ return config, nil
|
|
||||||
+}
|
|
||||||
--- a/proxy/shadowsocks_2022/inbound.go
|
|
||||||
+++ b/proxy/shadowsocks_2022/inbound.go
|
|
||||||
@@ -1,3 +1,5 @@
|
|
||||||
+//go:build go1.18
|
|
||||||
+
|
|
||||||
package shadowsocks_2022
|
|
||||||
|
|
||||||
import (
|
|
||||||
--- a/proxy/shadowsocks_2022/inbound_multi.go
|
|
||||||
+++ b/proxy/shadowsocks_2022/inbound_multi.go
|
|
||||||
@@ -1,3 +1,5 @@
|
|
||||||
+//go:build go1.18
|
|
||||||
+
|
|
||||||
package shadowsocks_2022
|
|
||||||
|
|
||||||
import (
|
|
||||||
--- a/proxy/shadowsocks_2022/outbound.go
|
|
||||||
+++ b/proxy/shadowsocks_2022/outbound.go
|
|
||||||
@@ -1,3 +1,5 @@
|
|
||||||
+//go:build go1.18
|
|
||||||
+
|
|
||||||
package shadowsocks_2022
|
|
||||||
|
|
||||||
import (
|
|
||||||
--- a/proxy/shadowsocks_2022/shadowsocks_2022.go
|
|
||||||
+++ b/proxy/shadowsocks_2022/shadowsocks_2022.go
|
|
||||||
@@ -1,3 +1,5 @@
|
|
||||||
+//go:build go1.18
|
|
||||||
+
|
|
||||||
package shadowsocks_2022
|
|
||||||
|
|
||||||
import (
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/testing/scenarios/shadowsocks_2022_test.go
|
|
||||||
@@ -0,0 +1,209 @@
|
|
||||||
+package scenarios
|
|
||||||
+
|
|
||||||
+import (
|
|
||||||
+ "crypto/rand"
|
|
||||||
+ "encoding/base64"
|
|
||||||
+ "github.com/sagernet/sing-shadowsocks/shadowaead_2022"
|
|
||||||
+ "github.com/xtls/xray-core/proxy/shadowsocks_2022"
|
|
||||||
+ "testing"
|
|
||||||
+ "time"
|
|
||||||
+
|
|
||||||
+ "github.com/xtls/xray-core/app/log"
|
|
||||||
+ "github.com/xtls/xray-core/app/proxyman"
|
|
||||||
+ "github.com/xtls/xray-core/common"
|
|
||||||
+ clog "github.com/xtls/xray-core/common/log"
|
|
||||||
+ "github.com/xtls/xray-core/common/net"
|
|
||||||
+ "github.com/xtls/xray-core/common/serial"
|
|
||||||
+ "github.com/xtls/xray-core/core"
|
|
||||||
+ "github.com/xtls/xray-core/proxy/dokodemo"
|
|
||||||
+ "github.com/xtls/xray-core/proxy/freedom"
|
|
||||||
+ "github.com/xtls/xray-core/testing/servers/tcp"
|
|
||||||
+ "github.com/xtls/xray-core/testing/servers/udp"
|
|
||||||
+ "golang.org/x/sync/errgroup"
|
|
||||||
+)
|
|
||||||
+
|
|
||||||
+func TestShadowsocks2022Tcp(t *testing.T) {
|
|
||||||
+ for _, method := range shadowaead_2022.List {
|
|
||||||
+ password := make([]byte, 32)
|
|
||||||
+ rand.Read(password)
|
|
||||||
+ t.Run(method, func(t *testing.T) {
|
|
||||||
+ testShadowsocks2022Tcp(t, method, base64.StdEncoding.EncodeToString(password))
|
|
||||||
+ })
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+func TestShadowsocks2022Udp(t *testing.T) {
|
|
||||||
+ for _, method := range shadowaead_2022.List {
|
|
||||||
+ password := make([]byte, 32)
|
|
||||||
+ rand.Read(password)
|
|
||||||
+ t.Run(method, func(t *testing.T) {
|
|
||||||
+ testShadowsocks2022Udp(t, method, base64.StdEncoding.EncodeToString(password))
|
|
||||||
+ })
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+func testShadowsocks2022Tcp(t *testing.T, method string, password string) {
|
|
||||||
+ tcpServer := tcp.Server{
|
|
||||||
+ MsgProcessor: xor,
|
|
||||||
+ }
|
|
||||||
+ dest, err := tcpServer.Start()
|
|
||||||
+ common.Must(err)
|
|
||||||
+ defer tcpServer.Close()
|
|
||||||
+
|
|
||||||
+ serverPort := tcp.PickPort()
|
|
||||||
+ serverConfig := &core.Config{
|
|
||||||
+ App: []*serial.TypedMessage{
|
|
||||||
+ serial.ToTypedMessage(&log.Config{
|
|
||||||
+ ErrorLogLevel: clog.Severity_Debug,
|
|
||||||
+ ErrorLogType: log.LogType_Console,
|
|
||||||
+ }),
|
|
||||||
+ },
|
|
||||||
+ Inbound: []*core.InboundHandlerConfig{
|
|
||||||
+ {
|
|
||||||
+ ReceiverSettings: serial.ToTypedMessage(&proxyman.ReceiverConfig{
|
|
||||||
+ PortList: &net.PortList{Range: []*net.PortRange{net.SinglePortRange(serverPort)}},
|
|
||||||
+ Listen: net.NewIPOrDomain(net.LocalHostIP),
|
|
||||||
+ }),
|
|
||||||
+ ProxySettings: serial.ToTypedMessage(&shadowsocks_2022.ServerConfig{
|
|
||||||
+ Method: method,
|
|
||||||
+ Key: password,
|
|
||||||
+ Network: []net.Network{net.Network_TCP},
|
|
||||||
+ }),
|
|
||||||
+ },
|
|
||||||
+ },
|
|
||||||
+ Outbound: []*core.OutboundHandlerConfig{
|
|
||||||
+ {
|
|
||||||
+ ProxySettings: serial.ToTypedMessage(&freedom.Config{}),
|
|
||||||
+ },
|
|
||||||
+ },
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ clientPort := tcp.PickPort()
|
|
||||||
+ clientConfig := &core.Config{
|
|
||||||
+ App: []*serial.TypedMessage{
|
|
||||||
+ serial.ToTypedMessage(&log.Config{
|
|
||||||
+ ErrorLogLevel: clog.Severity_Debug,
|
|
||||||
+ ErrorLogType: log.LogType_Console,
|
|
||||||
+ }),
|
|
||||||
+ },
|
|
||||||
+ Inbound: []*core.InboundHandlerConfig{
|
|
||||||
+ {
|
|
||||||
+ ReceiverSettings: serial.ToTypedMessage(&proxyman.ReceiverConfig{
|
|
||||||
+ PortList: &net.PortList{Range: []*net.PortRange{net.SinglePortRange(clientPort)}},
|
|
||||||
+ Listen: net.NewIPOrDomain(net.LocalHostIP),
|
|
||||||
+ }),
|
|
||||||
+ ProxySettings: serial.ToTypedMessage(&dokodemo.Config{
|
|
||||||
+ Address: net.NewIPOrDomain(dest.Address),
|
|
||||||
+ Port: uint32(dest.Port),
|
|
||||||
+ Networks: []net.Network{net.Network_TCP},
|
|
||||||
+ }),
|
|
||||||
+ },
|
|
||||||
+ },
|
|
||||||
+ Outbound: []*core.OutboundHandlerConfig{
|
|
||||||
+ {
|
|
||||||
+ ProxySettings: serial.ToTypedMessage(&shadowsocks_2022.ClientConfig{
|
|
||||||
+ Address: net.NewIPOrDomain(net.LocalHostIP),
|
|
||||||
+ Port: uint32(serverPort),
|
|
||||||
+ Method: method,
|
|
||||||
+ Key: password,
|
|
||||||
+ }),
|
|
||||||
+ },
|
|
||||||
+ },
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ servers, err := InitializeServerConfigs(serverConfig, clientConfig)
|
|
||||||
+ common.Must(err)
|
|
||||||
+ defer CloseAllServers(servers)
|
|
||||||
+
|
|
||||||
+ var errGroup errgroup.Group
|
|
||||||
+ for i := 0; i < 10; i++ {
|
|
||||||
+ errGroup.Go(testTCPConn(clientPort, 10240*1024, time.Second*20))
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if err := errGroup.Wait(); err != nil {
|
|
||||||
+ t.Error(err)
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+func testShadowsocks2022Udp(t *testing.T, method string, password string) {
|
|
||||||
+ udpServer := udp.Server{
|
|
||||||
+ MsgProcessor: xor,
|
|
||||||
+ }
|
|
||||||
+ udpDest, err := udpServer.Start()
|
|
||||||
+ common.Must(err)
|
|
||||||
+ defer udpServer.Close()
|
|
||||||
+
|
|
||||||
+ serverPort := udp.PickPort()
|
|
||||||
+ serverConfig := &core.Config{
|
|
||||||
+ App: []*serial.TypedMessage{
|
|
||||||
+ serial.ToTypedMessage(&log.Config{
|
|
||||||
+ ErrorLogLevel: clog.Severity_Debug,
|
|
||||||
+ ErrorLogType: log.LogType_Console,
|
|
||||||
+ }),
|
|
||||||
+ },
|
|
||||||
+ Inbound: []*core.InboundHandlerConfig{
|
|
||||||
+ {
|
|
||||||
+ ReceiverSettings: serial.ToTypedMessage(&proxyman.ReceiverConfig{
|
|
||||||
+ PortList: &net.PortList{Range: []*net.PortRange{net.SinglePortRange(serverPort)}},
|
|
||||||
+ Listen: net.NewIPOrDomain(net.LocalHostIP),
|
|
||||||
+ }),
|
|
||||||
+ ProxySettings: serial.ToTypedMessage(&shadowsocks_2022.ServerConfig{
|
|
||||||
+ Method: method,
|
|
||||||
+ Key: password,
|
|
||||||
+ Network: []net.Network{net.Network_UDP},
|
|
||||||
+ }),
|
|
||||||
+ },
|
|
||||||
+ },
|
|
||||||
+ Outbound: []*core.OutboundHandlerConfig{
|
|
||||||
+ {
|
|
||||||
+ ProxySettings: serial.ToTypedMessage(&freedom.Config{}),
|
|
||||||
+ },
|
|
||||||
+ },
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ udpClientPort := udp.PickPort()
|
|
||||||
+ clientConfig := &core.Config{
|
|
||||||
+ App: []*serial.TypedMessage{
|
|
||||||
+ serial.ToTypedMessage(&log.Config{
|
|
||||||
+ ErrorLogLevel: clog.Severity_Debug,
|
|
||||||
+ ErrorLogType: log.LogType_Console,
|
|
||||||
+ }),
|
|
||||||
+ },
|
|
||||||
+ Inbound: []*core.InboundHandlerConfig{
|
|
||||||
+ {
|
|
||||||
+ ReceiverSettings: serial.ToTypedMessage(&proxyman.ReceiverConfig{
|
|
||||||
+ PortList: &net.PortList{Range: []*net.PortRange{net.SinglePortRange(udpClientPort)}},
|
|
||||||
+ Listen: net.NewIPOrDomain(net.LocalHostIP),
|
|
||||||
+ }),
|
|
||||||
+ ProxySettings: serial.ToTypedMessage(&dokodemo.Config{
|
|
||||||
+ Address: net.NewIPOrDomain(udpDest.Address),
|
|
||||||
+ Port: uint32(udpDest.Port),
|
|
||||||
+ Networks: []net.Network{net.Network_UDP},
|
|
||||||
+ }),
|
|
||||||
+ },
|
|
||||||
+ },
|
|
||||||
+ Outbound: []*core.OutboundHandlerConfig{
|
|
||||||
+ {
|
|
||||||
+ ProxySettings: serial.ToTypedMessage(&shadowsocks_2022.ClientConfig{
|
|
||||||
+ Address: net.NewIPOrDomain(net.LocalHostIP),
|
|
||||||
+ Port: uint32(serverPort),
|
|
||||||
+ Method: method,
|
|
||||||
+ Key: password,
|
|
||||||
+ }),
|
|
||||||
+ },
|
|
||||||
+ },
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ servers, err := InitializeServerConfigs(serverConfig, clientConfig)
|
|
||||||
+ common.Must(err)
|
|
||||||
+ defer CloseAllServers(servers)
|
|
||||||
+
|
|
||||||
+ var errGroup errgroup.Group
|
|
||||||
+ for i := 0; i < 10; i++ {
|
|
||||||
+ errGroup.Go(testUDPConn(udpClientPort, 1024, time.Second*5))
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if err := errGroup.Wait(); err != nil {
|
|
||||||
+ t.Error(err)
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
--- a/testing/scenarios/shadowsocks_test.go
|
|
||||||
+++ b/testing/scenarios/shadowsocks_test.go
|
|
||||||
@@ -1,10 +1,6 @@
|
|
||||||
package scenarios
|
|
||||||
|
|
||||||
import (
|
|
||||||
- "crypto/rand"
|
|
||||||
- "encoding/base64"
|
|
||||||
- "github.com/sagernet/sing-shadowsocks/shadowaead_2022"
|
|
||||||
- "github.com/xtls/xray-core/proxy/shadowsocks_2022"
|
|
||||||
"testing"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
@@ -489,189 +485,3 @@ func TestShadowsocksNone(t *testing.T) {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-
|
|
||||||
-func TestShadowsocks2022Tcp(t *testing.T) {
|
|
||||||
- for _, method := range shadowaead_2022.List {
|
|
||||||
- password := make([]byte, 32)
|
|
||||||
- rand.Read(password)
|
|
||||||
- t.Run(method, func(t *testing.T) {
|
|
||||||
- testShadowsocks2022Tcp(t, method, base64.StdEncoding.EncodeToString(password))
|
|
||||||
- })
|
|
||||||
- }
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-func TestShadowsocks2022Udp(t *testing.T) {
|
|
||||||
- for _, method := range shadowaead_2022.List {
|
|
||||||
- password := make([]byte, 32)
|
|
||||||
- rand.Read(password)
|
|
||||||
- t.Run(method, func(t *testing.T) {
|
|
||||||
- testShadowsocks2022Udp(t, method, base64.StdEncoding.EncodeToString(password))
|
|
||||||
- })
|
|
||||||
- }
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-func testShadowsocks2022Tcp(t *testing.T, method string, password string) {
|
|
||||||
- tcpServer := tcp.Server{
|
|
||||||
- MsgProcessor: xor,
|
|
||||||
- }
|
|
||||||
- dest, err := tcpServer.Start()
|
|
||||||
- common.Must(err)
|
|
||||||
- defer tcpServer.Close()
|
|
||||||
-
|
|
||||||
- serverPort := tcp.PickPort()
|
|
||||||
- serverConfig := &core.Config{
|
|
||||||
- App: []*serial.TypedMessage{
|
|
||||||
- serial.ToTypedMessage(&log.Config{
|
|
||||||
- ErrorLogLevel: clog.Severity_Debug,
|
|
||||||
- ErrorLogType: log.LogType_Console,
|
|
||||||
- }),
|
|
||||||
- },
|
|
||||||
- Inbound: []*core.InboundHandlerConfig{
|
|
||||||
- {
|
|
||||||
- ReceiverSettings: serial.ToTypedMessage(&proxyman.ReceiverConfig{
|
|
||||||
- PortList: &net.PortList{Range: []*net.PortRange{net.SinglePortRange(serverPort)}},
|
|
||||||
- Listen: net.NewIPOrDomain(net.LocalHostIP),
|
|
||||||
- }),
|
|
||||||
- ProxySettings: serial.ToTypedMessage(&shadowsocks_2022.ServerConfig{
|
|
||||||
- Method: method,
|
|
||||||
- Key: password,
|
|
||||||
- Network: []net.Network{net.Network_TCP},
|
|
||||||
- }),
|
|
||||||
- },
|
|
||||||
- },
|
|
||||||
- Outbound: []*core.OutboundHandlerConfig{
|
|
||||||
- {
|
|
||||||
- ProxySettings: serial.ToTypedMessage(&freedom.Config{}),
|
|
||||||
- },
|
|
||||||
- },
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- clientPort := tcp.PickPort()
|
|
||||||
- clientConfig := &core.Config{
|
|
||||||
- App: []*serial.TypedMessage{
|
|
||||||
- serial.ToTypedMessage(&log.Config{
|
|
||||||
- ErrorLogLevel: clog.Severity_Debug,
|
|
||||||
- ErrorLogType: log.LogType_Console,
|
|
||||||
- }),
|
|
||||||
- },
|
|
||||||
- Inbound: []*core.InboundHandlerConfig{
|
|
||||||
- {
|
|
||||||
- ReceiverSettings: serial.ToTypedMessage(&proxyman.ReceiverConfig{
|
|
||||||
- PortList: &net.PortList{Range: []*net.PortRange{net.SinglePortRange(clientPort)}},
|
|
||||||
- Listen: net.NewIPOrDomain(net.LocalHostIP),
|
|
||||||
- }),
|
|
||||||
- ProxySettings: serial.ToTypedMessage(&dokodemo.Config{
|
|
||||||
- Address: net.NewIPOrDomain(dest.Address),
|
|
||||||
- Port: uint32(dest.Port),
|
|
||||||
- Networks: []net.Network{net.Network_TCP},
|
|
||||||
- }),
|
|
||||||
- },
|
|
||||||
- },
|
|
||||||
- Outbound: []*core.OutboundHandlerConfig{
|
|
||||||
- {
|
|
||||||
- ProxySettings: serial.ToTypedMessage(&shadowsocks_2022.ClientConfig{
|
|
||||||
- Address: net.NewIPOrDomain(net.LocalHostIP),
|
|
||||||
- Port: uint32(serverPort),
|
|
||||||
- Method: method,
|
|
||||||
- Key: password,
|
|
||||||
- }),
|
|
||||||
- },
|
|
||||||
- },
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- servers, err := InitializeServerConfigs(serverConfig, clientConfig)
|
|
||||||
- common.Must(err)
|
|
||||||
- defer CloseAllServers(servers)
|
|
||||||
-
|
|
||||||
- var errGroup errgroup.Group
|
|
||||||
- for i := 0; i < 10; i++ {
|
|
||||||
- errGroup.Go(testTCPConn(clientPort, 10240*1024, time.Second*20))
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- if err := errGroup.Wait(); err != nil {
|
|
||||||
- t.Error(err)
|
|
||||||
- }
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-func testShadowsocks2022Udp(t *testing.T, method string, password string) {
|
|
||||||
- udpServer := udp.Server{
|
|
||||||
- MsgProcessor: xor,
|
|
||||||
- }
|
|
||||||
- udpDest, err := udpServer.Start()
|
|
||||||
- common.Must(err)
|
|
||||||
- defer udpServer.Close()
|
|
||||||
-
|
|
||||||
- serverPort := udp.PickPort()
|
|
||||||
- serverConfig := &core.Config{
|
|
||||||
- App: []*serial.TypedMessage{
|
|
||||||
- serial.ToTypedMessage(&log.Config{
|
|
||||||
- ErrorLogLevel: clog.Severity_Debug,
|
|
||||||
- ErrorLogType: log.LogType_Console,
|
|
||||||
- }),
|
|
||||||
- },
|
|
||||||
- Inbound: []*core.InboundHandlerConfig{
|
|
||||||
- {
|
|
||||||
- ReceiverSettings: serial.ToTypedMessage(&proxyman.ReceiverConfig{
|
|
||||||
- PortList: &net.PortList{Range: []*net.PortRange{net.SinglePortRange(serverPort)}},
|
|
||||||
- Listen: net.NewIPOrDomain(net.LocalHostIP),
|
|
||||||
- }),
|
|
||||||
- ProxySettings: serial.ToTypedMessage(&shadowsocks_2022.ServerConfig{
|
|
||||||
- Method: method,
|
|
||||||
- Key: password,
|
|
||||||
- Network: []net.Network{net.Network_UDP},
|
|
||||||
- }),
|
|
||||||
- },
|
|
||||||
- },
|
|
||||||
- Outbound: []*core.OutboundHandlerConfig{
|
|
||||||
- {
|
|
||||||
- ProxySettings: serial.ToTypedMessage(&freedom.Config{}),
|
|
||||||
- },
|
|
||||||
- },
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- udpClientPort := udp.PickPort()
|
|
||||||
- clientConfig := &core.Config{
|
|
||||||
- App: []*serial.TypedMessage{
|
|
||||||
- serial.ToTypedMessage(&log.Config{
|
|
||||||
- ErrorLogLevel: clog.Severity_Debug,
|
|
||||||
- ErrorLogType: log.LogType_Console,
|
|
||||||
- }),
|
|
||||||
- },
|
|
||||||
- Inbound: []*core.InboundHandlerConfig{
|
|
||||||
- {
|
|
||||||
- ReceiverSettings: serial.ToTypedMessage(&proxyman.ReceiverConfig{
|
|
||||||
- PortList: &net.PortList{Range: []*net.PortRange{net.SinglePortRange(udpClientPort)}},
|
|
||||||
- Listen: net.NewIPOrDomain(net.LocalHostIP),
|
|
||||||
- }),
|
|
||||||
- ProxySettings: serial.ToTypedMessage(&dokodemo.Config{
|
|
||||||
- Address: net.NewIPOrDomain(udpDest.Address),
|
|
||||||
- Port: uint32(udpDest.Port),
|
|
||||||
- Networks: []net.Network{net.Network_UDP},
|
|
||||||
- }),
|
|
||||||
- },
|
|
||||||
- },
|
|
||||||
- Outbound: []*core.OutboundHandlerConfig{
|
|
||||||
- {
|
|
||||||
- ProxySettings: serial.ToTypedMessage(&shadowsocks_2022.ClientConfig{
|
|
||||||
- Address: net.NewIPOrDomain(net.LocalHostIP),
|
|
||||||
- Port: uint32(serverPort),
|
|
||||||
- Method: method,
|
|
||||||
- Key: password,
|
|
||||||
- }),
|
|
||||||
- },
|
|
||||||
- },
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- servers, err := InitializeServerConfigs(serverConfig, clientConfig)
|
|
||||||
- common.Must(err)
|
|
||||||
- defer CloseAllServers(servers)
|
|
||||||
-
|
|
||||||
- var errGroup errgroup.Group
|
|
||||||
- for i := 0; i < 10; i++ {
|
|
||||||
- errGroup.Go(testUDPConn(udpClientPort, 1024, time.Second*5))
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- if err := errGroup.Wait(); err != nil {
|
|
||||||
- t.Error(err)
|
|
||||||
- }
|
|
||||||
-}
|
|
|
@ -5,12 +5,12 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=xray-plugin
|
PKG_NAME:=xray-plugin
|
||||||
PKG_VERSION:=1.5.6
|
PKG_VERSION:=1.5.7
|
||||||
PKG_RELEASE:=$(AUTORELEASE)
|
PKG_RELEASE:=$(AUTORELEASE)
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:=https://codeload.github.com/teddysun/xray-plugin/tar.gz/v$(PKG_VERSION)?
|
PKG_SOURCE_URL:=https://codeload.github.com/teddysun/xray-plugin/tar.gz/v$(PKG_VERSION)?
|
||||||
PKG_HASH:=c352ba07c84ea58aab6a0f41f628fa37f2e5aab0701d019d163e12678dc8c062
|
PKG_HASH:=55f72a44a4089eb211ab0e35f064723c028854243e8388d0fcc5d8524aa5fb6b
|
||||||
|
|
||||||
PKG_LICENSE:=MIT
|
PKG_LICENSE:=MIT
|
||||||
PKG_LICENSE_FILES:=LICENSE
|
PKG_LICENSE_FILES:=LICENSE
|
||||||
|
|
Loading…
Reference in New Issue