luci/protocols/luci-proto-xfrm/htdocs/luci-static/resources/protocol/xfrm.js
Glen Huang 9b02d5b776 luci-proto-xfrm: add xfrm proto support
Signed-off-by: Glen Huang <heyhgl@gmail.com>
2022-01-19 22:35:33 +08:00

51 lines
1.1 KiB
JavaScript

'use strict';
'require uci';
'require form';
'require network';
'require tools.widgets as widgets';
return network.registerProtocol('xfrm', {
getI18n: function() {
return _('IPsec XFRM');
},
getIfname: function() {
return this._ubus('l3_device') || this.sid;
},
getOpkgPackage: function() {
return 'xfrm';
},
isFloating: function() {
return true;
},
isVirtual: function() {
return true;
},
getDevice: function() {
return null;
},
containsDevice: function(ifname) {
return (network.getIfnameOf(ifname) == this.getIfname());
},
renderFormOptions: function(s) {
var o, ss;
o = s.taboption('general', form.Value, 'ifid', _('Interface ID'), _('Required. XFRM interface ID to be used for SA.'));
o.datatype = 'integer';
o = s.taboption('general', widgets.NetworkSelect, 'tunlink', _('Required. Underlying interface.'));
o.exclude = s.section;
o.nocreate = true;
o = s.taboption('general', form.Value, 'mtu', _('MTU'), _('Optional. Maximum Transmission Unit of the XFRM interface.'));
o.datatype = 'range(68,65535)';
o.placeholder = '1280';
o.optional = true;
}
});