diff --git a/config/config_it_test.go b/config/config_it_test.go index 575749dc7..7059db5dc 100644 --- a/config/config_it_test.go +++ b/config/config_it_test.go @@ -545,7 +545,7 @@ func testCGRConfigReloadDNSAgent(t *testing.T) { } expAttr := &DNSAgentCfg{ Enabled: true, - Listeners: []Listener{ + Listeners: []DNSListener{ { Address: ":2053", Network: "udp", diff --git a/config/config_test.go b/config/config_test.go index 53bfdcb66..3d2d141a7 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -1547,7 +1547,7 @@ func TestRadiusAgentConfig(t *testing.T) { func TestDNSAgentConfig(t *testing.T) { expected := &DNSAgentCfg{ Enabled: false, - Listeners: []Listener{ + Listeners: []DNSListener{ { Address: "127.0.0.1:53", Network: "udp", diff --git a/config/dns.go b/config/dns.go index fbd97c072..20d572514 100644 --- a/config/dns.go +++ b/config/dns.go @@ -25,7 +25,7 @@ import ( "github.com/cgrates/cgrates/utils" ) -type Listener struct { +type DNSListener struct { Address string Network string // udp or tcp } @@ -33,7 +33,7 @@ type Listener struct { // DNSAgentCfg the config section that describes the DNS Agent type DNSAgentCfg struct { Enabled bool - Listeners []Listener + Listeners []DNSListener SessionSConns []string StatSConns []string ThresholdSConns []string @@ -58,9 +58,9 @@ func (da *DNSAgentCfg) loadFromJSONCfg(jsnCfg *DNSAgentJsonCfg) (err error) { da.Enabled = *jsnCfg.Enabled } if jsnCfg.Listeners != nil { - da.Listeners = make([]Listener, 0, len(*jsnCfg.Listeners)) + da.Listeners = make([]DNSListener, 0, len(*jsnCfg.Listeners)) for _, listnr := range *jsnCfg.Listeners { - var ls Listener + var ls DNSListener if listnr.Address != nil { ls.Address = *listnr.Address } @@ -86,7 +86,7 @@ func (da *DNSAgentCfg) loadFromJSONCfg(jsnCfg *DNSAgentJsonCfg) (err error) { return } -func (lstn *Listener) AsMapInterface() map[string]any { +func (lstn *DNSListener) AsMapInterface() map[string]any { return map[string]any{ utils.AddressCfg: lstn.Address, utils.NetworkCfg: lstn.Network, diff --git a/config/dns_test.go b/config/dns_test.go index 3a61f507a..5a63f2dd3 100644 --- a/config/dns_test.go +++ b/config/dns_test.go @@ -53,7 +53,7 @@ func TestDNSAgentCfgloadFromJsonCfg(t *testing.T) { } expected := &DNSAgentCfg{ Enabled: true, - Listeners: []Listener{ + Listeners: []DNSListener{ { Address: "127.0.0.1:2053", Network: "udp", @@ -338,7 +338,7 @@ func TestRequestProcessorClone(t *testing.T) { func TestDNSAgentCfgClone(t *testing.T) { ban := &DNSAgentCfg{ Enabled: true, - Listeners: []Listener{ + Listeners: []DNSListener{ { Address: "127.0.0.1:2053", Network: "udp", @@ -384,7 +384,7 @@ func TestDiffDNSAgentJsonCfg(t *testing.T) { v1 := &DNSAgentCfg{ Enabled: false, - Listeners: []Listener{ + Listeners: []DNSListener{ { Address: "localhost:8080", Network: "tcp", @@ -399,7 +399,7 @@ func TestDiffDNSAgentJsonCfg(t *testing.T) { v2 := &DNSAgentCfg{ Enabled: true, - Listeners: []Listener{ + Listeners: []DNSListener{ { Address: "localhost:8037", Network: "udp", @@ -457,7 +457,7 @@ func TestDiffDNSAgentJsonCfgExtraV1(t *testing.T) { v1 := &DNSAgentCfg{ Enabled: false, - Listeners: []Listener{ + Listeners: []DNSListener{ { Address: "localhost:8080", Network: "tcp", @@ -471,7 +471,7 @@ func TestDiffDNSAgentJsonCfgExtraV1(t *testing.T) { v2 := &DNSAgentCfg{ Enabled: true, - Listeners: []Listener{ + Listeners: []DNSListener{ { Address: "localhost:8037", Network: "udp", @@ -505,7 +505,7 @@ func TestDiffDNSAgentJsonCfgExtraV2(t *testing.T) { v1 := &DNSAgentCfg{ Enabled: false, - Listeners: []Listener{ + Listeners: []DNSListener{ { Address: "localhost:8080", Network: "tcp", @@ -515,7 +515,7 @@ func TestDiffDNSAgentJsonCfgExtraV2(t *testing.T) { v2 := &DNSAgentCfg{ Enabled: true, - Listeners: []Listener{ + Listeners: []DNSListener{ { Address: "localhost:8037", Network: "udp", @@ -551,7 +551,7 @@ func TestDiffDNSAgentJsonCfgExtraV2(t *testing.T) { func TestDnsAgentCloneSection(t *testing.T) { dnsCfg := &DNSAgentCfg{ Enabled: false, - Listeners: []Listener{ + Listeners: []DNSListener{ { Address: "localhost:8080", Network: "tcp", @@ -566,7 +566,7 @@ func TestDnsAgentCloneSection(t *testing.T) { exp := &DNSAgentCfg{ Enabled: false, - Listeners: []Listener{ + Listeners: []DNSListener{ { Address: "localhost:8080", Network: "tcp",