<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://meta.wikioasis.org/wiki/Module:IPAddress?action=history&amp;feed=atom</id>
	<title>Module:IPAddress - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://meta.wikioasis.org/wiki/Module:IPAddress?action=history&amp;feed=atom"/>
	<link rel="alternate" type="text/html" href="https://meta.wikioasis.org/wiki/Module:IPAddress?action=history"/>
	<updated>2026-05-25T01:37:25Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://meta.wikioasis.org/wiki/Module:IPAddress?diff=1318&amp;oldid=prev</id>
		<title>WikiOasisGDPR1162b7f4ed1ab49381ec4a02900cb791: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://meta.wikioasis.org/wiki/Module:IPAddress?diff=1318&amp;oldid=prev"/>
		<updated>2025-04-14T03:28:10Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 03:28, 14 April 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key metawiki:diff:1.41:old-304:rev-1318 --&gt;
&lt;/table&gt;</summary>
		<author><name>WikiOasisGDPR1162b7f4ed1ab49381ec4a02900cb791</name></author>
	</entry>
	<entry>
		<id>https://meta.wikioasis.org/wiki/Module:IPAddress?diff=304&amp;oldid=prev</id>
		<title>Globe: Created page with &quot;--[=[ Functions are not &quot;local&quot;, so other modules can require this module and call them directly. We return an object with 3 small stub functions to call the real ones so that the functions can be called from templates also.  Only dotted decimal notation for IPv4 supported. Does not support dotted hexadecimal, dotted octal, or single-number formats (see IPv4#Address_representations).  Unit tests at Module:IPAddress/tests ]=]  function _isIpV6( s ) 	local dcolon,...&quot;</title>
		<link rel="alternate" type="text/html" href="https://meta.wikioasis.org/wiki/Module:IPAddress?diff=304&amp;oldid=prev"/>
		<updated>2024-10-30T11:51:20Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;--[=[ Functions are not &amp;quot;local&amp;quot;, so other modules can require this module and call them directly. We return an object with 3 small stub functions to call the real ones so that the functions can be called from templates also.  Only &lt;a href=&quot;/wiki/Dotted_decimal?action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Dotted decimal (page does not exist)&quot;&gt;dotted decimal&lt;/a&gt; notation for IPv4 supported. Does not support dotted hexadecimal, dotted octal, or single-number formats (see &lt;a href=&quot;/wiki/IPv4?action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;IPv4 (page does not exist)&quot;&gt;IPv4#Address_representations&lt;/a&gt;).  Unit tests at Module:IPAddress/tests ]=]  function _isIpV6( s ) 	local dcolon,...&amp;quot;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 11:51, 30 October 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key metawiki:diff:1.41:old-1317:rev-304 --&gt;
&lt;/table&gt;</summary>
		<author><name>Globe</name></author>
	</entry>
	<entry>
		<id>https://meta.wikioasis.org/wiki/Module:IPAddress?diff=1317&amp;oldid=prev</id>
		<title>Miraheze &gt;Agent Isai: 23 revisions imported from :metawikimedia:Module:IPAddress: Required for local usage</title>
		<link rel="alternate" type="text/html" href="https://meta.wikioasis.org/wiki/Module:IPAddress?diff=1317&amp;oldid=prev"/>
		<updated>2022-10-28T05:43:12Z</updated>

		<summary type="html">&lt;p&gt;23 revisions imported from &lt;a href=&quot;/wiki/Metawikimedia:Module:IPAddress?action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Metawikimedia:Module:IPAddress (page does not exist)&quot;&gt;metawikimedia:Module:IPAddress&lt;/a&gt;: Required for local usage&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;--[=[&lt;br /&gt;
Functions are not &amp;quot;local&amp;quot;, so other modules can require this module and call them directly.&lt;br /&gt;
We return an object with 3 small stub functions to call the real ones so that the functions&lt;br /&gt;
can be called from templates also.&lt;br /&gt;
&lt;br /&gt;
Only [[dotted decimal]] notation for IPv4 supported. Does not support&lt;br /&gt;
dotted hexadecimal, dotted octal, or single-number formats (see [[IPv4#Address_representations]]).&lt;br /&gt;
&lt;br /&gt;
Unit tests at Module:IPAddress/tests&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
function _isIpV6( s )&lt;br /&gt;
	local dcolon, groups&lt;br /&gt;
	if type( s ) ~= &amp;quot;string&amp;quot;&lt;br /&gt;
		or s:len() == 0&lt;br /&gt;
		or s:find( &amp;quot;[^:%x]&amp;quot; ) -- only colon and hex digits are legal chars&lt;br /&gt;
		or s:find( &amp;quot;^:[^:]&amp;quot; ) -- can begin or end with :: but not with single :&lt;br /&gt;
		or s:find( &amp;quot;[^:]:$&amp;quot; )&lt;br /&gt;
		or s:find( &amp;quot;:::&amp;quot; )&lt;br /&gt;
	then&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
	s, dcolon = s:gsub( &amp;quot;::&amp;quot;, &amp;quot;:&amp;quot; )&lt;br /&gt;
	if dcolon &amp;gt; 1 then return false end -- at most one ::&lt;br /&gt;
	s = s:gsub( &amp;quot;^:?&amp;quot;, &amp;quot;:&amp;quot; ) -- prepend : if needed, upper&lt;br /&gt;
	s, groups = s:gsub( &amp;quot;:%x%x?%x?%x?&amp;quot;, &amp;quot;&amp;quot; ) -- remove valid groups, and count them&lt;br /&gt;
	return ( ( dcolon == 1 and groups &amp;lt; 8 ) or ( dcolon == 0 and groups == 8 ) )&lt;br /&gt;
		and ( s:len() == 0 or ( dcolon == 1 and s == &amp;quot;:&amp;quot; ) ) -- might be one dangling : if original ended with ::&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function _isIpV4( s )&lt;br /&gt;
	local function legal( n ) return ( tonumber( n ) or 256 ) &amp;lt; 256  and not n:match(&amp;quot;^0%d&amp;quot;) end-- in lua 0 is true!&lt;br /&gt;
&lt;br /&gt;
	if type( s ) ~= &amp;quot;string&amp;quot; then return false end&lt;br /&gt;
	local p1, p2, p3, p4 = s:match( &amp;quot;^(%d+)%.(%d+)%.(%d+)%.(%d+)$&amp;quot; )&lt;br /&gt;
	return legal( p1 ) and legal( p2 ) and legal( p3 ) and legal( p4 )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function _isIp( s )&lt;br /&gt;
	return _isIpV4( s ) and &amp;quot;4&amp;quot; or _isIpV6( s ) and &amp;quot;6&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
function p.isIpV6(frame) return _isIpV6( frame.args[ 1 ] ) and &amp;quot;1&amp;quot; or &amp;quot;0&amp;quot; end&lt;br /&gt;
function p.isIpV4(frame) return _isIpV4( frame.args[ 1 ] ) and &amp;quot;1&amp;quot; or &amp;quot;0&amp;quot; end&lt;br /&gt;
function p.isIp(frame) return _isIp( frame.args[ 1 ] ) or &amp;quot;&amp;quot; end&lt;br /&gt;
&lt;br /&gt;
function p.isIpOrRange(frame)&lt;br /&gt;
	-- {{#invoke:IPAddress|isIpOrRange|x}} → &amp;#039;ip&amp;#039; (IPv4/IPv6) or &amp;#039;range&amp;#039; (CIDR IPv4/IPv6) or &amp;#039;&amp;#039; (invalid)&lt;br /&gt;
	local modip = require(&amp;#039;Module:IP&amp;#039;)&lt;br /&gt;
	local s = frame.args[1]&lt;br /&gt;
	local success, ip = pcall(modip.IPAddress.new, s)&lt;br /&gt;
	if success then&lt;br /&gt;
		return &amp;#039;ip&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	success, ip = pcall(modip.Subnet.new, s)&lt;br /&gt;
	if success then&lt;br /&gt;
		return &amp;#039;range&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	return &amp;#039;&amp;#039;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Miraheze &gt;Agent Isai</name></author>
	</entry>
</feed>