From: Jo-Philipp Wich Date: Tue, 20 Aug 2019 13:41:41 +0000 (+0200) Subject: protocols: drop server side cbi implementations of protocol handlers X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=06f4feca1da3ca66e8dbb9d55aa2fa1de3172b94;p=oweals%2Fluci.git protocols: drop server side cbi implementations of protocol handlers Signed-off-by: Jo-Philipp Wich --- diff --git a/modules/luci-base/luasrc/model/cbi/admin_network/proto_dhcp.lua b/modules/luci-base/luasrc/model/cbi/admin_network/proto_dhcp.lua deleted file mode 100644 index 6e04465ac..000000000 --- a/modules/luci-base/luasrc/model/cbi/admin_network/proto_dhcp.lua +++ /dev/null @@ -1,68 +0,0 @@ --- Copyright 2011-2012 Jo-Philipp Wich --- Licensed to the public under the Apache License 2.0. - -local map, section, net = ... -local ifc = net:get_interface() - -local hostname, accept_ra, send_rs -local bcast, defaultroute, peerdns, dns, metric, clientid, vendorclass - - -hostname = section:taboption("general", Value, "hostname", - translate("Hostname to send when requesting DHCP")) - -hostname.placeholder = luci.sys.hostname() -hostname.datatype = "hostname" - - -bcast = section:taboption("advanced", Flag, "broadcast", - translate("Use broadcast flag"), - translate("Required for certain ISPs, e.g. Charter with DOCSIS 3")) - -bcast.default = bcast.disabled - - -defaultroute = section:taboption("advanced", Flag, "defaultroute", - translate("Use default gateway"), - translate("If unchecked, no default route is configured")) - -defaultroute.default = defaultroute.enabled - - -peerdns = section:taboption("advanced", Flag, "peerdns", - translate("Use DNS servers advertised by peer"), - translate("If unchecked, the advertised DNS server addresses are ignored")) - -peerdns.default = peerdns.enabled - - -dns = section:taboption("advanced", DynamicList, "dns", - translate("Use custom DNS servers")) - -dns:depends("peerdns", "") -dns.datatype = "ipaddr" -dns.cast = "string" - - -metric = section:taboption("advanced", Value, "metric", - translate("Use gateway metric")) - -metric.placeholder = "0" -metric.datatype = "uinteger" - - -clientid = section:taboption("advanced", Value, "clientid", - translate("Client ID to send when requesting DHCP")) -clientid.datatype = "hexstring" - - -vendorclass = section:taboption("advanced", Value, "vendorid", - translate("Vendor Class to send when requesting DHCP")) - - -luci.tools.proto.opt_macaddr(section, ifc, translate("Override MAC address")) - - -mtu = section:taboption("advanced", Value, "mtu", translate("Override MTU")) -mtu.placeholder = "1500" -mtu.datatype = "max(9200)" diff --git a/modules/luci-base/luasrc/model/cbi/admin_network/proto_none.lua b/modules/luci-base/luasrc/model/cbi/admin_network/proto_none.lua deleted file mode 100644 index 6fdded9ad..000000000 --- a/modules/luci-base/luasrc/model/cbi/admin_network/proto_none.lua +++ /dev/null @@ -1,4 +0,0 @@ --- Copyright 2011 Jo-Philipp Wich --- Licensed to the public under the Apache License 2.0. - -local map, section, net = ... diff --git a/modules/luci-base/luasrc/model/cbi/admin_network/proto_static.lua b/modules/luci-base/luasrc/model/cbi/admin_network/proto_static.lua deleted file mode 100644 index 246d2c0ed..000000000 --- a/modules/luci-base/luasrc/model/cbi/admin_network/proto_static.lua +++ /dev/null @@ -1,167 +0,0 @@ --- Copyright 2011 Jo-Philipp Wich --- Licensed to the public under the Apache License 2.0. - -local map, section, net = ... -local ifc = net:get_interface() - -local netmask, gateway, broadcast, dns, accept_ra, send_rs, ip6addr, ip6gw -local mtu, metric, usecidr, ipaddr_single, ipaddr_multi - - -local function is_cidr(s) - return (type(s) == "string" and luci.ip.IPv4(s) and s:find("/")) -end - -usecidr = section:taboption("general", Value, "ipaddr_usecidr") -usecidr.forcewrite = true - -usecidr.cfgvalue = function(self, section) - local cfgvalue = self.map:get(section, "ipaddr") - return (type(cfgvalue) == "table" or is_cidr(cfgvalue)) and "1" or "0" -end - -usecidr.render = function(self, section, scope) - luci.template.Template(nil, [[ - /> - ]]):render({ - cbid = self:cbid(section), - value = self:cfgvalue(section) - }) -end - -usecidr.write = function(self, section) - local cfgvalue = self.map:get(section, "ipaddr") - local formvalue = (self:formvalue(section) == "1") and ipaddr_multi:formvalue(section) or ipaddr_single:formvalue(section) - local equal = (cfgvalue == formvalue) - - if not equal and type(cfgvalue) == "table" and type(formvalue) == "table" and #cfgvalue == #formvalue then - equal = true - - local _, v - for _, v in ipairs(cfgvalue) do - if v ~= formvalue[_] then - equal = false - break - end - end - end - - if not equal then - self.map:set(section, "ipaddr", formvalue or "") - end - - return not equal -end - - -ipaddr_multi = section:taboption("general", DynamicList, "ipaddrs", translate("IPv4 address")) -ipaddr_multi:depends("ipaddr_usecidr", "1") -ipaddr_multi.datatype = "or(cidr4,ipnet4)" -ipaddr_multi.placeholder = translate("Add IPv4 address…") - -ipaddr_multi.alias = "ipaddr" -ipaddr_multi.write = function() end -ipaddr_multi.remove = function() end -ipaddr_multi.cfgvalue = function(self, section) - local addr = self.map:get(section, "ipaddr") - local mask = self.map:get(section, "netmask") - - if is_cidr(addr) then - return { addr } - elseif type(addr) == "string" and - type(mask) == "string" and - #addr > 0 and #mask > 0 - then - return { "%s/%s" %{ addr, mask } } - elseif type(addr) == "table" then - return addr - else - return {} - end -end - - -ipaddr_single = section:taboption("general", Value, "ipaddr", translate("IPv4 address")) -ipaddr_single:depends("ipaddr_usecidr", "0") -ipaddr_single.datatype = "ip4addr" -ipaddr_single.template = "cbi/ipaddr" -ipaddr_single.write = function() end -ipaddr_single.remove = function() end - - -netmask = section:taboption("general", Value, "netmask", translate("IPv4 netmask")) -netmask:depends("ipaddr_usecidr", "0") -netmask.datatype = "ip4addr" -netmask:value("255.255.255.0") -netmask:value("255.255.0.0") -netmask:value("255.0.0.0") - - -gateway = section:taboption("general", Value, "gateway", translate("IPv4 gateway")) -gateway.datatype = "ip4addr" - - -broadcast = section:taboption("general", Value, "broadcast", translate("IPv4 broadcast")) -broadcast.datatype = "ip4addr" - - -dns = section:taboption("general", DynamicList, "dns", - translate("Use custom DNS servers")) - -dns.datatype = "ipaddr" -dns.cast = "string" - - -if luci.model.network:has_ipv6() then - - local ip6assign = section:taboption("general", Value, "ip6assign", translate("IPv6 assignment length"), - translate("Assign a part of given length of every public IPv6-prefix to this interface")) - ip6assign:value("", translate("disabled")) - ip6assign:value("64") - ip6assign.datatype = "max(64)" - - local ip6hint = section:taboption("general", Value, "ip6hint", translate("IPv6 assignment hint"), - translate("Assign prefix parts using this hexadecimal subprefix ID for this interface.")) - for i=33,64 do ip6hint:depends("ip6assign", i) end - - ip6addr = section:taboption("general", DynamicList, "ip6addr", translate("IPv6 address")) - ip6addr.datatype = "ip6addr" - ip6addr.placeholder = translate("Add IPv6 address…") - ip6addr:depends("ip6assign", "") - - - ip6gw = section:taboption("general", Value, "ip6gw", translate("IPv6 gateway")) - ip6gw.datatype = "ip6addr" - ip6gw:depends("ip6assign", "") - - - local ip6prefix = s:taboption("general", Value, "ip6prefix", translate("IPv6 routed prefix"), - translate("Public prefix routed to this device for distribution to clients.")) - ip6prefix.datatype = "ip6addr" - ip6prefix:depends("ip6assign", "") - - local ip6ifaceid = s:taboption("general", Value, "ip6ifaceid", translate("IPv6 suffix"), - translate("Optional. Allowed values: 'eui64', 'random', fixed value like '::1' " .. - "or '::1:2'. When IPv6 prefix (like 'a:b:c:d::') is received from a " .. - "delegating server, use the suffix (like '::1') to form the IPv6 address " .. - "('a:b:c:d::1') for the interface.")) - ip6ifaceid.datatype = "ip6hostid" - ip6ifaceid.placeholder = "::1" - ip6ifaceid.rmempty = true - -end - - -luci.tools.proto.opt_macaddr(section, ifc, translate("Override MAC address")) - - -mtu = section:taboption("advanced", Value, "mtu", translate("Override MTU")) -mtu.placeholder = "1500" -mtu.datatype = "max(9200)" - - -metric = section:taboption("advanced", Value, "metric", - translate("Use gateway metric")) - -metric.placeholder = "0" -metric.datatype = "uinteger" diff --git a/protocols/luci-proto-3g/luasrc/model/cbi/admin_network/proto_3g.lua b/protocols/luci-proto-3g/luasrc/model/cbi/admin_network/proto_3g.lua deleted file mode 100644 index 85c5cd604..000000000 --- a/protocols/luci-proto-3g/luasrc/model/cbi/admin_network/proto_3g.lua +++ /dev/null @@ -1,149 +0,0 @@ --- Copyright 2011 Jo-Philipp Wich --- Licensed to the public under the Apache License 2.0. - -local map, section, net = ... - -local device, apn, service, pincode, username, password, dialnumber -local ipv6, delay, defaultroute, metric, peerdns, dns, - keepalive_failure, keepalive_interval, demand - - -device = section:taboption("general", Value, "device", translate("Modem device")) -device.rmempty = false - -local device_suggestions = nixio.fs.glob("/dev/tty[A-Z]*") - or nixio.fs.glob("/dev/tts/*") - -if device_suggestions then - local node - for node in device_suggestions do - device:value(node) - end -end - - -service = section:taboption("general", Value, "service", translate("Service Type")) -service:value("", translate("-- Please choose --")) -service:value("umts", "UMTS/GPRS") -service:value("umts_only", translate("UMTS only")) -service:value("gprs_only", translate("GPRS only")) -service:value("evdo", "CDMA/EV-DO") - - -apn = section:taboption("general", Value, "apn", translate("APN")) - - -pincode = section:taboption("general", Value, "pincode", translate("PIN")) - - -username = section:taboption("general", Value, "username", translate("PAP/CHAP username")) - - -password = section:taboption("general", Value, "password", translate("PAP/CHAP password")) -password.password = true - -dialnumber = section:taboption("general", Value, "dialnumber", translate("Dial number")) -dialnumber.placeholder = "*99***1#" - -if luci.model.network:has_ipv6() then - - ipv6 = section:taboption("advanced", ListValue, "ipv6", - translate("Obtain IPv6-Address")) - - ipv6:value("auto", translate("Automatic")) - ipv6:value("0", translate("Disabled")) - ipv6:value("1", translate("Manual")) - ipv6.default = "auto" - -end - - -delay = section:taboption("advanced", Value, "delay", - translate("Modem init timeout"), - translate("Maximum amount of seconds to wait for the modem to become ready")) - -delay.placeholder = "10" -delay.datatype = "min(1)" - - -defaultroute = section:taboption("advanced", Flag, "defaultroute", - translate("Use default gateway"), - translate("If unchecked, no default route is configured")) - -defaultroute.default = defaultroute.enabled - - -metric = section:taboption("advanced", Value, "metric", - translate("Use gateway metric")) - -metric.placeholder = "0" -metric.datatype = "uinteger" -metric:depends("defaultroute", defaultroute.enabled) - - -peerdns = section:taboption("advanced", Flag, "peerdns", - translate("Use DNS servers advertised by peer"), - translate("If unchecked, the advertised DNS server addresses are ignored")) - -peerdns.default = peerdns.enabled - - -dns = section:taboption("advanced", DynamicList, "dns", - translate("Use custom DNS servers")) - -dns:depends("peerdns", "") -dns.datatype = "ipaddr" -dns.cast = "string" - - -keepalive_failure = section:taboption("advanced", Value, "_keepalive_failure", - translate("LCP echo failure threshold"), - translate("Presume peer to be dead after given amount of LCP echo failures, use 0 to ignore failures")) - -function keepalive_failure.cfgvalue(self, section) - local v = m:get(section, "keepalive") - if v and #v > 0 then - return tonumber(v:match("^(%d+)[ ,]+%d+") or v) - end -end - -function keepalive_failure.write() end -function keepalive_failure.remove() end - -keepalive_failure.placeholder = "0" -keepalive_failure.datatype = "uinteger" - - -keepalive_interval = section:taboption("advanced", Value, "_keepalive_interval", - translate("LCP echo interval"), - translate("Send LCP echo requests at the given interval in seconds, only effective in conjunction with failure threshold")) - -function keepalive_interval.cfgvalue(self, section) - local v = m:get(section, "keepalive") - if v and #v > 0 then - return tonumber(v:match("^%d+[ ,]+(%d+)")) - end -end - -function keepalive_interval.write(self, section, value) - local f = tonumber(keepalive_failure:formvalue(section)) or 0 - local i = tonumber(value) or 5 - if i < 1 then i = 1 end - if f > 0 then - m:set(section, "keepalive", "%d %d" %{ f, i }) - else - m:del(section, "keepalive") - end -end - -keepalive_interval.remove = keepalive_interval.write -keepalive_interval.placeholder = "5" -keepalive_interval.datatype = "min(1)" - - -demand = section:taboption("advanced", Value, "demand", - translate("Inactivity timeout"), - translate("Close inactive connection after the given amount of seconds, use 0 to persist connection")) - -demand.placeholder = "0" -demand.datatype = "uinteger" diff --git a/protocols/luci-proto-hnet/luasrc/model/cbi/admin_network/proto_hnet.lua b/protocols/luci-proto-hnet/luasrc/model/cbi/admin_network/proto_hnet.lua deleted file mode 100644 index 2ed34faf7..000000000 --- a/protocols/luci-proto-hnet/luasrc/model/cbi/admin_network/proto_hnet.lua +++ /dev/null @@ -1,37 +0,0 @@ --- Copyright 2013 Steven Barth --- Licensed to the public under the Apache License 2.0. - -local map, section, net = ... - -local mode = section:taboption("general", ListValue, "mode", translate("Category")) -mode:value("auto", translate("Automatic")) -mode:value("external", translate("External")) -mode:value("internal", translate("Internal")) -mode:value("leaf", translate("Leaf")) -mode:value("guest", translate("Guest")) -mode:value("adhoc", translate("Ad-Hoc")) -mode:value("hybrid", translate("Hybrid")) -mode.default = "auto" - - - -local plen = section:taboption("advanced", Value, "ip6assign", translate("IPv6 assignment length"), - translate("Assign a part of given length of every public IPv6-prefix to this interface")) -plen.datatype = "max(128)" -plen.default = "64" - -section:taboption("advanced", Value, "link_id", translate("IPv6 assignment hint"), - translate("Assign prefix parts using this hexadecimal subprefix ID for this interface.")) - -plen = section:taboption("advanced", Value, "ip4assign", translate("IPv4 assignment length")) -plen.datatype = "max(32)" -plen.default = "24" - -local o = section:taboption("advanced", Value, "dnsname", translate("DNS-Label / FQDN")) -o.default = map.name - -luci.tools.proto.opt_macaddr(section, ifc, translate("Override MAC address")) - -o = section:taboption("advanced", Value, "mtu", translate("Override MTU")) -o.placeholder = "1500" -o.datatype = "max(9200)" diff --git a/protocols/luci-proto-ipip/luasrc/model/cbi/admin_network/proto_ipip.lua b/protocols/luci-proto-ipip/luasrc/model/cbi/admin_network/proto_ipip.lua deleted file mode 100644 index 8817f18d6..000000000 --- a/protocols/luci-proto-ipip/luasrc/model/cbi/admin_network/proto_ipip.lua +++ /dev/null @@ -1,34 +0,0 @@ --- Copyright 2016 Roger Pueyo Centelles --- Licensed to the public under the Apache License 2.0. - -local map, section, net = ... - -local peeraddr, ipaddr, ttl, tos, df, mtu, tunlink - -peeraddr = section:taboption("general", Value, "peeraddr", translate("Remote IPv4 address or FQDN"), translate("The IPv4 address or the fully-qualified domain name of the remote tunnel end.")) -peeraddr.optional = false -peeraddr.datatype = "or(hostname,ip4addr)" - -ipaddr = section:taboption("general", Value, "ipaddr", translate("Local IPv4 address"), translate("The local IPv4 address over which the tunnel is created (optional).")) -ipaddr.optional = true -ipaddr.datatype = "ip4addr" - -tunlink = section:taboption("general", Value, "tunlink", translate("Bind interface"), translate("Bind the tunnel to this interface (optional).")) -ipaddr.optional = true - - -mtu = section:taboption("advanced", Value, "mtu", translate("Override MTU"), translate("Specify an MTU (Maximum Transmission Unit) other than the default (1280 bytes).")) -mtu.optional = true -mtu.placeholder = 1280 -mtu.datatype = "range(68, 9200)" - -ttl = section:taboption("advanced", Value, "ttl", translate("Override TTL"), translate("Specify a TTL (Time to Live) for the encapsulating packet other than the default (64).")) -ttl.optional = true -ttl.placeholder = 64 -ttl.datatype = "min(1)" - -tos = section:taboption("advanced", Value, "tos", translate("Override TOS"), translate("Specify a TOS (Type of Service).")) -tos.optional = true -tos.datatype = "range(0, 255)" - -df = section:taboption("advanced", Flag, "df", translate("Don't Fragment"), translate("Enable the DF (Don't Fragment) flag of the encapsulating packets.")) diff --git a/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_464xlat.lua b/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_464xlat.lua deleted file mode 100644 index 5a37582fa..000000000 --- a/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_464xlat.lua +++ /dev/null @@ -1,33 +0,0 @@ --- Copyright 2011 Jo-Philipp Wich --- Copyright 2013 Steven Barth --- Licensed to the public under the Apache License 2.0. - -local map, section, net = ... -local tunlink, defaultroute, metric, mtu - -section:taboption("general", Value, "ip6prefix", - translate("NAT64 Prefix"), translate("Leave empty to autodetect")) - -tunlink = section:taboption("advanced", DynamicList, "tunlink", translate("Tunnel Link")) -tunlink.template = "cbi/network_netlist" -tunlink.nocreate = true - - -defaultroute = section:taboption("advanced", Flag, "defaultroute", - translate("Default gateway"), - translate("If unchecked, no default route is configured")) - -defaultroute.default = defaultroute.enabled - - -metric = section:taboption("advanced", Value, "metric", - translate("Use gateway metric")) - -metric.placeholder = "0" -metric.datatype = "uinteger" -metric:depends("defaultroute", defaultroute.enabled) - - -mtu = section:taboption("advanced", Value, "mtu", translate("Use MTU on tunnel interface")) -mtu.placeholder = "1280" -mtu.datatype = "max(9200)" diff --git a/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_6in4.lua b/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_6in4.lua deleted file mode 100644 index 3c9f41f6b..000000000 --- a/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_6in4.lua +++ /dev/null @@ -1,102 +0,0 @@ --- Copyright 2011 Jo-Philipp Wich --- Licensed to the public under the Apache License 2.0. - -local map, section, net = ... - -local ipaddr, peeraddr, ip6addr, tunnelid, username, password -local defaultroute, metric, ttl, mtu - - -ipaddr = s:taboption("general", Value, "ipaddr", - translate("Local IPv4 address"), - translate("Leave empty to use the current WAN address")) - -ipaddr.datatype = "ip4addr" - - -peeraddr = s:taboption("general", Value, "peeraddr", - translate("Remote IPv4 address"), - translate("This is usually the address of the nearest PoP operated by the tunnel broker")) - -peeraddr.rmempty = false -peeraddr.datatype = "ip4addr" - - -ip6addr = s:taboption("general", Value, "ip6addr", - translate("Local IPv6 address"), - translate("This is the local endpoint address assigned by the tunnel broker, it usually ends with ...:2/64")) - -ip6addr.datatype = "ip6addr" - - -local ip6prefix = s:taboption("general", Value, "ip6prefix", - translate("IPv6 routed prefix"), - translate("This is the prefix routed to you by the tunnel broker for use by clients")) - -ip6prefix.datatype = "list(ip6addr)" - - -local update = section:taboption("general", Flag, "_update", - translate("Dynamic tunnel"), - translate("Enable HE.net dynamic endpoint update")) - -update.enabled = "1" -update.disabled = "0" - -function update.write() end -function update.remove() end -function update.cfgvalue(self, section) - return (tonumber(m:get(section, "tunnelid")) ~= nil) - and self.enabled or self.disabled -end - - -tunnelid = section:taboption("general", Value, "tunnelid", translate("Tunnel ID")) -tunnelid.datatype = "uinteger" -tunnelid:depends("_update", update.enabled) - - -username = section:taboption("general", Value, "username", - translate("HE.net username"), - translate("This is the plain username for logging into the account")) - -username:depends("_update", update.enabled) -username.validate = function(self, val, sid) - if type(val) == "string" and #val == 32 and val:match("^[a-fA-F0-9]+$") then - return nil, translate("The HE.net endpoint update configuration changed, you must now use the plain username instead of the user ID!") - end - return val -end - - -password = section:taboption("general", Value, "password", - translate("HE.net password"), - translate("This is either the \"Update Key\" configured for the tunnel or the account password if no update key has been configured")) - -password.password = true -password:depends("_update", update.enabled) - - -defaultroute = section:taboption("advanced", Flag, "defaultroute", - translate("Default gateway"), - translate("If unchecked, no default route is configured")) - -defaultroute.default = defaultroute.enabled - - -metric = section:taboption("advanced", Value, "metric", - translate("Use gateway metric")) - -metric.placeholder = "0" -metric.datatype = "uinteger" -metric:depends("defaultroute", defaultroute.enabled) - - -ttl = section:taboption("advanced", Value, "ttl", translate("Use TTL on tunnel interface")) -ttl.placeholder = "64" -ttl.datatype = "range(1,255)" - - -mtu = section:taboption("advanced", Value, "mtu", translate("Use MTU on tunnel interface")) -mtu.placeholder = "1280" -mtu.datatype = "max(9200)" diff --git a/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_6rd.lua b/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_6rd.lua deleted file mode 100644 index 708a9c5ad..000000000 --- a/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_6rd.lua +++ /dev/null @@ -1,72 +0,0 @@ --- Copyright 2011-2012 Jo-Philipp Wich --- Licensed to the public under the Apache License 2.0. - -local map, section, net = ... - -local ipaddr, peeraddr, ip6addr, tunnelid, username, password -local defaultroute, metric, ttl, mtu - - -ipaddr = s:taboption("general", Value, "ipaddr", - translate("Local IPv4 address"), - translate("Leave empty to use the current WAN address")) - -ipaddr.datatype = "ip4addr" - - -peeraddr = s:taboption("general", Value, "peeraddr", - translate("Remote IPv4 address"), - translate("This IPv4 address of the relay")) - -peeraddr.rmempty = false -peeraddr.datatype = "ip4addr" - - -ip6addr = s:taboption("general", Value, "ip6prefix", - translate("IPv6 prefix"), - translate("The IPv6 prefix assigned to the provider, usually ends with ::")) - -ip6addr.rmempty = false -ip6addr.datatype = "ip6addr" - - -ip6prefixlen = s:taboption("general", Value, "ip6prefixlen", - translate("IPv6 prefix length"), - translate("The length of the IPv6 prefix in bits")) - -ip6prefixlen.placeholder = "16" -ip6prefixlen.datatype = "range(0,128)" - - -ip6prefixlen = s:taboption("general", Value, "ip4prefixlen", - translate("IPv4 prefix length"), - translate("The length of the IPv4 prefix in bits, the remainder is used in the IPv6 addresses.")) - -ip6prefixlen.placeholder = "0" -ip6prefixlen.datatype = "range(0,32)" - - - -defaultroute = section:taboption("advanced", Flag, "defaultroute", - translate("Default gateway"), - translate("If unchecked, no default route is configured")) - -defaultroute.default = defaultroute.enabled - - -metric = section:taboption("advanced", Value, "metric", - translate("Use gateway metric")) - -metric.placeholder = "0" -metric.datatype = "uinteger" -metric:depends("defaultroute", defaultroute.enabled) - - -ttl = section:taboption("advanced", Value, "ttl", translate("Use TTL on tunnel interface")) -ttl.placeholder = "64" -ttl.datatype = "range(1,255)" - - -mtu = section:taboption("advanced", Value, "mtu", translate("Use MTU on tunnel interface")) -mtu.placeholder = "1280" -mtu.datatype = "max(9200)" diff --git a/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_6to4.lua b/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_6to4.lua deleted file mode 100644 index 50a706974..000000000 --- a/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_6to4.lua +++ /dev/null @@ -1,37 +0,0 @@ --- Copyright 2011 Jo-Philipp Wich --- Licensed to the public under the Apache License 2.0. - -local map, section, net = ... - -local ipaddr, defaultroute, metric, ttl, mtu - - -ipaddr = section:taboption("general", Value, "ipaddr", - translate("Local IPv4 address"), - translate("Leave empty to use the current WAN address")) - -ipaddr.datatype = "ip4addr" - -defaultroute = section:taboption("advanced", Flag, "defaultroute", - translate("Use default gateway"), - translate("If unchecked, no default route is configured")) - -defaultroute.default = defaultroute.enabled - - -metric = section:taboption("advanced", Value, "metric", - translate("Use gateway metric")) - -metric.placeholder = "0" -metric.datatype = "uinteger" -metric:depends("defaultroute", defaultroute.enabled) - - -ttl = section:taboption("advanced", Value, "ttl", translate("Use TTL on tunnel interface")) -ttl.placeholder = "64" -ttl.datatype = "range(1,255)" - - -mtu = section:taboption("advanced", Value, "mtu", translate("Use MTU on tunnel interface")) -mtu.placeholder = "1280" -mtu.datatype = "max(9200)" diff --git a/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_dhcpv6.lua b/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_dhcpv6.lua deleted file mode 100644 index 49281ee41..000000000 --- a/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_dhcpv6.lua +++ /dev/null @@ -1,58 +0,0 @@ --- Copyright 2013 Steven Barth --- Licensed to the public under the Apache License 2.0. - -local map, section, net = ... - - -local o = section:taboption("general", ListValue, "reqaddress", - translate("Request IPv6-address")) -o:value("try") -o:value("force") -o:value("none", "disabled") -o.default = "try" - - -o = section:taboption("general", Value, "reqprefix", - translate("Request IPv6-prefix of length")) -o:value("auto", translate("Automatic")) -o:value("no", translate("disabled")) -o:value("48") -o:value("52") -o:value("56") -o:value("60") -o:value("64") -o.default = "auto" - - -o = section:taboption("advanced", Flag, "defaultroute", - translate("Use default gateway"), - translate("If unchecked, no default route is configured")) -o.default = o.enabled - - -o = section:taboption("advanced", Flag, "peerdns", - translate("Use DNS servers advertised by peer"), - translate("If unchecked, the advertised DNS server addresses are ignored")) -o.default = o.enabled - - -o = section:taboption("advanced", Value, "ip6prefix", - translate("Custom delegated IPv6-prefix")) -o.dataype = "list(ip6addr)" - - -o = section:taboption("advanced", DynamicList, "dns", - translate("Use custom DNS servers")) -o:depends("peerdns", "") -o.datatype = "list(ip6addr)" -o.cast = "string" - - -o = section:taboption("advanced", Value, "clientid", - translate("Client ID to send when requesting DHCP")) - -luci.tools.proto.opt_macaddr(section, ifc, translate("Override MAC address")) - -o = section:taboption("advanced", Value, "mtu", translate("Override MTU")) -o.placeholder = "1500" -o.datatype = "max(9200)" diff --git a/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_dslite.lua b/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_dslite.lua deleted file mode 100644 index eca9750ad..000000000 --- a/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_dslite.lua +++ /dev/null @@ -1,53 +0,0 @@ --- Copyright 2011 Jo-Philipp Wich --- Copyright 2013 Steven Barth --- Licensed to the public under the Apache License 2.0. - -local map, section, net = ... - -local peeraddr, ip6addr -local tunlink, defaultroute, metric, ttl, mtu - - - - -peeraddr = section:taboption("general", Value, "peeraddr", - translate("DS-Lite AFTR address")) - -peeraddr.rmempty = false -peeraddr.datatype = "or(hostname,ip6addr)" - -ip6addr = section:taboption("general", Value, "ip6addr", - translate("Local IPv6 address"), - translate("Leave empty to use the current WAN address")) - -ip6addr.datatype = "ip6addr" - - -tunlink = section:taboption("advanced", DynamicList, "tunlink", translate("Tunnel Link")) -tunlink.template = "cbi/network_netlist" -tunlink.nocreate = true - - -defaultroute = section:taboption("advanced", Flag, "defaultroute", - translate("Default gateway"), - translate("If unchecked, no default route is configured")) - -defaultroute.default = defaultroute.enabled - - -metric = section:taboption("advanced", Value, "metric", - translate("Use gateway metric")) - -metric.placeholder = "0" -metric.datatype = "uinteger" -metric:depends("defaultroute", defaultroute.enabled) - - -ttl = section:taboption("advanced", Value, "ttl", translate("Use TTL on tunnel interface")) -ttl.placeholder = "64" -ttl.datatype = "range(1,255)" - - -mtu = section:taboption("advanced", Value, "mtu", translate("Use MTU on tunnel interface")) -mtu.placeholder = "1280" -mtu.datatype = "max(9200)" diff --git a/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_map.lua b/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_map.lua deleted file mode 100644 index 37d4ec901..000000000 --- a/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_map.lua +++ /dev/null @@ -1,88 +0,0 @@ --- Copyright 2011 Jo-Philipp Wich --- Copyright 2013 Steven Barth --- Licensed to the public under the Apache License 2.0. - -local map, section, net = ... - -local peeraddr, ip6addr -local tunlink, defaultroute, metric, ttl, mtu - - -maptype = section:taboption("general", ListValue, "type", translate("Type")) -maptype:value("map-e", "MAP-E") -maptype:value("map-t", "MAP-T") -maptype:value("lw4o6", "LW4over6") - - -peeraddr = section:taboption("general", Value, "peeraddr", - translate("BR / DMR / AFTR")) - -peeraddr.rmempty = false -peeraddr.datatype = "ip6addr" - - -ipaddr = section:taboption("general", Value, "ipaddr", - translate("IPv4 prefix")) -ipaddr.datatype = "ip4addr" - - -ip4prefixlen = s:taboption("general", Value, "ip4prefixlen", - translate("IPv4 prefix length"), - translate("The length of the IPv4 prefix in bits, the remainder is used in the IPv6 addresses.")) - -ip4prefixlen.placeholder = "32" -ip4prefixlen.datatype = "range(0,32)" - -ip6addr = s:taboption("general", Value, "ip6prefix", - translate("IPv6 prefix"), - translate("The IPv6 prefix assigned to the provider, usually ends with ::")) - -ip6addr.rmempty = false -ip6addr.datatype = "ip6addr" - - -ip6prefixlen = s:taboption("general", Value, "ip6prefixlen", - translate("IPv6 prefix length"), - translate("The length of the IPv6 prefix in bits")) - -ip6prefixlen.placeholder = "16" -ip6prefixlen.datatype = "range(0,64)" - - -s:taboption("general", Value, "ealen", - translate("EA-bits length")).datatype = "range(0,48)" - -s:taboption("general", Value, "psidlen", - translate("PSID-bits length")).datatype = "range(0,16)" - -s:taboption("general", Value, "offset", - translate("PSID offset")).datatype = "range(0,16)" - -tunlink = section:taboption("advanced", DynamicList, "tunlink", translate("Tunnel Link")) -tunlink.template = "cbi/network_netlist" -tunlink.nocreate = true - - -defaultroute = section:taboption("advanced", Flag, "defaultroute", - translate("Default gateway"), - translate("If unchecked, no default route is configured")) - -defaultroute.default = defaultroute.enabled - - -metric = section:taboption("advanced", Value, "metric", - translate("Use gateway metric")) - -metric.placeholder = "0" -metric.datatype = "uinteger" -metric:depends("defaultroute", defaultroute.enabled) - - -ttl = section:taboption("advanced", Value, "ttl", translate("Use TTL on tunnel interface")) -ttl.placeholder = "64" -ttl.datatype = "range(1,255)" - - -mtu = section:taboption("advanced", Value, "mtu", translate("Use MTU on tunnel interface")) -mtu.placeholder = "1280" -mtu.datatype = "max(9200)" diff --git a/protocols/luci-proto-ncm/luasrc/model/cbi/admin_network/proto_ncm.lua b/protocols/luci-proto-ncm/luasrc/model/cbi/admin_network/proto_ncm.lua deleted file mode 100644 index 3fe4ef33a..000000000 --- a/protocols/luci-proto-ncm/luasrc/model/cbi/admin_network/proto_ncm.lua +++ /dev/null @@ -1,110 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2015 Cezary Jackiewicz - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 -]]-- - -local map, section, net = ... - -local device, apn, service, pincode, username, password, dialnum -local ipv6, delay, defaultroute, metric, peerdns, dns - - -device = section:taboption("general", Value, "device", translate("Modem device")) -device.rmempty = false - -local dev -for dev in nixio.fs.glob("/dev/ttyUSB*") do - device:value(dev) -end -for dev in nixio.fs.glob("/dev/cdc-wdm*") do - device:value(dev) -end - -mode = section:taboption("general", Value, "mode", translate("Service Type")) -mode:value("", translate("Modem default")) -mode:value("preferlte", translate("Prefer LTE")) -mode:value("preferumts", translate("Prefer UMTS")) -mode:value("lte", "LTE") -mode:value("umts", "UMTS/GPRS") -mode:value("gsm", translate("GPRS only")) -mode:value("auto", translate("auto")) - - -mode = section:taboption("general", Value, "pdptype", translate("IP Protocol")) -mode.default = "IP" -mode:value("IP", translate("IPv4")) -mode:value("IPV4V6", translate("IPv4+IPv6")) -mode:value("IPV6", translate("IPv6")) - - -apn = section:taboption("general", Value, "apn", translate("APN")) - - -pincode = section:taboption("general", Value, "pincode", translate("PIN")) - - -username = section:taboption("general", Value, "username", translate("PAP/CHAP username")) - - -password = section:taboption("general", Value, "password", translate("PAP/CHAP password")) -password.password = true - - -dialnum = section:taboption("general", Value, "dialnum", translate("Dial number")) -dialnum.placeholder = "*99#" - - -if luci.model.network:has_ipv6() then - - ipv6 = section:taboption("advanced", ListValue, "ipv6") - ipv6:value("auto", translate("Automatic")) - ipv6:value("0", translate("Disabled")) - ipv6:value("1", translate("Manual")) - ipv6.default = "auto" - -end - - -delay = section:taboption("advanced", Value, "delay", - translate("Modem init timeout"), - translate("Maximum amount of seconds to wait for the modem to become ready")) - -delay.placeholder = "10" -delay.datatype = "min(1)" - - -defaultroute = section:taboption("advanced", Flag, "defaultroute", - translate("Use default gateway"), - translate("If unchecked, no default route is configured")) - -defaultroute.default = defaultroute.enabled - -metric = section:taboption("advanced", Value, "metric", - translate("Use gateway metric")) - -metric.placeholder = "0" -metric.datatype = "uinteger" -metric:depends("defaultroute", defaultroute.enabled) - - -peerdns = section:taboption("advanced", Flag, "peerdns", - translate("Use DNS servers advertised by peer"), - translate("If unchecked, the advertised DNS server addresses are ignored")) - -peerdns.default = peerdns.enabled - - -dns = section:taboption("advanced", DynamicList, "dns", - translate("Use custom DNS servers")) - -dns:depends("peerdns", "") -dns.datatype = "ipaddr" -dns.cast = "string" - diff --git a/protocols/luci-proto-openconnect/luasrc/model/cbi/admin_network/proto_openconnect.lua b/protocols/luci-proto-openconnect/luasrc/model/cbi/admin_network/proto_openconnect.lua deleted file mode 100644 index 5adfccae4..000000000 --- a/protocols/luci-proto-openconnect/luasrc/model/cbi/admin_network/proto_openconnect.lua +++ /dev/null @@ -1,90 +0,0 @@ --- Copyright 2014 Nikos Mavrogiannopoulos --- Licensed to the public under the Apache License 2.0. - -local map, section, net = ... - -local server, username, password, cert, ca -local oc_cert_file, oc_key_file, oc_ca_file - -local ifc = net:get_interface():name() - -oc_cert_file = "/etc/openconnect/user-cert-" .. ifc .. ".pem" -oc_key_file = "/etc/openconnect/user-key-" .. ifc .. ".pem" -oc_ca_file = "/etc/openconnect/ca-" .. ifc .. ".pem" - -server = section:taboption("general", Value, "server", translate("VPN Server")) -server.datatype = "host(0)" - -port = section:taboption("general", Value, "port", translate("VPN Server port")) -port.placeholder = "443" -port.datatype = "port" - - -defaultroute = section:taboption("advanced", Flag, "defaultroute", - translate("Use default gateway"), - translate("If unchecked, no default route is configured")) - -defaultroute.default = defaultroute.enabled - - -metric = section:taboption("advanced", Value, "metric", - translate("Use gateway metric")) - -metric.placeholder = "0" -metric.datatype = "uinteger" -metric:depends("defaultroute", defaultroute.enabled) - -section:taboption("general", Value, "serverhash", translate("VPN Server's certificate SHA1 hash")) - -section:taboption("general", Value, "authgroup", translate("Auth Group")) - -username = section:taboption("general", Value, "username", translate("Username")) -password = section:taboption("general", Value, "password", translate("Password")) -password.password = true -password2 = section:taboption("general", Value, "password2", translate("Password2")) -password2.password = true - - -cert = section:taboption("advanced", Value, "usercert", translate("User certificate (PEM encoded)")) -cert.template = "cbi/tvalue" -cert.rows = 10 - -function cert.cfgvalue(self, section) - return nixio.fs.readfile(oc_cert_file) -end - -function cert.write(self, section, value) - value = value:gsub("\r\n?", "\n") - nixio.fs.writefile(oc_cert_file, value) -end - -cert = section:taboption("advanced", Value, "userkey", translate("User key (PEM encoded)")) -cert.template = "cbi/tvalue" -cert.rows = 10 - -function cert.cfgvalue(self, section) - return nixio.fs.readfile(oc_key_file) -end - -function cert.write(self, section, value) - value = value:gsub("\r\n?", "\n") - nixio.fs.writefile(oc_key_file, value) -end - - -ca = section:taboption("advanced", Value, "ca", translate("CA certificate; if empty it will be saved after the first connection.")) -ca.template = "cbi/tvalue" -ca.rows = 10 - -function ca.cfgvalue(self, section) - return nixio.fs.readfile(oc_ca_file) -end - -function ca.write(self, section, value) - value = value:gsub("\r\n?", "\n") - nixio.fs.writefile(oc_ca_file, value) -end - -mtu = section:taboption("advanced", Value, "mtu", translate("Override MTU")) -mtu.placeholder = "1406" -mtu.datatype = "max(9200)" diff --git a/protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_l2tp.lua b/protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_l2tp.lua deleted file mode 100644 index 604f019ee..000000000 --- a/protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_l2tp.lua +++ /dev/null @@ -1,61 +0,0 @@ --- Copyright 2011 Jo-Philipp Wich --- Licensed to the public under the Apache License 2.0. - -local map, section, net = ... - -local server, username, password -local ipv6, defaultroute, metric, peerdns, dns, mtu - - -server = section:taboption("general", Value, "server", translate("L2TP Server")) -server.datatype = "or(host(1), hostport(1))" - - -username = section:taboption("general", Value, "username", translate("PAP/CHAP username")) - - -password = section:taboption("general", Value, "password", translate("PAP/CHAP password")) -password.password = true - -if luci.model.network:has_ipv6() then - ipv6 = section:taboption("advanced", ListValue, "ipv6", - translate("Obtain IPv6-Address"), - translate("Enable IPv6 negotiation on the PPP link")) - ipv6:value("auto", translate("Automatic")) - ipv6:value("0", translate("Disabled")) - ipv6:value("1", translate("Manual")) - ipv6.default = "auto" -end - -defaultroute = section:taboption("advanced", Flag, "defaultroute", - translate("Use default gateway"), - translate("If unchecked, no default route is configured")) - -defaultroute.default = defaultroute.enabled - - -metric = section:taboption("advanced", Value, "metric", - translate("Use gateway metric")) - -metric.placeholder = "0" -metric.datatype = "uinteger" -metric:depends("defaultroute", defaultroute.enabled) - - -peerdns = section:taboption("advanced", Flag, "peerdns", - translate("Use DNS servers advertised by peer"), - translate("If unchecked, the advertised DNS server addresses are ignored")) - -peerdns.default = peerdns.enabled - - -dns = section:taboption("advanced", DynamicList, "dns", - translate("Use custom DNS servers")) - -dns:depends("peerdns", "") -dns.datatype = "ipaddr" -dns.cast = "string" - -mtu = section:taboption("advanced", Value, "mtu", translate("Override MTU")) -mtu.placeholder = "1500" -mtu.datatype = "max(9200)" diff --git a/protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_ppp.lua b/protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_ppp.lua deleted file mode 100644 index 5f468bc14..000000000 --- a/protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_ppp.lua +++ /dev/null @@ -1,127 +0,0 @@ --- Copyright 2011 Jo-Philipp Wich --- Licensed to the public under the Apache License 2.0. - -local map, section, net = ... - -local device, username, password -local ipv6, defaultroute, metric, peerdns, dns, - keepalive_failure, keepalive_interval, demand, mtu - - -device = section:taboption("general", Value, "device", translate("Modem device")) -device.rmempty = false - -local device_suggestions = nixio.fs.glob("/dev/tty*S*") - or nixio.fs.glob("/dev/tts/*") - -if device_suggestions then - local node - for node in device_suggestions do - device:value(node) - end -end - - -username = section:taboption("general", Value, "username", translate("PAP/CHAP username")) - - -password = section:taboption("general", Value, "password", translate("PAP/CHAP password")) -password.password = true - - -if luci.model.network:has_ipv6() then - ipv6 = section:taboption("advanced", ListValue, "ipv6", - translate("Obtain IPv6-Address"), - translate("Enable IPv6 negotiation on the PPP link")) - ipv6:value("auto", translate("Automatic")) - ipv6:value("0", translate("Disabled")) - ipv6:value("1", translate("Manual")) - ipv6.default = "auto" -end - - -defaultroute = section:taboption("advanced", Flag, "defaultroute", - translate("Use default gateway"), - translate("If unchecked, no default route is configured")) - -defaultroute.default = defaultroute.enabled - - -metric = section:taboption("advanced", Value, "metric", - translate("Use gateway metric")) - -metric.placeholder = "0" -metric.datatype = "uinteger" -metric:depends("defaultroute", defaultroute.enabled) - - -peerdns = section:taboption("advanced", Flag, "peerdns", - translate("Use DNS servers advertised by peer"), - translate("If unchecked, the advertised DNS server addresses are ignored")) - -peerdns.default = peerdns.enabled - - -dns = section:taboption("advanced", DynamicList, "dns", - translate("Use custom DNS servers")) - -dns:depends("peerdns", "") -dns.datatype = "ipaddr" -dns.cast = "string" - - -keepalive_failure = section:taboption("advanced", Value, "_keepalive_failure", - translate("LCP echo failure threshold"), - translate("Presume peer to be dead after given amount of LCP echo failures, use 0 to ignore failures")) - -function keepalive_failure.cfgvalue(self, section) - local v = m:get(section, "keepalive") - if v and #v > 0 then - return tonumber(v:match("^(%d+)[ ,]+%d+") or v) - end -end - -keepalive_failure.placeholder = "0" -keepalive_failure.datatype = "uinteger" - - -keepalive_interval = section:taboption("advanced", Value, "_keepalive_interval", - translate("LCP echo interval"), - translate("Send LCP echo requests at the given interval in seconds, only effective in conjunction with failure threshold")) - -function keepalive_interval.cfgvalue(self, section) - local v = m:get(section, "keepalive") - if v and #v > 0 then - return tonumber(v:match("^%d+[ ,]+(%d+)")) - end -end - -function keepalive_interval.write(self, section, value) - local f = tonumber(keepalive_failure:formvalue(section)) or 0 - local i = tonumber(value) or 5 - if i < 1 then i = 1 end - if f > 0 then - m:set(section, "keepalive", "%d %d" %{ f, i }) - else - m:set(section, "keepalive", "0") - end -end - -keepalive_interval.remove = keepalive_interval.write -keepalive_failure.write = keepalive_interval.write -keepalive_failure.remove = keepalive_interval.write -keepalive_interval.placeholder = "5" -keepalive_interval.datatype = "min(1)" - - -demand = section:taboption("advanced", Value, "demand", - translate("Inactivity timeout"), - translate("Close inactive connection after the given amount of seconds, use 0 to persist connection")) - -demand.placeholder = "0" -demand.datatype = "uinteger" - - -mtu = section:taboption("advanced", Value, "mtu", translate("Override MTU")) -mtu.placeholder = "1500" -mtu.datatype = "max(9200)" diff --git a/protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_pppoa.lua b/protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_pppoa.lua deleted file mode 100644 index 004fd7ef6..000000000 --- a/protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_pppoa.lua +++ /dev/null @@ -1,133 +0,0 @@ --- Copyright 2011 Jo-Philipp Wich --- Licensed to the public under the Apache License 2.0. - -local map, section, net = ... - -local encaps, atmdev, vci, vpi, username, password -local ipv6, defaultroute, metric, peerdns, dns, - keepalive_failure, keepalive_interval, demand, mtu - - -encaps = section:taboption("general", ListValue, "encaps", translate("PPPoA Encapsulation")) -encaps:value("vc", "VC-Mux") -encaps:value("llc", "LLC") - - -atmdev = section:taboption("general", Value, "atmdev", translate("ATM device number")) -atmdev.default = "0" -atmdev.datatype = "uinteger" - - -vci = section:taboption("general", Value, "vci", translate("ATM Virtual Channel Identifier (VCI)")) -vci.default = "35" -vci.datatype = "uinteger" - - -vpi = section:taboption("general", Value, "vpi", translate("ATM Virtual Path Identifier (VPI)")) -vpi.default = "8" -vpi.datatype = "uinteger" - - -username = section:taboption("general", Value, "username", translate("PAP/CHAP username")) - - -password = section:taboption("general", Value, "password", translate("PAP/CHAP password")) -password.password = true - - -if luci.model.network:has_ipv6() then - ipv6 = section:taboption("advanced", ListValue, "ipv6", - translate("Obtain IPv6-Address"), - translate("Enable IPv6 negotiation on the PPP link")) - ipv6:value("auto", translate("Automatic")) - ipv6:value("0", translate("Disabled")) - ipv6:value("1", translate("Manual")) - ipv6.default = "auto" -end - - -defaultroute = section:taboption("advanced", Flag, "defaultroute", - translate("Use default gateway"), - translate("If unchecked, no default route is configured")) - -defaultroute.default = defaultroute.enabled - - -metric = section:taboption("advanced", Value, "metric", - translate("Use gateway metric")) - -metric.placeholder = "0" -metric.datatype = "uinteger" -metric:depends("defaultroute", defaultroute.enabled) - - -peerdns = section:taboption("advanced", Flag, "peerdns", - translate("Use DNS servers advertised by peer"), - translate("If unchecked, the advertised DNS server addresses are ignored")) - -peerdns.default = peerdns.enabled - - -dns = section:taboption("advanced", DynamicList, "dns", - translate("Use custom DNS servers")) - -dns:depends("peerdns", "") -dns.datatype = "ipaddr" -dns.cast = "string" - - -keepalive_failure = section:taboption("advanced", Value, "_keepalive_failure", - translate("LCP echo failure threshold"), - translate("Presume peer to be dead after given amount of LCP echo failures, use 0 to ignore failures")) - -function keepalive_failure.cfgvalue(self, section) - local v = m:get(section, "keepalive") - if v and #v > 0 then - return tonumber(v:match("^(%d+)[ ,]+%d+") or v) - end -end - -keepalive_failure.placeholder = "0" -keepalive_failure.datatype = "uinteger" - - -keepalive_interval = section:taboption("advanced", Value, "_keepalive_interval", - translate("LCP echo interval"), - translate("Send LCP echo requests at the given interval in seconds, only effective in conjunction with failure threshold")) - -function keepalive_interval.cfgvalue(self, section) - local v = m:get(section, "keepalive") - if v and #v > 0 then - return tonumber(v:match("^%d+[ ,]+(%d+)")) - end -end - -function keepalive_interval.write(self, section, value) - local f = tonumber(keepalive_failure:formvalue(section)) or 0 - local i = tonumber(value) or 5 - if i < 1 then i = 1 end - if f > 0 then - m:set(section, "keepalive", "%d %d" %{ f, i }) - else - m:set(section, "keepalive", "0") - end -end - -keepalive_interval.remove = keepalive_interval.write -keepalive_failure.write = keepalive_interval.write -keepalive_failure.remove = keepalive_interval.write -keepalive_interval.placeholder = "5" -keepalive_interval.datatype = "min(1)" - - -demand = section:taboption("advanced", Value, "demand", - translate("Inactivity timeout"), - translate("Close inactive connection after the given amount of seconds, use 0 to persist connection")) - -demand.placeholder = "0" -demand.datatype = "uinteger" - - -mtu = section:taboption("advanced", Value, "mtu", translate("Override MTU")) -mtu.placeholder = "1500" -mtu.datatype = "max(9200)" diff --git a/protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_pppoe.lua b/protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_pppoe.lua deleted file mode 100644 index 063d8c07e..000000000 --- a/protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_pppoe.lua +++ /dev/null @@ -1,135 +0,0 @@ --- Copyright 2011 Jo-Philipp Wich --- Licensed to the public under the Apache License 2.0. - -local map, section, net = ... - -local username, password, ac, service -local ipv6, defaultroute, metric, peerdns, dns, - keepalive_failure, keepalive_interval, demand, mtu - - -username = section:taboption("general", Value, "username", translate("PAP/CHAP username")) - - -password = section:taboption("general", Value, "password", translate("PAP/CHAP password")) -password.password = true - - -ac = section:taboption("general", Value, "ac", - translate("Access Concentrator"), - translate("Leave empty to autodetect")) - -ac.placeholder = translate("auto") - - -service = section:taboption("general", Value, "service", - translate("Service Name"), - translate("Leave empty to autodetect")) - -service.placeholder = translate("auto") - - -if luci.model.network:has_ipv6() then - ipv6 = section:taboption("advanced", ListValue, "ipv6", - translate("Obtain IPv6-Address"), - translate("Enable IPv6 negotiation on the PPP link")) - ipv6:value("auto", translate("Automatic")) - ipv6:value("0", translate("Disabled")) - ipv6:value("1", translate("Manual")) - ipv6.default = "auto" -end - - -defaultroute = section:taboption("advanced", Flag, "defaultroute", - translate("Use default gateway"), - translate("If unchecked, no default route is configured")) - -defaultroute.default = defaultroute.enabled - - -metric = section:taboption("advanced", Value, "metric", - translate("Use gateway metric")) - -metric.placeholder = "0" -metric.datatype = "uinteger" -metric:depends("defaultroute", defaultroute.enabled) - - -peerdns = section:taboption("advanced", Flag, "peerdns", - translate("Use DNS servers advertised by peer"), - translate("If unchecked, the advertised DNS server addresses are ignored")) - -peerdns.default = peerdns.enabled - - -dns = section:taboption("advanced", DynamicList, "dns", - translate("Use custom DNS servers")) - -dns:depends("peerdns", "") -dns.datatype = "ipaddr" -dns.cast = "string" - - -keepalive_failure = section:taboption("advanced", Value, "_keepalive_failure", - translate("LCP echo failure threshold"), - translate("Presume peer to be dead after given amount of LCP echo failures, use 0 to ignore failures")) - -function keepalive_failure.cfgvalue(self, section) - local v = m:get(section, "keepalive") - if v and #v > 0 then - return tonumber(v:match("^(%d+)[ ,]+%d+") or v) - end -end - -keepalive_failure.placeholder = "0" -keepalive_failure.datatype = "uinteger" - - -keepalive_interval = section:taboption("advanced", Value, "_keepalive_interval", - translate("LCP echo interval"), - translate("Send LCP echo requests at the given interval in seconds, only effective in conjunction with failure threshold")) - -function keepalive_interval.cfgvalue(self, section) - local v = m:get(section, "keepalive") - if v and #v > 0 then - return tonumber(v:match("^%d+[ ,]+(%d+)")) - end -end - -function keepalive_interval.write(self, section, value) - local f = tonumber(keepalive_failure:formvalue(section)) or 0 - local i = tonumber(value) or 5 - if i < 1 then i = 1 end - if f > 0 then - m:set(section, "keepalive", "%d %d" %{ f, i }) - else - m:set(section, "keepalive", "0") - end -end - -keepalive_interval.remove = keepalive_interval.write -keepalive_failure.write = keepalive_interval.write -keepalive_failure.remove = keepalive_interval.write -keepalive_interval.placeholder = "5" -keepalive_interval.datatype = "min(1)" - - -host_uniq = section:taboption("advanced", Value, "host_uniq", - translate("Host-Uniq tag content"), - translate("Raw hex-encoded bytes. Leave empty unless your ISP require this")) - -host_uniq.placeholder = translate("auto") -host_uniq.datatype = "hexstring" - - -demand = section:taboption("advanced", Value, "demand", - translate("Inactivity timeout"), - translate("Close inactive connection after the given amount of seconds, use 0 to persist connection")) - -demand.placeholder = "0" -demand.datatype = "uinteger" - - -mtu = section:taboption("advanced", Value, "mtu", translate("Override MTU")) -mtu.placeholder = "1500" -mtu.datatype = "max(9200)" diff --git a/protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_pptp.lua b/protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_pptp.lua deleted file mode 100644 index 6a828efe9..000000000 --- a/protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_pptp.lua +++ /dev/null @@ -1,106 +0,0 @@ --- Copyright 2011-2012 Jo-Philipp Wich --- Licensed to the public under the Apache License 2.0. - -local map, section, net = ... - -local server, username, password -local defaultroute, metric, peerdns, dns, - keepalive_failure, keepalive_interval, demand, mtu - - -server = section:taboption("general", Value, "server", translate("VPN Server")) -server.datatype = "host(0)" - - -username = section:taboption("general", Value, "username", translate("PAP/CHAP username")) - - -password = section:taboption("general", Value, "password", translate("PAP/CHAP password")) -password.password = true - - -defaultroute = section:taboption("advanced", Flag, "defaultroute", - translate("Use default gateway"), - translate("If unchecked, no default route is configured")) - -defaultroute.default = defaultroute.enabled - - -metric = section:taboption("advanced", Value, "metric", - translate("Use gateway metric")) - -metric.placeholder = "0" -metric.datatype = "uinteger" -metric:depends("defaultroute", defaultroute.enabled) - - -peerdns = section:taboption("advanced", Flag, "peerdns", - translate("Use DNS servers advertised by peer"), - translate("If unchecked, the advertised DNS server addresses are ignored")) - -peerdns.default = peerdns.enabled - - -dns = section:taboption("advanced", DynamicList, "dns", - translate("Use custom DNS servers")) - -dns:depends("peerdns", "") -dns.datatype = "ipaddr" -dns.cast = "string" - - -keepalive_failure = section:taboption("advanced", Value, "_keepalive_failure", - translate("LCP echo failure threshold"), - translate("Presume peer to be dead after given amount of LCP echo failures, use 0 to ignore failures")) - -function keepalive_failure.cfgvalue(self, section) - local v = m:get(section, "keepalive") - if v and #v > 0 then - return tonumber(v:match("^(%d+)[ ,]+%d+") or v) - end -end - -keepalive_failure.placeholder = "0" -keepalive_failure.datatype = "uinteger" - - -keepalive_interval = section:taboption("advanced", Value, "_keepalive_interval", - translate("LCP echo interval"), - translate("Send LCP echo requests at the given interval in seconds, only effective in conjunction with failure threshold")) - -function keepalive_interval.cfgvalue(self, section) - local v = m:get(section, "keepalive") - if v and #v > 0 then - return tonumber(v:match("^%d+[ ,]+(%d+)")) - end -end - -function keepalive_interval.write(self, section, value) - local f = tonumber(keepalive_failure:formvalue(section)) or 0 - local i = tonumber(value) or 5 - if i < 1 then i = 1 end - if f > 0 then - m:set(section, "keepalive", "%d %d" %{ f, i }) - else - m:set(section, "keepalive", "0") - end -end - -keepalive_interval.remove = keepalive_interval.write -keepalive_failure.write = keepalive_interval.write -keepalive_failure.remove = keepalive_interval.write -keepalive_interval.placeholder = "5" -keepalive_interval.datatype = "min(1)" - - -demand = section:taboption("advanced", Value, "demand", - translate("Inactivity timeout"), - translate("Close inactive connection after the given amount of seconds, use 0 to persist connection")) - -demand.placeholder = "0" -demand.datatype = "uinteger" - - -mtu = section:taboption("advanced", Value, "mtu", translate("Override MTU")) -mtu.placeholder = "1500" -mtu.datatype = "max(9200)" diff --git a/protocols/luci-proto-pppossh/luasrc/model/cbi/admin_network/proto_pppossh.lua b/protocols/luci-proto-pppossh/luasrc/model/cbi/admin_network/proto_pppossh.lua deleted file mode 100644 index e53262b5d..000000000 --- a/protocols/luci-proto-pppossh/luasrc/model/cbi/admin_network/proto_pppossh.lua +++ /dev/null @@ -1,122 +0,0 @@ --- Copyright (C) 2015 Yousong Zhou --- Licensed to the public under the Apache License 2.0. - -local map, section, net = ... - -local sshuser, server, port, ssh_options, identity, ipaddr, peeraddr - -sshuser = section:taboption("general", Value, "sshuser", translate("SSH username")) - -server = section:taboption("general", Value, "server", translate("SSH server address")) -server.datatype = "host(0)" - -port = section:taboption("general", Value, "port", translate("SSH server port")) -port.datatype = "port" -port.optional = true -port.default = 22 - -ssh_options = section:taboption("general", Value, "ssh_options", translate("Extra SSH command options")) -ssh_options.optional = true - -identity = section:taboption("general", DynamicList, "identity", translate("List of SSH key files for auth")) -identity.optional = true -identity.datatype = "file" - -ipaddr = section:taboption("general", Value, "ipaddr", translate("Local IP address to assign")) -ipaddr.datatype = "ipaddr" - -peeraddr = section:taboption("general", Value, "peeraddr", translate("Peer IP address to assign")) -peeraddr.datatype = "ipaddr" - - -local ipv6, defaultroute, metric, peerdns, dns, - keepalive_failure, keepalive_interval, demand - -if luci.model.network:has_ipv6() then - ipv6 = section:taboption("advanced", Flag, "ipv6", - translate("Enable IPv6 negotiation on the PPP link")) - ipv6.default = ipv6.disabled -end - - -defaultroute = section:taboption("advanced", Flag, "defaultroute", - translate("Use default gateway"), - translate("If unchecked, no default route is configured")) - -defaultroute.default = defaultroute.enabled - - -metric = section:taboption("advanced", Value, "metric", - translate("Use gateway metric")) - -metric.placeholder = "0" -metric.datatype = "uinteger" -metric:depends("defaultroute", defaultroute.enabled) - - -peerdns = section:taboption("advanced", Flag, "peerdns", - translate("Use DNS servers advertised by peer"), - translate("If unchecked, the advertised DNS server addresses are ignored")) - -peerdns.default = peerdns.enabled - - -dns = section:taboption("advanced", DynamicList, "dns", - translate("Use custom DNS servers")) - -dns:depends("peerdns", "") -dns.datatype = "ipaddr" -dns.cast = "string" - - -keepalive_failure = section:taboption("advanced", Value, "_keepalive_failure", - translate("LCP echo failure threshold"), - translate("Presume peer to be dead after given amount of LCP echo failures, use 0 to ignore failures")) - -function keepalive_failure.cfgvalue(self, section) - local v = m:get(section, "keepalive") - if v and #v > 0 then - return tonumber(v:match("^(%d+)[ ,]+%d+") or v) - end -end - -function keepalive_failure.write() end -function keepalive_failure.remove() end - -keepalive_failure.placeholder = "0" -keepalive_failure.datatype = "uinteger" - - -keepalive_interval = section:taboption("advanced", Value, "_keepalive_interval", - translate("LCP echo interval"), - translate("Send LCP echo requests at the given interval in seconds, only effective in conjunction with failure threshold")) - -function keepalive_interval.cfgvalue(self, section) - local v = m:get(section, "keepalive") - if v and #v > 0 then - return tonumber(v:match("^%d+[ ,]+(%d+)")) - end -end - -function keepalive_interval.write(self, section, value) - local f = tonumber(keepalive_failure:formvalue(section)) or 0 - local i = tonumber(value) or 5 - if i < 1 then i = 1 end - if f > 0 then - m:set(section, "keepalive", "%d %d" %{ f, i }) - else - m:set(section, "keepalive", "0") - end -end - -keepalive_interval.remove = keepalive_interval.write -keepalive_interval.placeholder = "5" -keepalive_interval.datatype = "min(1)" - - -demand = section:taboption("advanced", Value, "demand", - translate("Inactivity timeout"), - translate("Close inactive connection after the given amount of seconds, use 0 to persist connection")) - -demand.placeholder = "0" -demand.datatype = "uinteger" diff --git a/protocols/luci-proto-qmi/luasrc/model/cbi/admin_network/proto_qmi.lua b/protocols/luci-proto-qmi/luasrc/model/cbi/admin_network/proto_qmi.lua deleted file mode 100644 index 383bc4662..000000000 --- a/protocols/luci-proto-qmi/luasrc/model/cbi/admin_network/proto_qmi.lua +++ /dev/null @@ -1,63 +0,0 @@ --- Copyright 2016 David Thornley --- Licensed to the public under the Apache License 2.0. - -local map, section, net = ... - -local device, apn, pincode, username, password -local auth, ipv6, delay, mtu - - -device = section:taboption("general", Value, "device", translate("Modem device")) -device.rmempty = false - -local device_suggestions = nixio.fs.glob("/dev/cdc-wdm*") - -if device_suggestions then - local node - for node in device_suggestions do - device:value(node) - end -end - - -apn = section:taboption("general", Value, "apn", translate("APN")) - - -pincode = section:taboption("general", Value, "pincode", translate("PIN")) - - -auth = section:taboption("general", Value, "auth", translate("Authentication Type")) -auth:value("both", "PAP/CHAP (both)") -auth:value("pap", "PAP") -auth:value("chap", "CHAP") -auth:value("none", "NONE") -auth.default = "none" - - -username = section:taboption("general", Value, "username", translate("PAP/CHAP username")) -username:depends("auth", "pap") -username:depends("auth", "chap") -username:depends("auth", "both") - - -password = section:taboption("general", Value, "password", translate("PAP/CHAP password")) -password:depends("auth", "pap") -password:depends("auth", "chap") -password:depends("auth", "both") -password.password = true - - -if luci.model.network:has_ipv6() then - ipv6 = section:taboption("advanced", Flag, "ipv6", translate("Enable IPv6 negotiation")) - ipv6.default = ipv6.disabled -end - -delay = section:taboption("advanced", Value, "delay", - translate("Modem init timeout"), - translate("Maximum amount of seconds to wait for the modem to become ready")) -delay.placeholder = "10" -delay.datatype = "min(1)" - -mtu = section:taboption("advanced", Value, "mtu", translate("Override MTU")) -mtu.placeholder = "1500" -mtu.datatype = "max(9200)" diff --git a/protocols/luci-proto-relay/luasrc/model/cbi/admin_network/proto_relay.lua b/protocols/luci-proto-relay/luasrc/model/cbi/admin_network/proto_relay.lua deleted file mode 100644 index 3381d85e4..000000000 --- a/protocols/luci-proto-relay/luasrc/model/cbi/admin_network/proto_relay.lua +++ /dev/null @@ -1,68 +0,0 @@ --- Copyright 2011 Jo-Philipp Wich --- Licensed to the public under the Apache License 2.0. - -local map, section, net = ... - -local ipaddr, network -local forward_bcast, forward_dhcp, gateway, expiry, retry, table - - -ipaddr = section:taboption("general", Value, "ipaddr", - translate("Local IPv4 address"), - translate("Address to access local relay bridge")) - -ipaddr.datatype = "ip4addr" - - -network = s:taboption("general", DynamicList, "network", translate("Relay between networks")) -network.widget = "checkbox" -network.exclude = arg[1] -network.template = "cbi/network_netlist" -network.nocreate = true -network.nobridges = true -network.novirtual = true -network:depends("proto", "relay") - - -forward_bcast = section:taboption("advanced", Flag, "forward_bcast", - translate("Forward broadcast traffic")) - -forward_bcast.default = forward_bcast.enabled - - -forward_dhcp = section:taboption("advanced", Flag, "forward_dhcp", - translate("Forward DHCP traffic")) - -forward_dhcp.default = forward_dhcp.enabled - - -gateway = section:taboption("advanced", Value, "gateway", - translate("Use DHCP gateway"), - translate("Override the gateway in DHCP responses")) - -gateway.datatype = "ip4addr" -gateway:depends("forward_dhcp", forward_dhcp.enabled) - - -expiry = section:taboption("advanced", Value, "expiry", - translate("Host expiry timeout"), - translate("Specifies the maximum amount of seconds after which hosts are presumed to be dead")) - -expiry.placeholder = "30" -expiry.datatype = "min(1)" - - -retry = section:taboption("advanced", Value, "retry", - translate("ARP retry threshold"), - translate("Specifies the maximum amount of failed ARP requests until hosts are presumed to be dead")) - -retry.placeholder = "5" -retry.datatype = "min(1)" - - -table = section:taboption("advanced", Value, "table", - translate("Use routing table"), - translate("Override the table used for internal routes")) - -table.placeholder = "16800" -table.datatype = "range(0,65535)" diff --git a/protocols/luci-proto-vpnc/luasrc/model/cbi/admin_network/proto_vpnc.lua b/protocols/luci-proto-vpnc/luasrc/model/cbi/admin_network/proto_vpnc.lua deleted file mode 100644 index 3d85d02f4..000000000 --- a/protocols/luci-proto-vpnc/luasrc/model/cbi/admin_network/proto_vpnc.lua +++ /dev/null @@ -1,85 +0,0 @@ --- Copyright 2015 Daniel Dickinson --- Licensed to the public under the Apache License 2.0. - -local map, section, net = ... - -local server, username, password, hexpassword -local authgroup, interface, passgroup, hexpassgroup -local domain, vendor, natt_mode, dh_group -local pfs, enable_single_des, enable_no_enc -local mtu, local_addr, local_port, dpd_idle -local auth_mode, target_network, defaultroute - -local ifc = net:get_interface():name() - -server = section:taboption("general", Value, "server", translate("VPN Server")) -server.datatype = "host(0)" - -port = section:taboption("general", Value, "local_addr", translate("VPN Local address")) -port.placeholder = "0.0.0.0" -port.datatype = "ipaddr" - -port = section:taboption("general", Value, "local_port", translate("VPN Local port")) -port.placeholder = "500" -port.datatype = "port" - -ifname = section:taboption("general", Value, "interface", translate("Output Interface")) -ifname.template = "cbi/network_netlist" - -mtu = section:taboption("general", Value, "mtu", translate("MTU")) -mtu.datatype = "uinteger" - -username = section:taboption("general", Value, "username", translate("Username")) -password = section:taboption("general", Value, "password", translate("Password")) -password.password = true -hexpassword = section:taboption("general", Value, "hexpassword", translate("Obfuscated Password")) -hexpassword.password = true -authroup = section:taboption("general", Value, "authgroup", translate("Auth Group")) -passgroup = section:taboption("general", Value, "passgroup", translate("Group Password")) -passgroup.password = true -hexpassgroup = section:taboption("general", Value, "hexpassgroup", translate("Obfuscated Group Password")) -hexpassword.password= true - -domain = section:taboption("general", Value, "domain", translate("NT Domain")) -vendor = section:taboption("general", Value, "vendor", translate("Vendor")) -dh_group = section:taboption("general", ListValue, "dh_group", translate("IKE DH Group")) -dh_group:value("dh2") -dh_group:value("dh1") -dh_group:value("dh5") - -pfs = section:taboption("general", ListValue, "pfs", translate("Perfect Forward Secrecy")) -pfs:value("server") -pfs:value("nopfs") -pfs:value("dh1") -pfs:value("dh2") -pfs:value("dh5") - -natt_mode = section:taboption("general", ListValue, "natt_mode", translate("NAT-T Mode")) -natt_mode:value("natt", translate("RFC3947 NAT-T mode")) -natt_mode:value("none", translate("No NAT-T")) -natt_mode:value("force-natt", translate("Force use of NAT-T")) -natt_mode:value("cisco-udp", translate("Cisco UDP encapsulation")) - -enable_no_enc = section:taboption("general", Flag, "enable_no_enc", - translate("Disable Encryption"), - translate("If checked, encryption is disabled")) -enable_no_enc.default = enable_no_enc.disabled - -enable_single_des = section:taboption("general", Flag, "enable_single_des", - translate("Enable Single DES"), - translate("If checked, 1DES is enabled")) -enable_no_enc.default = enable_single_des.disabled - -dpd_idle = section:taboption("general", Value, "dpd_idle", translate("DPD Idle Timeout")) -dpd_idle.datatype = "uinteger" -dpd_idle.placeholder = "600" - -ifname = section:taboption("general", Value, "target_network", translate("Target network")) -port.placeholder = "0.0.0.0/0" -port.datatype = "network" - -defaultroute = section:taboption("general", ListValue, "defaultroute", - translate("Default Route"), - translate("Set VPN as Default Route")) -defaultroute:value("0", translate("No")) -defaultroute:value("1", translate("Yes")) diff --git a/protocols/luci-proto-wireguard/luasrc/model/cbi/admin_network/proto_wireguard.lua b/protocols/luci-proto-wireguard/luasrc/model/cbi/admin_network/proto_wireguard.lua deleted file mode 100644 index 64e256a51..000000000 --- a/protocols/luci-proto-wireguard/luasrc/model/cbi/admin_network/proto_wireguard.lua +++ /dev/null @@ -1,179 +0,0 @@ --- Copyright 2016-2017 Dan Luedtke --- Licensed to the public under the Apache License 2.0. - - -local map, section, net = ... -local ifname = net:get_interface():name() -local private_key, listen_port -local metric, mtu, preshared_key, description -local peers, public_key, allowed_ips, endpoint, persistent_keepalive - - --- general --------------------------------------------------------------------- - -private_key = section:taboption( - "general", - Value, - "private_key", - translate("Private Key"), - translate("Required. Base64-encoded private key for this interface.") -) -private_key.password = true -private_key.datatype = "and(base64,rangelength(44,44))" -private_key.optional = false - - -listen_port = section:taboption( - "general", - Value, - "listen_port", - translate("Listen Port"), - translate("Optional. UDP port used for outgoing and incoming packets.") -) -listen_port.datatype = "port" -listen_port.placeholder = translate("random") -listen_port.optional = true - -addresses = section:taboption( - "general", - DynamicList, - "addresses", - translate("IP Addresses"), - translate("Recommended. IP addresses of the WireGuard interface.") -) -addresses.datatype = "ipaddr" -addresses.optional = true - - --- advanced -------------------------------------------------------------------- - -metric = section:taboption( - "advanced", - Value, - "metric", - translate("Metric"), - translate("Optional") -) -metric.datatype = "uinteger" -metric.placeholder = "0" -metric.optional = true - - -mtu = section:taboption( - "advanced", - Value, - "mtu", - translate("MTU"), - translate("Optional. Maximum Transmission Unit of tunnel interface.") -) -mtu.datatype = "range(1280,1420)" -mtu.placeholder = "1420" -mtu.optional = true - -fwmark = section:taboption( - "advanced", - Value, - "fwmark", - translate("Firewall Mark"), - translate("Optional. 32-bit mark for outgoing encrypted packets. " .. - "Enter value in hex, starting with 0x.") -) -fwmark.datatype = "hex(4)" -fwmark.optional = true - - --- peers ----------------------------------------------------------------------- - -peers = map:section( - TypedSection, - "wireguard_" .. ifname, - translate("Peers"), - translate("Further information about WireGuard interfaces and peers " .. - "at wireguard.com.") -) -peers.template = "cbi/tsection" -peers.anonymous = true -peers.addremove = true - - -description = peers:option( - Value, - "description", - translate("Description"), - translate("Optional. Description of peer.")) -description.placeholder = "My Peer" -description.datatype = "string" -description.optional = true - - -public_key = peers:option( - Value, - "public_key", - translate("Public Key"), - translate("Required. Base64-encoded public key of peer.") -) -public_key.datatype = "and(base64,rangelength(44,44))" -public_key.optional = false - - -preshared_key = peers:option( - Value, - "preshared_key", - translate("Preshared Key"), - translate("Optional. Base64-encoded preshared key. " .. - "Adds in an additional layer of symmetric-key " .. - "cryptography for post-quantum resistance.") -) -preshared_key.password = true -preshared_key.datatype = "and(base64,rangelength(44,44))" -preshared_key.optional = true - - -allowed_ips = peers:option( - DynamicList, - "allowed_ips", - translate("Allowed IPs"), - translate("Required. IP addresses and prefixes that this peer is allowed " .. - "to use inside the tunnel. Usually the peer's tunnel IP " .. - "addresses and the networks the peer routes through the tunnel.") -) -allowed_ips.datatype = "ipaddr" -allowed_ips.optional = false - - -route_allowed_ips = peers:option( - Flag, - "route_allowed_ips", - translate("Route Allowed IPs"), - translate("Optional. Create routes for Allowed IPs for this peer.") -) - - -endpoint_host = peers:option( - Value, - "endpoint_host", - translate("Endpoint Host"), - translate("Optional. Host of peer. Names are resolved " .. - "prior to bringing up the interface.")) -endpoint_host.placeholder = "vpn.example.com" -endpoint_host.datatype = "host" - - -endpoint_port = peers:option( - Value, - "endpoint_port", - translate("Endpoint Port"), - translate("Optional. Port of peer.")) -endpoint_port.placeholder = "51820" -endpoint_port.datatype = "port" - - -persistent_keepalive = peers:option( - Value, - "persistent_keepalive", - translate("Persistent Keep Alive"), - translate("Optional. Seconds between keep alive messages. " .. - "Default is 0 (disabled). Recommended value if " .. - "this device is behind a NAT is 25.")) -persistent_keepalive.datatype = "range(0,65535)" -persistent_keepalive.placeholder = "0"