Closed abzcoding closed 4 years ago
we can have socks5 proxy support
usage:
hget -proxy "127.0.0.1:12345" https://releases.ubuntu.com/20.04.1/ubuntu-20.04.1-desktop-amd64.iso
we can also use the env and forget about the flag, something like this:
proxyServer, isSet := os.LookupEnv("HTTP_PROXY") if isSet { proxyUrl, err := url.Parse(proxyServer) if err == nil { dialer, err = proxy.FromURL(proxyUrl, proxy.Direct) }else if strings.HasPrefix("socks5://"){ socksProxy := strings.Replace(proxyUrl, "socks5://", "", -1) dialer, err := proxy.SOCKS5("tcp", socksProxy, nil, proxy.Direct) } }
let me know if you prefer the second method, so i can update the code accordingly
we can have socks5 proxy support
usage:
we can also use the env and forget about the flag, something like this:
let me know if you prefer the second method, so i can update the code accordingly