From b4a236c0231b69daee24fa840c8e9f8329eace89 Mon Sep 17 00:00:00 2001 From: Lichas Date: Wed, 18 Oct 2023 11:22:41 +0800 Subject: [PATCH 1/3] client: remove internal info --- client/config_test.go | 18 +++++++++--------- client/options.go | 6 +++--- client/options_test.go | 4 ++-- naming/selector/selector.go | 2 +- testdata/client.yaml | 12 ++++++------ testdata/trpc_go_error.yaml | 10 +--------- 6 files changed, 22 insertions(+), 30 deletions(-) diff --git a/client/config_test.go b/client/config_test.go index 6a026ea..10870d3 100644 --- a/client/config_test.go +++ b/client/config_test.go @@ -42,8 +42,8 @@ func TestConfigOptions(t *testing.T) { assert.Equal(t, "udp", transportOpts.Network) assert.Equal(t, trpc.DefaultClientCodec, clientOpts.Codec) - filter.Register("tjg", filter.NoopServerFilter, filter.NoopClientFilter) - filter.Register("m007", filter.NoopServerFilter, filter.NoopClientFilter) + filter.Register("Monitoring", filter.NoopServerFilter, filter.NoopClientFilter) + filter.Register("Authentication", filter.NoopServerFilter, filter.NoopClientFilter) } func TestConfigNoDiscovery(t *testing.T) { @@ -54,7 +54,7 @@ func TestConfigNoDiscovery(t *testing.T) { Network: "tcp", Timeout: 1000, Protocol: "trpc", - Filter: []string{"tjg", "m007"}, + Filter: []string{"Monitoring", "Authentication"}, } err := client.RegisterClientConfig("trpc.test.nodiscovery", backconfig) assert.NotNil(t, err) @@ -68,7 +68,7 @@ func TestConfigNoServiceRouter(t *testing.T) { Network: "tcp", Timeout: 1000, Protocol: "trpc", - Filter: []string{"tjg", "m007"}, + Filter: []string{"Monitoring", "Authentication"}, } err := client.RegisterClientConfig("trpc.test.noservicerouter", backconfig) assert.NotNil(t, err) @@ -82,7 +82,7 @@ func TestConfigNoBalance(t *testing.T) { Network: "tcp", Timeout: 1000, Protocol: "trpc", - Filter: []string{"tjg", "m007"}, + Filter: []string{"Monitoring", "Authentication"}, } err := client.RegisterClientConfig("trpc.test.nobalance", backconfig) assert.NotNil(t, err) @@ -150,7 +150,7 @@ func TestConfigNoBreaker(t *testing.T) { Network: "tcp", Timeout: 1000, Protocol: "trpc", - Filter: []string{"tjg", "m007"}, + Filter: []string{"Monitoring", "Authentication"}, } err := client.RegisterClientConfig("trpc.test.nobreaker", backconfig) assert.NotNil(t, err) @@ -163,7 +163,7 @@ func TestConfigNoFilter(t *testing.T) { Network: "tcp", Timeout: 1000, Protocol: "trpc", - Filter: []string{"tjg", "no-exists"}, + Filter: []string{"Monitoring", "no-exists"}, } err := client.RegisterClientConfig("trpc.test.nofilter", backconfig) assert.NotNil(t, err) @@ -176,9 +176,9 @@ func TestConfigFilter(t *testing.T) { Network: "tcp", Timeout: 1000, Protocol: "trpc", - Filter: []string{"tjg"}, + Filter: []string{"Monitoring"}, } - filter.Register("tjg", nil, filter.NoopClientFilter) + filter.Register("Monitoring", nil, filter.NoopClientFilter) err := client.RegisterClientConfig("trpc.test.filter", backconfig) assert.Nil(t, err) } diff --git a/client/options.go b/client/options.go index ae531b7..77f2b2c 100644 --- a/client/options.go +++ b/client/options.go @@ -34,7 +34,7 @@ type Options struct { Timeout time.Duration // Timeout. // Target is address of backend service: name://endpoint, - // also compatible with old addressing like cl5://sid cmlb://appid ip://ip:port + // also compatible with old addressing like ip://ip:port Target string endpoint string // The same as service name if target is not set. @@ -260,8 +260,8 @@ func WithReplicas(r int) Option { } } -// WithTarget returns an Option that sets target address with scheme name://endpoint, -// like cl5://sid ons://zkname ip://ip:port. +// WithTarget returns an Option that sets target address using schema_name://endpoint . +// e.g. ip://ip_addr:port func WithTarget(t string) Option { return func(o *Options) { o.Target = t diff --git a/client/options_test.go b/client/options_test.go index 60f0cb7..234cc71 100644 --- a/client/options_test.go +++ b/client/options_test.go @@ -169,9 +169,9 @@ func TestOptions(t *testing.T) { require.Equal(t, "trpc.test.helloworld", opts.ServiceName) // WithTarget sets target address - o = client.WithTarget("cl5://111:222") + o = client.WithTarget("ip://0.0.0.0:8080") o(opts) - require.Equal(t, "cl5://111:222", opts.Target) + require.Equal(t, "ip://0.0.0.0:8080", opts.Target) // WithNetwork sets network of backend service: tcp or udp, tcp by default o = client.WithNetwork("tcp") diff --git a/naming/selector/selector.go b/naming/selector/selector.go index 3caad38..28bddca 100644 --- a/naming/selector/selector.go +++ b/naming/selector/selector.go @@ -25,7 +25,7 @@ var ( selectors = make(map[string]Selector) ) -// Register registers a named Selector, such as l5, cmlb and tseer. +// Register registers a named Selector func Register(name string, s Selector) { selectors[name] = s } diff --git a/testdata/client.yaml b/testdata/client.yaml index 47fe170..9a33422 100644 --- a/testdata/client.yaml +++ b/testdata/client.yaml @@ -1,8 +1,8 @@ Test.HelloServer: - Network: tcp # network. - Target: cl5://4234234:32423424 # cl5 target. - Timeout: 3 # ms. + Network: tcp # network protocol. + Target: ip://127.0.0.1:8080 + Timeout: 3 # time unit: ms Test.HelloServer2: - Network: tcp # network. - Target: cl5://4234234:32423424 # cl5 target. - Timeout: 5 # ms. + Network: tcp # network protocol. + Target: ip://127.0.0.1:8081 + Timeout: 5 # time unit: ms. diff --git a/testdata/trpc_go_error.yaml b/testdata/trpc_go_error.yaml index 5042a7b..5d4b9a6 100644 --- a/testdata/trpc_go_error.yaml +++ b/testdata/trpc_go_error.yaml @@ -45,7 +45,7 @@ client: # configuration for client ca - name: trpc.test.helloworld.Greeter2 # backend service name. namespace: Production # backend service environment. network: tcp # backend service network type, tcp or udp, configuration takes precedence. - target: cl5://11111:222222 # the specific address of the backend service, generally not configures, compatible with the old routing method, (ip://127.0.0.1:8080, cl5://modid:cmdid, cmlb://appid). + target: ip://127.0.0.1:8080 # the specific address of the backend service, generally not configures, compatible with the old routing method, (e.g. ip://127.0.0.1:8080). protocol: http # application layer protocol, trpc or http. timeout: 2000 # maximum request processing time in milliseconds. @@ -76,9 +76,6 @@ plugins: # plugins configurations. curcuitbreaker: # circuit breaker configuration of polaris overall api. name: rate # circuit breaker strategy of polaris overall api. address_list: ${polaris_address_list} # name service remote address list. - cmlb: # configuration for cmlb name service. - refresh_interval: 10000 # sync refresh time. - agent_address: ${cmlb_agent_address} # local agent address. discovery: # service discovery configuration. polaris: # configuration for polaris service discovery. @@ -118,8 +115,3 @@ plugins: # plugins configurations. param: 1 reporter: localAgentHostPort: localhost:6831 - tjg: # tpstelemetry. - agent: localhost:4534 - sample_rate: 1000 # sampling rate. - min_speed_rate: 100 # minimum speed rate. - max_speed_rate: 1000 # maximum speed rate. From 8f624f968fec3b482215a8c71d2d4b2141a13ad7 Mon Sep 17 00:00:00 2001 From: Lichas Date: Wed, 18 Oct 2023 11:28:52 +0800 Subject: [PATCH 2/3] client: remove internal info --- client/options.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/options.go b/client/options.go index 77f2b2c..53a5a8d 100644 --- a/client/options.go +++ b/client/options.go @@ -260,7 +260,7 @@ func WithReplicas(r int) Option { } } -// WithTarget returns an Option that sets target address using schema_name://endpoint . +// WithTarget returns an Option that sets target address using URI scheme://endpoint. // e.g. ip://ip_addr:port func WithTarget(t string) Option { return func(o *Options) { From b12785f795f76b51fb3e5f53ed7b6c75af968d8d Mon Sep 17 00:00:00 2001 From: Lichas Date: Wed, 18 Oct 2023 11:35:38 +0800 Subject: [PATCH 3/3] client: remove internal info --- naming/selector/selector.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/naming/selector/selector.go b/naming/selector/selector.go index 28bddca..3c15c2a 100644 --- a/naming/selector/selector.go +++ b/naming/selector/selector.go @@ -25,7 +25,7 @@ var ( selectors = make(map[string]Selector) ) -// Register registers a named Selector +// Register registers a named Selector. func Register(name string, s Selector) { selectors[name] = s }