Exemplo n.º 1
0
func socksClient(ip string, block *Block) *http.Client {
	dialSocksProxy := socks.DialSocksProxy(socks.SOCKS5, ip, time.Second*10)
	tr := &http.Transport{Dial: dialSocksProxy, ResponseHeaderTimeout: time.Second * 10}
	return &http.Client{
		Transport: tr,
		CheckRedirect: func(req *http.Request, via []*http.Request) error {
			log.Println("redirect to:", req.URL.String(), ip)
			block.block(ip)
			return errors.New("does not allow redirect")
		},
	}
}
Exemplo n.º 2
0
func socksClient(ip string) *http.Client {
	dialSocksProxy := socks.DialSocksProxy(socks.SOCKS5, ip, time.Second*10)
	tr := &http.Transport{Dial: dialSocksProxy, ResponseHeaderTimeout: time.Second * 10}
	return &http.Client{Transport: tr}
}
Exemplo n.º 3
0
func socksClient(ip string, tp int) *http.Client {
	dialSocksProxy := socks.DialSocksProxy(tp, ip, time.Second*2)
	tr := &http.Transport{Dial: dialSocksProxy}
	return &http.Client{Transport: tr}
}