Code Monkey home page Code Monkey logo

Comments (8)

guilleiguaran avatar guilleiguaran commented on June 30, 2024

👍 I need it for this: #18 (comment)

from plug.

josevalim avatar josevalim commented on June 30, 2024

FWIW, there was a discussion for implementing this here: #26

from plug.

MSch avatar MSch commented on June 30, 2024

Just looked through #26, I really don't like converting the IP tuple into a string.

I would add a remote_ip field that contains the peer's ip as a tuple (and can be overwritten by plugs that parse X-Forwarded-For or the PROXY protocol) and I'd add a peer field that is the original peer we get from cowboy.

I can tackle this on Sunday.

from plug.

josevalim avatar josevalim commented on June 30, 2024

Should we make those a struct so we get inspect?

from plug.

josevalim avatar josevalim commented on June 30, 2024

and other protocols?

from plug.

josevalim avatar josevalim commented on June 30, 2024

Like to_string(conn.peer) == "123.123.53.43:482".

from plug.

MSch avatar MSch commented on June 30, 2024

I think that would be useful, but IMO the IP struct should be in Elixir's stdlib. I'd want it for Ecto, HTTPoison, and even GenTCP too. (Not sure how that would work with Elixir 1.0 being almost here)

from plug.

MSch avatar MSch commented on June 30, 2024

Ah, but we'd need not only an IP struct but also a Peer one that has IP and Port and maybe even protocol (TCP, UDP, others?). That seems no longer worth it to me.

from plug.

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.