add uncloud machine token command to print machine token to add machine to cluster

This commit is contained in:
Pavel Sviderski
2024-09-05 16:13:27 +10:00
parent 4656bdd132
commit 945eff471b
9 changed files with 327 additions and 42 deletions
+5
View File
@@ -35,6 +35,11 @@ type PeerConfig struct {
PublicKey secret.Secret
}
func (c Config) IsConfigured() bool {
return c.Subnet != (netip.Prefix{}) && c.ManagementIP != (netip.Addr{}) &&
c.PrivateKey != nil && c.PublicKey != nil
}
func (c Config) toDeviceConfig() (wgtypes.Config, error) {
privateKey, err := wgtypes.NewKey(c.PrivateKey)
if err != nil {