From 48f39402181d959cad88cb3f460210c007169f50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Wed, 12 May 2021 11:13:47 +0200 Subject: Cowboy 2.9.0 --- .../cowboy/2.9/manual/cowboy_req.peer/index.html | 203 +++++++++++++++++++++ 1 file changed, 203 insertions(+) create mode 100644 docs/en/cowboy/2.9/manual/cowboy_req.peer/index.html (limited to 'docs/en/cowboy/2.9/manual/cowboy_req.peer') diff --git a/docs/en/cowboy/2.9/manual/cowboy_req.peer/index.html b/docs/en/cowboy/2.9/manual/cowboy_req.peer/index.html new file mode 100644 index 00000000..d43da9cb --- /dev/null +++ b/docs/en/cowboy/2.9/manual/cowboy_req.peer/index.html @@ -0,0 +1,203 @@ + + + + + + + + + + Nine Nines: cowboy_req:peer(3) + + + + + + + + + + + + + + + + +
+
+
+
+ +

cowboy_req:peer(3)

+ +

Name

+

cowboy_req:peer - Peer address and port

+

Description

+
+
peer(Req :: cowboy_req:req()) -> Info
+
+Info :: {inet:ip_address(), inet:port_number()}
+
+

Return the peer's IP address and port number.

+

The peer information can also be obtained using pattern matching:

+
+
#{peer := {IP, Port}} = Req.
+
+

Arguments

+
Req
+

The Req object.

+
+
+

Return value

+

The peer's IP address and port number.

+

The peer is not necessarily the client's IP address and port. It is the IP address of the endpoint connecting directly to the server, which may be a gateway or a proxy.

+

The forwarded header can be used to get better information about the different endpoints from the client to the server. Note however that it is only informative; there is no reliable way of determining the source of an HTTP request.

+

Changelog

+
  • 2.0: Only the peer is returned, it is no longer wrapped in a tuple. +
  • +
  • 1.0: Function introduced. +
  • +
+

Examples

+
Get the peer IP address and port number.
+
+
{IP, Port} = cowboy_req:peer(Req).
+
+

See also

+

cowboy_req(3), cowboy_req:sock(3), cowboy_req:cert(3)

+ + + + + + +
+ +
+ + +

+ Cowboy + 2.9 + Function Reference + +

+ + + +

Navigation

+ +

Version select

+ + +

Like my work? Donate!

+

Donate to Loïc Hoguin because his work on Cowboy, Ranch, Gun and Erlang.mk is fantastic:

+
+ + + + + + + + + +

Recurring payment options are also available via GitHub Sponsors. These funds are used to cover the recurring expenses like food, dedicated servers or domain names.

+ + + +
+
+
+
+ + + + + + + + + -- cgit v1.2.3