Merge pull request #5960 from hnyman/proto-unetd
luci-proto-unet: initial support
This commit is contained in:
commit
2650d79f18
2 changed files with 63 additions and 0 deletions
15
protocols/luci-proto-unet/Makefile
Normal file
15
protocols/luci-proto-unet/Makefile
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#
|
||||||
|
# Copyright (C) 2022 Hannu Nyman <hannu.nyman@iki.fi>
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||||
|
#
|
||||||
|
|
||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
LUCI_TITLE:=Support for unetd VPN
|
||||||
|
LUCI_DEPENDS:=+unetd +unet-cli
|
||||||
|
LUCI_PKGARCH:=all
|
||||||
|
|
||||||
|
include ../../luci.mk
|
||||||
|
|
||||||
|
# call BuildPackage - OpenWrt buildroot signature
|
|
@ -0,0 +1,48 @@
|
||||||
|
'use strict';
|
||||||
|
'require form';
|
||||||
|
'require network';
|
||||||
|
'require tools.widgets as widgets';
|
||||||
|
|
||||||
|
return network.registerProtocol('unet', {
|
||||||
|
getI18n: function() {
|
||||||
|
return _('Unet');
|
||||||
|
},
|
||||||
|
|
||||||
|
getIfname: function() {
|
||||||
|
return this._ubus('l3_device') || this.sid;
|
||||||
|
},
|
||||||
|
|
||||||
|
getOpkgPackage: function() {
|
||||||
|
return 'unetd';
|
||||||
|
},
|
||||||
|
|
||||||
|
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.DummyValue, 'device', _('Name of the tunnel device'));
|
||||||
|
o.optional = false;
|
||||||
|
|
||||||
|
o = s.taboption('general', form.DummyValue, 'key', _('Local wireguard key'));
|
||||||
|
o.optional = false;
|
||||||
|
|
||||||
|
o = s.taboption('general', form.DummyValue, 'auth_key', _('Key used to sign network config'));
|
||||||
|
o.optional = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
Loading…
Reference in a new issue