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,

66
docker-compose.nodns.yml Normal file
View file

@ -0,0 +1,66 @@
version: "3.4"
volumes:
dnsconfig:
driver: local
services:
mongodb:
image: mongo:4.2
ports:
- "27017:27017"
container_name: mongodb
volumes:
- mongovol:/data/db
restart: always
environment:
MONGO_INITDB_ROOT_USERNAME: mongoadmin
MONGO_INITDB_ROOT_PASSWORD: mongopass
netmaker:
privileged: true
container_name: netmaker
build: netmaker
depends_on:
- mongodb
image: gravitl/netmaker:v0.3
ports:
- "8081:8081"
- "50051:50051"
volumes:
- ./:/local
- /etc/netclient:/etc/netclient
- dnsconfig:/root/config/dnsconfig
- /usr/bin/wg:/usr/bin/wg:ro
- /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket
- /run/systemd/system:/run/systemd/system
- /etc/systemd/system:/etc/systemd/system
- /sys/fs/cgroup:/sys/fs/cgroup
cap_add:
- NET_ADMIN
- SYS_MODULE
restart: always
network_mode: host
netmaker-ui:
container_name: netmaker-ui
depends_on:
- netmaker
image: gravitl/netmaker-ui:v0.3
links:
- "netmaker:api"
ports:
- "80:80"
environment:
BACKEND_URL: "http://3.236.149.180:8081"
coredns:
depends_on:
- netmaker
image: coredns/coredns
command: -conf /root/dnsconfig/Corefile
container_name: coredns
restart: always
ports:
- "53:53/udp"
volumes:
- dnsconfig:/root/dnsconfig
volumes:
mongovol: {}
dnsconfig: {}

View file

@ -34,8 +34,6 @@ services:
- /run/systemd/system:/run/systemd/system
- /etc/systemd/system:/etc/systemd/system
- /sys/fs/cgroup:/sys/fs/cgroup
environment:
MONGO_HOST: "127.0.0.1"
cap_add:
- NET_ADMIN
- SYS_MODULE

1
go.mod
View file

@ -22,6 +22,7 @@ require (
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20200609130330-bd2cb7843e1b
google.golang.org/genproto v0.0.0-20210201151548-94839c025ad4 // indirect
google.golang.org/grpc v1.35.0
google.golang.org/protobuf v1.25.0 // indirect
gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
gopkg.in/go-playground/validator.v9 v9.31.0
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c

File diff suppressed because it is too large Load diff

View file

@ -24,6 +24,7 @@ message Node {
string id = 1;
string name = 2;
string address = 3;
string address6 = 26;
int32 listenport = 4;
string publickey = 5;
string endpoint = 6;
@ -44,6 +45,7 @@ message Node {
string postchanges = 21;
string allowedips = 22;
bool islocal = 23;
bool isdualstack = 27;
bool dnsoff = 24;
string localrange = 25;
}
@ -64,6 +66,7 @@ message PeersResponse {
string publickey = 5;
string endpoint = 6;
string address = 3;
string address6 = 8;
int32 listenport = 4;
string localaddress = 7;
int32 keepalive = 13;

View file

@ -94,6 +94,7 @@ type PeersResponse struct {
PublicKey string `json:"publickey" bson:"publickey"`
Endpoint string `json:"endpoint" bson:"endpoint"`
Address string `json:"address" bson:"address"`
Address6 string `json:"address6" bson:"address6"`
LocalAddress string `json:"localaddress" bson:"localaddress"`
IsGateway bool `json:"isgateway" bson:"isgateway"`
GatewayRange string `json:"gatewayrange" bson:"gatewayrange"`