ips: implement NavigableMapper for AllocatedIP

This commit is contained in:
ionutboangiu
2025-07-09 00:50:55 +03:00
committed by Dan Christian Bogos
parent 97969bb707
commit 4278d3ed78
2 changed files with 11 additions and 0 deletions

View File

@@ -807,6 +807,7 @@ const (
MetaFD = "*fd"
SortingData = "SortingData"
ProfileID = "ProfileID"
PoolID = "PoolID"
SortedRoutes = "SortedRoutes"
MetaMonthly = "*monthly"
MetaYearly = "*yearly"

View File

@@ -387,6 +387,16 @@ type AllocatedIP struct {
Address netip.Addr
}
// AsNavigableMap implements engine.NavigableMapper.
func (ip *AllocatedIP) AsNavigableMap() map[string]*DataNode {
return map[string]*DataNode{
ProfileID: NewLeafNode(ip.ProfileID),
PoolID: NewLeafNode(ip.PoolID),
Message: NewLeafNode(ip.Message),
Address: NewLeafNode(ip.Address.String()),
}
}
// IPAllocations represents IP allocations with usage tracking and TTL management.
type IPAllocations struct {
Tenant string