Files
gluetun/internal/tinyproxy/command.go

28 lines
698 B
Go
Raw Normal View History

package tinyproxy
import (
2020-04-19 18:13:48 +00:00
"context"
"fmt"
"io"
"strings"
)
2020-04-19 18:13:48 +00:00
func (c *configurator) Start(ctx context.Context) (stdout io.ReadCloser, waitFn func() error, err error) {
2020-04-12 19:07:19 +00:00
c.logger.Info("starting tinyproxy server")
2020-04-19 18:13:48 +00:00
stdout, _, waitFn, err = c.commander.Start(ctx, "tinyproxy", "-d")
return stdout, waitFn, err
}
// Version obtains the version of the installed Tinyproxy server
2020-04-19 18:13:48 +00:00
func (c *configurator) Version(ctx context.Context) (string, error) {
output, err := c.commander.Run(ctx, "tinyproxy", "-v")
if err != nil {
return "", err
}
words := strings.Fields(output)
if len(words) < 2 {
return "", fmt.Errorf("tinyproxy -v: output is too short: %q", output)
}
return words[1], nil
}