From f26ac49d9ef93d5fecdd70a5719af0e215201fa2 Mon Sep 17 00:00:00 2001 From: mzz <2017@duck.com> Date: Wed, 24 Apr 2024 02:22:50 +0800 Subject: [PATCH] fix/chore: update submodule outbound to fix panic in some edge cases (#503) --- cmd/run.go | 6 +++--- common/bitlist/bitlist.go | 2 +- common/netutils/dns.go | 6 +++--- common/netutils/ip46.go | 2 +- common/netutils/ip46_test.go | 2 +- common/utils.go | 2 +- component/dns/upstream.go | 2 +- component/outbound/dialer/alive_dialer_set.go | 2 +- component/outbound/dialer/block.go | 2 +- component/outbound/dialer/connectivity_check.go | 8 ++++---- component/outbound/dialer/dialer.go | 2 +- component/outbound/dialer/direct.go | 2 +- component/outbound/dialer/register.go | 2 +- component/outbound/dialer_group.go | 2 +- component/outbound/dialer_group_test.go | 2 +- component/outbound/outbound.go | 12 ++++++------ component/sniffing/internal/quicutils/cipher.go | 2 +- component/sniffing/internal/quicutils/hkdf.go | 5 +++-- component/sniffing/quic.go | 2 +- component/sniffing/sniffer.go | 4 ++-- component/sniffing/sniffing_bench_test.go | 5 +++-- control/control_plane.go | 8 ++++---- control/dns_control.go | 6 +++--- control/tcp.go | 4 ++-- control/udp.go | 2 +- control/udp_endpoint_pool.go | 4 ++-- go.mod | 5 +---- go.sum | 9 +++------ pkg/trie/trie.go | 2 +- 29 files changed, 55 insertions(+), 59 deletions(-) diff --git a/cmd/run.go b/cmd/run.go index cb20c75..633593f 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -20,9 +20,9 @@ import ( "syscall" "time" - "github.com/daeuniverse/softwind/netproxy" - "github.com/daeuniverse/softwind/pkg/fastrand" - "github.com/daeuniverse/softwind/protocol/direct" + "github.com/daeuniverse/outbound/netproxy" + "github.com/daeuniverse/outbound/pkg/fastrand" + "github.com/daeuniverse/outbound/protocol/direct" "gopkg.in/natefinch/lumberjack.v2" "github.com/daeuniverse/dae/cmd/internal" diff --git a/common/bitlist/bitlist.go b/common/bitlist/bitlist.go index 489b3ac..df53115 100644 --- a/common/bitlist/bitlist.go +++ b/common/bitlist/bitlist.go @@ -10,7 +10,7 @@ import ( "math/bits" "github.com/daeuniverse/dae/pkg/anybuffer" - "github.com/daeuniverse/softwind/common" + "github.com/daeuniverse/outbound/common" ) // CompactBitList allows your units to be of arbitrary bit size. diff --git a/common/netutils/dns.go b/common/netutils/dns.go index 58a7701..7c37447 100644 --- a/common/netutils/dns.go +++ b/common/netutils/dns.go @@ -16,9 +16,9 @@ import ( "time" "github.com/daeuniverse/dae/common/consts" - "github.com/daeuniverse/softwind/netproxy" - "github.com/daeuniverse/softwind/pkg/fastrand" - "github.com/daeuniverse/softwind/pool" + "github.com/daeuniverse/outbound/netproxy" + "github.com/daeuniverse/outbound/pkg/fastrand" + "github.com/daeuniverse/outbound/pool" dnsmessage "github.com/miekg/dns" ) diff --git a/common/netutils/ip46.go b/common/netutils/ip46.go index 7cf13b2..ca9c28d 100644 --- a/common/netutils/ip46.go +++ b/common/netutils/ip46.go @@ -12,7 +12,7 @@ import ( "net/netip" "sync" - "github.com/daeuniverse/softwind/netproxy" + "github.com/daeuniverse/outbound/netproxy" dnsmessage "github.com/miekg/dns" "github.com/sirupsen/logrus" ) diff --git a/common/netutils/ip46_test.go b/common/netutils/ip46_test.go index 1f592ea..20724fb 100644 --- a/common/netutils/ip46_test.go +++ b/common/netutils/ip46_test.go @@ -11,7 +11,7 @@ import ( "testing" "time" - "github.com/daeuniverse/softwind/protocol/direct" + "github.com/daeuniverse/outbound/protocol/direct" ) func TestResolveIp46(t *testing.T) { diff --git a/common/utils.go b/common/utils.go index 298a527..350195b 100644 --- a/common/utils.go +++ b/common/utils.go @@ -22,7 +22,7 @@ import ( "time" "unsafe" - "github.com/daeuniverse/softwind/netproxy" + "github.com/daeuniverse/outbound/netproxy" internal "github.com/daeuniverse/dae/pkg/ebpf_internal" dnsmessage "github.com/miekg/dns" diff --git a/component/dns/upstream.go b/component/dns/upstream.go index 5bb0c1d..bd8682f 100644 --- a/component/dns/upstream.go +++ b/component/dns/upstream.go @@ -16,7 +16,7 @@ import ( "github.com/daeuniverse/dae/common/consts" "github.com/daeuniverse/dae/common/netutils" - "github.com/daeuniverse/softwind/protocol/direct" + "github.com/daeuniverse/outbound/protocol/direct" ) var ( diff --git a/component/outbound/dialer/alive_dialer_set.go b/component/outbound/dialer/alive_dialer_set.go index a79bafd..85e4e91 100644 --- a/component/outbound/dialer/alive_dialer_set.go +++ b/component/outbound/dialer/alive_dialer_set.go @@ -13,7 +13,7 @@ import ( "time" "github.com/daeuniverse/dae/common/consts" - "github.com/daeuniverse/softwind/pkg/fastrand" + "github.com/daeuniverse/outbound/pkg/fastrand" "github.com/sirupsen/logrus" ) diff --git a/component/outbound/dialer/block.go b/component/outbound/dialer/block.go index a3a4df8..8dc2840 100644 --- a/component/outbound/dialer/block.go +++ b/component/outbound/dialer/block.go @@ -7,7 +7,7 @@ package dialer import ( D "github.com/daeuniverse/outbound/dialer" - "github.com/daeuniverse/softwind/netproxy" + "github.com/daeuniverse/outbound/netproxy" ) func NewBlockDialer(option *GlobalOption, dialCallback func()) (netproxy.Dialer, *Property) { diff --git a/component/outbound/dialer/connectivity_check.go b/component/outbound/dialer/connectivity_check.go index f06212c..304f769 100644 --- a/component/outbound/dialer/connectivity_check.go +++ b/component/outbound/dialer/connectivity_check.go @@ -24,10 +24,10 @@ import ( "github.com/daeuniverse/dae/common/consts" "github.com/daeuniverse/dae/common/netutils" - "github.com/daeuniverse/softwind/netproxy" - "github.com/daeuniverse/softwind/pkg/fastrand" - "github.com/daeuniverse/softwind/pool" - "github.com/daeuniverse/softwind/protocol/direct" + "github.com/daeuniverse/outbound/netproxy" + "github.com/daeuniverse/outbound/pkg/fastrand" + "github.com/daeuniverse/outbound/pool" + "github.com/daeuniverse/outbound/protocol/direct" dnsmessage "github.com/miekg/dns" "github.com/sirupsen/logrus" ) diff --git a/component/outbound/dialer/dialer.go b/component/outbound/dialer/dialer.go index 64ef069..5d08706 100644 --- a/component/outbound/dialer/dialer.go +++ b/component/outbound/dialer/dialer.go @@ -12,7 +12,7 @@ import ( "time" D "github.com/daeuniverse/outbound/dialer" - "github.com/daeuniverse/softwind/netproxy" + "github.com/daeuniverse/outbound/netproxy" "github.com/sirupsen/logrus" ) diff --git a/component/outbound/dialer/direct.go b/component/outbound/dialer/direct.go index 99a3d10..d8a707c 100644 --- a/component/outbound/dialer/direct.go +++ b/component/outbound/dialer/direct.go @@ -7,7 +7,7 @@ package dialer import ( D "github.com/daeuniverse/outbound/dialer" - "github.com/daeuniverse/softwind/netproxy" + "github.com/daeuniverse/outbound/netproxy" ) func NewDirectDialer(option *GlobalOption, fullcone bool) (netproxy.Dialer, *Property) { diff --git a/component/outbound/dialer/register.go b/component/outbound/dialer/register.go index 40b5117..6fdc383 100644 --- a/component/outbound/dialer/register.go +++ b/component/outbound/dialer/register.go @@ -7,7 +7,7 @@ package dialer import ( D "github.com/daeuniverse/outbound/dialer" - "github.com/daeuniverse/softwind/protocol/direct" + "github.com/daeuniverse/outbound/protocol/direct" ) func NewFromLink(gOption *GlobalOption, iOption InstanceOption, link string, subscriptionTag string) (*Dialer, error) { diff --git a/component/outbound/dialer_group.go b/component/outbound/dialer_group.go index fecb17e..c0a6bce 100644 --- a/component/outbound/dialer_group.go +++ b/component/outbound/dialer_group.go @@ -13,7 +13,7 @@ import ( "github.com/daeuniverse/dae/common/consts" "github.com/daeuniverse/dae/component/outbound/dialer" _ "github.com/daeuniverse/outbound/dialer" - "github.com/daeuniverse/softwind/netproxy" + "github.com/daeuniverse/outbound/netproxy" "github.com/sirupsen/logrus" ) diff --git a/component/outbound/dialer_group_test.go b/component/outbound/dialer_group_test.go index 65a918d..f1fa08c 100644 --- a/component/outbound/dialer_group_test.go +++ b/component/outbound/dialer_group_test.go @@ -12,7 +12,7 @@ import ( "github.com/daeuniverse/dae/common/consts" "github.com/daeuniverse/dae/component/outbound/dialer" "github.com/daeuniverse/dae/pkg/logger" - "github.com/daeuniverse/softwind/pkg/fastrand" + "github.com/daeuniverse/outbound/pkg/fastrand" ) const ( diff --git a/component/outbound/outbound.go b/component/outbound/outbound.go index 97072ae..8a4dd71 100644 --- a/component/outbound/outbound.go +++ b/component/outbound/outbound.go @@ -14,13 +14,13 @@ import ( _ "github.com/daeuniverse/outbound/dialer/trojan" _ "github.com/daeuniverse/outbound/dialer/tuic" _ "github.com/daeuniverse/outbound/dialer/v2ray" + _ "github.com/daeuniverse/outbound/protocol/juicity" + _ "github.com/daeuniverse/outbound/protocol/shadowsocks" + _ "github.com/daeuniverse/outbound/protocol/trojanc" + _ "github.com/daeuniverse/outbound/protocol/tuic" + _ "github.com/daeuniverse/outbound/protocol/vless" + _ "github.com/daeuniverse/outbound/protocol/vmess" _ "github.com/daeuniverse/outbound/transport/simpleobfs" _ "github.com/daeuniverse/outbound/transport/tls" _ "github.com/daeuniverse/outbound/transport/ws" - _ "github.com/daeuniverse/softwind/protocol/juicity" - _ "github.com/daeuniverse/softwind/protocol/shadowsocks" - _ "github.com/daeuniverse/softwind/protocol/trojanc" - _ "github.com/daeuniverse/softwind/protocol/tuic" - _ "github.com/daeuniverse/softwind/protocol/vless" - _ "github.com/daeuniverse/softwind/protocol/vmess" ) diff --git a/component/sniffing/internal/quicutils/cipher.go b/component/sniffing/internal/quicutils/cipher.go index cc8f9f6..a54484a 100644 --- a/component/sniffing/internal/quicutils/cipher.go +++ b/component/sniffing/internal/quicutils/cipher.go @@ -13,7 +13,7 @@ import ( "io" "github.com/daeuniverse/dae/common" - "github.com/daeuniverse/softwind/pool" + "github.com/daeuniverse/outbound/pool" "golang.org/x/crypto/hkdf" ) diff --git a/component/sniffing/internal/quicutils/hkdf.go b/component/sniffing/internal/quicutils/hkdf.go index 648d2aa..fa67c4a 100644 --- a/component/sniffing/internal/quicutils/hkdf.go +++ b/component/sniffing/internal/quicutils/hkdf.go @@ -9,10 +9,11 @@ package quicutils import ( "encoding/binary" - "github.com/daeuniverse/softwind/pool" - "golang.org/x/crypto/hkdf" "hash" "io" + + "github.com/daeuniverse/outbound/pool" + "golang.org/x/crypto/hkdf" ) // HkdfExpandLabelFromPool HKDF expands a label. diff --git a/component/sniffing/quic.go b/component/sniffing/quic.go index 91fef67..b4ab39b 100644 --- a/component/sniffing/quic.go +++ b/component/sniffing/quic.go @@ -10,7 +10,7 @@ import ( "io/fs" "github.com/daeuniverse/dae/component/sniffing/internal/quicutils" - "github.com/daeuniverse/softwind/pool" + "github.com/daeuniverse/outbound/pool" ) const ( diff --git a/component/sniffing/sniffer.go b/component/sniffing/sniffer.go index 5b66a77..8e4813a 100644 --- a/component/sniffing/sniffer.go +++ b/component/sniffing/sniffer.go @@ -12,8 +12,8 @@ import ( "time" "github.com/daeuniverse/dae/component/sniffing/internal/quicutils" - "github.com/daeuniverse/softwind/pool" - "github.com/daeuniverse/softwind/pool/bytes" + "github.com/daeuniverse/outbound/pool" + "github.com/daeuniverse/outbound/pool/bytes" ) type Sniffer struct { diff --git a/component/sniffing/sniffing_bench_test.go b/component/sniffing/sniffing_bench_test.go index 639b9f2..93df8ad 100644 --- a/component/sniffing/sniffing_bench_test.go +++ b/component/sniffing/sniffing_bench_test.go @@ -7,10 +7,11 @@ package sniffing import ( "fmt" - "github.com/daeuniverse/dae/common" "testing" - "github.com/daeuniverse/softwind/pkg/fastrand" + "github.com/daeuniverse/dae/common" + + "github.com/daeuniverse/outbound/pkg/fastrand" ) var ( diff --git a/control/control_plane.go b/control/control_plane.go index 34eca42..3fb0998 100644 --- a/control/control_plane.go +++ b/control/control_plane.go @@ -34,10 +34,10 @@ import ( "github.com/daeuniverse/dae/pkg/config_parser" internal "github.com/daeuniverse/dae/pkg/ebpf_internal" D "github.com/daeuniverse/outbound/dialer" - "github.com/daeuniverse/softwind/pool" - "github.com/daeuniverse/softwind/protocol/direct" - "github.com/daeuniverse/softwind/transport/grpc" - "github.com/daeuniverse/softwind/transport/meek" + "github.com/daeuniverse/outbound/pool" + "github.com/daeuniverse/outbound/protocol/direct" + "github.com/daeuniverse/outbound/transport/grpc" + "github.com/daeuniverse/outbound/transport/meek" dnsmessage "github.com/miekg/dns" "github.com/mohae/deepcopy" "github.com/sirupsen/logrus" diff --git a/control/dns_control.go b/control/dns_control.go index 088a601..222436b 100644 --- a/control/dns_control.go +++ b/control/dns_control.go @@ -25,9 +25,9 @@ import ( "github.com/daeuniverse/dae/component/dns" "github.com/daeuniverse/dae/component/outbound" "github.com/daeuniverse/dae/component/outbound/dialer" - "github.com/daeuniverse/softwind/netproxy" - "github.com/daeuniverse/softwind/pkg/fastrand" - "github.com/daeuniverse/softwind/pool" + "github.com/daeuniverse/outbound/netproxy" + "github.com/daeuniverse/outbound/pkg/fastrand" + "github.com/daeuniverse/outbound/pool" dnsmessage "github.com/miekg/dns" "github.com/mohae/deepcopy" "github.com/sirupsen/logrus" diff --git a/control/tcp.go b/control/tcp.go index 55a6345..b09ef75 100644 --- a/control/tcp.go +++ b/control/tcp.go @@ -17,8 +17,8 @@ import ( "github.com/daeuniverse/dae/common/consts" "github.com/daeuniverse/dae/component/outbound/dialer" "github.com/daeuniverse/dae/component/sniffing" - "github.com/daeuniverse/softwind/netproxy" - "github.com/daeuniverse/softwind/pkg/zeroalloc/io" + "github.com/daeuniverse/outbound/netproxy" + "github.com/daeuniverse/outbound/pkg/zeroalloc/io" "github.com/sirupsen/logrus" "golang.org/x/sys/unix" ) diff --git a/control/udp.go b/control/udp.go index 86456f3..b96b5f4 100644 --- a/control/udp.go +++ b/control/udp.go @@ -16,7 +16,7 @@ import ( ob "github.com/daeuniverse/dae/component/outbound" "github.com/daeuniverse/dae/component/outbound/dialer" "github.com/daeuniverse/dae/component/sniffing" - "github.com/daeuniverse/softwind/pool" + "github.com/daeuniverse/outbound/pool" dnsmessage "github.com/miekg/dns" "github.com/sirupsen/logrus" ) diff --git a/control/udp_endpoint_pool.go b/control/udp_endpoint_pool.go index 6908173..45ce35c 100644 --- a/control/udp_endpoint_pool.go +++ b/control/udp_endpoint_pool.go @@ -15,8 +15,8 @@ import ( "github.com/daeuniverse/dae/common/consts" "github.com/daeuniverse/dae/component/outbound" "github.com/daeuniverse/dae/component/outbound/dialer" - "github.com/daeuniverse/softwind/netproxy" - "github.com/daeuniverse/softwind/pool" + "github.com/daeuniverse/outbound/netproxy" + "github.com/daeuniverse/outbound/pool" ) type UdpHandler func(data []byte, from netip.AddrPort) error diff --git a/go.mod b/go.mod index caa3eca..bf3229b 100644 --- a/go.mod +++ b/go.mod @@ -10,8 +10,7 @@ require ( github.com/bits-and-blooms/bloom/v3 v3.5.0 github.com/cilium/ebpf v0.12.3 github.com/daeuniverse/dae-config-dist/go/dae_config v0.0.0-20230604120805-1c27619b592d - github.com/daeuniverse/outbound v0.0.0-20240413032918-078e65ce9409 - github.com/daeuniverse/softwind v0.0.0-20240413031314-0049ada6ee9d + github.com/daeuniverse/outbound v0.0.0-20240423150318-97fdbb427e02 github.com/fsnotify/fsnotify v1.7.0 github.com/json-iterator/go v1.1.12 github.com/miekg/dns v1.1.55 @@ -74,8 +73,6 @@ require ( google.golang.org/grpc v1.57.0 // indirect ) -// replace github.com/daeuniverse/softwind => ../softwind - // replace github.com/daeuniverse/outbound => ../outbound // replace github.com/daeuniverse/quic-go => ../quic-go diff --git a/go.sum b/go.sum index ed3b010..d99b7da 100644 --- a/go.sum +++ b/go.sum @@ -15,12 +15,10 @@ github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBS github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/daeuniverse/dae-config-dist/go/dae_config v0.0.0-20230604120805-1c27619b592d h1:hnC39MjR7xt5kZjrKlef7DXKFDkiX8MIcDXYC/6Jf9Q= github.com/daeuniverse/dae-config-dist/go/dae_config v0.0.0-20230604120805-1c27619b592d/go.mod h1:VGWGgv7pCP5WGyHGUyb9+nq/gW0yBm+i/GfCNATOJ1M= -github.com/daeuniverse/outbound v0.0.0-20240413032918-078e65ce9409 h1:A08H+3cGMreCiAYGq965rP2XoKXgvPKoR9I09/lDW7s= -github.com/daeuniverse/outbound v0.0.0-20240413032918-078e65ce9409/go.mod h1:+incQmNwLG/JkkBymqMz/SnxRGWcSCSjy80CAjVj4v0= +github.com/daeuniverse/outbound v0.0.0-20240423150318-97fdbb427e02 h1:RvfDfy4c67zHoHos8OyxrpzUqGjnBf/EyfLt3AXehEg= +github.com/daeuniverse/outbound v0.0.0-20240423150318-97fdbb427e02/go.mod h1:UDGbEWJWcLVHanbq6NCK9kszBCBcIbrF4FT8v+XcU/I= github.com/daeuniverse/quic-go v0.0.0-20240413031024-943f218e0810 h1:YtEYouFaNrg9sV9vf3UabvKShKn6sD0QaCdOxCwaF3g= github.com/daeuniverse/quic-go v0.0.0-20240413031024-943f218e0810/go.mod h1:61o2uZUGLrlv1i+oO2rx9sVX0vbf8cHzdSHt7h6lMnM= -github.com/daeuniverse/softwind v0.0.0-20240413031314-0049ada6ee9d h1:1Tj48+Vv5W4XIyG0X2JWzzRBo13ll6csThKzFGCbT1o= -github.com/daeuniverse/softwind v0.0.0-20240413031314-0049ada6ee9d/go.mod h1:xhBh5EiYniZRA0qRRy0PvjRd1TeHMXR8M6k0beD7sv4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -139,9 +137,8 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/twmb/murmur3 v1.1.6 h1:mqrRot1BRxm+Yct+vavLMou2/iJt0tNVTTC0QoIjaZg= github.com/twmb/murmur3 v1.1.6/go.mod h1:Qq/R7NUyOfr65zD+6Q5IHKsJLwP7exErjN6lyyq3OSQ= github.com/v2rayA/ahocorasick-domain v0.0.0-20231231085011-99ceb8ef3208 h1:s/K1ome/+rTDictkqGhqLuAleUymyWnvgNWARjblS9U= diff --git a/pkg/trie/trie.go b/pkg/trie/trie.go index 5f95f69..eb5d5f6 100644 --- a/pkg/trie/trie.go +++ b/pkg/trie/trie.go @@ -16,7 +16,7 @@ import ( "github.com/daeuniverse/dae/common" "github.com/daeuniverse/dae/common/bitlist" - "github.com/daeuniverse/softwind/pool" + "github.com/daeuniverse/outbound/pool" ) var ValidCidrChars = NewValidChars([]byte{'0', '1'})