Debian Codegraph @

doc/src/guide/migrating_from_2.0.asciidoc

raw
1 [appendix]
2 == Migrating from Ranch 2.0 to Ranch 2.1
3
4 Ranch 2.1 adds counters and alarms.
5
6 The https://github.com/juhlig/prometheus_ranch[Prometheus collector]
7 was updated to include accepted/terminated connections
8 metrics.
9
10 Ranch 2.1 is compatible with Erlang/OTP 22.0 onward. Support
11 for Erlang/OTP 21 has been removed.
12
13 === Features added
14
15 * Metrics are now provided by `ranch:info/0,1`. Currently
16 includes accepted/terminated connection counts per
17 connection supervisor.
18
19 * Alarms can now be configured. The only alarm currently
20 available is `num_connections`. When the number of
21 connections goes over a configurable threshold Ranch
22 will call the given callback. This can be used to
23 programmatically shut down idle connections to
24 make up space for new connections, for example.
25
26 * A `post_listen_callback` option has been added. It
27 receives sockets immediately after the `Transport:listen/1`
28 call. It can be used for some additional initialization
29 of the socket, such as setting file permissions on
30 Unix domain sockets.
31
32 * It is now possible to use TLS-PSK authentication
33 without having to specify a default certificate
34 for TLS < 1.3.
35
36 === Experimental features added
37
38 * The `inet_backend` option is now properly handled
39 and tested for TCP listeners. This allows using
40 the experimental `socket` backend. The `socket`
41 backend is now tested with Ranch. Note that
42 there are known issues and Windows support is not
43 currently implemented.
44
45 === Changed behaviors
46
47 * Ranch will now remove unsupported SSL/TLS options
48 where applicable. A warning will be logged when
49 this happens. Options are only removed when they
50 are not compatible with the selected TLS version
51 and leaving them would prevent the listener from
52 starting.
53 +
54 The following options are removed when using TLS
55 1.1, 1.2 or 1.3: `beast_mitigation` and `padding_check`.
56 +
57 The following options are removed when using TLS
58 1.3 exclusively: `client_renegotiation`,
59 `next_protocols_advertised`, `psk_identity`,
60 `reuse_session`, `reuse_sessions`,
61 `secure_renegotiate` and `user_lookup_fun`.
62
63 === Added functions
64
65 * The function `ranch_proxy_header:to_connection_info/1`
66 converts PROXY protocol information to the same
67 format as `ssl:connection_information/1`. Because
68 there is little overlap only the `protocol`,
69 `selected_cipher_suite` and `sni_hostname` will
70 be available, however.