diff --git a/api/api.go b/api/api.go index 256f0957..b457f047 100644 --- a/api/api.go +++ b/api/api.go @@ -281,13 +281,14 @@ func (a *API) GetServers(context.Context, *emptypb.Empty) (*structpb.Struct, err _, span := otel.Tracer(config.TracerName).Start(a.ctx, "Get Servers") defer span.End() - servers := make(map[string]interface{}) + servers := make(map[string]any) for name, server := range a.Servers { - servers[name] = map[string]interface{}{ + servers[name] = map[string]any{ "network": server.Network, "address": server.Address, "status": uint(server.Status), "tickInterval": server.TickInterval.Nanoseconds(), + "loadBalancer": map[string]any{"strategy": server.LoadbalancerStrategyName}, } } diff --git a/api/api_test.go b/api/api_test.go index a6717ab8..9f8253dd 100644 --- a/api/api_test.go +++ b/api/api_test.go @@ -342,11 +342,12 @@ func TestGetServers(t *testing.T) { Options: network.Option{ EnableTicker: false, }, - Proxies: []network.IProxy{proxy}, - Logger: zerolog.Logger{}, - PluginRegistry: pluginRegistry, - PluginTimeout: config.DefaultPluginTimeout, - HandshakeTimeout: config.DefaultHandshakeTimeout, + Proxies: []network.IProxy{proxy}, + Logger: zerolog.Logger{}, + PluginRegistry: pluginRegistry, + PluginTimeout: config.DefaultPluginTimeout, + HandshakeTimeout: config.DefaultHandshakeTimeout, + LoadbalancerStrategyName: config.DefaultLoadBalancerStrategy, }, ) @@ -376,6 +377,9 @@ func TestGetServers(t *testing.T) { tickInterval, ok := defaultServer["tickInterval"].(float64) assert.True(t, ok) assert.Equal(t, config.DefaultTickInterval.Nanoseconds(), int64(tickInterval)) + loadBalancer, ok := defaultServer["loadBalancer"].(map[string]interface{}) + assert.True(t, ok) + assert.Equal(t, config.DefaultLoadBalancerStrategy, loadBalancer["strategy"]) } else { t.Errorf("servers.default is not found or not a map") }