diff --git a/internal/configuration/settings/socks5.go b/internal/configuration/settings/socks5.go index f9b0cdc5..7c2cc115 100644 --- a/internal/configuration/settings/socks5.go +++ b/internal/configuration/settings/socks5.go @@ -1,6 +1,7 @@ package settings import ( + "errors" "fmt" "os" @@ -24,6 +25,13 @@ func (s Socks5) validate() (err error) { return fmt.Errorf("server listening address is not valid: %w", err) } + switch { + case *s.Username != "" && *s.Password == "": + return errors.New("password must be set if username is set") + case *s.Username == "" && *s.Password != "": + return errors.New("username must be set if password is set") + } + return nil } diff --git a/internal/socks5/loop.go b/internal/socks5/loop.go index ada4051f..18b77bff 100644 --- a/internal/socks5/loop.go +++ b/internal/socks5/loop.go @@ -35,11 +35,10 @@ func (l *Loop) Start(_ context.Context) (runError <-chan error, err error) { runDone := make(chan error) l.runDone = runDone - runErrorCh := make(chan error) go run(runCtx, runDone, l.settings) - return runErrorCh, nil + return nil, nil //nolint:nilnil } func run(ctx context.Context, done chan<- error, settings Settings) {