implement uncloudd daemon that starts a WireGuard network without peer probing

This commit is contained in:
Pavel Sviderski committed 2024-08-26 17:09:54 +10:00
1 parent 222edb7647
commit e074b6855f
13 files changed
+347 -145

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
package network
import (
"net"
"net/netip"
)
// MachineIP returns the IP address of the machine which is the first address in the subnet.
func MachineIP(subnet netip.Prefix) netip.Addr {
return subnet.Masked().Addr().Next()
}
func prefixToIPNet(prefix netip.Prefix) net.IPNet {
return net.IPNet{
IP: prefix.Addr().AsSlice(),
Mask: net.CIDRMask(prefix.Bits(), prefix.Addr().BitLen()),
}
}