= gun:info(3)

== Name

gun:info - Obtain information about the connection

== Description

[source,erlang]
----
info(ConnPid) -> Info

ConnPid :: pid()
Info :: #{
    owner               => pid(),
    socket              => inet:socket() | ssl:sslsocket(),
    transport           => tcp | tls,
    protocol            => http | http2 | socks | ws,
    state_name          => atom(),
    sock_ip             => inet:ip_address(),
    sock_port           => inet:port_number(),
    origin_scheme       => binary() | undefined,
    origin_host         => inet:hostname() | inet:ip_address(),
    origin_port         => inet:port_number(),
    intermediaries      => [Intermediary],
    cookie_store        => gun_cookies:cookie_store(),
    event_handler       => module(),
    event_handler_state => any()
}
Intermediary :: #{
    type      => connect | socks5,
    host      => inet:hostname() | inet:ip_address(),
    port      => inet:port_number(),
    transport => tcp | tls,
    protocol  => http | http2 | socks | raw
}
----

Obtain information about the connection.

== Arguments

ConnPid::

The pid of the Gun connection process.

== Return value

A map is returned containing various informations about
the connection.

== Changelog

* *2.2*: The values `event_handler`, `event_handler_state` and
         `state_name` were added.
* *2.0*: The values `owner`, `origin_scheme` and `cookie_store` were
         added.
* *1.3*: The values `socket`, `transport`, `protocol`, `origin_host`,
         `origin_port` and `intermediaries` were added.
* *1.0*: Function introduced.

== Examples

.Obtain information about the connection
[source,erlang]
----
Info = gun:info(ConnPid).
----

== See also

link:man:gun(3)[gun(3)],
link:man:gun:open(3)[gun:open(3)],
link:man:gun:open_unix(3)[gun:open_unix(3)]
