summaryrefslogtreecommitdiffstats
path: root/acf2/modules/net.lua
blob: de31be908d707cf0c18c2801d946c04c7037f020 (plain)
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
--[[
Copyright (c) 2012-2013 Kaarle Ritvanen
See LICENSE file for license details
--]]

local M = require('acf2.model')

local Host = M.new()
Host.address = M.net.IPAddress{addr='ipaddr'}
Host.canonical = M.String{ui_name='Canonical name'}
Host.alias = M.Set{
   type=M.String, addr='alias/#', ui_name='Aliases', ui_member='Alias'
}

local Resolv = M.new()
Resolv.servers = M.List{type=M.net.IPAddress, addr='nameserver/#'}
Resolv['search-domains'] = M.List{type=M.String, addr='search/domain/#'}

local Net = M.new()
Net['host-name'] = M.String{addr='/augeas/etc/hostname/hostname'}
Net.hosts = M.List{type=Host, addr='/augeas/etc/hosts'}
Net.resolver = M.Model{
   model=Resolv, addr='/augeas/etc/resolv.conf', ui_name='DNS resolver'
}

M.register('net', Net, {ui_name='Network'})
M.permission.defaults('/net')