From 4278d3ed7834b7138c38656fada1e6a14eecd77c Mon Sep 17 00:00:00 2001 From: ionutboangiu Date: Wed, 9 Jul 2025 00:50:55 +0300 Subject: [PATCH] ips: implement NavigableMapper for AllocatedIP --- utils/consts.go | 1 + utils/ips.go | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/utils/consts.go b/utils/consts.go index 0da9d6c84..431f14737 100644 --- a/utils/consts.go +++ b/utils/consts.go @@ -807,6 +807,7 @@ const ( MetaFD = "*fd" SortingData = "SortingData" ProfileID = "ProfileID" + PoolID = "PoolID" SortedRoutes = "SortedRoutes" MetaMonthly = "*monthly" MetaYearly = "*yearly" diff --git a/utils/ips.go b/utils/ips.go index b7002d221..8f6a67d5e 100644 --- a/utils/ips.go +++ b/utils/ips.go @@ -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