Map route into machine
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
parent
f7f472ae07
commit
bce8427423
2 changed files with 61 additions and 13 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue