Merge pull request #71 from tim-beatham/66-ipv6-address-not-conforming-to-spec

66 ipv6 address not conforming to spec
This commit is contained in:
Tim Beatham 2023-12-30 22:26:53 +00:00 committed by GitHub
commit c29eb197f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 6 deletions

View File

@ -34,7 +34,7 @@ func NewCtrlServer(params *NewCtrlServerParams) (*MeshCtrlServer, error) {
nodeFactory := &crdt.MeshNodeFactory{ nodeFactory := &crdt.MeshNodeFactory{
Config: *params.Conf, Config: *params.Conf,
} }
idGenerator := &lib.IDNameGenerator{} idGenerator := &lib.ShortIDGenerator{}
ipAllocator := &ip.ULABuilder{} ipAllocator := &ip.ULABuilder{}
interfaceManipulator := wg.NewWgInterfaceManipulator(params.Client) interfaceManipulator := wg.NewWgInterfaceManipulator(params.Client)
@ -89,7 +89,6 @@ func NewCtrlServer(params *NewCtrlServerParams) (*MeshCtrlServer, error) {
return ctrlServer, nil return ctrlServer, nil
} }
func (s *MeshCtrlServer) GetConfiguration() *conf.DaemonConfiguration { func (s *MeshCtrlServer) GetConfiguration() *conf.DaemonConfiguration {
return s.Conf return s.Conf
} }

View File

@ -3,6 +3,7 @@ package lib
import ( import (
"github.com/anandvarma/namegen" "github.com/anandvarma/namegen"
"github.com/google/uuid" "github.com/google/uuid"
"github.com/lithammer/shortuuid"
) )
// IdGenerator generates unique ids // IdGenerator generates unique ids
@ -19,6 +20,14 @@ func (g *UUIDGenerator) GetId() (string, error) {
return id.String(), nil return id.String(), nil
} }
type ShortIDGenerator struct {
}
func (g *ShortIDGenerator) GetId() (string, error) {
id := shortuuid.New()
return id, nil
}
type IDNameGenerator struct { type IDNameGenerator struct {
} }

View File

@ -4,6 +4,7 @@ import (
"fmt" "fmt"
"io" "io"
"math/rand" "math/rand"
"sync"
"time" "time"
"github.com/tim-beatham/wgmesh/pkg/conf" "github.com/tim-beatham/wgmesh/pkg/conf"
@ -169,7 +170,14 @@ func (s *SyncerImpl) Pull(self mesh.MeshNode, mesh mesh.MeshProvider) error {
// SyncMeshes: Sync all meshes // SyncMeshes: Sync all meshes
func (s *SyncerImpl) SyncMeshes() error { func (s *SyncerImpl) SyncMeshes() error {
var wg sync.WaitGroup
for _, mesh := range s.manager.GetMeshes() { for _, mesh := range s.manager.GetMeshes() {
wg.Add(1)
sync := func() {
defer wg.Done()
err := s.Sync(mesh) err := s.Sync(mesh)
if err != nil { if err != nil {
@ -177,6 +185,9 @@ func (s *SyncerImpl) SyncMeshes() error {
} }
} }
go sync()
}
logging.Log.WriteInfof("updating the WireGuard configuration") logging.Log.WriteInfof("updating the WireGuard configuration")
err := s.manager.ApplyConfig() err := s.manager.ApplyConfig()