From d8afd7740fb1b5f8019929c899d331a439ee3cdc Mon Sep 17 00:00:00 2001 From: fangyincheng Date: Sat, 21 Sep 2019 18:56:04 +0800 Subject: [PATCH 1/7] Mod: update getty&hessian2 version --- go.mod | 4 ++-- go.sum | 12 ++++++------ protocol/dubbo/readwriter.go | 16 ++++++++-------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/go.mod b/go.mod index 09948c93c5..0df15c144c 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ require ( github.com/Workiva/go-datastructures v1.0.50 github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190802083043-4cd0c391755e // indirect - github.com/apache/dubbo-go-hessian2 v1.2.5-0.20190909140437-80cbb25cbb22 + github.com/apache/dubbo-go-hessian2 v1.2.5-0.20190921023740-335b8c601359 github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23 // indirect github.com/coreos/bbolt v1.3.3 // indirect github.com/coreos/etcd v3.3.13+incompatible @@ -12,7 +12,7 @@ require ( github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f // indirect github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f // indirect github.com/creasty/defaults v1.3.0 - github.com/dubbogo/getty v1.2.2 + github.com/dubbogo/getty v1.3.0 github.com/dubbogo/gost v1.1.1 github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239 // indirect github.com/go-errors/errors v1.0.1 // indirect diff --git a/go.sum b/go.sum index 1452a76298..d2f28f6e6f 100644 --- a/go.sum +++ b/go.sum @@ -35,8 +35,8 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190802083043-4cd0c391755e h1:MSuLXx/mveDbpDNhVrcWTMeV4lbYWKcyO4rH+jAxmX0= github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190802083043-4cd0c391755e/go.mod h1:myCDvQSzCW+wB1WAlocEru4wMGJxy+vlxHdhegi1CDQ= github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20190307165228-86c17b95fcd5/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8= -github.com/apache/dubbo-go-hessian2 v1.2.5-0.20190909140437-80cbb25cbb22 h1:Ku+3LFRYVelgo/INS9893QOUeIiKNeNKzK3CzDcqt/4= -github.com/apache/dubbo-go-hessian2 v1.2.5-0.20190909140437-80cbb25cbb22/go.mod h1:LWnndnrFXZmJLAzoyNAPNHSIJ1KOHVkTSsHgC3YYWlo= +github.com/apache/dubbo-go-hessian2 v1.2.5-0.20190921023740-335b8c601359 h1:ti5HOgxW/aKonsBe4Sj/W3+RMq4Jxl/EAAblROneggg= +github.com/apache/dubbo-go-hessian2 v1.2.5-0.20190921023740-335b8c601359/go.mod h1:LWnndnrFXZmJLAzoyNAPNHSIJ1KOHVkTSsHgC3YYWlo= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e h1:QEF07wC0T1rKkctt1RINW/+RMTVmiwxETico2l3gxJA= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= @@ -102,8 +102,8 @@ github.com/docker/go-connections v0.3.0 h1:3lOnM9cSzgGwx8VfK/NGOW5fLQ0GjIlCkaktF github.com/docker/go-connections v0.3.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.3.3 h1:Xk8S3Xj5sLGlG5g67hJmYMmUgXv5N4PhkjJHHqrwnTk= github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/dubbogo/getty v1.2.2 h1:qDC9WXjxcs5NPvWZz2ruVKBKr2r1Jjm6i0Sq//CQwbE= -github.com/dubbogo/getty v1.2.2/go.mod h1:K4b3MkGLf7T+lMgQNFgpg0dI1Wvv1PTisFs1Psf86kU= +github.com/dubbogo/getty v1.3.0 h1:GImOCANdts7dlRqi9GMVsZJnfst9EPyjTVTR1AesOD8= +github.com/dubbogo/getty v1.3.0/go.mod h1:K4b3MkGLf7T+lMgQNFgpg0dI1Wvv1PTisFs1Psf86kU= github.com/dubbogo/gost v1.1.1 h1:JCM7vx5edPIjDA5ovJTuzEEXuw2t7xLyrlgi2mi5jHI= github.com/dubbogo/gost v1.1.1/go.mod h1:R7wZm1DrmrKGr50mBZVcg6C9ekG8aL5hP+sgWcIDwQg= github.com/duosecurity/duo_api_golang v0.0.0-20190308151101-6c680f768e74 h1:2MIhn2R6oXQbgW5yHfS+d6YqyMfXiu2L55rFZC4UD/M= @@ -184,7 +184,7 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGa github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gotestyourself/gotestyourself v2.2.0+incompatible h1:1yOKgt0XYKUg1HOKunGOSt2ocU4bxLCjmIHt0vRtVHM= +github.com/gotestyourself/gotestyourself v2.2.0+incompatible h1:AQwinXlbQR2HvPjQZOmDhRqsv5mZf+Jb1RnSLxcqZcI= github.com/gotestyourself/gotestyourself v2.2.0+incompatible/go.mod h1:zZKM6oeNM8k+FRljX1mnzVYeS8wiGgQyvST1/GafPbY= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 h1:pdN6V1QBWetyv/0+wjACpqVH+eVULgEjkurDLq3goeM= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= @@ -553,7 +553,7 @@ gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bl gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gotest.tools v2.2.0+incompatible h1:y0IMTfclpMdsdIbr6uwmJn5/WZ7vFuObxDMdrylFM3A= +gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/protocol/dubbo/readwriter.go b/protocol/dubbo/readwriter.go index a57c29f890..930382cca8 100644 --- a/protocol/dubbo/readwriter.go +++ b/protocol/dubbo/readwriter.go @@ -68,20 +68,20 @@ func (p *RpcClientPackageHandler) Read(ss getty.Session, data []byte) (interface return pkg, hessian.HEADER_LENGTH + pkg.Header.BodyLen, nil } -func (p *RpcClientPackageHandler) Write(ss getty.Session, pkg interface{}) error { +func (p *RpcClientPackageHandler) Write(ss getty.Session, pkg interface{}) ([]byte, error) { req, ok := pkg.(*DubboPackage) if !ok { logger.Errorf("illegal pkg:%+v\n", pkg) - return perrors.New("invalid rpc request") + return nil, perrors.New("invalid rpc request") } buf, err := req.Marshal() if err != nil { logger.Warnf("binary.Write(req{%#v}) = err{%#v}", req, perrors.WithStack(err)) - return perrors.WithStack(err) + return nil, perrors.WithStack(err) } - return perrors.WithStack(ss.WriteBytes(buf.Bytes())) + return buf.Bytes(), nil } //////////////////////////////////////////// @@ -164,18 +164,18 @@ func (p *RpcServerPackageHandler) Read(ss getty.Session, data []byte) (interface return pkg, hessian.HEADER_LENGTH + pkg.Header.BodyLen, nil } -func (p *RpcServerPackageHandler) Write(ss getty.Session, pkg interface{}) error { +func (p *RpcServerPackageHandler) Write(ss getty.Session, pkg interface{}) ([]byte, error) { res, ok := pkg.(*DubboPackage) if !ok { logger.Errorf("illegal pkg:%+v\n, it is %+v", pkg, reflect.TypeOf(pkg)) - return perrors.New("invalid rpc response") + return nil, perrors.New("invalid rpc response") } buf, err := res.Marshal() if err != nil { logger.Warnf("binary.Write(res{%#v}) = err{%#v}", res, perrors.WithStack(err)) - return perrors.WithStack(err) + return nil, perrors.WithStack(err) } - return perrors.WithStack(ss.WriteBytes(buf.Bytes())) + return buf.Bytes(), nil } From 960a4e0fbe82c67a3033898b6d4e6b82f664704e Mon Sep 17 00:00:00 2001 From: fangyincheng Date: Sat, 21 Sep 2019 19:02:36 +0800 Subject: [PATCH 2/7] Fix: registryProtocol.Export --- registry/protocol/protocol.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registry/protocol/protocol.go b/registry/protocol/protocol.go index d1e02b11b2..c746cf8ef2 100644 --- a/registry/protocol/protocol.go +++ b/registry/protocol/protocol.go @@ -174,7 +174,7 @@ func (proto *registryProtocol) Export(invoker protocol.Invoker) protocol.Exporte logger.Infof("The exporter has not been cached, and will return a new exporter!") } - reg.Subscribe(overriderUrl, overrideSubscribeListener) + go reg.Subscribe(overriderUrl, overrideSubscribeListener) return cachedExporter.(protocol.Exporter) } From 225cf9ed5b3349262f70b6525993a26645935ef7 Mon Sep 17 00:00:00 2001 From: fangyincheng Date: Mon, 23 Sep 2019 11:59:06 +0800 Subject: [PATCH 3/7] Fix: failover_cluster_invoker.go --- cluster/cluster_impl/failover_cluster_invoker.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cluster/cluster_impl/failover_cluster_invoker.go b/cluster/cluster_impl/failover_cluster_invoker.go index 70db6d4c1c..3595a04c71 100644 --- a/cluster/cluster_impl/failover_cluster_invoker.go +++ b/cluster/cluster_impl/failover_cluster_invoker.go @@ -72,6 +72,9 @@ func (invoker *failoverClusterInvoker) Invoke(invocation protocol.Invocation) pr invoked := []protocol.Invoker{} providers := []string{} var result protocol.Result + if retries > len(invokers) { + retries = len(invokers) + } for i := 0; i <= retries; i++ { //Reselect before retry to avoid a change of candidate `invokers`. //NOTE: if `invokers` changed, then `invoked` also lose accuracy. @@ -87,6 +90,9 @@ func (invoker *failoverClusterInvoker) Invoke(invocation protocol.Invocation) pr } } ivk := invoker.doSelect(loadbalance, invocation, invokers, invoked) + if ivk == nil { + continue + } invoked = append(invoked, ivk) //DO INVOKE result = ivk.Invoke(invocation) From 7b3334e35ac2a4de925e64ed70214c0ebf199c28 Mon Sep 17 00:00:00 2001 From: fangyincheng Date: Mon, 23 Sep 2019 14:13:52 +0800 Subject: [PATCH 4/7] Fix: update hessian2 --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 0df15c144c..36ce955452 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ require ( github.com/Workiva/go-datastructures v1.0.50 github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190802083043-4cd0c391755e // indirect - github.com/apache/dubbo-go-hessian2 v1.2.5-0.20190921023740-335b8c601359 + github.com/apache/dubbo-go-hessian2 v1.2.5-0.20190923055845-e3dd5d131df5 github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23 // indirect github.com/coreos/bbolt v1.3.3 // indirect github.com/coreos/etcd v3.3.13+incompatible diff --git a/go.sum b/go.sum index d2f28f6e6f..f8900569b0 100644 --- a/go.sum +++ b/go.sum @@ -37,6 +37,8 @@ github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190802083043-4cd0c391755e/go.mod github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20190307165228-86c17b95fcd5/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8= github.com/apache/dubbo-go-hessian2 v1.2.5-0.20190921023740-335b8c601359 h1:ti5HOgxW/aKonsBe4Sj/W3+RMq4Jxl/EAAblROneggg= github.com/apache/dubbo-go-hessian2 v1.2.5-0.20190921023740-335b8c601359/go.mod h1:LWnndnrFXZmJLAzoyNAPNHSIJ1KOHVkTSsHgC3YYWlo= +github.com/apache/dubbo-go-hessian2 v1.2.5-0.20190923055845-e3dd5d131df5 h1:p85EqnwOfcqqayW7OPREn0YJxIPIuEmuBJPezzhtO/M= +github.com/apache/dubbo-go-hessian2 v1.2.5-0.20190923055845-e3dd5d131df5/go.mod h1:LWnndnrFXZmJLAzoyNAPNHSIJ1KOHVkTSsHgC3YYWlo= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e h1:QEF07wC0T1rKkctt1RINW/+RMTVmiwxETico2l3gxJA= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= From 15d792c412139a817fb32a0e13b4b3ec02bad5a5 Mon Sep 17 00:00:00 2001 From: "vito.he" Date: Mon, 23 Sep 2019 15:53:14 +0800 Subject: [PATCH 5/7] Fix:load protocol --- config/protocol_config.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/protocol_config.go b/config/protocol_config.go index b71423670c..2803456dbc 100644 --- a/config/protocol_config.go +++ b/config/protocol_config.go @@ -37,8 +37,8 @@ func (c *ProtocolConfig) Prefix() string { func loadProtocol(protocolsIds string, protocols map[string]*ProtocolConfig) []*ProtocolConfig { returnProtocols := []*ProtocolConfig{} for _, v := range strings.Split(protocolsIds, ",") { - for _, prot := range protocols { - if v == prot.Name { + for k, prot := range protocols { + if v == k { returnProtocols = append(returnProtocols, prot) } } From 2b544b73714c3b7e20902c2e35c7bb1d6d6b49e1 Mon Sep 17 00:00:00 2001 From: fangyincheng Date: Mon, 23 Sep 2019 16:13:25 +0800 Subject: [PATCH 6/7] Imp: update dubbogo/gost and delete dubbo-go/common/utils --- cluster/cluster_impl/base_cluster_invoker.go | 6 +- .../cluster_impl/failover_cluster_invoker.go | 4 +- cluster/router/condition_router.go | 20 +-- cluster/router/condition_router_test.go | 22 ++-- common/utils/net.go | 124 ------------------ common/utils/net_test.go | 32 ----- common/utils/strings.go | 35 ----- common/utils/strings_test.go | 33 ----- config/reference_config.go | 4 +- config_center/configurator/override.go | 10 +- go.mod | 2 +- go.sum | 2 + registry/consul/utils.go | 4 +- registry/etcdv3/registry.go | 4 +- registry/nacos/registry.go | 4 +- registry/zookeeper/registry.go | 4 +- 16 files changed, 44 insertions(+), 266 deletions(-) delete mode 100644 common/utils/net.go delete mode 100644 common/utils/net_test.go delete mode 100644 common/utils/strings.go delete mode 100644 common/utils/strings_test.go diff --git a/cluster/cluster_impl/base_cluster_invoker.go b/cluster/cluster_impl/base_cluster_invoker.go index 52e2156885..d93e9a6a98 100644 --- a/cluster/cluster_impl/base_cluster_invoker.go +++ b/cluster/cluster_impl/base_cluster_invoker.go @@ -18,6 +18,7 @@ package cluster_impl import ( + gxnet "github.com/dubbogo/gost/net" perrors "github.com/pkg/errors" "go.uber.org/atomic" ) @@ -27,7 +28,6 @@ import ( "github.com/apache/dubbo-go/common" "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/extension" - "github.com/apache/dubbo-go/common/utils" "github.com/apache/dubbo-go/protocol" ) @@ -63,7 +63,7 @@ func (invoker *baseClusterInvoker) IsAvailable() bool { //check invokers availables func (invoker *baseClusterInvoker) checkInvokers(invokers []protocol.Invoker, invocation protocol.Invocation) error { if len(invokers) == 0 { - ip, _ := utils.GetLocalIP() + ip, _ := gxnet.GetLocalIP() return perrors.Errorf("Failed to invoke the method %v. No provider available for the service %v from "+ "registry %v on the consumer %v using the dubbo version %v .Please check if the providers have been started and registered.", invocation.MethodName(), invoker.directory.GetUrl().SubURL.Key(), invoker.directory.GetUrl().String(), ip, constant.Version) @@ -75,7 +75,7 @@ func (invoker *baseClusterInvoker) checkInvokers(invokers []protocol.Invoker, in //check cluster invoker is destroyed or not func (invoker *baseClusterInvoker) checkWhetherDestroyed() error { if invoker.destroyed.Load() { - ip, _ := utils.GetLocalIP() + ip, _ := gxnet.GetLocalIP() return perrors.Errorf("Rpc cluster invoker for %v on consumer %v use dubbo version %v is now destroyed! can not invoke any more. ", invoker.directory.GetUrl().Service(), ip, constant.Version) } diff --git a/cluster/cluster_impl/failover_cluster_invoker.go b/cluster/cluster_impl/failover_cluster_invoker.go index 3595a04c71..dcce736993 100644 --- a/cluster/cluster_impl/failover_cluster_invoker.go +++ b/cluster/cluster_impl/failover_cluster_invoker.go @@ -22,6 +22,7 @@ import ( ) import ( + gxnet "github.com/dubbogo/gost/net" perrors "github.com/pkg/errors" ) @@ -29,7 +30,6 @@ import ( "github.com/apache/dubbo-go/cluster" "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/logger" - "github.com/apache/dubbo-go/common/utils" "github.com/apache/dubbo-go/protocol" ) @@ -103,7 +103,7 @@ func (invoker *failoverClusterInvoker) Invoke(invocation protocol.Invocation) pr return result } } - ip, _ := utils.GetLocalIP() + ip, _ := gxnet.GetLocalIP() return &protocol.RPCResult{Err: perrors.Errorf("Failed to invoke the method %v in the service %v. Tried %v times of "+ "the providers %v (%v/%v)from the registry %v on the consumer %v using the dubbo version %v. Last error is %v.", methodName, invoker.GetUrl().Service(), retries, providers, len(providers), len(invokers), invoker.directory.GetUrl(), ip, constant.Version, result.Error().Error(), diff --git a/cluster/router/condition_router.go b/cluster/router/condition_router.go index b9632e2911..a196ceb577 100644 --- a/cluster/router/condition_router.go +++ b/cluster/router/condition_router.go @@ -24,7 +24,8 @@ import ( ) import ( - "github.com/dubbogo/gost/container" + "github.com/dubbogo/gost/container/gxset" + gxnet "github.com/dubbogo/gost/net" perrors "github.com/pkg/errors" ) @@ -32,7 +33,6 @@ import ( "github.com/apache/dubbo-go/common" "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/logger" - "github.com/apache/dubbo-go/common/utils" "github.com/apache/dubbo-go/protocol" ) @@ -126,7 +126,7 @@ func (c *ConditionRouter) Route(invokers []protocol.Invoker, url common.URL, inv if len(c.ThenCondition) == 0 { return result } - localIP, _ := utils.GetLocalIP() + localIP, _ := gxnet.GetLocalIP() for _, invoker := range invokers { isMatchThen, err := c.MatchThen(invoker.GetUrl(), url) if err != nil { @@ -157,7 +157,7 @@ func parseRule(rule string) (map[string]MatchPair, error) { return condition, nil } var pair MatchPair - values := container.NewSet() + values := gxset.NewSet() reg := regexp.MustCompile(`([&!=,]*)\s*([^&!=,\s]+)`) var startIndex = 0 if indexTuple := reg.FindIndex([]byte(rule)); len(indexTuple) > 0 { @@ -170,8 +170,8 @@ func parseRule(rule string) (map[string]MatchPair, error) { switch separator { case "": pair = MatchPair{ - Matches: container.NewSet(), - Mismatches: container.NewSet(), + Matches: gxset.NewSet(), + Mismatches: gxset.NewSet(), } condition[content] = pair case "&": @@ -179,8 +179,8 @@ func parseRule(rule string) (map[string]MatchPair, error) { pair = r } else { pair = MatchPair{ - Matches: container.NewSet(), - Mismatches: container.NewSet(), + Matches: gxset.NewSet(), + Mismatches: gxset.NewSet(), } condition[content] = pair } @@ -257,8 +257,8 @@ func MatchCondition(pairs map[string]MatchPair, url *common.URL, param *common.U } type MatchPair struct { - Matches *container.HashSet - Mismatches *container.HashSet + Matches *gxset.HashSet + Mismatches *gxset.HashSet } func (pair MatchPair) isMatch(value string, param *common.URL) bool { diff --git a/cluster/router/condition_router_test.go b/cluster/router/condition_router_test.go index 577c5c416f..e7534f9595 100644 --- a/cluster/router/condition_router_test.go +++ b/cluster/router/condition_router_test.go @@ -26,6 +26,7 @@ import ( ) import ( + "github.com/dubbogo/gost/net" perrors "github.com/pkg/errors" "github.com/stretchr/testify/assert" ) @@ -33,7 +34,6 @@ import ( import ( "github.com/apache/dubbo-go/common" "github.com/apache/dubbo-go/common/logger" - "github.com/apache/dubbo-go/common/utils" "github.com/apache/dubbo-go/protocol" "github.com/apache/dubbo-go/protocol/invocation" ) @@ -146,7 +146,7 @@ func TestRoute_matchWhen(t *testing.T) { } func TestRoute_matchFilter(t *testing.T) { - localIP, _ := utils.GetLocalIP() + localIP, _ := gxnet.GetLocalIP() url1, _ := common.NewURL(context.TODO(), "dubbo://10.20.3.3:20880/com.foo.BarService?default.serialization=fastjson") url2, _ := common.NewURL(context.TODO(), fmt.Sprintf("dubbo://%s:20880/com.foo.BarService", localIP)) url3, _ := common.NewURL(context.TODO(), fmt.Sprintf("dubbo://%s:20880/com.foo.BarService", localIP)) @@ -204,7 +204,7 @@ func TestRoute_methodRoute(t *testing.T) { func TestRoute_ReturnFalse(t *testing.T) { url, _ := common.NewURL(context.TODO(), "") - localIP, _ := utils.GetLocalIP() + localIP, _ := gxnet.GetLocalIP() invokers := []protocol.Invoker{NewMockInvoker(url, 1), NewMockInvoker(url, 2), NewMockInvoker(url, 3)} inv := &invocation.RPCInvocation{} rule := base64.URLEncoding.EncodeToString([]byte("host = " + localIP + " => false")) @@ -215,7 +215,7 @@ func TestRoute_ReturnFalse(t *testing.T) { } func TestRoute_ReturnEmpty(t *testing.T) { - localIP, _ := utils.GetLocalIP() + localIP, _ := gxnet.GetLocalIP() url, _ := common.NewURL(context.TODO(), "") invokers := []protocol.Invoker{NewMockInvoker(url, 1), NewMockInvoker(url, 2), NewMockInvoker(url, 3)} inv := &invocation.RPCInvocation{} @@ -227,7 +227,7 @@ func TestRoute_ReturnEmpty(t *testing.T) { } func TestRoute_ReturnAll(t *testing.T) { - localIP, _ := utils.GetLocalIP() + localIP, _ := gxnet.GetLocalIP() invokers := []protocol.Invoker{&MockInvoker{}, &MockInvoker{}, &MockInvoker{}} inv := &invocation.RPCInvocation{} rule := base64.URLEncoding.EncodeToString([]byte("host = " + localIP + " => " + " host = " + localIP)) @@ -238,7 +238,7 @@ func TestRoute_ReturnAll(t *testing.T) { } func TestRoute_HostFilter(t *testing.T) { - localIP, _ := utils.GetLocalIP() + localIP, _ := gxnet.GetLocalIP() url1, _ := common.NewURL(context.TODO(), "dubbo://10.20.3.3:20880/com.foo.BarService") url2, _ := common.NewURL(context.TODO(), fmt.Sprintf("dubbo://%s:20880/com.foo.BarService", localIP)) url3, _ := common.NewURL(context.TODO(), fmt.Sprintf("dubbo://%s:20880/com.foo.BarService", localIP)) @@ -257,7 +257,7 @@ func TestRoute_HostFilter(t *testing.T) { } func TestRoute_Empty_HostFilter(t *testing.T) { - localIP, _ := utils.GetLocalIP() + localIP, _ := gxnet.GetLocalIP() url1, _ := common.NewURL(context.TODO(), "dubbo://10.20.3.3:20880/com.foo.BarService") url2, _ := common.NewURL(context.TODO(), fmt.Sprintf("dubbo://%s:20880/com.foo.BarService", localIP)) url3, _ := common.NewURL(context.TODO(), fmt.Sprintf("dubbo://%s:20880/com.foo.BarService", localIP)) @@ -276,7 +276,7 @@ func TestRoute_Empty_HostFilter(t *testing.T) { } func TestRoute_False_HostFilter(t *testing.T) { - localIP, _ := utils.GetLocalIP() + localIP, _ := gxnet.GetLocalIP() url1, _ := common.NewURL(context.TODO(), "dubbo://10.20.3.3:20880/com.foo.BarService") url2, _ := common.NewURL(context.TODO(), fmt.Sprintf("dubbo://%s:20880/com.foo.BarService", localIP)) url3, _ := common.NewURL(context.TODO(), fmt.Sprintf("dubbo://%s:20880/com.foo.BarService", localIP)) @@ -295,7 +295,7 @@ func TestRoute_False_HostFilter(t *testing.T) { } func TestRoute_Placeholder(t *testing.T) { - localIP, _ := utils.GetLocalIP() + localIP, _ := gxnet.GetLocalIP() url1, _ := common.NewURL(context.TODO(), "dubbo://10.20.3.3:20880/com.foo.BarService") url2, _ := common.NewURL(context.TODO(), fmt.Sprintf("dubbo://%s:20880/com.foo.BarService", localIP)) url3, _ := common.NewURL(context.TODO(), fmt.Sprintf("dubbo://%s:20880/com.foo.BarService", localIP)) @@ -314,7 +314,7 @@ func TestRoute_Placeholder(t *testing.T) { } func TestRoute_NoForce(t *testing.T) { - localIP, _ := utils.GetLocalIP() + localIP, _ := gxnet.GetLocalIP() url1, _ := common.NewURL(context.TODO(), "dubbo://10.20.3.3:20880/com.foo.BarService") url2, _ := common.NewURL(context.TODO(), fmt.Sprintf("dubbo://%s:20880/com.foo.BarService", localIP)) url3, _ := common.NewURL(context.TODO(), fmt.Sprintf("dubbo://%s:20880/com.foo.BarService", localIP)) @@ -331,7 +331,7 @@ func TestRoute_NoForce(t *testing.T) { } func TestRoute_Force(t *testing.T) { - localIP, _ := utils.GetLocalIP() + localIP, _ := gxnet.GetLocalIP() url1, _ := common.NewURL(context.TODO(), "dubbo://10.20.3.3:20880/com.foo.BarService") url2, _ := common.NewURL(context.TODO(), fmt.Sprintf("dubbo://%s:20880/com.foo.BarService", localIP)) url3, _ := common.NewURL(context.TODO(), fmt.Sprintf("dubbo://%s:20880/com.foo.BarService", localIP)) diff --git a/common/utils/net.go b/common/utils/net.go deleted file mode 100644 index 47a2502317..0000000000 --- a/common/utils/net.go +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package utils - -import ( - "net" - "strings" -) - -import ( - perrors "github.com/pkg/errors" -) - -var ( - privateBlocks []*net.IPNet -) - -func init() { - for _, b := range []string{"10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"} { - if _, block, err := net.ParseCIDR(b); err == nil { - privateBlocks = append(privateBlocks, block) - } - } -} - -func GetLocalIP() (string, error) { - faces, err := net.Interfaces() - if err != nil { - return "", perrors.WithStack(err) - } - - var addr net.IP - for _, face := range faces { - if !isValidNetworkInterface(face) { - continue - } - - addrs, err := face.Addrs() - if err != nil { - return "", perrors.WithStack(err) - } - - if ipv4, ok := getValidIPv4(addrs); ok { - addr = ipv4 - if isPrivateIP(ipv4) { - return ipv4.String(), nil - } - } - } - - if addr == nil { - return "", perrors.Errorf("can not get local IP") - } - - return addr.String(), nil -} - -func isPrivateIP(ip net.IP) bool { - for _, priv := range privateBlocks { - if priv.Contains(ip) { - return true - } - } - return false -} - -func getValidIPv4(addrs []net.Addr) (net.IP, bool) { - for _, addr := range addrs { - var ip net.IP - - switch v := addr.(type) { - case *net.IPNet: - ip = v.IP - case *net.IPAddr: - ip = v.IP - } - - if ip == nil || ip.IsLoopback() { - continue - } - - ip = ip.To4() - if ip == nil { - // not an valid ipv4 address - continue - } - - return ip, true - } - return nil, false -} - -func isValidNetworkInterface(face net.Interface) bool { - if face.Flags&net.FlagUp == 0 { - // interface down - return false - } - - if face.Flags&net.FlagLoopback != 0 { - // loopback interface - return false - } - - if strings.Contains(strings.ToLower(face.Name), "docker") { - return false - } - - return true -} diff --git a/common/utils/net_test.go b/common/utils/net_test.go deleted file mode 100644 index d50c437f84..0000000000 --- a/common/utils/net_test.go +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package utils - -import ( - "testing" -) - -import ( - "github.com/stretchr/testify/assert" -) - -func TestGetLocalIP(t *testing.T) { - ip, err := GetLocalIP() - assert.NoError(t, err) - t.Log(ip) -} diff --git a/common/utils/strings.go b/common/utils/strings.go deleted file mode 100644 index ec5d118e91..0000000000 --- a/common/utils/strings.go +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package utils - -import ( - "regexp" -) - -func RegSplit(text string, delimeter string) []string { - reg := regexp.MustCompile(delimeter) - indexes := reg.FindAllStringIndex(text, -1) - laststart := 0 - result := make([]string, len(indexes)+1) - for i, element := range indexes { - result[i] = text[laststart:element[0]] - laststart = element[1] - } - result[len(indexes)] = text[laststart:len(text)] - return result -} diff --git a/common/utils/strings_test.go b/common/utils/strings_test.go deleted file mode 100644 index 345ffd0c25..0000000000 --- a/common/utils/strings_test.go +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package utils - -import ( - "testing" -) -import ( - "github.com/stretchr/testify/assert" -) - -func Test_RegSplit(t *testing.T) { - strings := RegSplit("dubbo://123.1.2.1;jsonrpc://127.0.0.1;registry://3.2.1.3?registry=zookeeper", "\\s*[;]+\\s*") - assert.Len(t, strings, 3) - assert.Equal(t, "dubbo://123.1.2.1", strings[0]) - assert.Equal(t, "jsonrpc://127.0.0.1", strings[1]) - assert.Equal(t, "registry://3.2.1.3?registry=zookeeper", strings[2]) -} diff --git a/config/reference_config.go b/config/reference_config.go index 26976f1ccf..c63ac2ef28 100644 --- a/config/reference_config.go +++ b/config/reference_config.go @@ -27,6 +27,7 @@ import ( import ( "github.com/creasty/defaults" + gxstrings "github.com/dubbogo/gost/strings" ) import ( @@ -35,7 +36,6 @@ import ( "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/extension" "github.com/apache/dubbo-go/common/proxy" - "github.com/apache/dubbo-go/common/utils" "github.com/apache/dubbo-go/protocol" ) @@ -92,7 +92,7 @@ func (refconfig *ReferenceConfig) Refer() { //1. user specified URL, could be peer-to-peer address, or register center's address. if refconfig.Url != "" { - urlStrings := utils.RegSplit(refconfig.Url, "\\s*[;]+\\s*") + urlStrings := gxstrings.RegSplit(refconfig.Url, "\\s*[;]+\\s*") for _, urlStr := range urlStrings { serviceUrl, err := common.NewURL(context.Background(), urlStr) if err != nil { diff --git a/config_center/configurator/override.go b/config_center/configurator/override.go index 660c6ee315..e85b4d3ec9 100644 --- a/config_center/configurator/override.go +++ b/config_center/configurator/override.go @@ -21,14 +21,14 @@ import ( ) import ( - "github.com/dubbogo/gost/container" + "github.com/dubbogo/gost/container/gxset" + gxnet "github.com/dubbogo/gost/net" ) import ( "github.com/apache/dubbo-go/common" "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/extension" - "github.com/apache/dubbo-go/common/utils" "github.com/apache/dubbo-go/config_center" ) @@ -59,7 +59,7 @@ func (c *overrideConfigurator) Configure(url *common.URL) { currentSide := url.GetParam(constant.SIDE_KEY, "") configuratorSide := c.configuratorUrl.GetParam(constant.SIDE_KEY, "") if currentSide == configuratorSide && common.DubboRole[common.CONSUMER] == currentSide && c.configuratorUrl.Port == "0" { - localIP, _ := utils.GetLocalIP() + localIP, _ := gxnet.GetLocalIP() c.configureIfMatch(localIP, url) } else if currentSide == configuratorSide && common.DubboRole[common.PROVIDER] == currentSide && c.configuratorUrl.Port == url.Port { c.configureIfMatch(url.Ip, url) @@ -78,7 +78,7 @@ func (c *overrideConfigurator) configureIfMatch(host string, url *common.URL) { configApp := c.configuratorUrl.GetParam(constant.APPLICATION_KEY, c.configuratorUrl.Username) currentApp := url.GetParam(constant.APPLICATION_KEY, url.Username) if len(configApp) == 0 || constant.ANY_VALUE == configApp || configApp == currentApp { - conditionKeys := container.NewSet() + conditionKeys := gxset.NewSet() conditionKeys.Add(constant.CATEGORY_KEY) conditionKeys.Add(constant.CHECK_KEY) conditionKeys.Add(constant.ENABLED_KEY) @@ -122,7 +122,7 @@ func (c *overrideConfigurator) configureDeprecated(url *common.URL) { // 1.If it is a consumer ip address, the intention is to control a specific consumer instance, it must takes effect at the consumer side, any provider received this override url should ignore; // 2.If the ip is 0.0.0.0, this override url can be used on consumer, and also can be used on provider if url.GetParam(constant.SIDE_KEY, "") == common.DubboRole[common.CONSUMER] { - localIP, _ := utils.GetLocalIP() + localIP, _ := gxnet.GetLocalIP() c.configureIfMatch(localIP, url) } else { c.configureIfMatch(constant.ANYHOST_VALUE, url) diff --git a/go.mod b/go.mod index 36ce955452..be1c80bd17 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f // indirect github.com/creasty/defaults v1.3.0 github.com/dubbogo/getty v1.3.0 - github.com/dubbogo/gost v1.1.1 + github.com/dubbogo/gost v1.3.0 github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239 // indirect github.com/go-errors/errors v1.0.1 // indirect github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect diff --git a/go.sum b/go.sum index f8900569b0..eb82fe7668 100644 --- a/go.sum +++ b/go.sum @@ -108,6 +108,8 @@ github.com/dubbogo/getty v1.3.0 h1:GImOCANdts7dlRqi9GMVsZJnfst9EPyjTVTR1AesOD8= github.com/dubbogo/getty v1.3.0/go.mod h1:K4b3MkGLf7T+lMgQNFgpg0dI1Wvv1PTisFs1Psf86kU= github.com/dubbogo/gost v1.1.1 h1:JCM7vx5edPIjDA5ovJTuzEEXuw2t7xLyrlgi2mi5jHI= github.com/dubbogo/gost v1.1.1/go.mod h1:R7wZm1DrmrKGr50mBZVcg6C9ekG8aL5hP+sgWcIDwQg= +github.com/dubbogo/gost v1.3.0 h1:n90mIUWCPD69BqW8wJ43NDy0RgNxx02aAG4QJcJ785U= +github.com/dubbogo/gost v1.3.0/go.mod h1:R7wZm1DrmrKGr50mBZVcg6C9ekG8aL5hP+sgWcIDwQg= github.com/duosecurity/duo_api_golang v0.0.0-20190308151101-6c680f768e74 h1:2MIhn2R6oXQbgW5yHfS+d6YqyMfXiu2L55rFZC4UD/M= github.com/duosecurity/duo_api_golang v0.0.0-20190308151101-6c680f768e74/go.mod h1:UqXY1lYT/ERa4OEAywUqdok1T4RCRdArkhic1Opuavo= github.com/elazarl/go-bindata-assetfs v0.0.0-20160803192304-e1a2a7ec64b0 h1:ZoRgc53qJCfSLimXqJDrmBhnt5GChDsExMCK7t48o0Y= diff --git a/registry/consul/utils.go b/registry/consul/utils.go index ee17fcc0df..d295f64463 100644 --- a/registry/consul/utils.go +++ b/registry/consul/utils.go @@ -26,13 +26,13 @@ import ( ) import ( + gxnet "github.com/dubbogo/gost/net" consul "github.com/hashicorp/consul/api" perrors "github.com/pkg/errors" ) import ( "github.com/apache/dubbo-go/common" - "github.com/apache/dubbo-go/common/utils" ) func buildId(url common.URL) string { @@ -48,7 +48,7 @@ func buildService(url common.URL) (*consul.AgentServiceRegistration, error) { // address if url.Ip == "" { - url.Ip, _ = utils.GetLocalIP() + url.Ip, _ = gxnet.GetLocalIP() } // port diff --git a/registry/etcdv3/registry.go b/registry/etcdv3/registry.go index bf097f0b59..4ee90969e5 100644 --- a/registry/etcdv3/registry.go +++ b/registry/etcdv3/registry.go @@ -12,6 +12,7 @@ import ( ) import ( + gxnet "github.com/dubbogo/gost/net" perrors "github.com/pkg/errors" ) @@ -20,7 +21,6 @@ import ( "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/extension" "github.com/apache/dubbo-go/common/logger" - "github.com/apache/dubbo-go/common/utils" "github.com/apache/dubbo-go/registry" "github.com/apache/dubbo-go/remoting/etcdv3" ) @@ -37,7 +37,7 @@ const ( func init() { processID = fmt.Sprintf("%d", os.Getpid()) - localIP, _ = utils.GetLocalIP() + localIP, _ = gxnet.GetLocalIP() extension.SetRegistry(Name, newETCDV3Registry) } diff --git a/registry/nacos/registry.go b/registry/nacos/registry.go index 229c6f8f0c..810a1cb05f 100644 --- a/registry/nacos/registry.go +++ b/registry/nacos/registry.go @@ -9,6 +9,7 @@ import ( ) import ( + gxnet "github.com/dubbogo/gost/net" "github.com/nacos-group/nacos-sdk-go/clients" "github.com/nacos-group/nacos-sdk-go/clients/naming_client" nacosConstant "github.com/nacos-group/nacos-sdk-go/common/constant" @@ -21,7 +22,6 @@ import ( "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/extension" "github.com/apache/dubbo-go/common/logger" - "github.com/apache/dubbo-go/common/utils" "github.com/apache/dubbo-go/registry" ) @@ -34,7 +34,7 @@ const ( ) func init() { - localIP, _ = utils.GetLocalIP() + localIP, _ = gxnet.GetLocalIP() extension.SetRegistry(constant.NACOS_KEY, newNacosRegistry) } diff --git a/registry/zookeeper/registry.go b/registry/zookeeper/registry.go index 972a4b6c5e..29ae51d44f 100644 --- a/registry/zookeeper/registry.go +++ b/registry/zookeeper/registry.go @@ -29,6 +29,7 @@ import ( ) import ( + gxnet "github.com/dubbogo/gost/net" perrors "github.com/pkg/errors" "github.com/samuel/go-zookeeper/zk" ) @@ -38,7 +39,6 @@ import ( "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/extension" "github.com/apache/dubbo-go/common/logger" - "github.com/apache/dubbo-go/common/utils" "github.com/apache/dubbo-go/registry" "github.com/apache/dubbo-go/remoting/zookeeper" ) @@ -55,7 +55,7 @@ var ( func init() { processID = fmt.Sprintf("%d", os.Getpid()) - localIP, _ = utils.GetLocalIP() + localIP, _ = gxnet.GetLocalIP() //plugins.PluggableRegistries["zookeeper"] = newZkRegistry extension.SetRegistry("zookeeper", newZkRegistry) } From 1e55739f698df0e4fed0f6ce8f3d706d1b3b5009 Mon Sep 17 00:00:00 2001 From: fangyincheng Date: Mon, 23 Sep 2019 17:48:32 +0800 Subject: [PATCH 7/7] Fix: forgotten problems --- common/url.go | 4 ++-- registry/protocol/protocol.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/url.go b/common/url.go index bf58ca188c..6e7a843c8f 100644 --- a/common/url.go +++ b/common/url.go @@ -31,7 +31,7 @@ import ( ) import ( - "github.com/dubbogo/gost/container" + "github.com/dubbogo/gost/container/gxset" "github.com/jinzhu/copier" perrors "github.com/pkg/errors" "github.com/satori/go.uuid" @@ -447,7 +447,7 @@ func (c URL) GetMethodParam(method string, key string, d string) string { return r } -func (c *URL) RemoveParams(set *container.HashSet) { +func (c *URL) RemoveParams(set *gxset.HashSet) { c.paramsLock.Lock() defer c.paramsLock.Unlock() for k := range set.Items { diff --git a/registry/protocol/protocol.go b/registry/protocol/protocol.go index c746cf8ef2..534a4b9459 100644 --- a/registry/protocol/protocol.go +++ b/registry/protocol/protocol.go @@ -23,7 +23,7 @@ import ( ) import ( - "github.com/dubbogo/gost/container" + "github.com/dubbogo/gost/container/gxset" ) import ( @@ -65,7 +65,7 @@ func init() { func getCacheKey(url *common.URL) string { newUrl := url.Clone() - delKeys := container.NewSet("dynamic", "enabled") + delKeys := gxset.NewSet("dynamic", "enabled") newUrl.RemoveParams(delKeys) return newUrl.String() }