Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- "time"
- "io/ioutil"
- "math/rand"
- "net/http"
- "net/url"
- )
- func randInt(len int) int {
- rand.Seed(time.Now().Unix())
- return rand.Intn(len)
- }
- func main() {
- randoms := []string {
- "http://37.57.241.120:8888",
- "http://5.228.54.34:8081",
- "http://35.161.5.60:3128",
- "http://200.164.114.202:8080",
- "http://84.200.85.55:8888",
- "http://90.188.43.30:3128",
- "http://103.56.114.90:80",
- "http://195.80.140.212:8081",
- }
- best_ua := randInt(len(randoms))
- fmt.Println(best_ua)
- proxyUrl, err := url.Parse(randoms[best_ua])
- httpClient := &http.Client { Transport: &http.Transport { Proxy: http.ProxyURL(proxyUrl) } }
- response, err := httpClient.Get("http://2ip.ru")
- if err != nil {
- fmt.Println(err.Error())
- } else {
- body, _ := ioutil.ReadAll(response.Body)
- fmt.Println("OK: ", len(body))
- fmt.Println(response.Header)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement