mirror of
https://github.com/juanfont/headscale.git
synced 2025-08-12 04:57:36 +00:00
Map route into machine
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:

committed by
Kristoffer Dalby

parent
f7f472ae07
commit
bce8427423
@@ -59,6 +59,8 @@ type Machine struct {
|
||||
HostInfo HostInfo
|
||||
Endpoints StringList
|
||||
|
||||
Routes []Route
|
||||
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
DeletedAt *time.Time
|
||||
@@ -80,6 +82,16 @@ func (ma MachineAddresses) ToStringSlice() []string {
|
||||
return strSlice
|
||||
}
|
||||
|
||||
func (ma MachineAddresses) Prefixes() []netip.Prefix {
|
||||
addrs := []netip.Prefix{}
|
||||
for _, machineAddress := range ma {
|
||||
ip := netip.PrefixFrom(machineAddress, machineAddress.BitLen())
|
||||
addrs = append(addrs, ip)
|
||||
}
|
||||
|
||||
return addrs
|
||||
}
|
||||
|
||||
// AppendToIPSet adds the individual ips in MachineAddresses to a
|
||||
// given netipx.IPSetBuilder.
|
||||
func (ma MachineAddresses) AppendToIPSet(build *netipx.IPSetBuilder) {
|
||||
|
Reference in New Issue
Block a user