aboutsummaryrefslogtreecommitdiffstats
path: root/doc/src/manual/gun_tunnel_up.asciidoc
blob: 41fbea8c4aeff4331c5dee8f759f85bcc377f0e9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
= gun_tunnel_up(3)

== Name

gun_tunnel_up - The tunnel is up

== Description

[source,erlang]
----
{gun_tunnel_up, ConnPid, StreamRef, Protocol}

ConnPid   :: pid()
StreamRef :: gun:stream_ref() | undefined
Protocol  :: http | http2 | socks
----

The tunnel is up.

This message informs the owner/calling process that the connection
completed through the SOCKS or CONNECT proxy.

If Gun is configured to connect to another SOCKS server, then the
connection is not usable yet. One or more
link:man:gun_tunnel_up(3)[gun_tunnel_up(3)] messages will follow.

== Elements

ConnPid::

The pid of the Gun connection process.

StreamRef::

The stream reference the tunnel is running on, or `undefined`
if there are no underlying stream.

Protocol::

The protocol selected for this connection. It can be used
to determine the capabilities of the server.

== Changelog

* *2.0*: Message introduced.

== Examples

.Receive a gun_tunnel_up message in a gen_server
[source,erlang]
----
handle_info({gun_tunnel_up, ConnPid, _StreamRef, _Protocol},
            State=#state{conn_pid=ConnPid}) ->
    %% Do something.
    {noreply, State}.
----

== 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)],
link:man:gun:await_up(3)[gun:await_up(3)],
link:man:gun_up(3)[gun_up(3)],
link:man:gun_down(3)[gun_down(3)],
link:man:gun_error(3)[gun_error(3)]