treewide: remove rendundant proto handler options
[project/luci.git] / protocols / luci-proto-ipv6 / htdocs / luci-static / resources / protocol / 6to4.js
1 'use strict';
2 'require form';
3 'require network';
4
5 network.registerPatternVirtual(/^6to4-.+$/);
6
7 return network.registerProtocol('6to4', {
8 getI18n: function() {
9 return _('IPv6-over-IPv4 (6to4)');
10 },
11
12 getIfname: function() {
13 return this._ubus('l3_device') || '6to4-%s'.format(this.sid);
14 },
15
16 getOpkgPackage: function() {
17 return '6rd';
18 },
19
20 isFloating: function() {
21 return true;
22 },
23
24 isVirtual: function() {
25 return true;
26 },
27
28 getDevices: function() {
29 return null;
30 },
31
32 containsDevice: function(ifname) {
33 return (network.getIfnameOf(ifname) == this.getIfname());
34 },
35
36 renderFormOptions: function(s) {
37 var o;
38
39 o = s.taboption('general', form.Value, 'ipaddr', _('Local IPv4 address'), _('Leave empty to use the current WAN address'));
40 o.datatype = 'ip4addr("nomask")';
41 o.load = function(section_id) {
42 return network.getWANNetworks().then(L.bind(function(nets) {
43 if (nets.length)
44 this.placeholder = nets[0].getIPAddr();
45 return form.Value.prototype.load.apply(this, [section_id]);
46 }, this));
47 };
48
49 o = s.taboption('advanced', form.Value, 'ttl', _('Use TTL on tunnel interface'));
50 o.placeholder = '64';
51 o.datatype = 'range(1,255)';
52
53 o = s.taboption('advanced', form.Value, 'mtu', _('Use MTU on tunnel interface'));
54 o.placeholder = '1280';
55 o.datatype = 'max(9200)';
56 }
57 });