From 987e21297a0598d8a1e00aec1efb745e03a4fd00 Mon Sep 17 00:00:00 2001 From: MohammadReza Palide Date: Thu, 30 Nov 2023 17:27:43 +0000 Subject: [PATCH] add ConnectedServersPK method to dmsg client --- pkg/dmsg/client.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/dmsg/client.go b/pkg/dmsg/client.go index e23860f01..86a216ee8 100644 --- a/pkg/dmsg/client.go +++ b/pkg/dmsg/client.go @@ -472,6 +472,16 @@ func (ce *Client) AllEntries(ctx context.Context) (entries []string, err error) return entries, err } +// ConnectedServersPK return all dmsg-servers keys +func (ce *Client) ConnectedServersPK() []string { + sessions := ce.allClientSessions(ce.porter) + addrs := make([]string, len(sessions)) + for i, s := range sessions { + addrs[i] = s.RemotePK().String() + } + return addrs +} + // ConnectionsSummary associates connected clients, and the servers that connect such clients. // Key: Client PK, Value: Slice of Server PKs type ConnectionsSummary map[cipher.PubKey][]cipher.PubKey