added ipv6 responses

This commit is contained in:
afeiszli
2021-05-06 11:41:11 +00:00
parent 9db5d43304
commit 45eb3b4466
7 changed files with 1378 additions and 755 deletions

View File

@@ -7,6 +7,7 @@ import (
nodepb "github.com/gravitl/netmaker/grpc"
"github.com/gravitl/netmaker/models"
"github.com/gravitl/netmaker/functions"
"github.com/gravitl/netmaker/servercfg"
"go.mongodb.org/mongo-driver/mongo"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
@@ -40,6 +41,7 @@ func (s *NodeServiceServer) ReadNode(ctx context.Context, req *nodepb.ReadNodeRe
Macaddress: node.MacAddress,
Name: node.Name,
Address: node.Address,
Address6: node.Address6,
Endpoint: node.Endpoint,
Password: node.Password,
Nodenetwork: node.Network,
@@ -48,6 +50,7 @@ func (s *NodeServiceServer) ReadNode(ctx context.Context, req *nodepb.ReadNodeRe
Postdown: node.PostDown,
Postup: node.PostUp,
Checkininterval: node.CheckInInterval,
Dnsoff: servercfg.IsDNSMode(),
Ispending: node.IsPending,
Publickey: node.PublicKey,
Listenport: node.ListenPort,
@@ -71,6 +74,7 @@ func (s *NodeServiceServer) CreateNode(ctx context.Context, req *nodepb.CreateNo
LocalAddress: data.GetLocaladdress(),
Name: data.GetName(),
Address: data.GetAddress(),
Address6: data.GetAddress6(),
AccessKey: data.GetAccesskey(),
Endpoint: data.GetEndpoint(),
PersistentKeepalive: data.GetKeepalive(),
@@ -132,10 +136,12 @@ func (s *NodeServiceServer) CreateNode(ctx context.Context, req *nodepb.CreateNo
Localaddress: node.LocalAddress,
Name: node.Name,
Address: node.Address,
Address6: node.Address6,
Endpoint: node.Endpoint,
Password: node.Password,
Interface: node.Interface,
Nodenetwork: node.Network,
Dnsoff: servercfg.IsDNSMode(),
Ispending: node.IsPending,
Publickey: node.PublicKey,
Listenport: node.ListenPort,
@@ -162,6 +168,7 @@ func (s *NodeServiceServer) CheckIn(ctx context.Context, req *nodepb.CheckInReq)
// ID: primitive.NilObjectID,
MacAddress: data.GetMacaddress(),
Address: data.GetAddress(),
Address6: data.GetAddress6(),
Endpoint: data.GetEndpoint(),
Network: data.GetNodenetwork(),
Password: data.GetPassword(),
@@ -207,6 +214,7 @@ func (s *NodeServiceServer) UpdateNode(ctx context.Context, req *nodepb.UpdateNo
MacAddress: data.GetMacaddress(),
Name: data.GetName(),
Address: data.GetAddress(),
Address6: data.GetAddress6(),
LocalAddress: data.GetLocaladdress(),
Endpoint: data.GetEndpoint(),
Password: data.GetPassword(),
@@ -255,6 +263,7 @@ func (s *NodeServiceServer) UpdateNode(ctx context.Context, req *nodepb.UpdateNo
Localaddress: newnode.LocalAddress,
Name: newnode.Name,
Address: newnode.Address,
Address6: newnode.Address6,
Endpoint: newnode.Endpoint,
Password: newnode.Password,
Interface: newnode.Interface,
@@ -263,6 +272,7 @@ func (s *NodeServiceServer) UpdateNode(ctx context.Context, req *nodepb.UpdateNo
Nodenetwork: newnode.Network,
Ispending: newnode.IsPending,
Publickey: newnode.PublicKey,
Dnsoff: servercfg.IsDNSMode(),
Listenport: newnode.ListenPort,
Keepalive: newnode.PersistentKeepalive,
Islocal: *network.IsLocal,
@@ -316,6 +326,7 @@ func (s *NodeServiceServer) GetPeers(req *nodepb.GetPeersReq, stream nodepb.Node
stream.Send(&nodepb.GetPeersRes{
Peers: &nodepb.PeersResponse{
Address: peers[i].Address,
Address6: peers[i].Address6,
Endpoint: peers[i].Endpoint,
Gatewayrange: peers[i].GatewayRange,
Isgateway: peers[i].IsGateway,