mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
cfg: rename Listener to DNSListener
This commit is contained in:
committed by
Dan Christian Bogos
parent
c42198f3c2
commit
43e1630a55
@@ -545,7 +545,7 @@ func testCGRConfigReloadDNSAgent(t *testing.T) {
|
||||
}
|
||||
expAttr := &DNSAgentCfg{
|
||||
Enabled: true,
|
||||
Listeners: []Listener{
|
||||
Listeners: []DNSListener{
|
||||
{
|
||||
Address: ":2053",
|
||||
Network: "udp",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user