Coder Social home page Coder Social logo

antoniojmsjr / ipgeolocation Goto Github PK

View Code? Open in Web Editor NEW
34.0 6.0 11.0 768 KB

Biblioteca de geolocalização por IP.

License: Apache License 2.0

C++ 0.52% Pascal 99.48%
delphi ipgeolocation ip2location ipstack ipify ipapi ipinfo ipwhois ipdig api pascal

ipgeolocation's Introduction

Maintained YES Memory Leak Verified YES Release Stars Forks Issues
Compatibility Delphi Supported Versions

IPGeolocation

IPGeoLocation

Biblioteca de geolocalização por IP.

Implementado na linguagem Delphi, utiliza o conceito de fluent interface para guiar no uso da biblioteca.
Biblioteca desenvolvida utilizando os principais players do mercado de solução de "IP-Geolocation", em anexo a lista dos provedores homologados.

O que é a geolocalização de IP?

A geolocalização baseada em endereços IP é uma técnica usada para estimar a localização geográfica de um dispositivo conectado à Internet usando o endereço IP do mesmo. Este mecanismo depende de que o endereço IP do dispositivo apareça em um banco de dados com sua respectiva localização, endereço postal, cidade, país, região ou coordenadas geográficas, que são alguns dos níveis de detalhe que podem ser registrados.

Para mais informações: Geolocalização de IPs

Para que?

Essa tecnologia é amplamente usada em:

  • Geo Marketing

    • Propagandas direcionadas/sob medida
    • Informação interessante com base na localização
    • Promoções/campanhas destinadas a certo público/local
    • Empresas de turismo, companhias aéreas, redes hoteleiras
    • Entretenimento
  • Direcionamento de conteúdo

    • Portais “globais” com conteúdos “locais”
    • Informações no idioma do leitor
    • Conteúdo de interesse local (notícia, novidades, etc)
    • Portais de notícias
    • Serviços de informação meteorológica
    • Serviços de emergência
  • Controle de acesso (à conteúdos/serviços)

    • Restringir acesso conteúdo/serviços com base na “localização” do usuário
    • Conteúdos específicos para determinado “público”
    • Censura
    • Jogos online
    • Streaming vídeos/músicas
  • Segurança

    • Restringir tráfego, por localização do usuário
    • Em situação de emergência/ataque descartar tráfego “não esperado”
    • Controle de SPAM
    • Firewalls

Provedores Homologados

Provedor Site API Free Requests
IP2Location https://www.ip2location.com https://api.ip2location.com/v2 10.000 yearthly
IPGeolocation https://ipgeolocation.io https://api.ipgeolocation.io/ipgeo 1.500 daily
IPStack https://ipstack.com http://api.ipstack.com 10.000 monthly
IPIfy https://geo.ipify.org https://geo.ipify.org/api/v1 1.000 monthly
IPAPI https://ipapi.com http://api.ipapi.com/api 10.000 yearthly
IPInfo https://ipinfo.io https://ipinfo.io 50.000 monthly
IPGeolocationAPI https://ipgeolocationapi.com https://api.ipgeolocationapi.com/geolocate Unlimited
IPWhois https://ipwhois.io http://ipwhois.app 10.000 monthly
IPDig https://ipdig.io https://ipdig.io Unlimited
IPData https://ipdata.co https://api.ipdata.co 1.500 daily
IPLabstack https://labstack.com/ip https://ip.labstack.com/api/v1 10.000 monthly
IPTwist https://iptwist.com https://iptwist.com 1.000 monthly
IP-API https://ip-api.com http://ip-api.com Unlimited
DB-IP https://db-ip.com http://api.db-ip.com/v2 Unlimited

Instalação Automatizada

Utilizando o Boss (Dependency anager for Delphi) é possível instalar a biblioteca de forma automática.

boss install github.com/antoniojmsjr/IPGeoLocation

Instalação Manual:

Project > Options > Delphi Compiler > Target > All Configurations > Search path

..\IPGeoLocation\Source

Uso

uses IPGeoLocation, IPGeoLocation.Interfaces, IPGeoLocation.Types;
var
  lMsgError: string;
  lGeoLocation: IGeoLocation;
begin

  try
    lGeoLocation := TIPGeoLocation.New
      .IP['201.86.220.241']
      .Provider[TIPGeoLocationProviderKind.IPInfo]
        //.SetTimeout(5000) //[OPCIONAL]
        //.SetAPIKey('TOKEN') //[OPCIONAL]: VERIFICAR ARQUIVO: APIKey.inc
      .Request
        //.SetResultLanguageCode('pt-br') //[OPCIONAL]
        .Execute;

    Application.MessageBox(PWideChar(lGeoLocation.ToJSON), 'JSON', MB_OK + MB_ICONINFORMATION); //JSON COM O RESULTADO DA GEOLOCALIZAÇÃO
  except
    on E: EIPGeoLocationRequestException do
    begin
      lMsgError := Concat(lMsgError, Format('IP: %s', [E.IP]), sLineBreak);
      lMsgError := Concat(lMsgError, Format('IPVersion: %s', [E.IPVersion]), sLineBreak);      
      lMsgError := Concat(lMsgError, Format('Provider: %s', [E.Provider]), sLineBreak);
      lMsgError := Concat(lMsgError, Format('DateTime: %s', [DateTimeTostr(E.DateTime)]), sLineBreak);
      lMsgError := Concat(lMsgError, Format('Kind: %s', [E.Kind.AsString]), sLineBreak);
      lMsgError := Concat(lMsgError, Format('URL: %s', [E.URL]), sLineBreak);
      lMsgError := Concat(lMsgError, Format('Method: %s', [E.Method]), sLineBreak);
      lMsgError := Concat(lMsgError, Format('Status Code: %d', [E.StatusCode]), sLineBreak);
      lMsgError := Concat(lMsgError, Format('Status Text: %s', [E.StatusText]), sLineBreak);
      lMsgError := Concat(lMsgError, Format('Message: %s', [E.Message]));

      Application.MessageBox(PWideChar(lMsgError), 'A T E N Ç Ã O', MB_OK + MB_ICONERROR);
    end;
    on E: Exception do
    begin
      Application.MessageBox(PWideChar(E.Message), 'A T E N Ç Ã O', MB_OK + MB_ICONERROR);
    end;
  end;

end;

Demo

Download IP Geolocalização

Youtube

Vídeo Youtube

Licença

IPGeoLocation is free and open-source software licensed under the License

ipgeolocation's People

Contributors

antoniojmsjr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar

ipgeolocation's Issues

btnIPExternoClick

While pressing btnIPExternoClick I need a certificate
Any Help how to?
Error getting server cetrtificate

Server certificate error

Your new ver 1.5.1 on 8.8.8.8 need a server certificate
also on search, your download does not have a library directory
Why do you use GOOGLE? and not my IP?
D10.2.3

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.