utils.go 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package utils
  2. import "gitee.com/nanqis/bigtires/big"
  3. /**
  4. 获取一个呼风云代理IP
  5. 返回:
  6. proxyip:代理IP:端口
  7. user:代理账号,非IP白名单的情况下需要使用
  8. password:代理密码,非IP白名单的情况下需要使用
  9. realip:真实IP
  10. */
  11. func GetProxyIpHuFengYun() (proxyip string, user string, password string, realip string) {
  12. temp := ""
  13. for proxyip == "" || proxyip == ":" {
  14. temp, _, _, _ = big.HttpSend(&big.HttpParms{Url: "http://pool.hufengyun.com/tunnel?id=1035423500007204235&secret=ZUEhEEzhbW4ujJNe&format=json&city=0&num=1"})
  15. proxyip = big.StrGetSub(temp, "proxy_ip\":\"", "\"") + ":" + big.StrGetSub(temp, "proxy_port\":", ",\"")
  16. }
  17. user = "2021052001605121442"
  18. password = "ZUEhEEzhbW4ujJNe"
  19. realip = big.StrGetSub(temp, "real_ip\":\"", "\"")
  20. return
  21. }
  22. /**
  23. 获取一个芝麻代理
  24. 返回:
  25. proxyip:代理ip:端口
  26. */
  27. func GetProxyIpZhiMa() (proxyip string) {
  28. temp := ""
  29. for proxyip == "" || proxyip == ":" {
  30. temp, _, _, _ = big.HttpSend(&big.HttpParms{Url: "http://webapi.http.zhimacangku.com/getip?num=1&type=2&pro=0&city=0&yys=0&port=1&time=1&ts=1&ys=1&cs=1&lb=1&sb=0&pb=45&mr=2&regions="})
  31. proxyip = big.StrGetSub(temp, "\"ip\":\"", "\",") + ":" + big.StrGetSub(temp, "port\":", ",\"")
  32. }
  33. return
  34. }
  35. /**
  36. 获取一个亿牛云代理
  37. 返回:
  38. proxyip:代理ip:端口
  39. */
  40. func GetProxyIpNiuYun() string {
  41. res, _, _, _ := big.HttpSend(&big.HttpParms{
  42. Url: "http://120.79.71.17:9090/agent/getip",
  43. Mode: "POST",
  44. })
  45. res = big.StrGetSub(res, "http://", "\"")
  46. return res
  47. }