Giter Site home page Giter Site logo

proxysampler's Introduction

ProxySampler. CLI tool for testing & measuring the health of proxy tunnels.

ProxySampler is a tool for testing proxies and measuring their performance & health.

How can I use this?

Use this tool to check the performance and health of proxy tunnels. Test massive lists or one-off proxies.

PacketStream customers can use this tool as part of their automation tooling to get metrics on which residential proxy sessions/geolocations are performing more reliably and prioritize those sessions.

We use this tool internally at PacketStream as part of our infrastructure monitoring toolset to keep an eye on the the health of our proxy tunnel and trigger alerts if something doesn't seem right.

Installation

Go

go get -u github.com/packetstream/proxysampler

Usage and options

You provide the proxy server, port, and auth information. ProxySampler tests the proxy tunnel(s) and returns information about the response codes and response times.

ProxySampler is straightforward to use and has a few cli arguments for configuration.

Usage: 
  proxysampler [OPTIONS]

Application Options:
  --output {json|yaml|plaintext}    Default is plaintext.
  --include-response-body           Include response bodies in JSON/YAML output. Disabled by default.
  --file {/path/to/file.txt}        Relative/absolute path to a file containing a list of proxies.
  --proxy {proxy info}              Test a single proxy tunnel. Example: https://proxyuser:[email protected]:31111
  --endpoint {https://example.com}  The endpoint that you want to use for testing.
  --max-threads {10}                Number of concurrent threads to use for testing proxy. Default is 10.
  --delay {50}                      Delay in ms between each request. Default is 50.

Help Options
  --help, -h                        Show this screen.

Usage examples

Testing a single PacketStream residential proxy with a US exit IP. JSON output.
proxysampler --output json --proxy https://proxyuser:[email protected]:31111 --endpoint https://example.com
{
  "success": 1,
  "fail": 0,
  "average_ttfb": 221,
  "results": [
    {
      "proxy": "https://proxyuser:[email protected]:31111",
      "endpoint": "https://example.com",
      "status_code": 200,
      "latency": {
        "ttfb": 221,
        "connect": 34,
        "tls_handshake": 23
      },
      "error": null
    }
  ]
}
Testing a list of PacketStream residential proxies from a file. JSON output. Include response bodies.
proxysampler --output json --file ./proxies.txt --endpoint https://ifconfig.co/json --include-response-body
{
  "success": 3,
  "fail": 0,
  "average_ttfb": 693,
  "results": [
    {
      "proxy": "https://proxyuser:[email protected]:31111",
      "endpoint": "https://ifconfig.co/json",
      "status_code": 200,
			"response_body": "{\"ip\":\"47.149.139.253\",\"ip_decimal\":798329853,\"country\":\"United States\",\"country_eu\":false,\"country_iso\":\"US\",\"city\":\"Torrance\",\"latitude\":33.846,\"longitude\":-118.3456,\"asn\":\"AS5650\",\"asn_org\":\"Frontier Communications of America, Inc.\"}",
      "latency": {
        "ttfb": 552,
        "connect": 29,
        "tls_handshake": 141
      },
      "error": null
    },
    {
      "proxy": "https://proxyuser:[email protected]:31111",
      "endpoint": "https://ifconfig.co/json",
      "status_code": 200,
      "response_body": "{\"ip\":\"63.237.69.254\",\"ip_decimal\":1072514558,\"country\":\"United States\",\"country_eu\":false,\"country_iso\":\"US\",\"city\":\"Walkersville\",\"hostname\":\"ssl.clarkconstruction.com\",\"latitude\":39.4787,\"longitude\":-77.3484,\"asn\":\"AS16431\",\"asn_org\":\"The Clark Construction Group, Inc.\"}",
      "latency": {
        "ttfb": 534,
        "connect": 28,
        "tls_handshake": 114
      },
      "error": null
    },
    {
      "proxy": "https://proxyuser:[email protected]:31111",
      "endpoint": "https://ifconfig.co/json",
      "status_code": 200,
      "response_body": "{\"ip\":\"24.167.234.46\",\"ip_decimal\":413657646,\"country\":\"United States\",\"country_eu\":false,\"country_iso\":\"US\",\"city\":\"Milwaukee\",\"hostname\":\"cpe-24-167-234-46.wi.res.rr.com\",\"latitude\":43.1166,\"longitude\":-87.9904,\"asn\":\"AS10796\",\"asn_org\":\"Charter Communications Inc\"}",
      "latency": {
        "ttfb": 993,
        "connect": 27,
        "tls_handshake": 272
      },
      "error": null
    }
  ]
}

Contributing

We'd love to accept your improvements! Feel free to fork & submit a pull-request if you'd like to make changes.

About PacketStream

PacketStream is a residential proxy network that enables businesses to access the web through a pool of residential IPs. With PacketStream, you can gather data, scrape websites, and perform other web-related tasks with requests originating from real residential ISPs all over the world.

For more information, visit PacketStream.io.

proxysampler's People

Contributors

rdbell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

proxysampler's Issues

Proxy samples fail

When trying to test some proxies, which I know are working and have the right credentials from through running in my program.

I get the following when running the command:
proxysampler --output json --proxy https://myusername:RanD0mPassWord_country-SomeWhere_session-01@ipaddress:31112 --endpoint https://ifconfig.co/json

Resulting in:

{"success":0,"fail":1,"average_ttfb":0,"results":[{"proxy":"https://myusername:RanD0mPassWord_country-SomeWhere_session-01@ipaddress:31112","endpoint":"https://ifconfig.co/json","status_code":-1,"latency":{"ttfb":0,"connect":87,"tls_handshake":35086},"error":{"Op":"proxyconnect","Net":"tcp","Source":null,"Addr":null,"Err":{}}}]}

Same goes for using an input file, although proxy is slightly different from input in the result

{
"success": 0,
"fail": 1,
"average_ttfb": 0,
"results": [
{
"proxy": "https://myusername:RanD0mPassWord_country-SomeWhere_session-01@ipaddress:31112",
"endpoint": "https://ifconfig.co/json",
"status_code": -1,
"latency": {
"ttfb": 0,
"connect": 88,
"tls_handshake": 35086
},
"error": {
"Op": "proxyconnect",
"Net": "tcp",
"Source": null,
"Addr": null,
"Err": {}
}
}
]
}

Redundant tests

When using --file, the script seems to skip some proxies while testing other proxies multiple times. In my experimentation, it seems to be the last proxy listed in the file provided that is tested multiple times.

The fork from @petr-tichy doesn't seem to have this problem.

You may wish to incorporate some of his/her changes!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.