mirror of
https://github.com/netbirdio/netbird.git
synced 2025-06-19 00:06:58 +02:00
Allow adding 3 nameserver addresses (#1588)
This commit is contained in:
parent
0afd738509
commit
cb3408a10b
@ -904,7 +904,7 @@ components:
|
|||||||
nameservers:
|
nameservers:
|
||||||
description: Nameserver list
|
description: Nameserver list
|
||||||
minLength: 1
|
minLength: 1
|
||||||
maxLength: 2
|
maxLength: 3
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
$ref: '#/components/schemas/Nameserver'
|
$ref: '#/components/schemas/Nameserver'
|
||||||
|
@ -255,8 +255,8 @@ func validateNSGroupName(name, nsGroupID string, nsGroupMap map[string]*nbdns.Na
|
|||||||
|
|
||||||
func validateNSList(list []nbdns.NameServer) error {
|
func validateNSList(list []nbdns.NameServer) error {
|
||||||
nsListLenght := len(list)
|
nsListLenght := len(list)
|
||||||
if nsListLenght == 0 || nsListLenght > 2 {
|
if nsListLenght == 0 || nsListLenght > 3 {
|
||||||
return status.Errorf(status.InvalidArgument, "the list of nameservers should be 1 or 2, got %d", len(list))
|
return status.Errorf(status.InvalidArgument, "the list of nameservers should be 1 or 3, got %d", len(list))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@ func TestCreateNameServerGroup(t *testing.T) {
|
|||||||
shouldCreate: false,
|
shouldCreate: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Create A NS Group With More Than 2 Nameservers Should Fail",
|
name: "Create A NS Group With More Than 3 Nameservers Should Fail",
|
||||||
inputArgs: input{
|
inputArgs: input{
|
||||||
name: "super",
|
name: "super",
|
||||||
description: "super",
|
description: "super",
|
||||||
@ -238,6 +238,11 @@ func TestCreateNameServerGroup(t *testing.T) {
|
|||||||
NSType: nbdns.UDPNameServerType,
|
NSType: nbdns.UDPNameServerType,
|
||||||
Port: nbdns.DefaultDNSPort,
|
Port: nbdns.DefaultDNSPort,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
IP: netip.MustParseAddr("1.1.4.4"),
|
||||||
|
NSType: nbdns.UDPNameServerType,
|
||||||
|
Port: nbdns.DefaultDNSPort,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
enabled: true,
|
enabled: true,
|
||||||
},
|
},
|
||||||
@ -457,6 +462,11 @@ func TestSaveNameServerGroup(t *testing.T) {
|
|||||||
NSType: nbdns.UDPNameServerType,
|
NSType: nbdns.UDPNameServerType,
|
||||||
Port: nbdns.DefaultDNSPort,
|
Port: nbdns.DefaultDNSPort,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
IP: netip.MustParseAddr("1.1.4.4"),
|
||||||
|
NSType: nbdns.UDPNameServerType,
|
||||||
|
Port: nbdns.DefaultDNSPort,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
invalidID := "doesntExist"
|
invalidID := "doesntExist"
|
||||||
validName := "12345678901234567890qw"
|
validName := "12345678901234567890qw"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user