chore(deps): bump gosettings and govalid
This commit is contained in:
4
go.mod
4
go.mod
@@ -8,11 +8,11 @@ require (
|
|||||||
github.com/golang/mock v1.6.0
|
github.com/golang/mock v1.6.0
|
||||||
github.com/qdm12/dns v1.11.0
|
github.com/qdm12/dns v1.11.0
|
||||||
github.com/qdm12/golibs v0.0.0-20210822203818-5c568b0777b6
|
github.com/qdm12/golibs v0.0.0-20210822203818-5c568b0777b6
|
||||||
github.com/qdm12/gosettings v0.2.0
|
github.com/qdm12/gosettings v0.3.0-rc3
|
||||||
github.com/qdm12/goshutdown v0.3.0
|
github.com/qdm12/goshutdown v0.3.0
|
||||||
github.com/qdm12/gosplash v0.1.0
|
github.com/qdm12/gosplash v0.1.0
|
||||||
github.com/qdm12/gotree v0.2.0
|
github.com/qdm12/gotree v0.2.0
|
||||||
github.com/qdm12/govalid v0.1.0
|
github.com/qdm12/govalid v0.2.0-rc1
|
||||||
github.com/qdm12/log v0.1.0
|
github.com/qdm12/log v0.1.0
|
||||||
github.com/qdm12/ss-server v0.4.0
|
github.com/qdm12/ss-server v0.4.0
|
||||||
github.com/qdm12/updated v0.0.0-20210603204757-205acfe6937e
|
github.com/qdm12/updated v0.0.0-20210603204757-205acfe6937e
|
||||||
|
|||||||
4
go.sum
4
go.sum
@@ -93,6 +93,8 @@ github.com/qdm12/golibs v0.0.0-20210822203818-5c568b0777b6 h1:bge5AL7cjHJMPz+5IO
|
|||||||
github.com/qdm12/golibs v0.0.0-20210822203818-5c568b0777b6/go.mod h1:6aRbg4Z/bTbm9JfxsGXfWKHi7zsOvPfUTK1S5HuAFKg=
|
github.com/qdm12/golibs v0.0.0-20210822203818-5c568b0777b6/go.mod h1:6aRbg4Z/bTbm9JfxsGXfWKHi7zsOvPfUTK1S5HuAFKg=
|
||||||
github.com/qdm12/gosettings v0.2.0 h1:Q/4s0t8k9e3MSKMM5oMUIE3UGrdd+U2+qR8rTgiKRvA=
|
github.com/qdm12/gosettings v0.2.0 h1:Q/4s0t8k9e3MSKMM5oMUIE3UGrdd+U2+qR8rTgiKRvA=
|
||||||
github.com/qdm12/gosettings v0.2.0/go.mod h1:GptXlJVLQxfWznSlgc+pNo3JGnp+f2AKEv0tq/U7igU=
|
github.com/qdm12/gosettings v0.2.0/go.mod h1:GptXlJVLQxfWznSlgc+pNo3JGnp+f2AKEv0tq/U7igU=
|
||||||
|
github.com/qdm12/gosettings v0.3.0-rc3 h1:ySstdo7i3h5z6iJ6R96YykC+JuluaVqncHxsFzndyUI=
|
||||||
|
github.com/qdm12/gosettings v0.3.0-rc3/go.mod h1:+hHzN8lsE63T01t6SruGzc6xkpvfsZFod/ooDs8FWnQ=
|
||||||
github.com/qdm12/goshutdown v0.3.0 h1:pqBpJkdwlZlfTEx4QHtS8u8CXx6pG0fVo6S1N0MpSEM=
|
github.com/qdm12/goshutdown v0.3.0 h1:pqBpJkdwlZlfTEx4QHtS8u8CXx6pG0fVo6S1N0MpSEM=
|
||||||
github.com/qdm12/goshutdown v0.3.0/go.mod h1:EqZ46No00kCTZ5qzdd3qIzY6ayhMt24QI8Mh8LVQYmM=
|
github.com/qdm12/goshutdown v0.3.0/go.mod h1:EqZ46No00kCTZ5qzdd3qIzY6ayhMt24QI8Mh8LVQYmM=
|
||||||
github.com/qdm12/gosplash v0.1.0 h1:Sfl+zIjFZFP7b0iqf2l5UkmEY97XBnaKkH3FNY6Gf7g=
|
github.com/qdm12/gosplash v0.1.0 h1:Sfl+zIjFZFP7b0iqf2l5UkmEY97XBnaKkH3FNY6Gf7g=
|
||||||
@@ -101,6 +103,8 @@ github.com/qdm12/gotree v0.2.0 h1:+58ltxkNLUyHtATFereAcOjBVfY6ETqRex8XK90Fb/c=
|
|||||||
github.com/qdm12/gotree v0.2.0/go.mod h1:1SdFaqKZuI46U1apbXIf25pDMNnrPuYLEqMF/qL4lY4=
|
github.com/qdm12/gotree v0.2.0/go.mod h1:1SdFaqKZuI46U1apbXIf25pDMNnrPuYLEqMF/qL4lY4=
|
||||||
github.com/qdm12/govalid v0.1.0 h1:UIFVmuaAg0Q+h0GeyfcFEZ5sQ5KJPvRQwycC1/cqDN8=
|
github.com/qdm12/govalid v0.1.0 h1:UIFVmuaAg0Q+h0GeyfcFEZ5sQ5KJPvRQwycC1/cqDN8=
|
||||||
github.com/qdm12/govalid v0.1.0/go.mod h1:CyS/OEQdOvunBgrtIsW93fjd4jBkwZPBjGSpxq3NwA4=
|
github.com/qdm12/govalid v0.1.0/go.mod h1:CyS/OEQdOvunBgrtIsW93fjd4jBkwZPBjGSpxq3NwA4=
|
||||||
|
github.com/qdm12/govalid v0.2.0-rc1 h1:4iYQvU4ibrASgzelsEgZX4JyKX3UTB/DcHObzQ7BXtw=
|
||||||
|
github.com/qdm12/govalid v0.2.0-rc1/go.mod h1:/uWzVWMuS71wmbsVnlUxpQiy6EAXqm8eQ2RbyA72roQ=
|
||||||
github.com/qdm12/log v0.1.0 h1:jYBd/xscHYpblzZAd2kjZp2YmuYHjAAfbTViJWxoPTw=
|
github.com/qdm12/log v0.1.0 h1:jYBd/xscHYpblzZAd2kjZp2YmuYHjAAfbTViJWxoPTw=
|
||||||
github.com/qdm12/log v0.1.0/go.mod h1:Vchi5M8uBvHfPNIblN4mjXn/oSbiWguQIbsgF1zdQPI=
|
github.com/qdm12/log v0.1.0/go.mod h1:Vchi5M8uBvHfPNIblN4mjXn/oSbiWguQIbsgF1zdQPI=
|
||||||
github.com/qdm12/ss-server v0.4.0 h1:lMMYfDGc9P86Lyvd3+p8lK4hhgHUKDzjZC91FqJYkDU=
|
github.com/qdm12/ss-server v0.4.0 h1:lMMYfDGc9P86Lyvd3+p8lK4hhgHUKDzjZC91FqJYkDU=
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ type Health struct {
|
|||||||
|
|
||||||
func (h Health) Validate() (err error) {
|
func (h Health) Validate() (err error) {
|
||||||
uid := os.Getuid()
|
uid := os.Getuid()
|
||||||
_, err = address.Validate(h.ServerAddress,
|
err = address.Validate(h.ServerAddress,
|
||||||
address.OptionListening(uid))
|
address.OptionListening(uid))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("server listening address is not valid: %w", err)
|
return fmt.Errorf("server listening address is not valid: %w", err)
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ func (h HTTPProxy) validate() (err error) {
|
|||||||
// Do not validate user and password
|
// Do not validate user and password
|
||||||
|
|
||||||
uid := os.Getuid()
|
uid := os.Getuid()
|
||||||
_, err = address.Validate(h.ListeningAddress, address.OptionListening(uid))
|
err = address.Validate(h.ListeningAddress, address.OptionListening(uid))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("%w: %s", ErrServerAddressNotValid, h.ListeningAddress)
|
return fmt.Errorf("%w: %s", ErrServerAddressNotValid, h.ListeningAddress)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,12 +38,7 @@ func (s *Source) readDNSBlacklist() (blacklist settings.DNSBlacklist, err error)
|
|||||||
|
|
||||||
func (s *Source) readBlockSurveillance() (blocked *bool, err error) {
|
func (s *Source) readBlockSurveillance() (blocked *bool, err error) {
|
||||||
key, value := s.getEnvWithRetro("BLOCK_SURVEILLANCE", "BLOCK_NSA")
|
key, value := s.getEnvWithRetro("BLOCK_SURVEILLANCE", "BLOCK_NSA")
|
||||||
if value == "" {
|
blocked, err = binary.Validate(value)
|
||||||
return nil, nil //nolint:nilnil
|
|
||||||
}
|
|
||||||
|
|
||||||
blocked = new(bool)
|
|
||||||
*blocked, err = binary.Validate(value)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("environment variable %s: %w", key, err)
|
return nil, fmt.Errorf("environment variable %s: %w", key, err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,14 +48,11 @@ func envToStringPtr(envKey string) (stringPtr *string) {
|
|||||||
|
|
||||||
func envToBoolPtr(envKey string) (boolPtr *bool, err error) {
|
func envToBoolPtr(envKey string) (boolPtr *bool, err error) {
|
||||||
s := getCleanedEnv(envKey)
|
s := getCleanedEnv(envKey)
|
||||||
if s == "" {
|
|
||||||
return nil, nil //nolint:nilnil
|
|
||||||
}
|
|
||||||
value, err := binary.Validate(s)
|
value, err := binary.Validate(s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &value, nil
|
return value, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func envToIntPtr(envKey string) (intPtr *int, err error) {
|
func envToIntPtr(envKey string) (intPtr *int, err error) {
|
||||||
|
|||||||
13
internal/configuration/sources/env/httproxy.go
vendored
13
internal/configuration/sources/env/httproxy.go
vendored
@@ -56,12 +56,7 @@ func (s *Source) readHTTProxyListeningAddress() (listeningAddress string) {
|
|||||||
|
|
||||||
func (s *Source) readHTTProxyEnabled() (enabled *bool, err error) {
|
func (s *Source) readHTTProxyEnabled() (enabled *bool, err error) {
|
||||||
key, value := s.getEnvWithRetro("HTTPPROXY", "PROXY", "TINYPROXY")
|
key, value := s.getEnvWithRetro("HTTPPROXY", "PROXY", "TINYPROXY")
|
||||||
if value == "" {
|
enabled, err = binary.Validate(value)
|
||||||
return nil, nil //nolint:nilnil
|
|
||||||
}
|
|
||||||
|
|
||||||
enabled = new(bool)
|
|
||||||
*enabled, err = binary.Validate(value)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("environment variable %s: %w", key, err)
|
return nil, fmt.Errorf("environment variable %s: %w", key, err)
|
||||||
}
|
}
|
||||||
@@ -71,9 +66,6 @@ func (s *Source) readHTTProxyEnabled() (enabled *bool, err error) {
|
|||||||
|
|
||||||
func (s *Source) readHTTProxyLog() (enabled *bool, err error) {
|
func (s *Source) readHTTProxyLog() (enabled *bool, err error) {
|
||||||
key, value := s.getEnvWithRetro("HTTPPROXY_LOG", "PROXY_LOG_LEVEL", "TINYPROXY_LOG")
|
key, value := s.getEnvWithRetro("HTTPPROXY_LOG", "PROXY_LOG_LEVEL", "TINYPROXY_LOG")
|
||||||
if value == "" {
|
|
||||||
return nil, nil //nolint:nilnil
|
|
||||||
}
|
|
||||||
|
|
||||||
var binaryOptions []binary.Option
|
var binaryOptions []binary.Option
|
||||||
if key != "HTTPROXY_LOG" {
|
if key != "HTTPROXY_LOG" {
|
||||||
@@ -81,8 +73,7 @@ func (s *Source) readHTTProxyLog() (enabled *bool, err error) {
|
|||||||
binaryOptions = append(binaryOptions, retroOption)
|
binaryOptions = append(binaryOptions, retroOption)
|
||||||
}
|
}
|
||||||
|
|
||||||
enabled = new(bool)
|
enabled, err = binary.Validate(value, binaryOptions...)
|
||||||
*enabled, err = binary.Validate(value, binaryOptions...)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("environment variable %s: %w", key, err)
|
return nil, fmt.Errorf("environment variable %s: %w", key, err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ func (s *Source) readOpenVPNProcessUser() (processUser string, err error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("environment variable %s: %w", key, err)
|
return "", fmt.Errorf("environment variable %s: %w", key, err)
|
||||||
}
|
}
|
||||||
if root {
|
if *root {
|
||||||
return "root", nil
|
return "root", nil
|
||||||
}
|
}
|
||||||
const defaultNonRootUser = "nonrootuser"
|
const defaultNonRootUser = "nonrootuser"
|
||||||
|
|||||||
7
internal/configuration/sources/env/server.go
vendored
7
internal/configuration/sources/env/server.go
vendored
@@ -20,16 +20,11 @@ func (s *Source) readControlServer() (controlServer settings.ControlServer, err
|
|||||||
|
|
||||||
func readControlServerLog() (enabled *bool, err error) {
|
func readControlServerLog() (enabled *bool, err error) {
|
||||||
s := getCleanedEnv("HTTP_CONTROL_SERVER_LOG")
|
s := getCleanedEnv("HTTP_CONTROL_SERVER_LOG")
|
||||||
if s == "" {
|
|
||||||
return nil, nil //nolint:nilnil
|
|
||||||
}
|
|
||||||
|
|
||||||
log, err := binary.Validate(s)
|
log, err := binary.Validate(s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("environment variable HTTP_CONTROL_SERVER_LOG: %w", err)
|
return nil, fmt.Errorf("environment variable HTTP_CONTROL_SERVER_LOG: %w", err)
|
||||||
}
|
}
|
||||||
|
return log, nil
|
||||||
return &log, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Source) readControlServerAddress() (address *string) {
|
func (s *Source) readControlServerAddress() (address *string) {
|
||||||
|
|||||||
@@ -22,8 +22,7 @@ func readVersionEnabled() (enabled *bool, err error) {
|
|||||||
return nil, nil //nolint:nilnil
|
return nil, nil //nolint:nilnil
|
||||||
}
|
}
|
||||||
|
|
||||||
enabled = new(bool)
|
enabled, err = binary.Validate(s)
|
||||||
*enabled, err = binary.Validate(s)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("environment variable VERSION_INFORMATION: %w", err)
|
return nil, fmt.Errorf("environment variable VERSION_INFORMATION: %w", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ var (
|
|||||||
|
|
||||||
func (s Settings) Validate() (err error) {
|
func (s Settings) Validate() (err error) {
|
||||||
uid := os.Getuid()
|
uid := os.Getuid()
|
||||||
_, err = address.Validate(s.Address, address.OptionListening(uid))
|
err = address.Validate(s.Address, address.OptionListening(uid))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user