GithubHelp home page GithubHelp logo

ip2location / ip2proxy-c Goto Github PK

View Code? Open in Web Editor NEW
12.0 8.0 6.0 7.66 MB

To detect proxy servers with country, region, city, ISP and proxy type information using IP2Proxy binary database.

Home Page: http://www.ip2location.com

License: MIT License

Makefile 6.19% Shell 86.13% C 7.07% M4 0.28% Roff 0.34%
ip2proxy proxy vpn tor anonymous-proxy c ip2location ip2proxy-database proxy-database

ip2proxy-c's Introduction

IP2Proxy C Library

To detect proxy servers with country, region, city, ISP and proxy type information using IP2Proxy binary database.

IP2Proxy database contains a list of daily-updated IP addresses which are being used as VPN servers, open proxies, web proxies, Tor exit nodes, search engine robots, data center ranges, residential proxies, consumer privacy networks, and enterprise private networks. The database includes records for IPv4 addresses.

You can access to the commercial databases from https://www.ip2location.com/proxy-database or use the free IP2Proxy LITE database from http://lite.ip2location.com

For more details, please visit: http://www.ip2location.com/ip2proxy/developers/c

Developer Documentation

To learn more about installation, usage, and code examples, please visit the developer documentation at https://ip2proxy-c.readthedocs.io/en/latest/index.html.

Testing

cd test
./test-IP2Proxy

Sample BIN Databases

IP2Proxy CLI

Query an IP address and display the result

ip2proxy -d [IP2PROXY BIN DATA PATH] --ip [IP ADDRESS]

Query all IP addresses from an input file and display the result

ip2proxy -d [IP2PROXY BIN DATA PATH] -i [INPUT FILE PATH]

Query all IP addresses from an input file and display the result in XML format

ip2proxy -d [IP2PROXY BIN DATA PATH] -i [INPUT FILE PATH] --format XML

Support

Email: [email protected].
URL: https://www.ip2location.com

ip2proxy-c's People

Contributors

bearknocks avatar chrislim2888 avatar ip2location avatar mailboxvalidator avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ip2proxy-c's Issues

./configure isn't executable

./configure probably shouldn't committed, but as it is, and isn't executable, the linux command in the README fails:

autoreconf -i -v --force
./configure
make

running it using sh configure or with chmod +x configure first works

Memory keeps growing

I use the following code to initialize g_ip2proxy:

     g_ip2proxy = IP2Proxy_open((char*)"../etc/IP2PROXY-IP-PROXYTYPE-COUNTRY.BIN");
    if(g_ip2proxy == nullptr){
         printf("ERROR: open ../etc/IP2PROXY-IP-PROXYTYPE-COUNTRY.BIN failure\n");
    }
    int ret = IP2Proxy_open_mem(g_ip2proxy,IP2PROXY_FILE_IO);
    if(ret == -1){
        printf("ERROR: IP2Proxy_open_mem failure\n");
    }

Then use the following code to determine whether it is a proxy:


bool is_proxy(const std::string &ip)
{
    if(ip == "")
        return true;

    IP2ProxyRecord *record = nullptr;
    record = IP2Proxy_is_proxy(g_ip2proxy, (char*)ip.c_str());
    if(record != nullptr){
        if(record->is_proxy == nullptr) {
            IP2Proxy_free_record(record);
            return false;
        }
        bool is_proxy = ('0' != record->is_proxy[0]);
        IP2Proxy_free_record(record);
        return is_proxy;
    }
    return false;
}

But after running for an hour or two, the memory grows 3-4GB, and it keeps rising

The size of the file "../etc/IP2PROXY-IP-PROXYTYPE-COUNTRY.BIN" is 219791489 bytes

How can I reduce memory usage?

DLL in Windows

Hello, I could not figure out how to load the generated .lib after nmake in Windows (10), so I compiled the DLL following these steps:

  1. add __declspec(dllexport) to the public functions
  2. Just run this cl /nologo /DWIN32 /DWIN64 /I libIP2Proxy /LD /Tp libIP2Proxy/IP2Proxy.c Ws2_32.lib

The generated DLL can be passed as argument as this

db = ip2proxy_python_c.IP2Proxy(libraryname=dllpath)

Additionally, it would be nice to specify that to run that .bat you need actually microsoft visual studio with the python extension. Also you should run the .bat to set the env to 64 or 32 bit as wished. Finally, to run nmake you have to do add a flag to specify which file: nmake /A /f Makefile.win

Build fails on Windows with MSVC

I've tried to build the library on Windows with MSVC, but since libIP2Proxy/IP2Proxy_DB.c is missing, nmake fails. Do I need to get that file from somewhere else, or is that just a leftover in Makefile.win?

ip2proxy module error rate is high

Hello,

We are using ip2proxy-c with nginx build with https://github.com/ip2location/ip2proxy-nginx with PX4 database.

We tested with both shared_memory and cache_memory database loading options and the failure rate (C library returning IP2Proxy_is_proxy value -1) is high, 10 to 30 %. This happens randomly, apparently, meaning that the same IP gets the correct IP2Proxy_is_proxy value and all the ip2proxy variables in 70 to 90 % of the cases and the error IP2Proxy_is_proxy=-1 in the rest of the cases.

We tested under multiple loads, the rate is almost the same.
We tested on multiple configurations (4 CPU 8 GB RAM, 8 CPU 24 GB RAM) and the results are similar.

For all the tests mentioned in this issue I used PX4 version released on December 06, 2018

The module and the nginx are built as rpms, I can provide the rpms if needed for testing if you cannot reproduce.

Test 1:

server: centos7 with nginx 1.13.12 build with ip2proxy and ip2location modules with 4 CPUs and 24 GB RAM
Calls from IP address: 52.44.56.77 (it should return IP2Proxy_is_proxy value 2)
rate: 500 req/second
result: IP2Proxy_is_proxy returns 2 for 70% of the calls, and -1 for 30% of the calls

Test 2:

server: centos7 with nginx 1.13.12 build with ip2proxy and ip2location modules with 4 CPUs and 24 GB RAM
Calls from IP address: 103.246.77.77 (it should return IP2Proxy_is_proxy value 0)
rate: 500 req/second
result: IP2Proxy_is_proxy returns 0 for 90% of the calls, and -1 for 10% of the calls

Ambiguous licensing

COPYING claims the license would be LGPL, but LICENSE.TXT states it would be MIT. According to 993851c is seems MIT is intended. Could you please clarify?

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.