diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-08-20 15:31:35 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-09-10 15:28:16 +0200 |
commit | 6a2a53a82918ea2ccbbbe23510aa0279827b2783 (patch) | |
tree | 7f065f96cc0f255ced7256c1d9092f0e1433fda0 /protocols/luci-proto-vpnc/htdocs/luci-static | |
parent | 0674fc20414e575c346ceb2066ff3af7e8601a48 (diff) |
protocols: add client side protocol handler implementations
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'protocols/luci-proto-vpnc/htdocs/luci-static')
-rw-r--r-- | protocols/luci-proto-vpnc/htdocs/luci-static/resources/protocol/vpnc.js | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/protocols/luci-proto-vpnc/htdocs/luci-static/resources/protocol/vpnc.js b/protocols/luci-proto-vpnc/htdocs/luci-static/resources/protocol/vpnc.js new file mode 100644 index 0000000000..87ccc9df1c --- /dev/null +++ b/protocols/luci-proto-vpnc/htdocs/luci-static/resources/protocol/vpnc.js @@ -0,0 +1,111 @@ +'use strict'; +'require form'; +'require network'; + +network.registerPatternVirtual(/^vpn-.+$/); + +return network.registerProtocol('vpnc', { + getI18n: function() { + return _('VPNC (CISCO 3000 (and others) VPN)'); + }, + + getIfname: function() { + return this._ubus('l3_device') || 'vpn-%s'.format(this.sid); + }, + + getOpkgPackage: function() { + return 'vpnc'; + }, + + isFloating: function() { + return true; + }, + + isVirtual: function() { + return true; + }, + + getDevices: function() { + return null; + }, + + containsDevice: function(ifname) { + return (network.getIfnameOf(ifname) == this.getIfname()); + }, + + renderFormOptions: function(s) { + var o; + + o = s.taboption('general', form.Value, 'server', _('VPN Server')); + o.datatype = 'host(0)'; + + o = s.taboption('general', form.Value, 'local_addr', _('VPN Local address')); + o.placeholder = '0.0.0.0'; + o.datatype = 'ipaddr'; + + o = s.taboption('general', form.Value, 'local_port', _('VPN Local port')); + o.placeholder = '500'; + o.datatype = 'port'; + + o = s.taboption('general', form.Value, 'interface', _('Output Interface')); + o.template = 'cbi/network_netlist'; + + o = s.taboption('general', form.Value, 'mtu', _('MTU')); + o.datatype = 'uinteger'; + + s.taboption('general', form.Value, 'username', _('Username')); + + o = s.taboption('general', form.Value, 'password', _('Password')); + o.password = true; + + o = s.taboption('general', form.Value, 'hexpassword', _('Obfuscated Password')); + o.password = true; + + s.taboption('general', form.Value, 'authgroup', _('Auth Group')); + + o = s.taboption('general', form.Value, 'passgroup', _('Group Password')); + o.password = true; + + o = s.taboption('general', form.Value, 'hexpassgroup', _('Obfuscated Group Password')); + o.password= true; + + s.taboption('general', form.Value, 'domain', _('NT Domain')); + s.taboption('general', form.Value, 'vendor', _('Vendor')); + + o = s.taboption('general', form.ListValue, 'dh_group', _('IKE DH Group')); + o.value('dh2'); + o.value('dh1'); + o.value('dh5'); + + o = s.taboption('general', form.ListValue, 'pfs', _('Perfect Forward Secrecy')); + o.value('server'); + o.value('nopfs'); + o.value('dh1'); + o.value('dh2'); + o.value('dh5'); + + o = s.taboption('general', form.ListValue, 'natt_mode', _('NAT-T Mode')); + o.value('natt', _('RFC3947 NAT-T mode')); + o.value('none', _('No NAT-T')); + o.value('force-natt', _('Force use of NAT-T')); + o.value('cisco-udp', _('Cisco UDP encapsulation')); + + o = s.taboption('general', form.Flag, 'enable_no_enc', _('Disable Encryption'), _('If checked, encryption is disabled')); + o.default = o.disabled; + + o = s.taboption('general', form.Flag, 'enable_single_des', _('Enable Single DES'), _('If checked, 1DES is enabled')); + o.default = o.disabled; + + o = s.taboption('general', form.Value, 'dpd_idle', _('DPD Idle Timeout')); + o.datatype = 'uinteger'; + o.placeholder = '600'; + + o = s.taboption('general', form.Value, 'target_network', _('Target network')); + o.placeholder = '0.0.0.0/0'; + o.datatype = 'network'; + + o = s.taboption('general', form.ListValue, 'defaultroute', _('Default Route'), _('Set VPN as Default Route')); + o.value('0', _('No')); + o.value('1', _('Yes')); + } +}); |