aboutsummaryrefslogtreecommitdiffstats
path: root/lua/inet/init.lua
blob: 229fbd8394f466f43e98e4252d51d7a5d5881c75 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
local core = require 'inet.core'
local set  = require 'inet.set'

local new_inet = core.new_inet

local M = {}
local mt = {}

function mt.__call(_, ...)
	return new_inet(...)
end

do
	local mixed_networks = set.new()
	mixed_networks:add(new_inet('::ffff:0:0/96')) -- RFC 5156
	mixed_networks:add(new_inet('64:ff9b::/96')) -- RFC 6052
	M.mixed_networks = mixed_networks
	core.set_mixed_networks(mixed_networks)
end

M.is4 = core.is_inet4
M.is6 = core.is_inet6
M.is  = core.is_inet

M.lpeg = core.lpeg

M.is_set = set.is_set
M.set    = set.new

-- API version
M.version = 1

return setmetatable(M, mt)