const ( SecretPrefix string = "keys-" SecretExpires string = "expires" SecretPublicKey string = "publicKey" SecretPrivateKey string = "privateKey" SecretIPAddress string = "ipAddress" )
type Instance struct { IPAddress net.IP PublicKey string PrivateKey string }
func GetInstance(ctx context.Context, c client.Client, name, clusterEdgeID string, vpnConfig *v1vpnconfig.VPNConfig) (*Instance, error)
Checks for existing wireguard instance secret If no secret exists or has expired, create new instance, marshal to json, save as K8s secret, return instance If secret exists, unmarshal secret and return instance
func New(ctx context.Context, c client.Client, name, clusterEdgeID string, vpnConfig *v1vpnconfig.VPNConfig) (*Instance, error)
Create a new wireguard instance and K8s secret
func (i *Instance) GetIPAddress() net.IP
func (i *Instance) GetPrivateKey() string
func (i *Instance) GetPublicKey() string
func (i *Instance) UpdateIPAddress(ctx context.Context, c client.Client, name, clusterEdgeID string, ip net.IP) error
Upon updating the IP address we update the K8s secret