Maint: move custom config files to custom package
This commit is contained in:
@@ -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 {
|
||||
@@ -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{
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user