util/ip.lua
changeset 12935 bbae3acc6694
parent 12359 a0ff5c438e9d
child 12936 9bb044705ea1
--- a/util/ip.lua	Sun Mar 12 13:05:50 2023 +0100
+++ b/util/ip.lua	Tue Mar 14 18:23:33 2023 +0000
@@ -241,9 +241,14 @@
 	return ipA.bits:sub(1, bits) == ipB.bits:sub(1, bits);
 end
 
+local function is_ip(obj)
+	return getmetatable(obj) == ip_mt;
+end
+
 return {
 	new_ip = new_ip,
 	commonPrefixLength = commonPrefixLength,
 	parse_cidr = parse_cidr,
 	match = match,
+	is_ip = is_ip;
 };