From 89bd9404bf8577fccfc365df84760b3b715501a6 Mon Sep 17 00:00:00 2001 From: Poorunga <2744323@qq.com> Date: Thu, 26 Oct 2023 10:25:18 +0800 Subject: [PATCH] Peer ID that distinguishes agent and gateway Signed-off-by: Poorunga <2744323@qq.com> --- pkg/tunnel/module.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/tunnel/module.go b/pkg/tunnel/module.go index d78e84c19..2b4d30676 100644 --- a/pkg/tunnel/module.go +++ b/pkg/tunnel/module.go @@ -94,7 +94,11 @@ func newEdgeTunnel(c *v1alpha1.EdgeTunnelConfig) (*EdgeTunnel, error) { opts := make([]libp2p.Option, 0) // libp2p options peerSource := make(chan peer.AddrInfo, c.MaxCandidates) - privKey, err := GenerateKeyPairWithString(c.NodeName) + hostName := c.NodeName + if c.Mode == defaults.ClientMode { + hostName += "-gateway" + } + privKey, err := GenerateKeyPairWithString(hostName) if err != nil { return nil, fmt.Errorf("failed to generate private key: %w", err) }