Git Product home page Git Product logo

proxylist's Introduction

Proxylist

Build Status Go Report Card Codecov GitHub

Library for working with proxy lists

Install

go get github.com/NovikovRoman/proxylist/v3

Usage

Download proxy list:

p := proxylist.NewList()
bad, err := p.FromFile("proxylist.txt", proxylist.Ip4)
// or bad, err := p.FromFileIP4("filename")
if err != nil {
    panic(err)
}

or

p := proxylist.NewList()
f, err := os.Open("proxylist.txt")
if err != nil {
    panic(err)
}

bad, err := p.FromReader(f, proxylist.Ip4)
// or bad, err := p.FromReaderIP4(f)
if err != nil {
    panic(err)
}

bad - contains an array of invalid proxies (erroneous URL). err - error reading/opening file/io.Reader.

The loaded a list shuffled.

Get a free proxy:

resource := "site.com" // any resource name using a proxy
proxy := p.GetFreeIP4(resource)
// or proxy := p.GetFree(resource, proxylist.Ip4)
if proxy == nil {
    panic("No free proxies.")
}

After using the proxy, you need to free it:

resource := "site.com" // any resource name using a proxy
p.SetFreeIP4(resource, proxy)
// or p.SetFree(resource, proxylist.Ip4)

Total number of proxies:

p.NumIP4()
// or p.Num(proxylist.Ip4)

Number of free proxies:

resource := "site.com" // any resource name using a proxy
p.NumFreeIP4(resource)
// or p.NumFree(resource, proxylist.Ip4)

Number of busy proxies:

resource := "site.com" // any resource name using a proxy
p.NumBusyIP4(resource)
// or p.NumBusy(resource, proxylist.Ip4)

Tests

go test -race -v

License

MIT License © Roman Novikov

proxylist's People

Contributors

novikovroman avatar

Stargazers

 avatar Lubomir Anastasov avatar

Watchers

James Cloos avatar  avatar

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.