Files
gluetun/internal/shadowsocks/shadowsocks.go

30 lines
819 B
Go
Raw Normal View History

package shadowsocks
import (
2020-04-19 18:13:48 +00:00
"context"
"io"
"github.com/qdm12/golibs/command"
"github.com/qdm12/golibs/files"
"github.com/qdm12/golibs/logging"
)
type Configurator interface {
2020-04-19 18:13:48 +00:00
Version(ctx context.Context) (string, error)
MakeConf(port uint16, password, method string, uid, gid int) (err error)
2020-04-19 18:13:48 +00:00
Start(ctx context.Context, server string, port uint16, password string, log bool) (stdout, stderr io.ReadCloser, waitFn func() error, err error)
}
type configurator struct {
fileManager files.FileManager
logger logging.Logger
commander command.Commander
}
func NewConfigurator(fileManager files.FileManager, logger logging.Logger) Configurator {
2020-04-12 19:07:19 +00:00
return &configurator{
fileManager: fileManager,
logger: logger.WithPrefix("shadowsocks configurator: "),
commander: command.NewCommander()}
}