Giter Site home page Giter Site logo

Comments (5)

phpony avatar phpony commented on June 26, 2024 1

It's probably possible to just rely on something like this

peer_ip = socket.handshake.headers['x-forwarded-for'] || socket.conn.remoteAddress.split(":")[3];

at server side instead of any 3rd-party services on client side. That'll work faster and the app will not depend on other services uptime. I don't see any cases when 3rd-party services will return any other IP than code above will. Except some heavily misconfigured servers.

from mirotalk.

miroslavpejic85 avatar miroslavpejic85 commented on June 26, 2024

Hey @phpony!
extreme-ip-lookup.com was initially totally free, then it became paid (geoip-lite you mentioned, seems like a great alternative to me and agree with you, that should be handled by server). However I was using it for debugging purposes, and you're right, this data on the server side it's not necessary/used at all. As for api.ipify.org, replacing it with your server-side proposal, seems excellent to me! I removed all unnecessary/unused code.
Thank you so much!

from mirotalk.

miroslavpejic85 avatar miroslavpejic85 commented on June 26, 2024

@phpony Now I remember why I used extreme-ip-lookup on the client side :) It was a simple hack to not pay for the API key, as with the key=demo2 using it on the client side, in more cases you get the info, while if you use that key on the server side, no. Try this one: https://extreme-ip-lookup.com/json/?key=demo2
Since I've been asking about that feature in the MiroTalk forum, I was thinking of bringing it back... or using geoip-lite on server side, but got less info compared to extreme. Probably in some use cases for private project, this functionality can be useful to someone for collect statistics, not depend of google analytics and so on. In my case it was just for debugging purposes.

from mirotalk.

miroslavpejic85 avatar miroslavpejic85 commented on June 26, 2024

Found the alternative: https://www.geojs.io/docs/v1/endpoints/geo/ this works on server side as well.

from mirotalk.

miroslavpejic85 avatar miroslavpejic85 commented on June 26, 2024

Make it as optional if someone need (default false), implementation on server side.

# IP lookup
# Using GeoJS to get more info about peer by IP
# Doc: https://www.geojs.io/docs/v1/endpoints/geo/

IP_LOOKUP_ENABLED=false # true or false

from mirotalk.

Related Issues (20)

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.