diff --git a/internal/runner/options.go b/internal/runner/options.go index 9bdd93a..c7cd014 100644 --- a/internal/runner/options.go +++ b/internal/runner/options.go @@ -1,6 +1,7 @@ package runner import ( + "errors" "math" "os" "path/filepath" @@ -142,6 +143,10 @@ func ParseOptions() (*Options, error) { readFlagsConfig(flagSet, options.ConfigDir) } + if len(options.UpstreamHTTPProxies) > 0 && len(options.UpstreamSOCKS5Proxies) > 0 { + return nil, errors.New("can't use upstream HTTP proxies and upstream SOCKS5 proxies at the same time") + } + if cfgFile != "" { if !fileutil.FileExists(cfgFile) { gologger.Fatal().Msgf("given config file '%s' does not exist", cfgFile) diff --git a/internal/runner/runner.go b/internal/runner/runner.go index 6f27352..8f37b03 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -112,7 +112,8 @@ func (r *Runner) Run() error { if len(r.options.UpstreamHTTPProxies) > 0 { gologger.Info().Msgf("Using upstream HTTP proxies: %s\n", r.options.UpstreamHTTPProxies) - } else if len(r.options.UpstreamSOCKS5Proxies) > 0 { + } + if len(r.options.UpstreamSOCKS5Proxies) > 0 { gologger.Info().Msgf("Using upstream SOCKS5 proxies: %s\n", r.options.UpstreamSOCKS5Proxies) } diff --git a/proxy.go b/proxy.go index f46e26a..ff35e89 100644 --- a/proxy.go +++ b/proxy.go @@ -523,7 +523,8 @@ func (p *Proxy) getRoundTripper() (http.RoundTripper, error) { roundtrip = &http.Transport{Proxy: func(req *http.Request) (*url.URL, error) { return url.Parse(p.rbHTTP.Next()) }, TLSClientConfig: &tls.Config{InsecureSkipVerify: true}} - } else if len(p.options.UpstreamSOCKS5Proxies) > 0 { + } + if len(p.options.UpstreamSOCKS5Proxies) > 0 { // for each socks5 proxy create a dialer socks5Dialers := make(map[string]proxy.Dialer) for _, socks5Proxy := range p.options.UpstreamSOCKS5Proxies {