mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-18 08:16:39 +00:00
Feature/dns protocol (#543)
Added DNS update protocol message Added sync to clients Update nameserver API with new fields Added default NS groups Added new dns-name flag for the management service append to peer DNS label
This commit is contained in:
@@ -136,6 +136,9 @@ components:
|
||||
ui_version:
|
||||
description: Peer's desktop UI version
|
||||
type: string
|
||||
dns_label:
|
||||
description: Peer's DNS label is the parsed peer name for domain resolution. It is used to form an FQDN by appending the account's domain to the peer label. e.g. peer-dns-label.netbird.cloud
|
||||
type: string
|
||||
required:
|
||||
- ip
|
||||
- connected
|
||||
@@ -145,6 +148,7 @@ components:
|
||||
- groups
|
||||
- ssh_enabled
|
||||
- hostname
|
||||
- dns_label
|
||||
SetupKey:
|
||||
type: object
|
||||
properties:
|
||||
@@ -480,7 +484,7 @@ components:
|
||||
path:
|
||||
description: Nameserver group field to update in form /<field>
|
||||
type: string
|
||||
enum: [ "name","description","enabled","groups","nameservers" ]
|
||||
enum: [ "name", "description", "enabled", "groups", "nameservers", "primary", "domains" ]
|
||||
required:
|
||||
- path
|
||||
|
||||
|
||||
@@ -39,10 +39,12 @@ const (
|
||||
// Defines values for NameserverGroupPatchOperationPath.
|
||||
const (
|
||||
NameserverGroupPatchOperationPathDescription NameserverGroupPatchOperationPath = "description"
|
||||
NameserverGroupPatchOperationPathDomains NameserverGroupPatchOperationPath = "domains"
|
||||
NameserverGroupPatchOperationPathEnabled NameserverGroupPatchOperationPath = "enabled"
|
||||
NameserverGroupPatchOperationPathGroups NameserverGroupPatchOperationPath = "groups"
|
||||
NameserverGroupPatchOperationPathName NameserverGroupPatchOperationPath = "name"
|
||||
NameserverGroupPatchOperationPathNameservers NameserverGroupPatchOperationPath = "nameservers"
|
||||
NameserverGroupPatchOperationPathPrimary NameserverGroupPatchOperationPath = "primary"
|
||||
)
|
||||
|
||||
// Defines values for PatchMinimumOp.
|
||||
@@ -240,6 +242,9 @@ type Peer struct {
|
||||
// Connected Peer to Management connection status
|
||||
Connected bool `json:"connected"`
|
||||
|
||||
// DnsLabel Peer's DNS label is the parsed peer name for domain resolution. It is used to form an FQDN by appending the account's domain to the peer label. e.g. peer-dns-label.netbird.cloud
|
||||
DnsLabel string `json:"dns_label"`
|
||||
|
||||
// Groups Groups that the peer belongs to
|
||||
Groups []GroupMinimum `json:"groups"`
|
||||
|
||||
|
||||
@@ -113,6 +113,8 @@ func (h *Nameservers) UpdateNameserverGroupHandler(w http.ResponseWriter, r *htt
|
||||
ID: nsGroupID,
|
||||
Name: req.Name,
|
||||
Description: req.Description,
|
||||
Primary: req.Primary,
|
||||
Domains: req.Domains,
|
||||
NameServers: nsList,
|
||||
Groups: req.Groups,
|
||||
Enabled: req.Enabled,
|
||||
@@ -168,6 +170,16 @@ func (h *Nameservers) PatchNameserverGroupHandler(w http.ResponseWriter, r *http
|
||||
Type: server.UpdateNameServerGroupDescription,
|
||||
Values: patch.Value,
|
||||
})
|
||||
case api.NameserverGroupPatchOperationPathPrimary:
|
||||
operations = append(operations, server.NameServerGroupUpdateOperation{
|
||||
Type: server.UpdateNameServerGroupPrimary,
|
||||
Values: patch.Value,
|
||||
})
|
||||
case api.NameserverGroupPatchOperationPathDomains:
|
||||
operations = append(operations, server.NameServerGroupUpdateOperation{
|
||||
Type: server.UpdateNameServerGroupDomains,
|
||||
Values: patch.Value,
|
||||
})
|
||||
case api.NameserverGroupPatchOperationPathNameservers:
|
||||
operations = append(operations, server.NameServerGroupUpdateOperation{
|
||||
Type: server.UpdateNameServerGroupNameServers,
|
||||
@@ -279,6 +291,8 @@ func toNameserverGroupResponse(serverNSGroup *nbdns.NameServerGroup) *api.Namese
|
||||
Id: serverNSGroup.ID,
|
||||
Name: serverNSGroup.Name,
|
||||
Description: serverNSGroup.Description,
|
||||
Primary: serverNSGroup.Primary,
|
||||
Domains: serverNSGroup.Domains,
|
||||
Groups: serverNSGroup.Groups,
|
||||
Nameservers: nsList,
|
||||
Enabled: serverNSGroup.Enabled,
|
||||
|
||||
@@ -172,6 +172,7 @@ func TestNameserversHandlers(t *testing.T) {
|
||||
},
|
||||
Groups: []string{"group"},
|
||||
Enabled: true,
|
||||
Primary: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -204,6 +205,7 @@ func TestNameserversHandlers(t *testing.T) {
|
||||
},
|
||||
Groups: []string{"group"},
|
||||
Enabled: true,
|
||||
Primary: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -238,6 +240,7 @@ func TestNameserversHandlers(t *testing.T) {
|
||||
Nameservers: toNameserverGroupResponse(baseExistingNSGroup).Nameservers,
|
||||
Groups: baseExistingNSGroup.Groups,
|
||||
Enabled: baseExistingNSGroup.Enabled,
|
||||
Primary: baseExistingNSGroup.Primary,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -152,5 +152,6 @@ func toPeerResponse(peer *server.Peer, account *server.Account) *api.Peer {
|
||||
Hostname: peer.Meta.Hostname,
|
||||
UserId: &peer.UserID,
|
||||
UiVersion: &peer.Meta.UIVersion,
|
||||
DnsLabel: peer.DNSLabel,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user