luci2: implement Class.require() and Class.instantiate()
[project/luci2/ui.git] / luci2 / htdocs / luci2 / proto / 6rd.js
1 L.NetworkModel.Protocol.extend({
2         protocol:    '6rd',
3         description: L.tr('IPv6-over-IPv4 (6rd)'),
4         tunnel:      true,
5         virtual:     true,
6
7         populateForm: function(section, iface)
8         {
9                 var wan = L.NetworkModel.findWAN();
10
11                 section.taboption('general', L.cbi.InputValue, 'peeraddr', {
12                         caption:     L.tr('6RD Gateway'),
13                         datatype:    'ip4addr',
14                         optional:    false
15                 });
16
17                 section.taboption('general', L.cbi.InputValue, 'ipaddr', {
18                         caption:     L.tr('Local IPv4 address'),
19                         description: L.tr('Leave empty to use the current WAN address'),
20                         datatype:    'ip4addr',
21                         placeholder: wan ? wan.getIPv4Addrs()[0] : undefined,
22                         optional:    true
23                 });
24
25                 section.taboption('general', L.cbi.InputValue, 'ip4prefixlen', {
26                         caption:     L.tr('IPv4 prefix length'),
27                         description: L.tr('The length of the IPv4 prefix in bits, the remainder is used in the IPv6 addresses'),
28                         datatype:    'range(0, 32)',
29                         placeholder: 0,
30                         optional:    true
31                 });
32
33                 section.taboption('general', L.cbi.InputValue, 'ip6prefix', {
34                         caption:     L.tr('IPv6 prefix'),
35                         description: L.tr('The IPv6 prefix assigned to the provider, usually ends with "::"'),
36                         datatype:    'ip6addr',
37                         optional:    false
38                 });
39
40                 section.taboption('general', L.cbi.InputValue, 'ip6prefixlen', {
41                         caption:     L.tr('IPv6 prefix length'),
42                         description: L.tr('The length of the IPv6 prefix in bits'),
43                         datatype:    'range(0, 128)',
44                         placeholder: 16,
45                         optional:    true
46                 });
47
48                 section.taboption('advanced', L.cbi.CheckboxValue, 'defaultroute', {
49                         caption:     L.tr('Default route'),
50                         description: L.tr('Create IPv6 default route via tunnel'),
51                         optional:    true,
52                         initial:     true
53                 });
54
55                 section.taboption('advanced', L.cbi.InputValue, 'ttl', {
56                         caption:     L.tr('Override TTL'),
57                         description: L.tr('Specifies the Time-to-Live on the tunnel interface'),
58                         datatype:    'range(1,255)',
59                         placeholder: 64,
60                         optional:    true
61                 });
62         }
63 });