Changeset

8433:ca7f8e60410a

util.ip: Add a method returning a normalized IP address
author Kim Alvefur <zash@zash.se>
date Fri, 01 Dec 2017 04:33:27 +0100
parents 8432:da807f4f706c
children 8434:ec8f37baffaa
files util/ip.lua
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/util/ip.lua	Fri Dec 01 04:32:20 2017 +0100
+++ b/util/ip.lua	Fri Dec 01 04:33:27 2017 +0100
@@ -52,6 +52,10 @@
 	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