2021-08-19 13:31:12 +00:00
|
|
|
package openvpn
|
2020-02-06 20:42:46 -05:00
|
|
|
|
|
|
|
|
import (
|
2021-07-23 16:06:19 +00:00
|
|
|
"github.com/qdm12/gluetun/internal/constants"
|
2020-02-06 20:42:46 -05:00
|
|
|
"github.com/qdm12/golibs/command"
|
|
|
|
|
"github.com/qdm12/golibs/logging"
|
|
|
|
|
)
|
|
|
|
|
|
2021-08-18 21:16:28 +00:00
|
|
|
var _ Interface = (*Configurator)(nil)
|
|
|
|
|
|
2021-08-18 20:28:42 +00:00
|
|
|
type Interface interface {
|
2021-07-26 16:03:04 +00:00
|
|
|
VersionGetter
|
|
|
|
|
AuthWriter
|
2021-08-18 21:16:28 +00:00
|
|
|
Runner
|
2021-08-18 20:23:50 +00:00
|
|
|
Writer
|
2020-02-06 20:42:46 -05:00
|
|
|
}
|
|
|
|
|
|
2021-08-18 20:28:42 +00:00
|
|
|
type Configurator struct {
|
2021-07-23 16:06:19 +00:00
|
|
|
logger logging.Logger
|
2021-07-24 17:59:22 +00:00
|
|
|
cmder command.RunStarter
|
2021-08-18 15:35:07 +00:00
|
|
|
configPath string
|
2021-07-23 16:06:19 +00:00
|
|
|
authFilePath string
|
2021-08-18 15:44:58 +00:00
|
|
|
puid, pgid int
|
2020-02-06 20:42:46 -05:00
|
|
|
}
|
|
|
|
|
|
2021-08-18 20:28:42 +00:00
|
|
|
func New(logger logging.Logger,
|
|
|
|
|
cmder command.RunStarter, puid, pgid int) *Configurator {
|
|
|
|
|
return &Configurator{
|
2021-07-23 16:06:19 +00:00
|
|
|
logger: logger,
|
2021-07-24 17:59:22 +00:00
|
|
|
cmder: cmder,
|
2021-08-18 15:35:07 +00:00
|
|
|
configPath: constants.OpenVPNConf,
|
2021-07-23 16:06:19 +00:00
|
|
|
authFilePath: constants.OpenVPNAuthConf,
|
2021-08-18 15:44:58 +00:00
|
|
|
puid: puid,
|
|
|
|
|
pgid: pgid,
|
2020-02-06 20:42:46 -05:00
|
|
|
}
|
|
|
|
|
}
|