Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

curl --socks5 127.0.0.1:1080 url #38

Open
kzhui125 opened this issue Nov 2, 2020 · 0 comments
Open

curl --socks5 127.0.0.1:1080 url #38

kzhui125 opened this issue Nov 2, 2020 · 0 comments

Comments

@kzhui125
Copy link

kzhui125 commented Nov 2, 2020

curl --socks5 127.0.0.1:1080 http://xyz.com
	proxyUrl, err := url.Parse("socks5://127.0.0.1:1080")
	httpClient := &http.Client{Transport: &http.Transport{Proxy: http.ProxyURL(proxyUrl)}}
	u := "http://xyz.com"
	req, err := http.NewRequest("GET", u, nil)
	if err != nil {
		panic(err)
	}
	resp, err := httpClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		panic(err)
	}
	log.Println(string(body))
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant