From 84da11d50e5627c84b5b85f262530d80bf107685 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 1 Dec 2017 04:33:27 +0100 Subject: util.ip: Add a method returning a normalized IP address --- util/ip.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/util/ip.lua b/util/ip.lua index 894fe2fb..7c438593 100644 --- a/util/ip.lua +++ b/util/ip.lua @@ -52,6 +52,10 @@ local function new_ip(ipStr, proto) return setmetatable({ addr = ipStr, packed = packed, proto = proto, zone = zone }, ip_mt); end +function ip_methods:normal() + return net.ntop(self.packed); +end + function ip_methods.bits(ip) return hex.to(ip.packed):upper():gsub(".", hex2bits); end -- cgit v1.2.3