...

Package wireguard

import "edge-infra.dev/pkg/sds/remoteaccess/wireguard"
Overview
Index
Subdirectories

Overview ▾

Constants

const (
    SecretPrefix     string = "keys-"
    SecretExpires    string = "expires"
    SecretPublicKey  string = "publicKey"
    SecretPrivateKey string = "privateKey"
    SecretIPAddress  string = "ipAddress"
)

type Instance

type Instance struct {
    IPAddress  net.IP
    PublicKey  string
    PrivateKey string
}

func GetInstance

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

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 (*Instance) GetIPAddress

func (i *Instance) GetIPAddress() net.IP

func (*Instance) GetPrivateKey

func (i *Instance) GetPrivateKey() string

func (*Instance) GetPublicKey

func (i *Instance) GetPublicKey() string

func (*Instance) UpdateIPAddress

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

Subdirectories

Name Synopsis
..
client
relay
secret
store
vpn