mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-28 03:53:33 +00:00
implement uncloudd daemon that starts a WireGuard network without peer probing
This commit is contained in:
@@ -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()),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user