Maint: decouple OpenVPN config writer from loop

This commit is contained in:
Quentin McGaw (desktop)
2021-08-18 15:35:07 +00:00
parent 6a545aa088
commit da30ae287f
4 changed files with 38 additions and 38 deletions

View File

@@ -5,8 +5,12 @@ import (
"strings"
)
func (l *Loop) writeOpenvpnConf(lines []string) error {
file, err := os.OpenFile(l.targetConfPath, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644)
type ConfigWriter interface {
WriteConfig(lines []string) error
}
func (c *configurator) WriteConfig(lines []string) error {
file, err := os.OpenFile(c.configPath, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644)
if err != nil {
return err
}