Comparison

util/ip.lua @ 12355:a0ff5c438e9d

util.hex: Deprecate to/from in favour of encode/decode, for consistency!
author Matthew Wild <mwild1@gmail.com>
date Fri, 04 Mar 2022 15:22:45 +0000
parent 11650:a227bc35771e
child 12931:bbae3acc6694
comparison
equal deleted inserted replaced
12354:3ce3633527af 12355:a0ff5c438e9d
65 function ip_methods:normal() 65 function ip_methods:normal()
66 return net.ntop(self.packed); 66 return net.ntop(self.packed);
67 end 67 end
68 68
69 function ip_methods.bits(ip) 69 function ip_methods.bits(ip)
70 return hex.to(ip.packed):upper():gsub(".", hex2bits); 70 return hex.encode(ip.packed):upper():gsub(".", hex2bits);
71 end 71 end
72 72
73 function ip_methods.bits_full(ip) 73 function ip_methods.bits_full(ip)
74 if ip.proto == "IPv4" then 74 if ip.proto == "IPv4" then
75 ip = ip.toV4mapped; 75 ip = ip.toV4mapped;