luci2: add missing depends to OpenWrt Makefile
[project/luci2/ui.git] / luci2 / htdocs / luci2 / proto / 6in4.js
1 L.network.Protocol.extend({
2         protocol:    '6in4',
3         description: L.tr('IPv6-in-IPv4 (RFC4213)'),
4         tunnel:      true,
5         virtual:     true,
6
7         populateForm: function(section, iface)
8         {
9                 var wan = L.network.findWAN();
10
11                 section.taboption('general', L.cbi.InputValue, 'ipaddr', {
12                         caption:     L.tr('Local IPv4 address'),
13                         description: L.tr('Leave empty to use the current WAN address'),
14                         datatype:    'ip4addr',
15                         placeholder: wan ? wan.getIPv4Addrs()[0] : undefined,
16                         optional:    true
17                 });
18
19                 section.taboption('general', L.cbi.InputValue, 'peeraddr', {
20                         caption:     L.tr('Remote IPv4 address'),
21                         description: L.tr('This is usually the address of the nearest PoP operated by the tunnel broker'),
22                         datatype:    'ip4addr',
23                         optional:    false
24                 });
25
26                 section.taboption('general', L.cbi.InputValue, 'ip6addr', {
27                         caption:     L.tr('Local IPv6 address'),
28                         description: L.tr('This is the local endpoint address assigned by the tunnel broker'),
29                         datatype:    'cidr6',
30                         optional:    false
31                 });
32
33                 section.taboption('general', L.cbi.InputValue, 'ip6prefix', {
34                         caption:     L.tr('IPv6 routed prefix'),
35                         description: L.tr('This is the prefix routed to you by the tunnel broker for use by clients'),
36                         datatype:    'cidr6',
37                         optional:    true
38                 });
39
40                 var update = section.taboption('general', L.cbi.CheckboxValue, '_update', {
41                         caption:     L.tr('Dynamic tunnel'),
42                         description: L.tr('Enable HE.net dynamic endpoint update'),
43                         enabled:     '1',
44                         disabled:    '0'
45                 });
46
47                 update.save = function(sid) { };
48                 update.ucivalue = function(sid) {
49                         var n = parseInt(this.ownerMap.get('network', sid, 'tunnelid'));
50                         return !isNaN(n);
51                 };
52
53                 section.taboption('general', L.cbi.InputValue, 'tunnelid', {
54                         caption:     L.tr('Tunnel ID'),
55                         datatype:    'uinteger',
56                         optional:    false,
57                         keep:        false
58                 }).depends('_update', true);
59
60                 section.taboption('general', L.cbi.InputValue, 'username', {
61                         caption:     L.tr('HE.net user ID'),
62                         description: L.tr('The login name of the HE.net account'),
63                         datatype:    'string',
64                         optional:    false,
65                         keep:        false
66                 }).depends('_update', true);
67
68                 section.taboption('general', L.cbi.PasswordValue, 'password', {
69                         caption:     L.tr('Password'),
70                         description: L.tr('Tunnel update key or HE.net account password'),
71                         optional:    false,
72                         keep:        false
73                 }).depends('_update', true);
74
75                 section.taboption('advanced', L.cbi.CheckboxValue, 'defaultroute', {
76                         caption:     L.tr('Default route'),
77                         description: L.tr('Create IPv6 default route via tunnel'),
78                         optional:    true,
79                         initial:     true
80                 });
81
82                 section.taboption('advanced', L.cbi.InputValue, 'ttl', {
83                         caption:     L.tr('Override TTL'),
84                         description: L.tr('Specifies the Time-to-Live on the tunnel interface'),
85                         datatype:    'range(1,255)',
86                         placeholder: 64,
87                         optional:    true
88                 });
89         }
90 });