From 385c42e6381450efd0d2e390f99659d1eac8a299 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Wed, 20 Jul 2022 22:05:11 +0800 Subject: [PATCH] Improve socksaddr --- common/dialer/resolve_conn.go | 2 +- go.mod | 2 +- go.sum | 4 ++-- route/rule_ipversion.go | 2 +- test/go.mod | 2 +- test/go.sum | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/common/dialer/resolve_conn.go b/common/dialer/resolve_conn.go index 8e9b3b22..ab506348 100644 --- a/common/dialer/resolve_conn.go +++ b/common/dialer/resolve_conn.go @@ -67,7 +67,7 @@ func (w *ResolvePacketConn) ReadPacket(buffer *buf.Buffer) (M.Socksaddr, error) func (w *ResolvePacketConn) WritePacket(buffer *buf.Buffer, destination M.Socksaddr) error { defer buffer.Release() - if destination.Family().IsFqdn() { + if destination.IsFqdn() { addresses, err := w.router.Lookup(context.Background(), destination.Fqdn, w.strategy) if err != nil { return err diff --git a/go.mod b/go.mod index c8876d35..38ac7c8b 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/gorilla/websocket v1.5.0 github.com/logrusorgru/aurora v2.0.3+incompatible github.com/oschwald/maxminddb-golang v1.9.0 - github.com/sagernet/sing v0.0.0-20220720054545-2af19486bb1f + github.com/sagernet/sing v0.0.0-20220720140412-fd4ec74d5eca github.com/sagernet/sing-dns v0.0.0-20220720045209-c44590ebeb0f github.com/sagernet/sing-shadowsocks v0.0.0-20220717063942-45a2ad9cd41f github.com/sagernet/sing-tun v0.0.0-20220720051454-d35c334b46c9 diff --git a/go.sum b/go.sum index 1d4e68ab..3002ccee 100644 --- a/go.sum +++ b/go.sum @@ -35,8 +35,8 @@ github.com/oschwald/maxminddb-golang v1.9.0/go.mod h1:TK+s/Z2oZq0rSl4PSeAEoP0bgm github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sagernet/sing v0.0.0-20220720054545-2af19486bb1f h1:eMaEhzlP5jFCd6xvLkeb8vMayLSuAPy446QSCZgdSGg= -github.com/sagernet/sing v0.0.0-20220720054545-2af19486bb1f/go.mod h1:GbtQfZSpmtD3cXeD1qX2LCMwY8dH+bnnInDTqd92IsM= +github.com/sagernet/sing v0.0.0-20220720140412-fd4ec74d5eca h1:xz/41NRDcjMm3w5UeojeU79Tu0aRiy/apQN+JadrWZ8= +github.com/sagernet/sing v0.0.0-20220720140412-fd4ec74d5eca/go.mod h1:GbtQfZSpmtD3cXeD1qX2LCMwY8dH+bnnInDTqd92IsM= github.com/sagernet/sing-dns v0.0.0-20220720045209-c44590ebeb0f h1:PCrkSLS+fQtBimPi/2WzjJqeTy0zJtBDaMLykyTAiwQ= github.com/sagernet/sing-dns v0.0.0-20220720045209-c44590ebeb0f/go.mod h1:y2fpvoxukw3G7eApIZwkcpcG/NE4AB8pCQI0Qd8rMqk= github.com/sagernet/sing-shadowsocks v0.0.0-20220717063942-45a2ad9cd41f h1:F6yiuKbBoXgWiuoP7R0YA14pDEl3emxA1mL7M16Q7gc= diff --git a/route/rule_ipversion.go b/route/rule_ipversion.go index 8169a7ea..ba95ee0b 100644 --- a/route/rule_ipversion.go +++ b/route/rule_ipversion.go @@ -15,7 +15,7 @@ func NewIPVersionItem(isIPv6 bool) *IPVersionItem { } func (r *IPVersionItem) Match(metadata *adapter.InboundContext) bool { - return metadata.Destination.IsIP() && metadata.Destination.Family().IsIPv6() == r.isIPv6 + return metadata.Destination.IsIP() && metadata.Destination.IsIPv6() == r.isIPv6 } func (r *IPVersionItem) String() string { diff --git a/test/go.mod b/test/go.mod index 75d70029..fdfcad08 100644 --- a/test/go.mod +++ b/test/go.mod @@ -10,7 +10,7 @@ require ( github.com/docker/docker v20.10.17+incompatible github.com/docker/go-connections v0.4.0 github.com/gofrs/uuid v4.2.0+incompatible - github.com/sagernet/sing v0.0.0-20220720054545-2af19486bb1f + github.com/sagernet/sing v0.0.0-20220720140412-fd4ec74d5eca github.com/spyzhov/ajson v0.7.1 github.com/stretchr/testify v1.8.0 golang.org/x/net v0.0.0-20220708220712-1185a9018129 diff --git a/test/go.sum b/test/go.sum index 06a87cc1..f06de290 100644 --- a/test/go.sum +++ b/test/go.sum @@ -62,8 +62,8 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/sagernet/sing v0.0.0-20220720054545-2af19486bb1f h1:eMaEhzlP5jFCd6xvLkeb8vMayLSuAPy446QSCZgdSGg= -github.com/sagernet/sing v0.0.0-20220720054545-2af19486bb1f/go.mod h1:GbtQfZSpmtD3cXeD1qX2LCMwY8dH+bnnInDTqd92IsM= +github.com/sagernet/sing v0.0.0-20220720140412-fd4ec74d5eca h1:xz/41NRDcjMm3w5UeojeU79Tu0aRiy/apQN+JadrWZ8= +github.com/sagernet/sing v0.0.0-20220720140412-fd4ec74d5eca/go.mod h1:GbtQfZSpmtD3cXeD1qX2LCMwY8dH+bnnInDTqd92IsM= github.com/sagernet/sing-dns v0.0.0-20220720045209-c44590ebeb0f h1:PCrkSLS+fQtBimPi/2WzjJqeTy0zJtBDaMLykyTAiwQ= github.com/sagernet/sing-dns v0.0.0-20220720045209-c44590ebeb0f/go.mod h1:y2fpvoxukw3G7eApIZwkcpcG/NE4AB8pCQI0Qd8rMqk= github.com/sagernet/sing-shadowsocks v0.0.0-20220717063942-45a2ad9cd41f h1:F6yiuKbBoXgWiuoP7R0YA14pDEl3emxA1mL7M16Q7gc=