Skip to content

Commit

Permalink
Merge pull request #243 from mrpalide/feat/add-method-to-direct-dmsgh…
Browse files Browse the repository at this point in the history
…ttp-to-return-connected-dmsg-servers-list

add ConnectedServersPK method
  • Loading branch information
mrpalide authored Nov 30, 2023
2 parents 0b6d513 + d378e36 commit 65d707c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/dmsg/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,16 @@ func (ce *Client) AllEntries(ctx context.Context) (entries []string, err error)
return entries, err
}

// ConnectedServersPK return keys of all connected dmsg servers
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
Expand Down

0 comments on commit 65d707c

Please sign in to comment.