Maint: dynamically set allowed VPN input ports

- Feat: allow to change VPN type at runtime
- Feat: allow to change interface name at runtime
- Maint: Add cleanup method to cleanup VPN loop on a vpn shutdown
- Change: allow VPN inputs ports only when tunnel is up
This commit is contained in:
Quentin McGaw (desktop)
2021-09-13 00:50:20 +00:00
parent 19bf62c21f
commit 40342619e7
6 changed files with 49 additions and 30 deletions

View File

@@ -34,8 +34,9 @@ type Loop struct {
statusManager loopstate.Manager
state state.Manager
// Fixed parameters
buildInfo models.BuildInformation
versionInfo bool
buildInfo models.BuildInformation
versionInfo bool
vpnInputPorts []uint16 // TODO make changeable through stateful firewall
// Configurators
openvpnConf openvpn.Interface
netLinker netlink.NetLinker
@@ -67,7 +68,7 @@ const (
defaultBackoffTime = 15 * time.Second
)
func NewLoop(vpnSettings configuration.VPN,
func NewLoop(vpnSettings configuration.VPN, vpnInputPorts []uint16,
allServers models.AllServers, openvpnConf openvpn.Interface,
netLinker netlink.NetLinker, fw firewallConfigurer, routing routing.VPNGetter,
portForward portforward.StartStopper, starter command.Starter,
@@ -87,6 +88,7 @@ func NewLoop(vpnSettings configuration.VPN,
state: state,
buildInfo: buildInfo,
versionInfo: versionInfo,
vpnInputPorts: vpnInputPorts,
openvpnConf: openvpnConf,
netLinker: netLinker,
fw: fw,