minor config refactor and management IP

This commit is contained in:
Pavel Sviderski
2024-09-05 12:22:53 +10:00
parent 3f71aec275
commit 4656bdd132
3 changed files with 66 additions and 48 deletions
+3 -2
View File
@@ -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)