luci2: add network protocol support extensions
[project/luci2/ui.git] / luci2 / htdocs / luci2 / proto / 6rd.js
diff --git a/luci2/htdocs/luci2/proto/6rd.js b/luci2/htdocs/luci2/proto/6rd.js
new file mode 100644 (file)
index 0000000..47f6d29
--- /dev/null
@@ -0,0 +1,63 @@
+L.NetworkModel.Protocol.extend({
+       protocol:    '6rd',
+       description: L.tr('IPv6-over-IPv4 (6rd)'),
+       tunnel:      true,
+       virtual:     true,
+
+       populateForm: function(section, iface)
+       {
+               var wan = L.NetworkModel.findWAN();
+
+               section.taboption('general', L.cbi.InputValue, 'peeraddr', {
+                       caption:     L.tr('6RD Gateway'),
+                       datatype:    'ip4addr',
+                       optional:    false
+               });
+
+               section.taboption('general', L.cbi.InputValue, 'ipaddr', {
+                       caption:     L.tr('Local IPv4 address'),
+                       description: L.tr('Leave empty to use the current WAN address'),
+                       datatype:    'ip4addr',
+                       placeholder: wan ? wan.getIPv4Addrs()[0] : undefined,
+                       optional:    true
+               });
+
+               section.taboption('general', L.cbi.InputValue, 'ip4prefixlen', {
+                       caption:     L.tr('IPv4 prefix length'),
+                       description: L.tr('The length of the IPv4 prefix in bits, the remainder is used in the IPv6 addresses'),
+                       datatype:    'range(0, 32)',
+                       placeholder: 0,
+                       optional:    true
+               });
+
+               section.taboption('general', L.cbi.InputValue, 'ip6prefix', {
+                       caption:     L.tr('IPv6 prefix'),
+                       description: L.tr('The IPv6 prefix assigned to the provider, usually ends with "::"'),
+                       datatype:    'ip6addr',
+                       optional:    false
+               });
+
+               section.taboption('general', L.cbi.InputValue, 'ip6prefixlen', {
+                       caption:     L.tr('IPv6 prefix length'),
+                       description: L.tr('The length of the IPv6 prefix in bits'),
+                       datatype:    'range(0, 128)',
+                       placeholder: 16,
+                       optional:    true
+               });
+
+               section.taboption('advanced', L.cbi.CheckboxValue, 'defaultroute', {
+                       caption:     L.tr('Default route'),
+                       description: L.tr('Create IPv6 default route via tunnel'),
+                       optional:    true,
+                       initial:     true
+               });
+
+               section.taboption('advanced', L.cbi.InputValue, 'ttl', {
+                       caption:     L.tr('Override TTL'),
+                       description: L.tr('Specifies the Time-to-Live on the tunnel interface'),
+                       datatype:    'range(1,255)',
+                       placeholder: 64,
+                       optional:    true
+               });
+       }
+});