diff --git a/internal/openvpn/custom.go b/internal/openvpn/custom/custom.go similarity index 98% rename from internal/openvpn/custom.go rename to internal/openvpn/custom/custom.go index e9f29bf6..6514b6c8 100644 --- a/internal/openvpn/custom.go +++ b/internal/openvpn/custom/custom.go @@ -1,4 +1,4 @@ -package openvpn +package custom import ( "errors" @@ -20,7 +20,7 @@ var ( errExtractConnection = errors.New("cannot extract connection from custom configuration file") ) -func processCustomConfig(settings configuration.OpenVPN) ( +func ProcessCustomConfig(settings configuration.OpenVPN) ( lines []string, connection models.OpenVPNConnection, err error) { lines, err = readCustomConfigLines(settings.Config) if err != nil { diff --git a/internal/openvpn/custom_test.go b/internal/openvpn/custom/custom_test.go similarity index 98% rename from internal/openvpn/custom_test.go rename to internal/openvpn/custom/custom_test.go index 313e532e..3c60365a 100644 --- a/internal/openvpn/custom_test.go +++ b/internal/openvpn/custom/custom_test.go @@ -1,4 +1,4 @@ -package openvpn +package custom import ( "errors" @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/require" ) -func Test_processCustomConfig(t *testing.T) { +func Test_ProcessCustomConfig(t *testing.T) { t.Parallel() file, err := os.CreateTemp("", "") @@ -33,7 +33,7 @@ func Test_processCustomConfig(t *testing.T) { Config: file.Name(), } - lines, connection, err := processCustomConfig(settings) + lines, connection, err := ProcessCustomConfig(settings) assert.NoError(t, err) expectedLines := []string{ diff --git a/internal/openvpn/run.go b/internal/openvpn/run.go index e3215f98..c749ca58 100644 --- a/internal/openvpn/run.go +++ b/internal/openvpn/run.go @@ -6,6 +6,7 @@ import ( "github.com/qdm12/gluetun/internal/constants" "github.com/qdm12/gluetun/internal/models" + "github.com/qdm12/gluetun/internal/openvpn/custom" "github.com/qdm12/gluetun/internal/provider" ) @@ -36,7 +37,7 @@ func (l *Loop) Run(ctx context.Context, done chan<- struct{}) { lines = providerConf.BuildConf(connection, openVPNSettings) } } else { - lines, connection, err = processCustomConfig(openVPNSettings) + lines, connection, err = custom.ProcessCustomConfig(openVPNSettings) } if err != nil { l.crashed(ctx, err)