Giter VIP home page Giter VIP logo

Comments (14)

maximium avatar maximium commented on May 28, 2024 2

then we return null when it's a internal ip such as 192.168.0.1

Probably a better way is to return the first not private ip from x-forwarded-for header instead of null
eg. 195.189.143.147 for X-Forwarded-For: 127.0.0.1, 192.168.0.100, 195.189.143.147, 130.236.236.80

from request-ip.

pbojinov avatar pbojinov commented on May 28, 2024 1

@Redmega yes it's in progress. I'll have something out soon.

from request-ip.

evdama avatar evdama commented on May 28, 2024 1

what's the status on this?

from request-ip.

pbojinov avatar pbojinov commented on May 28, 2024

What if we exposed a flag that you can set, lets say ignoreInteral or ignoreLocal and if its true, then we return null when it's a internal ip such as 192.168.0.1.

Also thoughts on getting a cohesive list of internal ips?

from request-ip.

floatdrop avatar floatdrop commented on May 28, 2024

@pbojinov yeah, sounds nice. We used netmask for a while, until IPv6 came into play. I think ip is good candidate for this task.

from request-ip.

pbojinov avatar pbojinov commented on May 28, 2024

@floatdrop in this case, will using ip.isPrivate('127.0.0.1') // true from ip work out ok?

Do you have any example headers we can use for the tests? Want to make sure we're using real live data to cover these test cases.

from request-ip.

pbojinov avatar pbojinov commented on May 28, 2024

What about thoughts on naming for the flag: ignorePrivate, ignoreLocal, ignoreInternal?

from request-ip.

floatdrop avatar floatdrop commented on May 28, 2024

@pbojinov we have only tests for filtering ipv4 adresses (all of them from private networks), but no actual headers.

What about thoughts on naming for the flag: ignorePrivate, ignoreLocal, ignoreInternal?

I think ignorePrivate is good choice, because of ip.isPrivate method.

from request-ip.

pbojinov avatar pbojinov commented on May 28, 2024

Sounds good, I'll add this in. Thanks!

from request-ip.

fluxsauce avatar fluxsauce commented on May 28, 2024

There's an existing dependency on is.js, maybe add it upstream?

from request-ip.

pbojinov avatar pbojinov commented on May 28, 2024

@fluxsauce the dependency is in the package.json. Am I missing something else?

  "dependencies": {
    "is_js": "^0.9.0"
  }

It should install from npm. I'm seeing this when I run a fresh install:

> npm install request-ip
[email protected] /Users/petar/test
└─┬ [email protected]
  └── [email protected]

from request-ip.

fluxsauce avatar fluxsauce commented on May 28, 2024

@pbojinov I meant add is.ipPrivate to is.js first, as it could be useful in some other places.

from request-ip.

Redmega avatar Redmega commented on May 28, 2024

Any update on this?

from request-ip.

Redmega avatar Redmega commented on May 28, 2024

Awesome to hear. I'm doing a geoip check on an aws box and its grabbing the IP of the box itself. It's hard to tell without intense console logging if its due to incorrectly set headers or the request-ip package itself. It isn't a high priority issue for us so I've left it alone for now, looking forward to the release 👍

from request-ip.

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.