Maint: use narrower interfaces for firewall config

This commit is contained in:
Quentin McGaw (desktop)
2021-07-26 16:07:50 +00:00
parent 430512dd27
commit 7a222923c7
19 changed files with 29 additions and 24 deletions

View File

@@ -37,7 +37,7 @@ type Loop struct {
targetConfPath string
// Configurators
conf StarterAuthWriter
fw firewall.Configurator
fw firewallConfigurer
routing routing.Routing
// Other objects
logger, pfLogger logging.Logger
@@ -54,13 +54,18 @@ type Loop struct {
backoffTime time.Duration
}
type firewallConfigurer interface {
firewall.VPNConnectionSetter
firewall.PortAllower
}
const (
defaultBackoffTime = 15 * time.Second
)
func NewLoop(settings configuration.OpenVPN,
username string, puid, pgid int, allServers models.AllServers,
conf Configurator, fw firewall.Configurator, routing routing.Routing,
conf Configurator, fw firewallConfigurer, routing routing.Routing,
logger logging.ParentLogger, client *http.Client,
tunnelReady chan<- struct{}) *Loop {
start := make(chan struct{})