mirror of
https://github.com/psviderski/uncloud.git
synced 2026-10-08 14:14:52 +00:00
minor config refactor and management IP
This commit is contained in:
1 parent
3f71aec275
commit
4656bdd132
3 files changed
+66
-48
No files matched your search
@@ -17,7 +17,7 @@ type Config struct {
|
||||
// Subnet is the IPv4 address range allocated to the machine. The machine's IP address is the first address
|
||||
// in the subnet. Other IP addresses are allocated to containers running on the machine.
|
||||
Subnet netip.Prefix
|
||||
// ManagementIP is the ManagementIP address assigned to the machine within the WireGuard network. This address is used
|
||||
// ManagementIP is the IPv6 address assigned to the machine within the WireGuard network. This address is used
|
||||
// for cluster management traffic, such as gRPC communication with the machine API server and Serf gossip.
|
||||
ManagementIP netip.Addr
|
||||
PrivateKey secret.Secret
|
||||
@@ -27,7 +27,7 @@ type Config struct {
|
||||
|
||||
type PeerConfig struct {
|
||||
Subnet *netip.Prefix `json:",omitempty"`
|
||||
// ManagementIP is the ManagementIP address assigned to the peer within the WireGuard network. This address is used
|
||||
// ManagementIP is the IPv6 address assigned to the peer within the WireGuard network. This address is used
|
||||
// for cluster management traffic, such as gRPC communication with the machine API server and Serf gossip.
|
||||
ManagementIP netip.Addr
|
||||
Endpoint *netip.AddrPort `json:",omitempty"`
|
||||
|
||||
@@ -12,8 +12,9 @@ func MachineIP(subnet netip.Prefix) netip.Addr {
|
||||
return subnet.Masked().Addr().Next()
|
||||
}
|
||||
|
||||
// PeerIPv6 returns the IPv6 address of a peer derived from the first 14 bytes of its public key.
|
||||
func PeerIPv6(publicKey secret.Secret) netip.Addr {
|
||||
// ManagementIP returns the IPv6 address of a peer derived from the first 14 bytes of its public key.
|
||||
// This address is intended for cluster management traffic.
|
||||
func ManagementIP(publicKey secret.Secret) netip.Addr {
|
||||
bytes := [16]byte{0xfd, 0xcc}
|
||||
copy(bytes[2:], publicKey[:14])
|
||||
return netip.AddrFrom16(bytes)
|
||||
|
||||
Reference in new issue
Block a user