From 16eaf9a12918ded7a57423ba701f714a5d56b629 Mon Sep 17 00:00:00 2001 From: anonpenguin23 Date: Sat, 31 Jan 2026 13:11:26 +0200 Subject: [PATCH] Fixed olric bug --- pkg/namespace/cluster_manager.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/pkg/namespace/cluster_manager.go b/pkg/namespace/cluster_manager.go index 25eeb63..1f27000 100644 --- a/pkg/namespace/cluster_manager.go +++ b/pkg/namespace/cluster_manager.go @@ -403,10 +403,14 @@ func (cm *ClusterManager) startOlricCluster(ctx context.Context, cluster *Namesp func (cm *ClusterManager) startGatewayCluster(ctx context.Context, cluster *NamespaceCluster, nodes []NodeCapacity, portBlocks []*PortBlock, rqliteInstances []*rqlite.Instance, olricInstances []*olric.OlricInstance) ([]*gateway.GatewayInstance, error) { instances := make([]*gateway.GatewayInstance, len(nodes)) - // Build Olric server addresses + // Build Olric server addresses — use WireGuard IPs for remote instances olricServers := make([]string, len(olricInstances)) for i, inst := range olricInstances { - olricServers[i] = inst.DSN() + if nodes[i].NodeID == cm.localNodeID { + olricServers[i] = inst.DSN() // localhost for local + } else { + olricServers[i] = inst.AdvertisedDSN() // WireGuard IP for remote + } } // Start all Gateway instances @@ -477,7 +481,13 @@ func (cm *ClusterManager) spawnOlricRemote(ctx context.Context, nodeIP string, c if err != nil { return nil, err } - return &olric.OlricInstance{PID: resp.PID}, nil + return &olric.OlricInstance{ + PID: resp.PID, + HTTPPort: cfg.HTTPPort, + MemberlistPort: cfg.MemberlistPort, + BindAddr: cfg.BindAddr, + AdvertiseAddr: cfg.AdvertiseAddr, + }, nil } // spawnResponse represents the JSON response from a spawn request