mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 11:03:34 +00:00
watch for peer endpoint changes and preserve in machine state
This commit is contained in:
@@ -3,6 +3,7 @@ package network
|
||||
import (
|
||||
"fmt"
|
||||
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
|
||||
"net/netip"
|
||||
"time"
|
||||
"uncloud/internal/secret"
|
||||
)
|
||||
@@ -14,6 +15,12 @@ const (
|
||||
WireGuardKeepaliveInterval = 25 * time.Second
|
||||
)
|
||||
|
||||
type EndpointChangeEvent struct {
|
||||
PublicKey secret.Secret
|
||||
// Endpoint is the new endpoint of the peer.
|
||||
Endpoint netip.AddrPort
|
||||
}
|
||||
|
||||
// NewMachineKeys generates a new WireGuard private and public key pair.
|
||||
func NewMachineKeys() (privKey, pubKey secret.Secret, err error) {
|
||||
wgPrivKey, err := wgtypes.GeneratePrivateKey()
|
||||
|
||||
Reference in New Issue
Block a user