# HG changeset patch # User Kim Alvefur # Date 1512099207 -3600 # Node ID ca7f8e60410a496611332661350e6831b125cb25 # Parent da807f4f706c024df51decaf0255daaf1be24cc4 util.ip: Add a method returning a normalized IP address diff -r da807f4f706c -r ca7f8e60410a util/ip.lua --- 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