SHARE
TWEET

Untitled

a guest Oct 29th, 2017 18 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package main
  2.  
  3. import (
  4.  
  5.     "fmt"
  6.     "time"
  7.     "io/ioutil"
  8.     "math/rand"
  9.     "net/http"
  10.     "net/url"
  11. )
  12.  
  13. func randInt(len int) int {
  14.     rand.Seed(time.Now().Unix())
  15.  
  16.     return rand.Intn(len)
  17. }
  18.  
  19. func main() {
  20.  
  21.  
  22.     randoms := []string {
  23.       "http://37.57.241.120:8888",
  24.       "http://5.228.54.34:8081",
  25.       "http://35.161.5.60:3128",
  26.       "http://200.164.114.202:8080",
  27.       "http://84.200.85.55:8888",
  28.       "http://90.188.43.30:3128",
  29.       "http://103.56.114.90:80",
  30.       "http://195.80.140.212:8081",
  31.     }
  32.     best_ua := randInt(len(randoms))
  33.  
  34.     fmt.Println(best_ua)
  35.    
  36.    
  37.     proxyUrl, err := url.Parse(randoms[best_ua])
  38.     httpClient := &http.Client { Transport: &http.Transport { Proxy: http.ProxyURL(proxyUrl) } }
  39.     response, err := httpClient.Get("http://2ip.ru")
  40.     if err != nil {
  41.         fmt.Println(err.Error())
  42.     } else {
  43.         body, _ := ioutil.ReadAll(response.Body)
  44.         fmt.Println("OK: ", len(body))
  45.         fmt.Println(response.Header)
  46.     }
  47.  
  48. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top