Skip to content

Commit

Permalink
cli: add wireguard status to cilium encrypt
Browse files Browse the repository at this point in the history
Fixes: #17274
Signed-off-by: Gaurav Genani <h3llix.pvt@gmail.com>
  • Loading branch information
h3llix authored and kkourt committed Oct 26, 2021
1 parent 6f1aacf commit 02012cb
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cilium/cmd/encrypt_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,9 @@ func getEncryptionMode() {
switch encryptionStatusResponse.Mode {
case models.EncryptionStatusModeIPsec:
dumpIPsecStatus()
case models.EncryptionStatusModeWireguard:
dumpWireGuardStatus(encryptionStatusResponse)
}

}

func dumpIPsecStatus() {
Expand All @@ -142,3 +143,11 @@ func dumpIPsecStatus() {
}
}
}

func dumpWireGuardStatus(p *models.EncryptionStatus) {
for _, wg := range p.Wireguard.Interfaces {
fmt.Printf("Interface: %s\n", wg.Name)
fmt.Printf("\tPublic key: %s\n", wg.PublicKey)
fmt.Printf("\tNumber of peers: %d\n", wg.PeerCount)
}
}

0 comments on commit 02012cb

Please sign in to comment.