Maint: move OpenVPN configurator to openvpn/config
This commit is contained in:
@@ -23,6 +23,7 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/httpproxy"
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
"github.com/qdm12/gluetun/internal/openvpn"
|
||||
openvpnconfig "github.com/qdm12/gluetun/internal/openvpn/config"
|
||||
"github.com/qdm12/gluetun/internal/portforward"
|
||||
"github.com/qdm12/gluetun/internal/publicip"
|
||||
"github.com/qdm12/gluetun/internal/routing"
|
||||
@@ -142,7 +143,7 @@ func _main(ctx context.Context, buildInfo models.BuildInformation,
|
||||
httpClient := &http.Client{Timeout: clientTimeout}
|
||||
// Create configurators
|
||||
alpineConf := alpine.New()
|
||||
ovpnConf := openvpn.NewConfigurator(
|
||||
ovpnConf := openvpnconfig.NewConfigurator(
|
||||
logger.NewChild(logging.Settings{Prefix: "openvpn configurator: "}),
|
||||
cmder, puid, pgid)
|
||||
dnsCrypto := dnscrypto.New(httpClient, "", "")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package openvpn
|
||||
package config
|
||||
|
||||
import (
|
||||
"io"
|
||||
@@ -1,4 +1,4 @@
|
||||
package openvpn
|
||||
package config
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -1,11 +1,11 @@
|
||||
package openvpn
|
||||
package config
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type ConfigWriter interface {
|
||||
type Writer interface {
|
||||
WriteConfig(lines []string) error
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
// Package openvpn defines interfaces to interact with openvpn
|
||||
// and run it in a stateful loop.
|
||||
package openvpn
|
||||
package config
|
||||
|
||||
import (
|
||||
"github.com/qdm12/gluetun/internal/constants"
|
||||
@@ -12,7 +10,7 @@ type Configurator interface {
|
||||
VersionGetter
|
||||
AuthWriter
|
||||
Starter
|
||||
ConfigWriter
|
||||
Writer
|
||||
}
|
||||
|
||||
type configurator struct {
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/firewall"
|
||||
"github.com/qdm12/gluetun/internal/loopstate"
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
"github.com/qdm12/gluetun/internal/openvpn/config"
|
||||
"github.com/qdm12/gluetun/internal/openvpn/state"
|
||||
"github.com/qdm12/gluetun/internal/portforward"
|
||||
"github.com/qdm12/gluetun/internal/publicip"
|
||||
@@ -34,7 +35,7 @@ type Loop struct {
|
||||
buildInfo models.BuildInformation
|
||||
versionInfo bool
|
||||
// Configurators
|
||||
conf Configurator
|
||||
conf config.Configurator
|
||||
fw firewallConfigurer
|
||||
routing routing.VPNGetter
|
||||
portForward portforward.StartStopper
|
||||
@@ -64,7 +65,7 @@ const (
|
||||
|
||||
func NewLoop(openVPNSettings configuration.OpenVPN,
|
||||
providerSettings configuration.Provider,
|
||||
allServers models.AllServers, conf Configurator,
|
||||
allServers models.AllServers, conf config.Configurator,
|
||||
fw firewallConfigurer, routing routing.VPNGetter,
|
||||
portForward portforward.StartStopper,
|
||||
publicip publicip.Looper, dnsLooper dns.Looper,
|
||||
|
||||
Reference in New Issue
Block a user