From 992831c7a516b5183c2af06260829d41aa45267c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 9 Sep 2021 12:15:32 +0200 Subject: Ranch 2.1.0 --- docs/en/gun/2.0/guide/migrating_from_1.3.asciidoc | 19 +- .../en/gun/2.0/guide/migrating_from_1.3/index.html | 7 +- docs/en/ranch/1.5/guide/embedded.asciidoc | 48 -- docs/en/ranch/1.5/guide/embedded/index.html | 202 --------- docs/en/ranch/1.5/guide/index.html | 174 ------- docs/en/ranch/1.5/guide/internals.asciidoc | 94 ---- docs/en/ranch/1.5/guide/internals/index.html | 202 --------- docs/en/ranch/1.5/guide/introduction.asciidoc | 28 -- docs/en/ranch/1.5/guide/introduction/index.html | 186 -------- docs/en/ranch/1.5/guide/listeners.asciidoc | 320 ------------- docs/en/ranch/1.5/guide/listeners/index.html | 385 ---------------- docs/en/ranch/1.5/guide/parsers.asciidoc | 92 ---- docs/en/ranch/1.5/guide/parsers/index.html | 241 ---------- docs/en/ranch/1.5/guide/protocols.asciidoc | 99 ---- docs/en/ranch/1.5/guide/protocols/index.html | 248 ---------- docs/en/ranch/1.5/guide/ssl_auth.asciidoc | 120 ----- docs/en/ranch/1.5/guide/ssl_auth/index.html | 254 ----------- docs/en/ranch/1.5/guide/transports.asciidoc | 161 ------- docs/en/ranch/1.5/guide/transports/index.html | 279 ------------ docs/en/ranch/1.5/manual/index.html | 170 ------- docs/en/ranch/1.5/manual/ranch/index.html | 382 ---------------- docs/en/ranch/1.5/manual/ranch_app/index.html | 168 ------- docs/en/ranch/1.5/manual/ranch_protocol/index.html | 183 -------- docs/en/ranch/1.5/manual/ranch_ssl/index.html | 324 ------------- docs/en/ranch/1.5/manual/ranch_tcp/index.html | 277 ------------ .../en/ranch/1.5/manual/ranch_transport/index.html | 381 ---------------- docs/en/ranch/1.6/guide/embedded/index.html | 4 +- docs/en/ranch/1.6/guide/index.html | 4 +- docs/en/ranch/1.6/guide/internals/index.html | 4 +- docs/en/ranch/1.6/guide/introduction/index.html | 4 +- docs/en/ranch/1.6/guide/listeners/index.html | 4 +- .../ranch/1.6/guide/migrating_from_1.5/index.html | 4 +- .../ranch/1.6/guide/migrating_from_1.6/index.html | 4 +- .../ranch/1.6/guide/migrating_from_1.x/index.html | 4 +- docs/en/ranch/1.6/guide/parsers/index.html | 4 +- docs/en/ranch/1.6/guide/protocols/index.html | 4 +- docs/en/ranch/1.6/guide/ssl_auth/index.html | 4 +- docs/en/ranch/1.6/guide/transports/index.html | 4 +- .../1.6/guide/upcoming_2.0_changes/index.html | 4 +- docs/en/ranch/1.6/manual/index.html | 4 +- .../ranch/1.6/manual/ranch.child_spec/index.html | 4 +- docs/en/ranch/1.6/manual/ranch.get_addr/index.html | 4 +- .../manual/ranch.get_max_connections/index.html | 4 +- docs/en/ranch/1.6/manual/ranch.get_port/index.html | 4 +- .../manual/ranch.get_protocol_options/index.html | 4 +- .../ranch/1.6/manual/ranch.get_status/index.html | 4 +- .../manual/ranch.get_transport_options/index.html | 4 +- .../en/ranch/1.6/manual/ranch.handshake/index.html | 4 +- docs/en/ranch/1.6/manual/ranch.info/index.html | 4 +- docs/en/ranch/1.6/manual/ranch.procs/index.html | 4 +- .../1.6/manual/ranch.remove_connection/index.html | 4 +- .../1.6/manual/ranch.resume_listener/index.html | 4 +- .../manual/ranch.set_max_connections/index.html | 4 +- .../manual/ranch.set_protocol_options/index.html | 4 +- .../manual/ranch.set_transport_options/index.html | 4 +- .../1.6/manual/ranch.start_listener/index.html | 4 +- .../1.6/manual/ranch.stop_listener/index.html | 4 +- .../1.6/manual/ranch.suspend_listener/index.html | 4 +- .../manual/ranch.wait_for_connections/index.html | 4 +- docs/en/ranch/1.6/manual/ranch/index.html | 4 +- docs/en/ranch/1.6/manual/ranch_app/index.html | 4 +- docs/en/ranch/1.6/manual/ranch_protocol/index.html | 4 +- docs/en/ranch/1.6/manual/ranch_ssl/index.html | 4 +- docs/en/ranch/1.6/manual/ranch_tcp/index.html | 4 +- .../1.6/manual/ranch_transport.sendfile/index.html | 4 +- .../en/ranch/1.6/manual/ranch_transport/index.html | 4 +- docs/en/ranch/1.7/guide/embedded/index.html | 4 +- docs/en/ranch/1.7/guide/index.html | 4 +- docs/en/ranch/1.7/guide/internals/index.html | 4 +- docs/en/ranch/1.7/guide/introduction/index.html | 4 +- docs/en/ranch/1.7/guide/listeners/index.html | 4 +- .../ranch/1.7/guide/migrating_from_1.5/index.html | 4 +- .../ranch/1.7/guide/migrating_from_1.6/index.html | 4 +- .../ranch/1.7/guide/migrating_from_1.7/index.html | 4 +- .../ranch/1.7/guide/migrating_from_1.x/index.html | 4 +- docs/en/ranch/1.7/guide/parsers/index.html | 4 +- docs/en/ranch/1.7/guide/protocols/index.html | 4 +- docs/en/ranch/1.7/guide/ssl_auth/index.html | 4 +- docs/en/ranch/1.7/guide/transports/index.html | 4 +- .../1.7/guide/upcoming_2.0_changes/index.html | 4 +- docs/en/ranch/1.7/manual/index.html | 4 +- .../ranch/1.7/manual/ranch.child_spec/index.html | 4 +- docs/en/ranch/1.7/manual/ranch.get_addr/index.html | 4 +- .../manual/ranch.get_max_connections/index.html | 4 +- docs/en/ranch/1.7/manual/ranch.get_port/index.html | 4 +- .../manual/ranch.get_protocol_options/index.html | 4 +- .../ranch/1.7/manual/ranch.get_status/index.html | 4 +- .../manual/ranch.get_transport_options/index.html | 4 +- .../en/ranch/1.7/manual/ranch.handshake/index.html | 4 +- docs/en/ranch/1.7/manual/ranch.info/index.html | 4 +- docs/en/ranch/1.7/manual/ranch.procs/index.html | 4 +- .../1.7/manual/ranch.recv_proxy_header/index.html | 4 +- .../1.7/manual/ranch.remove_connection/index.html | 4 +- .../1.7/manual/ranch.resume_listener/index.html | 4 +- .../manual/ranch.set_max_connections/index.html | 4 +- .../manual/ranch.set_protocol_options/index.html | 4 +- .../manual/ranch.set_transport_options/index.html | 4 +- .../1.7/manual/ranch.start_listener/index.html | 4 +- .../1.7/manual/ranch.stop_listener/index.html | 4 +- .../1.7/manual/ranch.suspend_listener/index.html | 4 +- .../manual/ranch.wait_for_connections/index.html | 4 +- docs/en/ranch/1.7/manual/ranch/index.html | 4 +- docs/en/ranch/1.7/manual/ranch_app/index.html | 4 +- docs/en/ranch/1.7/manual/ranch_protocol/index.html | 4 +- .../manual/ranch_proxy_header.header/index.html | 4 +- .../1.7/manual/ranch_proxy_header.parse/index.html | 4 +- .../ranch/1.7/manual/ranch_proxy_header/index.html | 4 +- docs/en/ranch/1.7/manual/ranch_ssl/index.html | 4 +- docs/en/ranch/1.7/manual/ranch_tcp/index.html | 4 +- .../1.7/manual/ranch_transport.sendfile/index.html | 4 +- .../en/ranch/1.7/manual/ranch_transport/index.html | 4 +- docs/en/ranch/1.8/guide/embedded/index.html | 4 +- docs/en/ranch/1.8/guide/index.html | 4 +- docs/en/ranch/1.8/guide/internals/index.html | 4 +- docs/en/ranch/1.8/guide/introduction/index.html | 4 +- docs/en/ranch/1.8/guide/listeners/index.html | 4 +- .../ranch/1.8/guide/migrating_from_1.5/index.html | 4 +- .../ranch/1.8/guide/migrating_from_1.6/index.html | 4 +- .../ranch/1.8/guide/migrating_from_1.7/index.html | 4 +- .../ranch/1.8/guide/migrating_from_1.x/index.html | 4 +- docs/en/ranch/1.8/guide/parsers/index.html | 4 +- docs/en/ranch/1.8/guide/protocols/index.html | 4 +- docs/en/ranch/1.8/guide/ssl_auth/index.html | 4 +- docs/en/ranch/1.8/guide/transports/index.html | 4 +- .../1.8/guide/upcoming_2.0_changes/index.html | 4 +- docs/en/ranch/1.8/manual/index.html | 4 +- .../ranch/1.8/manual/ranch.child_spec/index.html | 4 +- docs/en/ranch/1.8/manual/ranch.get_addr/index.html | 4 +- .../manual/ranch.get_max_connections/index.html | 4 +- docs/en/ranch/1.8/manual/ranch.get_port/index.html | 4 +- .../manual/ranch.get_protocol_options/index.html | 4 +- .../ranch/1.8/manual/ranch.get_status/index.html | 4 +- .../manual/ranch.get_transport_options/index.html | 4 +- .../en/ranch/1.8/manual/ranch.handshake/index.html | 4 +- docs/en/ranch/1.8/manual/ranch.info/index.html | 4 +- docs/en/ranch/1.8/manual/ranch.procs/index.html | 4 +- .../1.8/manual/ranch.recv_proxy_header/index.html | 4 +- .../1.8/manual/ranch.remove_connection/index.html | 4 +- .../1.8/manual/ranch.resume_listener/index.html | 4 +- .../manual/ranch.set_max_connections/index.html | 4 +- .../manual/ranch.set_protocol_options/index.html | 4 +- .../manual/ranch.set_transport_options/index.html | 4 +- .../1.8/manual/ranch.start_listener/index.html | 4 +- .../1.8/manual/ranch.stop_listener/index.html | 4 +- .../1.8/manual/ranch.suspend_listener/index.html | 4 +- .../manual/ranch.wait_for_connections/index.html | 4 +- docs/en/ranch/1.8/manual/ranch/index.html | 6 +- docs/en/ranch/1.8/manual/ranch_app/index.html | 4 +- docs/en/ranch/1.8/manual/ranch_protocol/index.html | 6 +- .../manual/ranch_proxy_header.header/index.html | 4 +- .../1.8/manual/ranch_proxy_header.parse/index.html | 4 +- .../ranch/1.8/manual/ranch_proxy_header/index.html | 6 +- docs/en/ranch/1.8/manual/ranch_ssl/index.html | 6 +- docs/en/ranch/1.8/manual/ranch_tcp/index.html | 6 +- .../1.8/manual/ranch_transport.sendfile/index.html | 4 +- .../en/ranch/1.8/manual/ranch_transport/index.html | 6 +- .../ranch/2.0/guide/connection_draining/index.html | 4 +- docs/en/ranch/2.0/guide/embedded/index.html | 4 +- docs/en/ranch/2.0/guide/index.html | 4 +- docs/en/ranch/2.0/guide/internals/index.html | 4 +- docs/en/ranch/2.0/guide/introduction/index.html | 4 +- docs/en/ranch/2.0/guide/listeners/index.html | 4 +- .../ranch/2.0/guide/migrating_from_1.5/index.html | 4 +- .../ranch/2.0/guide/migrating_from_1.6/index.html | 4 +- .../ranch/2.0/guide/migrating_from_1.7/index.html | 4 +- .../ranch/2.0/guide/migrating_from_1.x/index.html | 4 +- docs/en/ranch/2.0/guide/parsers/index.html | 4 +- docs/en/ranch/2.0/guide/protocols/index.html | 4 +- docs/en/ranch/2.0/guide/ssl_auth/index.html | 4 +- docs/en/ranch/2.0/guide/transports/index.html | 4 +- docs/en/ranch/2.0/manual/index.html | 4 +- .../ranch/2.0/manual/ranch.child_spec/index.html | 4 +- docs/en/ranch/2.0/manual/ranch.get_addr/index.html | 4 +- .../manual/ranch.get_max_connections/index.html | 4 +- docs/en/ranch/2.0/manual/ranch.get_port/index.html | 4 +- .../manual/ranch.get_protocol_options/index.html | 4 +- .../ranch/2.0/manual/ranch.get_status/index.html | 4 +- .../manual/ranch.get_transport_options/index.html | 4 +- .../en/ranch/2.0/manual/ranch.handshake/index.html | 4 +- .../2.0/manual/ranch.handshake_cancel/index.html | 4 +- .../2.0/manual/ranch.handshake_continue/index.html | 4 +- docs/en/ranch/2.0/manual/ranch.info/index.html | 4 +- docs/en/ranch/2.0/manual/ranch.procs/index.html | 4 +- .../2.0/manual/ranch.recv_proxy_header/index.html | 4 +- .../2.0/manual/ranch.remove_connection/index.html | 4 +- .../2.0/manual/ranch.resume_listener/index.html | 4 +- .../manual/ranch.set_max_connections/index.html | 4 +- .../manual/ranch.set_protocol_options/index.html | 4 +- .../manual/ranch.set_transport_options/index.html | 4 +- .../2.0/manual/ranch.start_listener/index.html | 4 +- .../2.0/manual/ranch.stop_listener/index.html | 4 +- .../2.0/manual/ranch.suspend_listener/index.html | 4 +- .../manual/ranch.wait_for_connections/index.html | 4 +- docs/en/ranch/2.0/manual/ranch/index.html | 4 +- docs/en/ranch/2.0/manual/ranch_app/index.html | 4 +- docs/en/ranch/2.0/manual/ranch_protocol/index.html | 4 +- .../manual/ranch_proxy_header.header/index.html | 4 +- .../2.0/manual/ranch_proxy_header.parse/index.html | 4 +- .../ranch/2.0/manual/ranch_proxy_header/index.html | 4 +- docs/en/ranch/2.0/manual/ranch_ssl/index.html | 4 +- docs/en/ranch/2.0/manual/ranch_tcp/index.html | 4 +- .../2.0/manual/ranch_transport.sendfile/index.html | 4 +- .../en/ranch/2.0/manual/ranch_transport/index.html | 4 +- .../ranch/2.1/guide/connection_draining.asciidoc | 98 ++++ .../ranch/2.1/guide/connection_draining/index.html | 258 +++++++++++ docs/en/ranch/2.1/guide/embedded.asciidoc | 47 ++ docs/en/ranch/2.1/guide/embedded/index.html | 199 ++++++++ docs/en/ranch/2.1/guide/index.html | 193 ++++++++ docs/en/ranch/2.1/guide/internals.asciidoc | 99 ++++ docs/en/ranch/2.1/guide/internals/index.html | 207 +++++++++ docs/en/ranch/2.1/guide/introduction.asciidoc | 25 + docs/en/ranch/2.1/guide/introduction/index.html | 185 ++++++++ docs/en/ranch/2.1/guide/listeners.asciidoc | 479 ++++++++++++++++++++ docs/en/ranch/2.1/guide/listeners/index.html | 502 +++++++++++++++++++++ .../en/ranch/2.1/guide/migrating_from_1.5.asciidoc | 76 ++++ .../ranch/2.1/guide/migrating_from_1.5/index.html | 221 +++++++++ .../en/ranch/2.1/guide/migrating_from_1.6.asciidoc | 46 ++ .../ranch/2.1/guide/migrating_from_1.6/index.html | 201 +++++++++ .../en/ranch/2.1/guide/migrating_from_1.7.asciidoc | 163 +++++++ .../ranch/2.1/guide/migrating_from_1.7/index.html | 258 +++++++++++ .../en/ranch/2.1/guide/migrating_from_1.x.asciidoc | 70 +++ .../ranch/2.1/guide/migrating_from_1.x/index.html | 274 +++++++++++ .../en/ranch/2.1/guide/migrating_from_2.0.asciidoc | 70 +++ .../ranch/2.1/guide/migrating_from_2.0/index.html | 206 +++++++++ docs/en/ranch/2.1/guide/parsers.asciidoc | 92 ++++ docs/en/ranch/2.1/guide/parsers/index.html | 241 ++++++++++ docs/en/ranch/2.1/guide/protocols.asciidoc | 113 +++++ docs/en/ranch/2.1/guide/protocols/index.html | 261 +++++++++++ docs/en/ranch/2.1/guide/ssl_auth.asciidoc | 120 +++++ docs/en/ranch/2.1/guide/ssl_auth/index.html | 254 +++++++++++ docs/en/ranch/2.1/guide/transports.asciidoc | 177 ++++++++ docs/en/ranch/2.1/guide/transports/index.html | 291 ++++++++++++ docs/en/ranch/2.1/manual/index.html | 201 +++++++++ .../ranch/2.1/manual/ranch.child_spec/index.html | 222 +++++++++ docs/en/ranch/2.1/manual/ranch.get_addr/index.html | 197 ++++++++ .../manual/ranch.get_max_connections/index.html | 189 ++++++++ docs/en/ranch/2.1/manual/ranch.get_port/index.html | 187 ++++++++ .../manual/ranch.get_protocol_options/index.html | 185 ++++++++ .../ranch/2.1/manual/ranch.get_status/index.html | 188 ++++++++ .../manual/ranch.get_transport_options/index.html | 185 ++++++++ .../en/ranch/2.1/manual/ranch.handshake/index.html | 211 +++++++++ .../2.1/manual/ranch.handshake_cancel/index.html | 198 ++++++++ .../2.1/manual/ranch.handshake_continue/index.html | 208 +++++++++ docs/en/ranch/2.1/manual/ranch.info/index.html | 248 ++++++++++ docs/en/ranch/2.1/manual/ranch.procs/index.html | 196 ++++++++ .../2.1/manual/ranch.recv_proxy_header/index.html | 206 +++++++++ .../2.1/manual/ranch.remove_connection/index.html | 186 ++++++++ .../2.1/manual/ranch.resume_listener/index.html | 192 ++++++++ .../manual/ranch.set_max_connections/index.html | 194 ++++++++ .../manual/ranch.set_protocol_options/index.html | 200 ++++++++ .../manual/ranch.set_transport_options/index.html | 248 ++++++++++ .../2.1/manual/ranch.start_listener/index.html | 246 ++++++++++ .../2.1/manual/ranch.stop_listener/index.html | 189 ++++++++ .../2.1/manual/ranch.suspend_listener/index.html | 193 ++++++++ .../manual/ranch.wait_for_connections/index.html | 213 +++++++++ docs/en/ranch/2.1/manual/ranch/index.html | 338 ++++++++++++++ docs/en/ranch/2.1/manual/ranch_app/index.html | 201 +++++++++ docs/en/ranch/2.1/manual/ranch_protocol/index.html | 186 ++++++++ .../manual/ranch_proxy_header.header/index.html | 220 +++++++++ .../2.1/manual/ranch_proxy_header.parse/index.html | 191 ++++++++ .../index.html | 190 ++++++++ .../ranch/2.1/manual/ranch_proxy_header/index.html | 276 +++++++++++ docs/en/ranch/2.1/manual/ranch_ssl/index.html | 384 ++++++++++++++++ docs/en/ranch/2.1/manual/ranch_tcp/index.html | 286 ++++++++++++ .../2.1/manual/ranch_transport.sendfile/index.html | 220 +++++++++ .../en/ranch/2.1/manual/ranch_transport/index.html | 427 ++++++++++++++++++ 266 files changed, 13411 insertions(+), 5380 deletions(-) delete mode 100644 docs/en/ranch/1.5/guide/embedded.asciidoc delete mode 100644 docs/en/ranch/1.5/guide/embedded/index.html delete mode 100644 docs/en/ranch/1.5/guide/index.html delete mode 100644 docs/en/ranch/1.5/guide/internals.asciidoc delete mode 100644 docs/en/ranch/1.5/guide/internals/index.html delete mode 100644 docs/en/ranch/1.5/guide/introduction.asciidoc delete mode 100644 docs/en/ranch/1.5/guide/introduction/index.html delete mode 100644 docs/en/ranch/1.5/guide/listeners.asciidoc delete mode 100644 docs/en/ranch/1.5/guide/listeners/index.html delete mode 100644 docs/en/ranch/1.5/guide/parsers.asciidoc delete mode 100644 docs/en/ranch/1.5/guide/parsers/index.html delete mode 100644 docs/en/ranch/1.5/guide/protocols.asciidoc delete mode 100644 docs/en/ranch/1.5/guide/protocols/index.html delete mode 100644 docs/en/ranch/1.5/guide/ssl_auth.asciidoc delete mode 100644 docs/en/ranch/1.5/guide/ssl_auth/index.html delete mode 100644 docs/en/ranch/1.5/guide/transports.asciidoc delete mode 100644 docs/en/ranch/1.5/guide/transports/index.html delete mode 100644 docs/en/ranch/1.5/manual/index.html delete mode 100644 docs/en/ranch/1.5/manual/ranch/index.html delete mode 100644 docs/en/ranch/1.5/manual/ranch_app/index.html delete mode 100644 docs/en/ranch/1.5/manual/ranch_protocol/index.html delete mode 100644 docs/en/ranch/1.5/manual/ranch_ssl/index.html delete mode 100644 docs/en/ranch/1.5/manual/ranch_tcp/index.html delete mode 100644 docs/en/ranch/1.5/manual/ranch_transport/index.html create mode 100644 docs/en/ranch/2.1/guide/connection_draining.asciidoc create mode 100644 docs/en/ranch/2.1/guide/connection_draining/index.html create mode 100644 docs/en/ranch/2.1/guide/embedded.asciidoc create mode 100644 docs/en/ranch/2.1/guide/embedded/index.html create mode 100644 docs/en/ranch/2.1/guide/index.html create mode 100644 docs/en/ranch/2.1/guide/internals.asciidoc create mode 100644 docs/en/ranch/2.1/guide/internals/index.html create mode 100644 docs/en/ranch/2.1/guide/introduction.asciidoc create mode 100644 docs/en/ranch/2.1/guide/introduction/index.html create mode 100644 docs/en/ranch/2.1/guide/listeners.asciidoc create mode 100644 docs/en/ranch/2.1/guide/listeners/index.html create mode 100644 docs/en/ranch/2.1/guide/migrating_from_1.5.asciidoc create mode 100644 docs/en/ranch/2.1/guide/migrating_from_1.5/index.html create mode 100644 docs/en/ranch/2.1/guide/migrating_from_1.6.asciidoc create mode 100644 docs/en/ranch/2.1/guide/migrating_from_1.6/index.html create mode 100644 docs/en/ranch/2.1/guide/migrating_from_1.7.asciidoc create mode 100644 docs/en/ranch/2.1/guide/migrating_from_1.7/index.html create mode 100644 docs/en/ranch/2.1/guide/migrating_from_1.x.asciidoc create mode 100644 docs/en/ranch/2.1/guide/migrating_from_1.x/index.html create mode 100644 docs/en/ranch/2.1/guide/migrating_from_2.0.asciidoc create mode 100644 docs/en/ranch/2.1/guide/migrating_from_2.0/index.html create mode 100644 docs/en/ranch/2.1/guide/parsers.asciidoc create mode 100644 docs/en/ranch/2.1/guide/parsers/index.html create mode 100644 docs/en/ranch/2.1/guide/protocols.asciidoc create mode 100644 docs/en/ranch/2.1/guide/protocols/index.html create mode 100644 docs/en/ranch/2.1/guide/ssl_auth.asciidoc create mode 100644 docs/en/ranch/2.1/guide/ssl_auth/index.html create mode 100644 docs/en/ranch/2.1/guide/transports.asciidoc create mode 100644 docs/en/ranch/2.1/guide/transports/index.html create mode 100644 docs/en/ranch/2.1/manual/index.html create mode 100644 docs/en/ranch/2.1/manual/ranch.child_spec/index.html create mode 100644 docs/en/ranch/2.1/manual/ranch.get_addr/index.html create mode 100644 docs/en/ranch/2.1/manual/ranch.get_max_connections/index.html create mode 100644 docs/en/ranch/2.1/manual/ranch.get_port/index.html create mode 100644 docs/en/ranch/2.1/manual/ranch.get_protocol_options/index.html create mode 100644 docs/en/ranch/2.1/manual/ranch.get_status/index.html create mode 100644 docs/en/ranch/2.1/manual/ranch.get_transport_options/index.html create mode 100644 docs/en/ranch/2.1/manual/ranch.handshake/index.html create mode 100644 docs/en/ranch/2.1/manual/ranch.handshake_cancel/index.html create mode 100644 docs/en/ranch/2.1/manual/ranch.handshake_continue/index.html create mode 100644 docs/en/ranch/2.1/manual/ranch.info/index.html create mode 100644 docs/en/ranch/2.1/manual/ranch.procs/index.html create mode 100644 docs/en/ranch/2.1/manual/ranch.recv_proxy_header/index.html create mode 100644 docs/en/ranch/2.1/manual/ranch.remove_connection/index.html create mode 100644 docs/en/ranch/2.1/manual/ranch.resume_listener/index.html create mode 100644 docs/en/ranch/2.1/manual/ranch.set_max_connections/index.html create mode 100644 docs/en/ranch/2.1/manual/ranch.set_protocol_options/index.html create mode 100644 docs/en/ranch/2.1/manual/ranch.set_transport_options/index.html create mode 100644 docs/en/ranch/2.1/manual/ranch.start_listener/index.html create mode 100644 docs/en/ranch/2.1/manual/ranch.stop_listener/index.html create mode 100644 docs/en/ranch/2.1/manual/ranch.suspend_listener/index.html create mode 100644 docs/en/ranch/2.1/manual/ranch.wait_for_connections/index.html create mode 100644 docs/en/ranch/2.1/manual/ranch/index.html create mode 100644 docs/en/ranch/2.1/manual/ranch_app/index.html create mode 100644 docs/en/ranch/2.1/manual/ranch_protocol/index.html create mode 100644 docs/en/ranch/2.1/manual/ranch_proxy_header.header/index.html create mode 100644 docs/en/ranch/2.1/manual/ranch_proxy_header.parse/index.html create mode 100644 docs/en/ranch/2.1/manual/ranch_proxy_header.to_connection_info/index.html create mode 100644 docs/en/ranch/2.1/manual/ranch_proxy_header/index.html create mode 100644 docs/en/ranch/2.1/manual/ranch_ssl/index.html create mode 100644 docs/en/ranch/2.1/manual/ranch_tcp/index.html create mode 100644 docs/en/ranch/2.1/manual/ranch_transport.sendfile/index.html create mode 100644 docs/en/ranch/2.1/manual/ranch_transport/index.html (limited to 'docs/en') diff --git a/docs/en/gun/2.0/guide/migrating_from_1.3.asciidoc b/docs/en/gun/2.0/guide/migrating_from_1.3.asciidoc index 2ad4a808..2e71a904 100644 --- a/docs/en/gun/2.0/guide/migrating_from_1.3.asciidoc +++ b/docs/en/gun/2.0/guide/migrating_from_1.3.asciidoc @@ -12,6 +12,10 @@ Gun 2.0 adds many more features such as Websocket over HTTP/2, a built-in cookie store, graceful shutdown, flow control for data messages, event handlers and more. +Gun 2.0 also introduces an experimental pool module that +automatically maintains connections and routes requests +to the right process, in a similar way as browsers do. + Gun 2.0 greatly improves the HTTP/2 performance when it comes to receiving large response bodies; and when receiving response bodies from many separate requests concurrently. @@ -135,7 +139,20 @@ Gun 2.0 requires Erlang/OTP 22.0 or greater. (for example during state transitions when switching protocols or connecting to proxies). -* Update Cowlib to 2.10.1. +* Update Cowlib to 2.11.0. + +=== Experimental features added + +* The `gun_pool` module was introduced. Its interface + is very similar to the `gun` module, but as it is an + experimental feature, it has not been documented yet. + The intent is to obtain feedback and document it in + an upcoming minor release. Pools are created for each + authority (host/port) and scope (user-defined value) + pairs and are resolved accordingly using the information + provided in the request and request options. Connections + may concurrently handle multiple requests/responses + from as many different processes as required. === Features removed diff --git a/docs/en/gun/2.0/guide/migrating_from_1.3/index.html b/docs/en/gun/2.0/guide/migrating_from_1.3/index.html index cfd61c66..e0af6714 100644 --- a/docs/en/gun/2.0/guide/migrating_from_1.3/index.html +++ b/docs/en/gun/2.0/guide/migrating_from_1.3/index.html @@ -64,6 +64,7 @@

Gun 2.0 includes state of the art tunnel support. With Gun 2.0 it is possible to make requests or data go through any number of proxy endpoints using any combination of TCP or TLS transports and HTTP/1.1, HTTP/2 or SOCKS5 protocols. All combinations of the scenario Proxy1 -> Proxy2 -> Origin are tested and known to work.

Gun 2.0 adds many more features such as Websocket over HTTP/2, a built-in cookie store, graceful shutdown, flow control for data messages, event handlers and more.

+

Gun 2.0 also introduces an experimental pool module that automatically maintains connections and routes requests to the right process, in a similar way as browsers do.

Gun 2.0 greatly improves the HTTP/2 performance when it comes to receiving large response bodies; and when receiving response bodies from many separate requests concurrently.

Gun now shares much of its HTTP/2 code with Cowboy, including the HTTP/2 state machine. Numerous issues were fixed as a result because the Cowboy implementation was much more advanced.

The Gun connection process is now implemented using gen_statem.

@@ -111,7 +112,11 @@
  • Many improvements have been done to postpone or reject requests and other operations while in the wrong state (for example during state transitions when switching protocols or connecting to proxies).
  • -
  • Update Cowlib to 2.10.1. +
  • Update Cowlib to 2.11.0. +
  • + +

    Experimental features added

    +

    Features removed

    diff --git a/docs/en/ranch/1.5/guide/embedded.asciidoc b/docs/en/ranch/1.5/guide/embedded.asciidoc deleted file mode 100644 index 55c018b1..00000000 --- a/docs/en/ranch/1.5/guide/embedded.asciidoc +++ /dev/null @@ -1,48 +0,0 @@ -== Embedded mode - -Embedded mode allows you to insert Ranch listeners directly -in your supervision tree. This allows for greater fault tolerance -control by permitting the shutdown of a listener due to the -failure of another part of the application and vice versa. - -=== Embedding - -To embed Ranch in your application you can simply add the child specs -to your supervision tree. This can all be done in the `init/1` function -of one of your application supervisors. - -Ranch requires at the minimum two kinds of child specs for embedding. -First, you need to add `ranch_sup` to your supervision tree, only once, -regardless of the number of listeners you will use. Then you need to -add the child specs for each listener. - -Ranch has a convenience function for getting the listeners child specs -called `ranch:child_spec/5`, that works like `ranch:start_listener/5`, -except that it doesn't start anything, it only returns child specs. - -As for `ranch_sup`, the child spec is simple enough to not require a -convenience function. - -The following example adds both `ranch_sup` and one listener to another -application's supervision tree. - -.Embed Ranch directly in your supervision tree - -[source,erlang] ----- -init([]) -> - RanchSupSpec = {ranch_sup, {ranch_sup, start_link, []}, - permanent, 5000, supervisor, [ranch_sup]}, - ListenerSpec = ranch:child_spec(echo, 100, - ranch_tcp, [{port, 5555}], - echo_protocol, [] - ), - {ok, {{one_for_one, 10, 10}, [RanchSupSpec, ListenerSpec]}}. ----- - -Remember, you can add as many listener child specs as needed, but only -one `ranch_sup` spec! - -It is recommended that your architecture makes sure that all listeners -are restarted if `ranch_sup` fails. See the Ranch internals chapter for -more details on how Ranch does it. diff --git a/docs/en/ranch/1.5/guide/embedded/index.html b/docs/en/ranch/1.5/guide/embedded/index.html deleted file mode 100644 index 92bce4ec..00000000 --- a/docs/en/ranch/1.5/guide/embedded/index.html +++ /dev/null @@ -1,202 +0,0 @@ - - - - - - - - - - Nine Nines: Embedded mode - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -

    Embedded mode

    - -

    Embedded mode allows you to insert Ranch listeners directly in your supervision tree. This allows for greater fault tolerance control by permitting the shutdown of a listener due to the failure of another part of the application and vice versa.

    -

    Embedding

    -

    To embed Ranch in your application you can simply add the child specs to your supervision tree. This can all be done in the init/1 function of one of your application supervisors.

    -

    Ranch requires at the minimum two kinds of child specs for embedding. First, you need to add ranch_sup to your supervision tree, only once, regardless of the number of listeners you will use. Then you need to add the child specs for each listener.

    -

    Ranch has a convenience function for getting the listeners child specs called ranch:child_spec/5, that works like ranch:start_listener/5, except that it doesn't start anything, it only returns child specs.

    -

    As for ranch_sup, the child spec is simple enough to not require a convenience function.

    -

    The following example adds both ranch_sup and one listener to another application's supervision tree.

    -
    Embed Ranch directly in your supervision tree
    -
    -
    init([]) ->
    -	RanchSupSpec = {ranch_sup, {ranch_sup, start_link, []},
    -		permanent, 5000, supervisor, [ranch_sup]},
    -	ListenerSpec = ranch:child_spec(echo, 100,
    -		ranch_tcp, [{port, 5555}],
    -		echo_protocol, []
    -	),
    -	{ok, {{one_for_one, 10, 10}, [RanchSupSpec, ListenerSpec]}}.
    -
    -

    Remember, you can add as many listener child specs as needed, but only one ranch_sup spec!

    -

    It is recommended that your architecture makes sure that all listeners are restarted if ranch_sup fails. See the Ranch internals chapter for more details on how Ranch does it.

    - - - - - - - - - - - - - - - - -
    - -
    - - -

    - Ranch - 1.5 - - User Guide -

    - - - -

    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.

    - - - -
    -
    -
    -
    - - - - - - - - - diff --git a/docs/en/ranch/1.5/guide/index.html b/docs/en/ranch/1.5/guide/index.html deleted file mode 100644 index d9046ef3..00000000 --- a/docs/en/ranch/1.5/guide/index.html +++ /dev/null @@ -1,174 +0,0 @@ - - - - - - - - - - Nine Nines: Ranch User Guide - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -

    Ranch User Guide

    - - - - - - - - -
    - -
    - - -

    - Ranch - 1.5 - - User Guide -

    - - - -

    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.

    - - - -
    -
    -
    -
    - - - - - - - - - diff --git a/docs/en/ranch/1.5/guide/internals.asciidoc b/docs/en/ranch/1.5/guide/internals.asciidoc deleted file mode 100644 index c5bde58f..00000000 --- a/docs/en/ranch/1.5/guide/internals.asciidoc +++ /dev/null @@ -1,94 +0,0 @@ -== Internals - -This chapter may not apply to embedded Ranch as embedding allows you -to use an architecture specific to your application, which may or may -not be compatible with the description of the Ranch application. - -Note that for everything related to efficiency and performance, -you should perform the benchmarks yourself to get the numbers that -matter to you. Generic benchmarks found on the web may or may not -be of use to you, you can never know until you benchmark your own -system. - -=== Architecture - -Ranch is an OTP application. - -Like all OTP applications, Ranch has a top supervisor. It is responsible -for supervising the `ranch_server` process and all the listeners that -will be started. - -The `ranch_server` gen_server is a central process keeping track of the -listeners and their acceptors. It does so through the use of a public ets -table called `ranch_server`. The table is owned by the top supervisor -to improve fault tolerance. This way if the `ranch_server` gen_server -fails, it doesn't lose any information and the restarted process can -continue as if nothing happened. - -Ranch uses a custom supervisor for managing connections. This supervisor -keeps track of the number of connections and handles connection limits -directly. While it is heavily optimized to perform the task of creating -connection processes for accepted connections, it is still following the -OTP principles and the usual `sys` and `supervisor` calls will work on -it as expected. - -Listeners are grouped into the `ranch_listener_sup` supervisor and -consist of three kinds of processes: the listener gen_server, the -acceptor processes and the connection processes, both grouped under -their own supervisor. All of these processes are registered to the -`ranch_server` gen_server with varying amount of information. - -All socket operations, including listening for connections, go through -transport handlers. Accepted connections are given to the protocol handler. -Transport handlers are simple callback modules for performing operations on -sockets. Protocol handlers start a new process, which receives socket -ownership, with no requirements on how the code should be written inside -that new process. - -=== Number of acceptors - -The second argument to `ranch:start_listener/5` is the number of -processes that will be accepting connections. Care should be taken -when choosing this number. - -First of all, it should not be confused with the maximum number -of connections. Acceptor processes are only used for accepting and -have nothing else in common with connection processes. Therefore -there is nothing to be gained from setting this number too high, -in fact it can slow everything else down. - -Second, this number should be high enough to allow Ranch to accept -connections concurrently. But the number of cores available doesn't -seem to be the only factor for choosing this number, as we can -observe faster accepts if we have more acceptors than cores. It -might be entirely dependent on the protocol, however. - -Our observations suggest that using 100 acceptors on modern hardware -is a good solution, as it's big enough to always have acceptors ready -and it's low enough that it doesn't have a negative impact on the -system's performances. - -=== Platform-specific TCP features - -Some socket options are platform-specific and not supported by `inet`. -They can be of interest because they generally are related to -optimizations provided by the underlying OS. They can still be enabled -thanks to the `raw` option, for which we will see an example. - -One of these features is `TCP_DEFER_ACCEPT` on Linux. It is a simplified -accept mechanism which will wait for application data to come in before -handing out the connection to the Erlang process. - -This is especially useful if you expect many connections to be mostly -idle, perhaps part of a connection pool. They can be handled by the -kernel directly until they send any real data, instead of allocating -resources to idle connections. - -To enable this mechanism, the following option can be used. - -.Using raw transport options - -[source,erlang] -{raw, 6, 9, << 30:32/native >>} - -It means go on layer 6, turn on option 9 with the given integer parameter. diff --git a/docs/en/ranch/1.5/guide/internals/index.html b/docs/en/ranch/1.5/guide/internals/index.html deleted file mode 100644 index 57e244db..00000000 --- a/docs/en/ranch/1.5/guide/internals/index.html +++ /dev/null @@ -1,202 +0,0 @@ - - - - - - - - - - Nine Nines: Internals - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -

    Internals

    - -

    This chapter may not apply to embedded Ranch as embedding allows you to use an architecture specific to your application, which may or may not be compatible with the description of the Ranch application.

    -

    Note that for everything related to efficiency and performance, you should perform the benchmarks yourself to get the numbers that matter to you. Generic benchmarks found on the web may or may not be of use to you, you can never know until you benchmark your own system.

    -

    Architecture

    -

    Ranch is an OTP application.

    -

    Like all OTP applications, Ranch has a top supervisor. It is responsible for supervising the ranch_server process and all the listeners that will be started.

    -

    The ranch_server gen_server is a central process keeping track of the listeners and their acceptors. It does so through the use of a public ets table called ranch_server. The table is owned by the top supervisor to improve fault tolerance. This way if the ranch_server gen_server fails, it doesn't lose any information and the restarted process can continue as if nothing happened.

    -

    Ranch uses a custom supervisor for managing connections. This supervisor keeps track of the number of connections and handles connection limits directly. While it is heavily optimized to perform the task of creating connection processes for accepted connections, it is still following the OTP principles and the usual sys and supervisor calls will work on it as expected.

    -

    Listeners are grouped into the ranch_listener_sup supervisor and consist of three kinds of processes: the listener gen_server, the acceptor processes and the connection processes, both grouped under their own supervisor. All of these processes are registered to the ranch_server gen_server with varying amount of information.

    -

    All socket operations, including listening for connections, go through transport handlers. Accepted connections are given to the protocol handler. Transport handlers are simple callback modules for performing operations on sockets. Protocol handlers start a new process, which receives socket ownership, with no requirements on how the code should be written inside that new process.

    -

    Number of acceptors

    -

    The second argument to ranch:start_listener/5 is the number of processes that will be accepting connections. Care should be taken when choosing this number.

    -

    First of all, it should not be confused with the maximum number of connections. Acceptor processes are only used for accepting and have nothing else in common with connection processes. Therefore there is nothing to be gained from setting this number too high, in fact it can slow everything else down.

    -

    Second, this number should be high enough to allow Ranch to accept connections concurrently. But the number of cores available doesn't seem to be the only factor for choosing this number, as we can observe faster accepts if we have more acceptors than cores. It might be entirely dependent on the protocol, however.

    -

    Our observations suggest that using 100 acceptors on modern hardware is a good solution, as it's big enough to always have acceptors ready and it's low enough that it doesn't have a negative impact on the system's performances.

    -

    Platform-specific TCP features

    -

    Some socket options are platform-specific and not supported by inet. They can be of interest because they generally are related to optimizations provided by the underlying OS. They can still be enabled thanks to the raw option, for which we will see an example.

    -

    One of these features is TCP_DEFER_ACCEPT on Linux. It is a simplified accept mechanism which will wait for application data to come in before handing out the connection to the Erlang process.

    -

    This is especially useful if you expect many connections to be mostly idle, perhaps part of a connection pool. They can be handled by the kernel directly until they send any real data, instead of allocating resources to idle connections.

    -

    To enable this mechanism, the following option can be used.

    -
    Using raw transport options
    -
    -
    {raw, 6, 9, << 30:32/native >>}
    -
    -

    It means go on layer 6, turn on option 9 with the given integer parameter.

    - - - - - - - - - - - - - - - - -
    - -
    - - -

    - Ranch - 1.5 - - User Guide -

    - - - -

    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.

    - - - -
    -
    -
    -
    - - - - - - - - - diff --git a/docs/en/ranch/1.5/guide/introduction.asciidoc b/docs/en/ranch/1.5/guide/introduction.asciidoc deleted file mode 100644 index ac27862e..00000000 --- a/docs/en/ranch/1.5/guide/introduction.asciidoc +++ /dev/null @@ -1,28 +0,0 @@ -== Introduction - -Ranch is a socket acceptor pool for TCP protocols. - -Ranch aims to provide everything you need to accept TCP connections -with a small code base and low latency while being easy to use directly -as an application or to embed into your own. - -=== Prerequisites - -It is assumed the developer already knows Erlang and has some experience -with socket programming and TCP protocols. - -=== Supported platforms - -Ranch is tested and supported on Linux, FreeBSD, OSX and Windows. - -Ranch is developed for Erlang/OTP R16B+. - -There are known issues with the SSL application found in Erlang/OTP -18.3.2 and 18.3.3. These versions are therefore not supported. - -Ranch may be compiled on earlier Erlang versions with small source code -modifications but there is no guarantee that it will work as expected. - -=== Versioning - -Ranch uses http://semver.org/[Semantic Versioning 2.0.0] diff --git a/docs/en/ranch/1.5/guide/introduction/index.html b/docs/en/ranch/1.5/guide/introduction/index.html deleted file mode 100644 index d5a2af7e..00000000 --- a/docs/en/ranch/1.5/guide/introduction/index.html +++ /dev/null @@ -1,186 +0,0 @@ - - - - - - - - - - Nine Nines: Introduction - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -

    Introduction

    - -

    Ranch is a socket acceptor pool for TCP protocols.

    -

    Ranch aims to provide everything you need to accept TCP connections with a small code base and low latency while being easy to use directly as an application or to embed into your own.

    -

    Prerequisites

    -

    It is assumed the developer already knows Erlang and has some experience with socket programming and TCP protocols.

    -

    Supported platforms

    -

    Ranch is tested and supported on Linux, FreeBSD, OSX and Windows.

    -

    Ranch is developed for Erlang/OTP R16B+.

    -

    There are known issues with the SSL application found in Erlang/OTP 18.3.2 and 18.3.3. These versions are therefore not supported.

    -

    Ranch may be compiled on earlier Erlang versions with small source code modifications but there is no guarantee that it will work as expected.

    -

    Versioning

    -

    Ranch uses Semantic Versioning 2.0.0

    - - - - - - - - - - - - - - - - -
    - -
    - - -

    - Ranch - 1.5 - - User Guide -

    - - - -

    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.

    - - - -
    -
    -
    -
    - - - - - - - - - diff --git a/docs/en/ranch/1.5/guide/listeners.asciidoc b/docs/en/ranch/1.5/guide/listeners.asciidoc deleted file mode 100644 index 97afa223..00000000 --- a/docs/en/ranch/1.5/guide/listeners.asciidoc +++ /dev/null @@ -1,320 +0,0 @@ -== Listeners - -A listener is a set of processes whose role is to listen on a port -for new connections. It manages a pool of acceptor processes, each -of them indefinitely accepting connections. When it does, it starts -a new process executing the protocol handler code. All the socket -programming is abstracted through the use of transport handlers. - -The listener takes care of supervising all the acceptor and connection -processes, allowing developers to focus on building their application. - -=== Starting a listener - -Ranch does nothing by default. It is up to the application developer -to request that Ranch listens for connections. - -A listener can be started and stopped at will. - -When starting a listener, a number of different settings are required: - -* A name to identify it locally and be able to interact with it. -* The number of acceptors in the pool. -* A transport handler and its associated options. -* A protocol handler and its associated options. - -Ranch includes both TCP and SSL transport handlers, respectively -`ranch_tcp` and `ranch_ssl`. - -A listener can be started by calling the `ranch:start_listener/5` -function. Before doing so however, you must ensure that the `ranch` -application is started. - -.Starting the Ranch application - -[source,erlang] -ok = application:start(ranch). - -You are then ready to start a listener. Let's call it `tcp_echo`. It will -have a pool of 100 acceptors, use a TCP transport and forward connections -to the `echo_protocol` handler. - -.Starting a listener for TCP connections on port 5555 - -[source,erlang] -{ok, _} = ranch:start_listener(tcp_echo, - ranch_tcp, [{port, 5555}], - echo_protocol, [] -). - -You can try this out by compiling and running the `tcp_echo` example in the -examples directory. To do so, open a shell in the 'examples/tcp_echo/' -directory and run the following command: - -.Building and starting a Ranch example - -[source,bash] -$ make run - -You can then connect to it using telnet and see the echo server reply -everything you send to it. Then when you're done testing, you can use -the `Ctrl+]` key to escape to the telnet command line and type -`quit` to exit. - -.Connecting to the example listener with telnet - -[source,bash] ----- -$ telnet localhost 5555 -Trying 127.0.0.1... -Connected to localhost. -Escape character is '^]'. -Hello! -Hello! -It works! -It works! -^] - -telnet> quit -Connection closed. ----- - -=== Stopping a listener - -All you need to stop a Ranch listener is to call the -`ranch:stop_listener/1` function with the listener's name -as argument. In the previous section we started the listener -named `tcp_echo`. We can now stop it. - -.Stopping a listener - -[source,erlang] -ranch:stop_listener(tcp_echo). - -=== Default transport options - -By default the socket will be set to return `binary` data, with the -options `{active, false}`, `{packet, raw}`, `{reuseaddr, true}` set. -These values can't be overriden when starting the listener, but -they can be overriden using `Transport:setopts/2` in the protocol. - -It will also set `{backlog, 1024}` and `{nodelay, true}`, which -can be overriden at listener startup. - -=== Listening on a random port - -You do not have to specify a specific port to listen on. If you give -the port number 0, or if you omit the port number entirely, Ranch will -start listening on a random port. - -You can retrieve this port number by calling `ranch:get_port/1`. The -argument is the name of the listener you gave in `ranch:start_listener/5`. - -.Starting a listener for TCP connections on a random port - -[source,erlang] -{ok, _} = ranch:start_listener(tcp_echo, - ranch_tcp, [{port, 0}], - echo_protocol, [] -). -Port = ranch:get_port(tcp_echo). - -=== Listening on privileged ports - -Some systems limit access to ports below 1024 for security reasons. -This can easily be identified by an `{error, eacces}` error when trying -to open a listening socket on such a port. - -The methods for listening on privileged ports vary between systems, -please refer to your system's documentation for more information. - -We recommend the use of port rewriting for systems with a single server, -and load balancing for systems with multiple servers. Documenting these -solutions is however out of the scope of this guide. - -=== Accepting connections on an existing socket - -If you want to accept connections on an existing socket, you can use the -`socket` transport option, which should just be the relevant data returned -from the connect function for the transport or the underlying socket library -(`gen_tcp:connect`, `ssl:connect`). The accept function will then be -called on the passed in socket. You should connect the socket in -`{active, false}` mode, as well. - -Note, however, that because of a bug in SSL, you cannot change ownership of an -SSL listen socket prior to R16. Ranch will catch the error thrown, but the -owner of the SSL socket will remain as whatever process created the socket. -However, this will not affect accept behaviour unless the owner process dies, -in which case the socket is closed. Therefore, to use this feature with SSL -with an erlang release prior to R16, ensure that the SSL socket is opened in a -persistant process. - -=== Limiting the number of concurrent connections - -The `max_connections` transport option allows you to limit the number -of concurrent connections. It defaults to 1024. Its purpose is to -prevent your system from being overloaded and ensuring all the -connections are handled optimally. - -.Customizing the maximum number of concurrent connections - -[source,erlang] -{ok, _} = ranch:start_listener(tcp_echo, - ranch_tcp, [{port, 5555}, {max_connections, 100}], - echo_protocol, [] -). - -You can disable this limit by setting its value to the atom `infinity`. - -.Disabling the limit for the number of connections - -[source,erlang] -{ok, _} = ranch:start_listener(tcp_echo, - ranch_tcp, [{port, 5555}, {max_connections, infinity}], - echo_protocol, [] -). - -The maximum number of connections is a soft limit. In practice, it -can reach `max_connections` + the number of acceptors. - -When the maximum number of connections is reached, Ranch will stop -accepting connections. This will not result in further connections -being rejected, as the kernel option allows queueing incoming -connections. The size of this queue is determined by the `backlog` -option and defaults to 1024. Ranch does not know about the number -of connections that are in the backlog. - -You may not always want connections to be counted when checking for -`max_connections`. For example you might have a protocol where both -short-lived and long-lived connections are possible. If the long-lived -connections are mostly waiting for messages, then they don't consume -much resources and can safely be removed from the count. - -To remove the connection from the count, you must call the -`ranch:remove_connection/1` from within the connection process, -with the name of the listener as the only argument. - -.Removing a connection from the count of connections - -[source,erlang] -ranch:remove_connection(Ref). - -As seen in the chapter covering protocols, this pid is received as the -first argument of the protocol's `start_link/4` callback. - -You can modify the `max_connections` value on a running listener by -using the `ranch:set_max_connections/2` function, with the name of the -listener as first argument and the new value as the second. - -.Upgrading the maximum number of connections - -[source,erlang] -ranch:set_max_connections(tcp_echo, MaxConns). - -The change will occur immediately. - -=== Customizing the number of acceptor processes - -By default Ranch will use 10 acceptor processes. Their role is -to accept connections and spawn a connection process for every -new connection. - -This number can be tweaked to improve performance. A good -number is typically between 10 or 100 acceptors. You must -measure to find the best value for your application. - -.Specifying a custom number of acceptor processes - -[source,erlang] -{ok, _} = ranch:start_listener(tcp_echo, - ranch_tcp, [{port, 5555}, {num_acceptors, 42}], - echo_protocol, [] -). - -=== When running out of file descriptors - -Operating systems have limits on the number of sockets -which can be opened by applications. When this maximum is -reached the listener can no longer accept new connections. The -accept rate of the listener will be automatically reduced, and a -warning message will be logged. - ----- -=ERROR REPORT==== 13-Jan-2016::12:24:38 === -Ranch acceptor reducing accept rate: out of file descriptors ----- - -If you notice messages like this you should increase the number -of file-descriptors which can be opened by your application. How -this should be done is operating-system dependent. Please consult -the documentation of your operating system. - -=== Using a supervisor for connection processes - -Ranch allows you to define the type of process that will be used -for the connection processes. By default it expects a `worker`. -When the `connection_type` configuration value is set to `supervisor`, -Ranch will consider that the connection process it manages is a -supervisor and will reflect that in its supervision tree. - -Connection processes of type `supervisor` can either handle the -socket directly or through one of their children. In the latter -case the start function for the connection process must return -two pids: the pid of the supervisor you created (that will be -supervised) and the pid of the protocol handling process (that -will receive the socket). - -Instead of returning `{ok, ConnPid}`, simply return -`{ok, SupPid, ConnPid}`. - -It is very important that the connection process be created -under the supervisor process so that everything works as intended. -If not, you will most likely experience issues when the supervised -process is stopped. - -=== Upgrading - -Ranch allows you to upgrade the protocol options. This takes effect -immediately and for all subsequent connections. - -To upgrade the protocol options, call `ranch:set_protocol_options/2` -with the name of the listener as first argument and the new options -as the second. - -.Upgrading the protocol options - -[source,erlang] -ranch:set_protocol_options(tcp_echo, NewOpts). - -All future connections will use the new options. - -You can also retrieve the current options similarly by -calling `ranch:get_protocol_options/1`. - -.Retrieving the current protocol options - -[source,erlang] -Opts = ranch:get_protocol_options(tcp_echo). - -=== Obtaining information about listeners - -Ranch provides two functions for retrieving information about the -listeners, for reporting and diagnostic purposes. - -The `ranch:info/0` function will return detailed information -about all listeners. - -.Retrieving detailed information -[source,erlang] -ranch:info(). - -The `ranch:procs/2` function will return all acceptor or listener -processes for a given listener. - -.Get all acceptor processes -[source,erlang] -ranch:procs(tcp_echo, acceptors). - -.Get all connection processes -[source,erlang] -ranch:procs(tcp_echo, connections). diff --git a/docs/en/ranch/1.5/guide/listeners/index.html b/docs/en/ranch/1.5/guide/listeners/index.html deleted file mode 100644 index 6a8330a6..00000000 --- a/docs/en/ranch/1.5/guide/listeners/index.html +++ /dev/null @@ -1,385 +0,0 @@ - - - - - - - - - - Nine Nines: Listeners - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -

    Listeners

    - -

    A listener is a set of processes whose role is to listen on a port for new connections. It manages a pool of acceptor processes, each of them indefinitely accepting connections. When it does, it starts a new process executing the protocol handler code. All the socket programming is abstracted through the use of transport handlers.

    -

    The listener takes care of supervising all the acceptor and connection processes, allowing developers to focus on building their application.

    -

    Starting a listener

    -

    Ranch does nothing by default. It is up to the application developer to request that Ranch listens for connections.

    -

    A listener can be started and stopped at will.

    -

    When starting a listener, a number of different settings are required:

    -
    • A name to identify it locally and be able to interact with it. -
    • -
    • The number of acceptors in the pool. -
    • -
    • A transport handler and its associated options. -
    • -
    • A protocol handler and its associated options. -
    • -
    -

    Ranch includes both TCP and SSL transport handlers, respectively ranch_tcp and ranch_ssl.

    -

    A listener can be started by calling the ranch:start_listener/5 function. Before doing so however, you must ensure that the ranch application is started.

    -
    Starting the Ranch application
    -
    -
    ok = application:start(ranch).
    -
    -

    You are then ready to start a listener. Let's call it tcp_echo. It will have a pool of 100 acceptors, use a TCP transport and forward connections to the echo_protocol handler.

    -
    Starting a listener for TCP connections on port 5555
    -
    -
    {ok, _} = ranch:start_listener(tcp_echo,
    -	ranch_tcp, [{port, 5555}],
    -	echo_protocol, []
    -).
    -
    -

    You can try this out by compiling and running the tcp_echo example in the examples directory. To do so, open a shell in the examples/tcp_echo/ directory and run the following command:

    -
    Building and starting a Ranch example
    -
    -
    $ make run
    -
    -

    You can then connect to it using telnet and see the echo server reply everything you send to it. Then when you're done testing, you can use the Ctrl+] key to escape to the telnet command line and type quit to exit.

    -
    Connecting to the example listener with telnet
    -
    -
    $ telnet localhost 5555
    -Trying 127.0.0.1...
    -Connected to localhost.
    -Escape character is '^]'.
    -Hello!
    -Hello!
    -It works!
    -It works!
    -^]
    -
    -telnet> quit
    -Connection closed.
    -
    -

    Stopping a listener

    -

    All you need to stop a Ranch listener is to call the ranch:stop_listener/1 function with the listener's name as argument. In the previous section we started the listener named tcp_echo. We can now stop it.

    -
    Stopping a listener
    -
    -
    ranch:stop_listener(tcp_echo).
    -
    -

    Default transport options

    -

    By default the socket will be set to return binary data, with the options {active, false}, {packet, raw}, {reuseaddr, true} set. These values can't be overriden when starting the listener, but they can be overriden using Transport:setopts/2 in the protocol.

    -

    It will also set {backlog, 1024} and {nodelay, true}, which can be overriden at listener startup.

    -

    Listening on a random port

    -

    You do not have to specify a specific port to listen on. If you give the port number 0, or if you omit the port number entirely, Ranch will start listening on a random port.

    -

    You can retrieve this port number by calling ranch:get_port/1. The argument is the name of the listener you gave in ranch:start_listener/5.

    -
    Starting a listener for TCP connections on a random port
    -
    -
    {ok, _} = ranch:start_listener(tcp_echo,
    -	ranch_tcp, [{port, 0}],
    -	echo_protocol, []
    -).
    -Port = ranch:get_port(tcp_echo).
    -
    -

    Listening on privileged ports

    -

    Some systems limit access to ports below 1024 for security reasons. This can easily be identified by an {error, eacces} error when trying to open a listening socket on such a port.

    -

    The methods for listening on privileged ports vary between systems, please refer to your system's documentation for more information.

    -

    We recommend the use of port rewriting for systems with a single server, and load balancing for systems with multiple servers. Documenting these solutions is however out of the scope of this guide.

    -

    Accepting connections on an existing socket

    -

    If you want to accept connections on an existing socket, you can use the socket transport option, which should just be the relevant data returned from the connect function for the transport or the underlying socket library (gen_tcp:connect, ssl:connect). The accept function will then be called on the passed in socket. You should connect the socket in {active, false} mode, as well.

    -

    Note, however, that because of a bug in SSL, you cannot change ownership of an SSL listen socket prior to R16. Ranch will catch the error thrown, but the owner of the SSL socket will remain as whatever process created the socket. However, this will not affect accept behaviour unless the owner process dies, in which case the socket is closed. Therefore, to use this feature with SSL with an erlang release prior to R16, ensure that the SSL socket is opened in a persistant process.

    -

    Limiting the number of concurrent connections

    -

    The max_connections transport option allows you to limit the number of concurrent connections. It defaults to 1024. Its purpose is to prevent your system from being overloaded and ensuring all the connections are handled optimally.

    -
    Customizing the maximum number of concurrent connections
    -
    -
    {ok, _} = ranch:start_listener(tcp_echo,
    -	ranch_tcp, [{port, 5555}, {max_connections, 100}],
    -	echo_protocol, []
    -).
    -
    -

    You can disable this limit by setting its value to the atom infinity.

    -
    Disabling the limit for the number of connections
    -
    -
    {ok, _} = ranch:start_listener(tcp_echo,
    -	ranch_tcp, [{port, 5555}, {max_connections, infinity}],
    -	echo_protocol, []
    -).
    -
    -

    The maximum number of connections is a soft limit. In practice, it can reach max_connections + the number of acceptors.

    -

    When the maximum number of connections is reached, Ranch will stop accepting connections. This will not result in further connections being rejected, as the kernel option allows queueing incoming connections. The size of this queue is determined by the backlog option and defaults to 1024. Ranch does not know about the number of connections that are in the backlog.

    -

    You may not always want connections to be counted when checking for max_connections. For example you might have a protocol where both short-lived and long-lived connections are possible. If the long-lived connections are mostly waiting for messages, then they don't consume much resources and can safely be removed from the count.

    -

    To remove the connection from the count, you must call the ranch:remove_connection/1 from within the connection process, with the name of the listener as the only argument.

    -
    Removing a connection from the count of connections
    -
    -
    ranch:remove_connection(Ref).
    -
    -

    As seen in the chapter covering protocols, this pid is received as the first argument of the protocol's start_link/4 callback.

    -

    You can modify the max_connections value on a running listener by using the ranch:set_max_connections/2 function, with the name of the listener as first argument and the new value as the second.

    -
    Upgrading the maximum number of connections
    -
    -
    ranch:set_max_connections(tcp_echo, MaxConns).
    -
    -

    The change will occur immediately.

    -

    Customizing the number of acceptor processes

    -

    By default Ranch will use 10 acceptor processes. Their role is to accept connections and spawn a connection process for every new connection.

    -

    This number can be tweaked to improve performance. A good number is typically between 10 or 100 acceptors. You must measure to find the best value for your application.

    -
    Specifying a custom number of acceptor processes
    -
    -
    {ok, _} = ranch:start_listener(tcp_echo,
    -	ranch_tcp, [{port, 5555}, {num_acceptors, 42}],
    -	echo_protocol, []
    -).
    -
    -

    When running out of file descriptors

    -

    Operating systems have limits on the number of sockets which can be opened by applications. When this maximum is reached the listener can no longer accept new connections. The accept rate of the listener will be automatically reduced, and a warning message will be logged.

    -
    =ERROR REPORT==== 13-Jan-2016::12:24:38 ===
    -Ranch acceptor reducing accept rate: out of file descriptors
    -

    If you notice messages like this you should increase the number of file-descriptors which can be opened by your application. How this should be done is operating-system dependent. Please consult the documentation of your operating system.

    -

    Using a supervisor for connection processes

    -

    Ranch allows you to define the type of process that will be used for the connection processes. By default it expects a worker. When the connection_type configuration value is set to supervisor, Ranch will consider that the connection process it manages is a supervisor and will reflect that in its supervision tree.

    -

    Connection processes of type supervisor can either handle the socket directly or through one of their children. In the latter case the start function for the connection process must return two pids: the pid of the supervisor you created (that will be supervised) and the pid of the protocol handling process (that will receive the socket).

    -

    Instead of returning {ok, ConnPid}, simply return {ok, SupPid, ConnPid}.

    -

    It is very important that the connection process be created under the supervisor process so that everything works as intended. If not, you will most likely experience issues when the supervised process is stopped.

    -

    Upgrading

    -

    Ranch allows you to upgrade the protocol options. This takes effect immediately and for all subsequent connections.

    -

    To upgrade the protocol options, call ranch:set_protocol_options/2 with the name of the listener as first argument and the new options as the second.

    -
    Upgrading the protocol options
    -
    -
    ranch:set_protocol_options(tcp_echo, NewOpts).
    -
    -

    All future connections will use the new options.

    -

    You can also retrieve the current options similarly by calling ranch:get_protocol_options/1.

    -
    Retrieving the current protocol options
    -
    -
    Opts = ranch:get_protocol_options(tcp_echo).
    -
    -

    Obtaining information about listeners

    -

    Ranch provides two functions for retrieving information about the listeners, for reporting and diagnostic purposes.

    -

    The ranch:info/0 function will return detailed information about all listeners.

    -
    Retrieving detailed information
    -
    -
    ranch:info().
    -
    -

    The ranch:procs/2 function will return all acceptor or listener processes for a given listener.

    -
    Get all acceptor processes
    -
    -
    ranch:procs(tcp_echo, acceptors).
    -
    -
    Get all connection processes
    -
    -
    ranch:procs(tcp_echo, connections).
    -
    - - - - - - - - - - - - - - - - -
    - -
    - - -

    - Ranch - 1.5 - - User Guide -

    - - - -

    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.

    - - - -
    -
    -
    -
    - - - - - - - - - diff --git a/docs/en/ranch/1.5/guide/parsers.asciidoc b/docs/en/ranch/1.5/guide/parsers.asciidoc deleted file mode 100644 index 9eacbfa9..00000000 --- a/docs/en/ranch/1.5/guide/parsers.asciidoc +++ /dev/null @@ -1,92 +0,0 @@ -== Writing parsers - -There are three kinds of protocols: - -* Text protocols -* Schema-less binary protocols -* Schema-based binary protocols - -This chapter introduces the first two kinds. It will not cover -more advanced topics such as continuations or parser generators. - -This chapter isn't specifically about Ranch, we assume here that -you know how to read data from the socket. The data you read and -the data that hasn't been parsed is saved in a buffer. Every -time you read from the socket, the data read is appended to the -buffer. What happens next depends on the kind of protocol. We -will only cover the first two. - -=== Parsing text - -Text protocols are generally line based. This means that we can't -do anything with them until we receive the full line. - -A simple way to get a full line is to use `binary:split/{2,3}`. - -.Using binary:split/2 to get a line of input - -[source,erlang] -case binary:split(Buffer, <<"\n">>) of - [_] -> - get_more_data(Buffer); - [Line, Rest] -> - handle_line(Line, Rest) -end. - -In the above example, we can have two results. Either there was -a line break in the buffer and we get it split into two parts, -the line and the rest of the buffer; or there was no line break -in the buffer and we need to get more data from the socket. - -Next, we need to parse the line. The simplest way is to again -split, here on space. The difference is that we want to split -on all spaces character, as we want to tokenize the whole string. - -.Using binary:split/3 to split text - -[source,erlang] -case binary:split(Line, <<" ">>, [global]) of - [<<"HELLO">>] -> - be_polite(); - [<<"AUTH">>, User, Password] -> - authenticate_user(User, Password); - [<<"QUIT">>, Reason] -> - quit(Reason) - %% ... -end. - -Pretty simple, right? Match on the command name, get the rest -of the tokens in variables and call the respective functions. - -After doing this, you will want to check if there is another -line in the buffer, and handle it immediately if any. -Otherwise wait for more data. - -=== Parsing binary - -Binary protocols can be more varied, although most of them are -pretty similar. The first four bytes of a frame tend to be -the size of the frame, which is followed by a certain number -of bytes for the type of frame and then various parameters. - -Sometimes the size of the frame includes the first four bytes, -sometimes not. Other times this size is encoded over two bytes. -And even other times little-endian is used instead of big-endian. - -The general idea stays the same though. - -.Using binary pattern matching to split frames - -[source,erlang] -<< Size:32, _/bits >> = Buffer, -case Buffer of - << Frame:Size/binary, Rest/bits >> -> - handle_frame(Frame, Rest); - _ -> - get_more_data(Buffer) -end. - -You will then need to parse this frame using binary pattern -matching, and handle it. Then you will want to check if there -is another frame fully received in the buffer, and handle it -immediately if any. Otherwise wait for more data. diff --git a/docs/en/ranch/1.5/guide/parsers/index.html b/docs/en/ranch/1.5/guide/parsers/index.html deleted file mode 100644 index 7dfa3675..00000000 --- a/docs/en/ranch/1.5/guide/parsers/index.html +++ /dev/null @@ -1,241 +0,0 @@ - - - - - - - - - - Nine Nines: Writing parsers - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -

    Writing parsers

    - -

    There are three kinds of protocols:

    -
    • Text protocols -
    • -
    • Schema-less binary protocols -
    • -
    • Schema-based binary protocols -
    • -
    -

    This chapter introduces the first two kinds. It will not cover more advanced topics such as continuations or parser generators.

    -

    This chapter isn't specifically about Ranch, we assume here that you know how to read data from the socket. The data you read and the data that hasn't been parsed is saved in a buffer. Every time you read from the socket, the data read is appended to the buffer. What happens next depends on the kind of protocol. We will only cover the first two.

    -

    Parsing text

    -

    Text protocols are generally line based. This means that we can't do anything with them until we receive the full line.

    -

    A simple way to get a full line is to use binary:split/{2,3}.

    -
    Using binary:split/2 to get a line of input
    -
    -
    case binary:split(Buffer, <<"\n">>) of
    -	[_] ->
    -		get_more_data(Buffer);
    -	[Line, Rest] ->
    -		handle_line(Line, Rest)
    -end.
    -
    -

    In the above example, we can have two results. Either there was a line break in the buffer and we get it split into two parts, the line and the rest of the buffer; or there was no line break in the buffer and we need to get more data from the socket.

    -

    Next, we need to parse the line. The simplest way is to again split, here on space. The difference is that we want to split on all spaces character, as we want to tokenize the whole string.

    -
    Using binary:split/3 to split text
    -
    -
    case binary:split(Line, <<" ">>, [global]) of
    -	[<<"HELLO">>] ->
    -		be_polite();
    -	[<<"AUTH">>, User, Password] ->
    -		authenticate_user(User, Password);
    -	[<<"QUIT">>, Reason] ->
    -		quit(Reason)
    -	%% ...
    -end.
    -
    -

    Pretty simple, right? Match on the command name, get the rest of the tokens in variables and call the respective functions.

    -

    After doing this, you will want to check if there is another line in the buffer, and handle it immediately if any. Otherwise wait for more data.

    -

    Parsing binary

    -

    Binary protocols can be more varied, although most of them are pretty similar. The first four bytes of a frame tend to be the size of the frame, which is followed by a certain number of bytes for the type of frame and then various parameters.

    -

    Sometimes the size of the frame includes the first four bytes, sometimes not. Other times this size is encoded over two bytes. And even other times little-endian is used instead of big-endian.

    -

    The general idea stays the same though.

    -
    Using binary pattern matching to split frames
    -
    -
    << Size:32, _/bits >> = Buffer,
    -case Buffer of
    -	<< Frame:Size/binary, Rest/bits >> ->
    -		handle_frame(Frame, Rest);
    -	_ ->
    -		get_more_data(Buffer)
    -end.
    -
    -

    You will then need to parse this frame using binary pattern matching, and handle it. Then you will want to check if there is another frame fully received in the buffer, and handle it immediately if any. Otherwise wait for more data.

    - - - - - - - - - - - - - - - - -
    - -
    - - -

    - Ranch - 1.5 - - User Guide -

    - - - -

    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.

    - - - -
    -
    -
    -
    - - - - - - - - - diff --git a/docs/en/ranch/1.5/guide/protocols.asciidoc b/docs/en/ranch/1.5/guide/protocols.asciidoc deleted file mode 100644 index b9a31f27..00000000 --- a/docs/en/ranch/1.5/guide/protocols.asciidoc +++ /dev/null @@ -1,99 +0,0 @@ -== Protocols - -A protocol handler starts a connection process and defines the -protocol logic executed in this process. - -=== Writing a protocol handler - -All protocol handlers must implement the `ranch_protocol` behavior -which defines a single callback, `start_link/4`. This callback is -responsible for spawning a new process for handling the connection. -It receives four arguments: the name of the listener, the socket, the -transport handler being used and the protocol options defined in -the call to `ranch:start_listener/5`. This callback must -return `{ok, Pid}`, with `Pid` the pid of the new process. - -The newly started process can then freely initialize itself. However, -it must call `ranch:accept_ack/1` before doing any socket operation. -This will ensure the connection process is the owner of the socket. -It expects the listener's name as argument. - -.Acknowledge accepting the socket - -[source,erlang] -ok = ranch:accept_ack(Ref). - -If your protocol code requires specific socket options, you should -set them while initializing your connection process, after -calling `ranch:accept_ack/1`. You can use `Transport:setopts/2` -for that purpose. - -Following is the complete protocol code for the example found -in `examples/tcp_echo/`. - -.Protocol module that echoes everything it receives - -[source,erlang] ----- --module(echo_protocol). --behaviour(ranch_protocol). - --export([start_link/4]). --export([init/4]). - -start_link(Ref, Socket, Transport, Opts) -> - Pid = spawn_link(?MODULE, init, [Ref, Socket, Transport, Opts]), - {ok, Pid}. - -init(Ref, Socket, Transport, _Opts = []) -> - ok = ranch:accept_ack(Ref), - loop(Socket, Transport). - -loop(Socket, Transport) -> - case Transport:recv(Socket, 0, 5000) of - {ok, Data} -> - Transport:send(Socket, Data), - loop(Socket, Transport); - _ -> - ok = Transport:close(Socket) - end. ----- - -=== Using gen_server - -Special processes like the ones that use the `gen_server` or `gen_fsm` -behaviours have the particularity of having their `start_link` call not -return until the `init` function returns. This is problematic, because -you won't be able to call `ranch:accept_ack/1` from the `init` callback -as this would cause a deadlock to happen. - -Use the `gen_server:enter_loop/3` function. It allows you to start your process -normally (although it must be started with `proc_lib` like all special -processes), then perform any needed operations before falling back into -the normal `gen_server` execution loop. - -.Use a gen_server for protocol handling - -[source,erlang] ----- --module(my_protocol). --behaviour(gen_server). --behaviour(ranch_protocol). - --export([start_link/4]). --export([init/1]). -%% Exports of other gen_server callbacks here. - -start_link(Ref, Socket, Transport, Opts) -> - {ok, proc_lib:spawn_link(?MODULE, init, [{Ref, Socket, Transport, Opts}])}. - -init({Ref, Socket, Transport, _Opts = []}) -> - %% Perform any required state initialization here. - ok = ranch:accept_ack(Ref), - ok = Transport:setopts(Socket, [{active, once}]), - gen_server:enter_loop(?MODULE, [], {state, Socket, Transport}). - -%% Other gen_server callbacks here. ----- - -Check the `tcp_reverse` example for a complete example. diff --git a/docs/en/ranch/1.5/guide/protocols/index.html b/docs/en/ranch/1.5/guide/protocols/index.html deleted file mode 100644 index dcba343e..00000000 --- a/docs/en/ranch/1.5/guide/protocols/index.html +++ /dev/null @@ -1,248 +0,0 @@ - - - - - - - - - - Nine Nines: Protocols - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -

    Protocols

    - -

    A protocol handler starts a connection process and defines the protocol logic executed in this process.

    -

    Writing a protocol handler

    -

    All protocol handlers must implement the ranch_protocol behavior which defines a single callback, start_link/4. This callback is responsible for spawning a new process for handling the connection. It receives four arguments: the name of the listener, the socket, the transport handler being used and the protocol options defined in the call to ranch:start_listener/5. This callback must return {ok, Pid}, with Pid the pid of the new process.

    -

    The newly started process can then freely initialize itself. However, it must call ranch:accept_ack/1 before doing any socket operation. This will ensure the connection process is the owner of the socket. It expects the listener's name as argument.

    -
    Acknowledge accepting the socket
    -
    -
    ok = ranch:accept_ack(Ref).
    -
    -

    If your protocol code requires specific socket options, you should set them while initializing your connection process, after calling ranch:accept_ack/1. You can use Transport:setopts/2 for that purpose.

    -

    Following is the complete protocol code for the example found in examples/tcp_echo/.

    -
    Protocol module that echoes everything it receives
    -
    -
    -module(echo_protocol).
    --behaviour(ranch_protocol).
    -
    --export([start_link/4]).
    --export([init/4]).
    -
    -start_link(Ref, Socket, Transport, Opts) ->
    -	Pid = spawn_link(?MODULE, init, [Ref, Socket, Transport, Opts]),
    -	{ok, Pid}.
    -
    -init(Ref, Socket, Transport, _Opts = []) ->
    -	ok = ranch:accept_ack(Ref),
    -	loop(Socket, Transport).
    -
    -loop(Socket, Transport) ->
    -	case Transport:recv(Socket, 0, 5000) of
    -		{ok, Data} ->
    -			Transport:send(Socket, Data),
    -			loop(Socket, Transport);
    -		_ ->
    -			ok = Transport:close(Socket)
    -	end.
    -
    -

    Using gen_server

    -

    Special processes like the ones that use the gen_server or gen_fsm behaviours have the particularity of having their start_link call not return until the init function returns. This is problematic, because you won't be able to call ranch:accept_ack/1 from the init callback as this would cause a deadlock to happen.

    -

    Use the gen_server:enter_loop/3 function. It allows you to start your process normally (although it must be started with proc_lib like all special processes), then perform any needed operations before falling back into the normal gen_server execution loop.

    -
    Use a gen_server for protocol handling
    -
    -
    -module(my_protocol).
    --behaviour(gen_server).
    --behaviour(ranch_protocol).
    -
    --export([start_link/4]).
    --export([init/1]).
    -%% Exports of other gen_server callbacks here.
    -
    -start_link(Ref, Socket, Transport, Opts) ->
    -	{ok, proc_lib:spawn_link(?MODULE, init, [{Ref, Socket, Transport, Opts}])}.
    -
    -init({Ref, Socket, Transport, _Opts = []}) ->
    -	%% Perform any required state initialization here.
    -	ok = ranch:accept_ack(Ref),
    -	ok = Transport:setopts(Socket, [{active, once}]),
    -	gen_server:enter_loop(?MODULE, [], {state, Socket, Transport}).
    -
    -%% Other gen_server callbacks here.
    -
    -

    Check the tcp_reverse example for a complete example.

    - - - - - - - - - - - - - - - - -
    - -
    - - -

    - Ranch - 1.5 - - User Guide -

    - - - -

    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.

    - - - -
    -
    -
    -
    - - - - - - - - - diff --git a/docs/en/ranch/1.5/guide/ssl_auth.asciidoc b/docs/en/ranch/1.5/guide/ssl_auth.asciidoc deleted file mode 100644 index de16107a..00000000 --- a/docs/en/ranch/1.5/guide/ssl_auth.asciidoc +++ /dev/null @@ -1,120 +0,0 @@ -== SSL client authentication - -=== Purpose - -SSL client authentication is a mechanism allowing applications to -identify certificates. This allows your application to make sure that -the client is an authorized certificate, but makes no claim about -whether the user can be trusted. This can be combined with a password -based authentication to attain greater security. - -The server only needs to retain the certificate serial number and -the certificate issuer to authenticate the certificate. Together, -they can be used to uniquely identify a certicate. - -As Ranch allows the same protocol code to be used for both SSL and -non-SSL transports, you need to make sure you are in an SSL context -before attempting to perform an SSL client authentication. This -can be done by checking the return value of `Transport:name/0`. - -=== Obtaining client certificates - -You can obtain client certificates from various sources. You can -generate them yourself, or you can use a service like CAcert.org -which allows you to generate client and server certificates for -free. - -Following are the steps you need to take to create a CAcert.org -account, generate a certificate and install it in your favorite -browser. - -* Open http://cacert.org in your favorite browser -* Root Certificate link: install both certificates -* Join (Register an account) -* Verify your account (check your email inbox!) -* Log in -* Client Certificates: New -* Follow instructions to create the certificate -* Install the certificate in your browser - -You can optionally save the certificate for later use, for example -to extract the `IssuerID` information as will be detailed later on. - -=== Transport configuration - -The SSL transport does not request a client certificate by default. -You need to specify the `{verify, verify_peer}` option when starting -the listener to enable this behavior. - -.Configure a listener for SSL authentication - -[source,erlang] -{ok, _} = ranch:start_listener(my_ssl, - ranch_ssl, [ - {port, SSLPort}, - {certfile, PathToCertfile}, - {cacertfile, PathToCACertfile}, - {verify, verify_peer} - ], - my_protocol, [] -). - -In this example we set the required `port` and `certfile`, but also -the `cacertfile` containing the CACert.org root certificate, and -the option to request the client certificate. - -If you enable the `{verify, verify_peer}` option and the client does -not have a client certificate configured for your domain, then no -certificate will be sent. This allows you to use SSL for more than -just authenticated clients. - -=== Authentication - -To authenticate users, you must first save the certificate information -required. If you have your users' certificate files, you can simply -load the certificate and retrieve the information directly. - -.Retrieve the issuer ID from a certificate - -[source,erlang] ----- -certfile_to_issuer_id(Filename) -> - {ok, Data} = file:read_file(Filename), - [{'Certificate', Cert, not_encrypted}] = public_key:pem_decode(Data), - {ok, IssuerID} = public_key:pkix_issuer_id(Cert, self), - IssuerID. ----- - -The `IssuerID` variable contains both the certificate serial number -and the certificate issuer stored in a tuple, so this value alone can -be used to uniquely identify the user certificate. You can save this -value in a database, a configuration file or any other place where an -Erlang term can be stored and retrieved. - -To retrieve the `IssuerID` from a running connection, you need to first -retrieve the client certificate and then extract this information from -it. Ranch does not provide a function to retrieve the client certificate. -Instead you can use the `ssl:peercert/1` function. Once you have the -certificate, you can again use the `public_key:pkix_issuer_id/2` to -extract the `IssuerID` value. - -The following function returns the `IssuerID` or `false` if no client -certificate was found. This snippet is intended to be used from your -protocol code. - -.Retrieve the issuer ID from the certificate for the current connection - -[source,erlang] ----- -socket_to_issuer_id(Socket) -> - case ssl:peercert(Socket) of - {error, no_peercert} -> - false; - {ok, Cert} -> - {ok, IssuerID} = public_key:pkix_issuer_id(Cert, self), - IssuerID - end. ----- - -You then only need to match the `IssuerID` value to authenticate the -user. diff --git a/docs/en/ranch/1.5/guide/ssl_auth/index.html b/docs/en/ranch/1.5/guide/ssl_auth/index.html deleted file mode 100644 index 317953d4..00000000 --- a/docs/en/ranch/1.5/guide/ssl_auth/index.html +++ /dev/null @@ -1,254 +0,0 @@ - - - - - - - - - - Nine Nines: SSL client authentication - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -

    SSL client authentication

    - -

    Purpose

    -

    SSL client authentication is a mechanism allowing applications to identify certificates. This allows your application to make sure that the client is an authorized certificate, but makes no claim about whether the user can be trusted. This can be combined with a password based authentication to attain greater security.

    -

    The server only needs to retain the certificate serial number and the certificate issuer to authenticate the certificate. Together, they can be used to uniquely identify a certicate.

    -

    As Ranch allows the same protocol code to be used for both SSL and non-SSL transports, you need to make sure you are in an SSL context before attempting to perform an SSL client authentication. This can be done by checking the return value of Transport:name/0.

    -

    Obtaining client certificates

    -

    You can obtain client certificates from various sources. You can generate them yourself, or you can use a service like CAcert.org which allows you to generate client and server certificates for free.

    -

    Following are the steps you need to take to create a CAcert.org account, generate a certificate and install it in your favorite browser.

    -
    • Open http://cacert.org in your favorite browser -
    • -
    • Root Certificate link: install both certificates -
    • -
    • Join (Register an account) -
    • -
    • Verify your account (check your email inbox!) -
    • -
    • Log in -
    • -
    • Client Certificates: New -
    • -
    • Follow instructions to create the certificate -
    • -
    • Install the certificate in your browser -
    • -
    -

    You can optionally save the certificate for later use, for example to extract the IssuerID information as will be detailed later on.

    -

    Transport configuration

    -

    The SSL transport does not request a client certificate by default. You need to specify the {verify, verify_peer} option when starting the listener to enable this behavior.

    -
    Configure a listener for SSL authentication
    -
    -
    {ok, _} = ranch:start_listener(my_ssl,
    -	ranch_ssl, [
    -		{port, SSLPort},
    -		{certfile, PathToCertfile},
    -		{cacertfile, PathToCACertfile},
    -		{verify, verify_peer}
    -	],
    -	my_protocol, []
    -).
    -
    -

    In this example we set the required port and certfile, but also the cacertfile containing the CACert.org root certificate, and the option to request the client certificate.

    -

    If you enable the {verify, verify_peer} option and the client does not have a client certificate configured for your domain, then no certificate will be sent. This allows you to use SSL for more than just authenticated clients.

    -

    Authentication

    -

    To authenticate users, you must first save the certificate information required. If you have your users' certificate files, you can simply load the certificate and retrieve the information directly.

    -
    Retrieve the issuer ID from a certificate
    -
    -
    certfile_to_issuer_id(Filename) ->
    -	{ok, Data} = file:read_file(Filename),
    -	[{'Certificate', Cert, not_encrypted}] = public_key:pem_decode(Data),
    -	{ok, IssuerID} = public_key:pkix_issuer_id(Cert, self),
    -	IssuerID.
    -
    -

    The IssuerID variable contains both the certificate serial number and the certificate issuer stored in a tuple, so this value alone can be used to uniquely identify the user certificate. You can save this value in a database, a configuration file or any other place where an Erlang term can be stored and retrieved.

    -

    To retrieve the IssuerID from a running connection, you need to first retrieve the client certificate and then extract this information from it. Ranch does not provide a function to retrieve the client certificate. Instead you can use the ssl:peercert/1 function. Once you have the certificate, you can again use the public_key:pkix_issuer_id/2 to extract the IssuerID value.

    -

    The following function returns the IssuerID or false if no client certificate was found. This snippet is intended to be used from your protocol code.

    -
    Retrieve the issuer ID from the certificate for the current connection
    -
    -
    socket_to_issuer_id(Socket) ->
    -	case ssl:peercert(Socket) of
    -		{error, no_peercert} ->
    -			false;
    -		{ok, Cert} ->
    -			{ok, IssuerID} = public_key:pkix_issuer_id(Cert, self),
    -			IssuerID
    -	end.
    -
    -

    You then only need to match the IssuerID value to authenticate the user.

    - - - - - - - - - - - - - - - - -
    - -
    - - -

    - Ranch - 1.5 - - User Guide -

    - - - -

    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.

    - - - -
    -
    -
    -
    - - - - - - - - - diff --git a/docs/en/ranch/1.5/guide/transports.asciidoc b/docs/en/ranch/1.5/guide/transports.asciidoc deleted file mode 100644 index f5bb17eb..00000000 --- a/docs/en/ranch/1.5/guide/transports.asciidoc +++ /dev/null @@ -1,161 +0,0 @@ -== Transports - -A transport defines the interface to interact with a socket. - -Transports can be used for connecting, listening and accepting -connections, but also for receiving and sending data. Both -passive and active mode are supported, although all sockets -are initialized as passive. - -=== TCP transport - -The TCP transport is a thin wrapper around `gen_tcp`. - -=== SSL transport - -The SSL transport is a thin wrapper around `ssl`. - -Ranch depends on `ssl` by default so any necessary -dependencies will start when Ranch is started. It is -possible to remove the dependency when the SSL transport -will not be used. Refer to your release build tool's -documentation for more information. - -When embedding Ranch listeners that have an SSL transport, -your application must depend on the `ssl` application for -proper behavior. - -=== Sending and receiving data - -This section assumes that `Transport` is a valid transport handler -(like `ranch_tcp` or `ranch_ssl`) and `Socket` is a connected -socket obtained through the listener. - -You can send data to a socket by calling the `Transport:send/2` -function. The data can be given as `iodata()`, which is defined as -`binary() | iolist()`. All the following calls will work: - -.Sending data to the socket - -[source,erlang] ----- -Transport:send(Socket, <<"Ranch is cool!">>). -Transport:send(Socket, "Ranch is cool!"). -Transport:send(Socket, ["Ranch", ["is", "cool!"]]). -Transport:send(Socket, ["Ranch", [<<"is">>, "cool!"]]). ----- - -You can receive data either in passive or in active mode. Passive mode -means that you will perform a blocking `Transport:recv/3` call, while -active mode means that you will receive the data as a message. - -By default, all data will be received as binary. It is possible to -receive data as strings, although this is not recommended as binaries -are a more efficient construct, especially for binary protocols. - -Receiving data using passive mode requires a single function call. The -first argument is the socket, and the third argument is a timeout duration -before the call returns with `{error, timeout}`. - -The second argument is the amount of data in bytes that we want to receive. -The function will wait for data until it has received exactly this amount. -If you are not expecting a precise size, you can specify 0 which will make -this call return as soon as data was read, regardless of its size. - -.Receiving data from the socket in passive mode - -[source,erlang] -{ok, Data} = Transport:recv(Socket, 0, 5000). - -Active mode requires you to inform the socket that you want to receive -data as a message and to write the code to actually receive it. - -There are two kinds of active modes: `{active, once}` and -`{active, true}`. The first will send a single message before going -back to passive mode; the second will send messages indefinitely. -We recommend not using the `{active, true}` mode as it could quickly -flood your process mailbox. It's better to keep the data in the socket -and read it only when required. - -Three different messages can be received: - -* `{OK, Socket, Data}` -* `{Closed, Socket}` -* `{Error, Socket, Reason}` - -The value of `OK`, `Closed` and `Error` can be different -depending on the transport being used. To be able to properly match -on them you must first call the `Transport:messages/0` function. - -.Retrieving the transport's active message identifiers - -[source,erlang] -{OK, Closed, Error} = Transport:messages(). - -To start receiving messages you will need to call the `Transport:setopts/2` -function, and do so every time you want to receive data. - -.Receiving messages from the socket in active mode - -[source,erlang] ----- -{OK, Closed, Error} = Transport:messages(), -Transport:setopts(Socket, [{active, once}]), -receive - {OK, Socket, Data} -> - io:format("data received: ~p~n", [Data]); - {Closed, Socket} -> - io:format("socket got closed!~n"); - {Error, Socket, Reason} -> - io:format("error happened: ~p~n", [Reason]) -end. ----- - -You can easily integrate active sockets with existing Erlang code as all -you really need is just a few more clauses when receiving messages. - -=== Sending files - -As in the previous section it is assumed `Transport` is a valid transport -handler and `Socket` is a connected socket obtained through the listener. - -To send a whole file, with name `Filename`, over a socket: - -.Sending a file by filename - -[source,erlang] -{ok, SentBytes} = Transport:sendfile(Socket, Filename). - -Or part of a file, with `Offset` greater than or equal to 0, `Bytes` number of -bytes and chunks of size `ChunkSize`: - -.Sending part of a file by filename in chunks - -[source,erlang] -Opts = [{chunk_size, ChunkSize}], -{ok, SentBytes} = Transport:sendfile(Socket, Filename, Offset, Bytes, Opts). - -To improve efficiency when sending multiple parts of the same file it is also -possible to use a file descriptor opened in raw mode: - -.Sending a file opened in raw mode - -[source,erlang] -{ok, RawFile} = file:open(Filename, [raw, read, binary]), -{ok, SentBytes} = Transport:sendfile(Socket, RawFile, Offset, Bytes, Opts). - -=== Writing a transport handler - -A transport handler is a module implementing the `ranch_transport` behavior. -It defines a certain number of callbacks that must be written in order to -allow transparent usage of the transport handler. - -The behavior doesn't define the socket options available when opening a -socket. These do not need to be common to all transports as it's easy enough -to write different initialization functions for the different transports that -will be used. With one exception though. The `setopts/2` function *must* -implement the `{active, once}` and the `{active, true}` options. - -If the transport handler doesn't have a native implementation of `sendfile/5` a -fallback is available, `ranch_transport:sendfile/6`. The extra first argument -is the transport's module. See `ranch_ssl` for an example. diff --git a/docs/en/ranch/1.5/guide/transports/index.html b/docs/en/ranch/1.5/guide/transports/index.html deleted file mode 100644 index edaf0cd4..00000000 --- a/docs/en/ranch/1.5/guide/transports/index.html +++ /dev/null @@ -1,279 +0,0 @@ - - - - - - - - - - Nine Nines: Transports - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -

    Transports

    - -

    A transport defines the interface to interact with a socket.

    -

    Transports can be used for connecting, listening and accepting connections, but also for receiving and sending data. Both passive and active mode are supported, although all sockets are initialized as passive.

    -

    TCP transport

    -

    The TCP transport is a thin wrapper around gen_tcp.

    -

    SSL transport

    -

    The SSL transport is a thin wrapper around ssl.

    -

    Ranch depends on ssl by default so any necessary dependencies will start when Ranch is started. It is possible to remove the dependency when the SSL transport will not be used. Refer to your release build tool's documentation for more information.

    -

    When embedding Ranch listeners that have an SSL transport, your application must depend on the ssl application for proper behavior.

    -

    Sending and receiving data

    -

    This section assumes that Transport is a valid transport handler (like ranch_tcp or ranch_ssl) and Socket is a connected socket obtained through the listener.

    -

    You can send data to a socket by calling the Transport:send/2 function. The data can be given as iodata(), which is defined as binary() | iolist(). All the following calls will work:

    -
    Sending data to the socket
    -
    -
    Transport:send(Socket, <<"Ranch is cool!">>).
    -Transport:send(Socket, "Ranch is cool!").
    -Transport:send(Socket, ["Ranch", ["is", "cool!"]]).
    -Transport:send(Socket, ["Ranch", [<<"is">>, "cool!"]]).
    -
    -

    You can receive data either in passive or in active mode. Passive mode means that you will perform a blocking Transport:recv/3 call, while active mode means that you will receive the data as a message.

    -

    By default, all data will be received as binary. It is possible to receive data as strings, although this is not recommended as binaries are a more efficient construct, especially for binary protocols.

    -

    Receiving data using passive mode requires a single function call. The first argument is the socket, and the third argument is a timeout duration before the call returns with {error, timeout}.

    -

    The second argument is the amount of data in bytes that we want to receive. The function will wait for data until it has received exactly this amount. If you are not expecting a precise size, you can specify 0 which will make this call return as soon as data was read, regardless of its size.

    -
    Receiving data from the socket in passive mode
    -
    -
    {ok, Data} = Transport:recv(Socket, 0, 5000).
    -
    -

    Active mode requires you to inform the socket that you want to receive data as a message and to write the code to actually receive it.

    -

    There are two kinds of active modes: {active, once} and {active, true}. The first will send a single message before going back to passive mode; the second will send messages indefinitely. We recommend not using the {active, true} mode as it could quickly flood your process mailbox. It's better to keep the data in the socket and read it only when required.

    -

    Three different messages can be received:

    -
    • {OK, Socket, Data} -
    • -
    • {Closed, Socket} -
    • -
    • {Error, Socket, Reason} -
    • -
    -

    The value of OK, Closed and Error can be different depending on the transport being used. To be able to properly match on them you must first call the Transport:messages/0 function.

    -
    Retrieving the transport's active message identifiers
    -
    -
    {OK, Closed, Error} = Transport:messages().
    -
    -

    To start receiving messages you will need to call the Transport:setopts/2 function, and do so every time you want to receive data.

    -
    Receiving messages from the socket in active mode
    -
    -
    {OK, Closed, Error} = Transport:messages(),
    -Transport:setopts(Socket, [{active, once}]),
    -receive
    -	{OK, Socket, Data} ->
    -		io:format("data received: ~p~n", [Data]);
    -	{Closed, Socket} ->
    -		io:format("socket got closed!~n");
    -	{Error, Socket, Reason} ->
    -		io:format("error happened: ~p~n", [Reason])
    -end.
    -
    -

    You can easily integrate active sockets with existing Erlang code as all you really need is just a few more clauses when receiving messages.

    -

    Sending files

    -

    As in the previous section it is assumed Transport is a valid transport handler and Socket is a connected socket obtained through the listener.

    -

    To send a whole file, with name Filename, over a socket:

    -
    Sending a file by filename
    -
    -
    {ok, SentBytes} = Transport:sendfile(Socket, Filename).
    -
    -

    Or part of a file, with Offset greater than or equal to 0, Bytes number of bytes and chunks of size ChunkSize:

    -
    Sending part of a file by filename in chunks
    -
    -
    Opts = [{chunk_size, ChunkSize}],
    -{ok, SentBytes} = Transport:sendfile(Socket, Filename, Offset, Bytes, Opts).
    -
    -

    To improve efficiency when sending multiple parts of the same file it is also possible to use a file descriptor opened in raw mode:

    -
    Sending a file opened in raw mode
    -
    -
    {ok, RawFile} = file:open(Filename, [raw, read, binary]),
    -{ok, SentBytes} = Transport:sendfile(Socket, RawFile, Offset, Bytes, Opts).
    -
    -

    Writing a transport handler

    -

    A transport handler is a module implementing the ranch_transport behavior. It defines a certain number of callbacks that must be written in order to allow transparent usage of the transport handler.

    -

    The behavior doesn't define the socket options available when opening a socket. These do not need to be common to all transports as it's easy enough to write different initialization functions for the different transports that will be used. With one exception though. The setopts/2 function must implement the {active, once} and the {active, true} options.

    -

    If the transport handler doesn't have a native implementation of sendfile/5 a fallback is available, ranch_transport:sendfile/6. The extra first argument is the transport's module. See ranch_ssl for an example.

    - - - - - - - - - - - - - - - - -
    - -
    - - -

    - Ranch - 1.5 - - User Guide -

    - - - -

    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.

    - - - -
    -
    -
    -
    - - - - - - - - - diff --git a/docs/en/ranch/1.5/manual/index.html b/docs/en/ranch/1.5/manual/index.html deleted file mode 100644 index 34b26786..00000000 --- a/docs/en/ranch/1.5/manual/index.html +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - Nine Nines: Ranch Function Reference - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -

    Ranch Function Reference

    - - - - - - - - -
    - -
    - - -

    - Ranch - 1.5 - 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.

    - - - -
    -
    -
    -
    - - - - - - - - - diff --git a/docs/en/ranch/1.5/manual/ranch/index.html b/docs/en/ranch/1.5/manual/ranch/index.html deleted file mode 100644 index d4f19adb..00000000 --- a/docs/en/ranch/1.5/manual/ranch/index.html +++ /dev/null @@ -1,382 +0,0 @@ - - - - - - - - - - Nine Nines: ranch(3) - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -

    ranch(3)

    - -

    Name

    -

    ranch - socket acceptor pool

    -

    Description

    -

    The ranch module provides functions for starting and manipulating Ranch listeners.

    -

    Types

    -

    max_conns() = non_neg_integer() | infinity

    -

    Maximum number of connections allowed on this listener.

    -

    This is a soft limit. The actual number of connections might be slightly above the limit due to concurrency when accepting new connections. Some connections may also be removed from this count explicitly by the user code.

    -

    opt()

    -
    -
    opt() = {ack_timeout, timeout()}
    -	| {connection_type, worker | supervisor}
    -	| {max_connections, max_conns()}
    -	| {num_acceptors, pos_integer()}
    -	| {shutdown, timeout() | brutal_kill}
    -	| {socket, any()}
    -
    -

    Ranch-specific transport options.

    -

    These options are not passed on to the transports. They are used by Ranch while setting up the listeners.

    -

    ref() = any()

    -

    Unique name used to refer to a listener.

    -

    Option descriptions

    -

    None of the options are required.

    -
    ack_timeout (5000)
    -

    Maximum allowed time for the ranch:accept_ack/1 call to finish.

    -
    -
    connection_type (worker)
    -

    Type of process that will handle the connection.

    -
    -
    max_connections (1024)
    -

    Maximum number of active connections. Soft limit. Using infinity will disable the limit entirely.

    -
    -
    num_acceptors (10)
    -

    Number of processes that accept connections.

    -
    -
    shutdown (5000)
    -

    Maximum allowed time for children to stop on listener shutdown.

    -
    -
    socket
    -

    Listening socket opened externally to be used instead of calling Transport:listen/1.

    -
    -
    -

    Exports

    -

    accept_ack(Ref) -> ok

    -
    Ref = ref()
    -

    Listener name.

    -
    -
    -

    Acknowledge that the connection is accepted.

    -

    This function MUST be used by a connection process to inform Ranch that it initialized properly and let it perform any additional operations before the socket can be safely used.

    -

    child_spec(Ref, NumAcceptors, Transport, TransOpts, Protocol, ProtoOpts) -> supervisor:child_spec()

    -
    Ref = ref()
    -

    Listener name.

    -
    -
    NumAcceptors = non_neg_integer()
    -

    Number of acceptor processes.

    -
    -
    Transport = module()
    -

    Transport module.

    -
    -
    TransOpts = any()
    -

    Transport options.

    -
    -
    Protocol = module()
    -

    Protocol module.

    -
    -
    ProtoOpts = any()
    -

    Protocol options.

    -
    -
    -

    Return child specifications for a new listener.

    -

    This function can be used to embed a listener directly in an application instead of letting Ranch handle it.

    -

    get_addr(Ref) -> {IP, Port}

    -
    Ref = ref()
    -

    Listener name.

    -
    -
    IP = inet:ip_address()
    -

    IP of the interface used by this listener.

    -
    -
    Port = inet:port_number()
    -

    Port number used by this listener.

    -
    -
    -

    Return the IP address and port for the given listener.

    -

    get_max_connections(Ref) -> MaxConns

    -
    Ref = ref()
    -

    Listener name.

    -
    -
    MaxConns = max_conns()
    -

    Current maximum number of connections.

    -
    -
    -

    Return the max number of connections allowed for the given listener.

    -

    get_port(Ref) -> Port

    -
    Ref = ref()
    -

    Listener name.

    -
    -
    Port = inet:port_number()
    -

    Port number used by this listener.

    -
    -
    -

    Return the port for the given listener.

    -

    get_protocol_options(Ref) -> ProtoOpts

    -
    Ref = ref()
    -

    Listener name.

    -
    -
    ProtoOpts = any()
    -

    Current protocol options.

    -
    -
    -

    Return the protocol options set for the given listener.

    -

    info() -> [{Ref, [{Key, Value}]}]

    -
    Ref = ref()
    -

    Listener name.

    -
    -
    Key = atom()
    -

    Information key.

    -
    -
    Value = any()
    -

    Information value.

    -
    -
    -

    Return detailed information about all Ranch listeners.

    -

    The following keys are defined:

    -
    pid
    -

    Pid of the listener's top-level supervisor.

    -
    -
    ip
    -

    Interface Ranch listens on.

    -
    -
    port
    -

    Port number Ranch listens on.

    -
    -
    num_acceptors
    -

    Number of acceptor processes.

    -
    -
    max_connections
    -

    Maximum number of connections.

    -
    -
    active_connections
    -

    Number of active connections.

    -
    -
    all_connections
    -

    Number of connections, including those removed from the count.

    -
    -
    transport
    -

    Transport module.

    -
    -
    transport_options
    -

    Transport options.

    -
    -
    protocol
    -

    Protocol module.

    -
    -
    protocol_options
    -

    Protocol options.

    -
    -
    -

    procs(Ref, acceptors | connections) -> [pid()]

    -
    Ref = ref()
    -

    Listener name.

    -
    -
    -

    Return all acceptor or connection processes for one listener.

    -

    remove_connection(Ref) -> ok

    -
    Ref = ref()
    -

    Listener name.

    -
    -
    -

    Do not count this connection when limiting the number of connections.

    -

    You can use this function for long-running connection processes which spend most of their time idling rather than consuming resources. This allows Ranch to accept a lot more connections without sacrificing the latency of the system.

    -

    This function may only be called from a connection process.

    -

    set_max_connections(Ref, MaxConns) -> ok

    -
    Ref = ref()
    -

    Listener name.

    -
    -
    MaxConns = max_conns()
    -

    New maximum number of connections.

    -
    -
    -

    Set the max number of connections for the given listener.

    -

    The change will be applied immediately. If the new value is smaller than the previous one, Ranch will not kill the extra connections, but will wait for them to terminate properly.

    -

    set_protocol_options(Ref, ProtoOpts) -> ok

    -
    Ref = ref()
    -

    Listener name.

    -
    -
    ProtoOpts = any()
    -

    New protocol options.

    -
    -
    -

    Set the protocol options for the given listener.

    -

    The change will be applied immediately for all new connections. Old connections will not receive the new options.

    -

    start_listener(Ref, NumAcceptors, Transport, TransOpts, Protocol, ProtoOpts) -> {ok, pid()} | {error, badarg}

    -
    Ref = ref()
    -

    Listener name.

    -
    -
    NumAcceptors = non_neg_integer()
    -

    Number of acceptor processes.

    -
    -
    Transport = module()
    -

    Transport module.

    -
    -
    TransOpts = any()
    -

    Transport options.

    -
    -
    Protocol = module()
    -

    Protocol module.

    -
    -
    ProtoOpts = any()
    -

    Protocol options.

    -
    -
    -

    Start listening for connections using the given transport and protocol. Returns the pid for this listener's supervisor.

    -

    There are additional transport options that apply regardless of transport. They allow configuring how the connections are supervised, rate limited and more. Please consult the previous section for more details.

    -

    stop_listener(Ref) -> ok | {error, not_found}

    -
    Ref = ref()
    -

    Listener name.

    -
    -
    -

    Stop the given listener.

    -

    The listener is stopped gracefully, first by closing the listening port, then by stopping the connection processes. These processes are stopped according to the shutdown transport option, which may be set to brutally kill all connection processes or give them some time to stop properly.

    -

    This function does not return until the listener is completely stopped.

    - - - - - - -
    - -
    - - -

    - Ranch - 1.5 - 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.

    - - - -
    -
    -
    -
    - - - - - - - - - diff --git a/docs/en/ranch/1.5/manual/ranch_app/index.html b/docs/en/ranch/1.5/manual/ranch_app/index.html deleted file mode 100644 index 74797ea0..00000000 --- a/docs/en/ranch/1.5/manual/ranch_app/index.html +++ /dev/null @@ -1,168 +0,0 @@ - - - - - - - - - - Nine Nines: ranch(7) - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -

    ranch(7)

    - -

    Name

    -

    ranch - Socket acceptor pool for TCP protocols.

    -

    Dependencies

    -

    The ranch application depends on the ssl application to start. It is used for handling secure connections, when the transport is ranch_ssl. It can be disabled if SSL is not used.

    -

    Environment

    -

    The ranch application defines one application environment configuration parameter.

    -
    profile (false)
    -

    When enabled, Ranch will start eprof profiling automatically.

    -
    -
    -

    You can use the ranch_app:profile_output/0 function to stop profiling and output the results to the files procs.profile and total.profile. Do not use in production.

    - - - - - - -
    - -
    - - -

    - Ranch - 1.5 - 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.

    - - - -
    -
    -
    -
    - - - - - - - - - diff --git a/docs/en/ranch/1.5/manual/ranch_protocol/index.html b/docs/en/ranch/1.5/manual/ranch_protocol/index.html deleted file mode 100644 index d4ed8a92..00000000 --- a/docs/en/ranch/1.5/manual/ranch_protocol/index.html +++ /dev/null @@ -1,183 +0,0 @@ - - - - - - - - - - Nine Nines: ranch_protocol(3) - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -

    ranch_protocol(3)

    - -

    Name

    -

    ranch_protocol - behaviour for protocol modules

    -

    Description

    -

    The ranch_protocol behaviour defines the interface used by Ranch protocols.

    -

    Types

    -

    None.

    -

    Callbacks

    - -
    Ref = ranch:ref()
    -

    Listener name.

    -
    -
    Socket = any()
    -

    Socket for this connection.

    -
    -
    Transport = module()
    -

    Transport module for this socket.

    -
    -
    ProtoOpts = any()
    -

    Protocol options.

    -
    -
    -

    Start a new connection process for the given socket.

    -

    The only purpose of this callback is to start a process that will handle the socket. It must spawn the process, link and then return the new pid. This function will always be called from inside a supervisor.

    -

    This callback can also return two pids. The first pid is the pid of the process that will be supervised. The second pid is the pid of the process that will receive ownership of the socket. This second process must be a child of the first. This form is only available when connection_type is set to supervisor.

    -

    If any other value is returned, the supervisor will close the socket and assume no process has been started.

    -

    Do not perform any operations in this callback, as this would block the supervisor responsible for starting connection processes and degrade performance severely.

    - - - - - - -
    - -
    - - -

    - Ranch - 1.5 - 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.

    - - - -
    -
    -
    -
    - - - - - - - - - diff --git a/docs/en/ranch/1.5/manual/ranch_ssl/index.html b/docs/en/ranch/1.5/manual/ranch_ssl/index.html deleted file mode 100644 index 2e732ec8..00000000 --- a/docs/en/ranch/1.5/manual/ranch_ssl/index.html +++ /dev/null @@ -1,324 +0,0 @@ - - - - - - - - - - Nine Nines: ranch_ssl(3) - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -

    ranch_ssl(3)

    - -

    Name

    -

    ranch_ssl - SSL transport module

    -

    Description

    -

    The ranch_ssl module implements an SSL Ranch transport.

    -

    Types

    -

    ssl_opt()

    -
    -
    ssl_opt() = {alpn_preferred_protocols, [binary()]}
    -	| {beast_mitigation, one_n_minus_one | zero_n | disabled}
    -	| {cacertfile, string()}
    -	| {cacerts, [public_key:der_encoded()]}
    -	| {cert, public_key:der_encoded()}
    -	| {certfile, string()}
    -	| {ciphers, [ssl:erl_cipher_suite()] | string()}
    -	| {client_renegotiation, boolean()}
    -	| {crl_cache, {module(), {internal | any(), list()}}}
    -	| {crl_check, boolean() | peer | best_effort}
    -	| {depth, 0..255}
    -	| {dh, public_key:der_encoded()}
    -	| {dhfile, string()}
    -	| {fail_if_no_peer_cert, boolean()}
    -	| {hibernate_after, integer() | undefined}
    -	| {honor_cipher_order, boolean()}
    -	| {key, {'RSAPrivateKey' | 'DSAPrivateKey' | 'PrivateKeyInfo', public_key:der_encoded()}}
    -	| {keyfile, string()}
    -	| {log_alert, boolean()}
    -	| {next_protocols_advertised, [binary()]}
    -	| {padding_check, boolean()}
    -	| {partial_chain, fun(([public_key:der_encoded()]) -> {trusted_ca, public_key:der_encoded()} | unknown_ca)}
    -	| {password, string()}
    -	| {psk_identity, string()}
    -	| {reuse_session, fun()}
    -	| {reuse_sessions, boolean()}
    -	| {secure_renegotiate, boolean()}
    -	| {signature_algs, [{atom(), atom()}]}
    -	| {sni_fun, fun()}
    -	| {sni_hosts, [{string(), ssl_opt()}]}
    -	| {user_lookup_fun, {fun(), any()}}
    -	| {v2_hello_compatible, boolean()}
    -	| {verify, ssl:verify_type()}
    -	| {verify_fun, {fun(), any()}}
    -	| {versions, [atom()]}.
    -
    -

    SSL-specific listen options.

    -

    opt() = ranch_tcp:opt() | ssl_opt()

    -

    Listen options.

    -

    opts() = [opt()]

    -

    List of listen options.

    -

    Option descriptions

    -

    Specifying a certificate is mandatory, either through the cert or the certfile option. None of the other options are required.

    -

    The default value is given next to the option name.

    -
    alpn_preferred_protocols
    -

    Perform Application-Layer Protocol Negotiation with the given list of preferred protocols.

    -
    -
    beast_mitigation
    -

    Change the BEAST mitigation strategy for SSL-3.0 and TLS-1.0 to interoperate with legacy software.

    -
    -
    cacertfile
    -

    Path to PEM encoded trusted certificates file used to verify peer certificates.

    -
    -
    cacerts
    -

    List of DER encoded trusted certificates.

    -
    -
    cert
    -

    DER encoded user certificate.

    -
    -
    certfile
    -

    Path to the PEM encoded user certificate file. May also contain the private key.

    -
    -
    ciphers
    -

    List of ciphers that clients are allowed to use.

    -
    -
    client_renegotiation (true)
    -

    Whether to allow client-initiated renegotiation.

    -
    -
    crl_cache ({ssl_crl_cache, {internal, []}})
    -

    Customize the module used to cache Certificate Revocation Lists.

    -
    -
    crl_check (false)
    -

    Whether to perform CRL check on all certificates in the chain during validation.

    -
    -
    depth (1)
    -

    Maximum of intermediate certificates allowed in the certification path.

    -
    -
    dh
    -

    DER encoded Diffie-Hellman parameters.

    -
    -
    dhfile
    -

    Path to the PEM encoded Diffie-Hellman parameters file.

    -
    -
    fail_if_no_peer_cert (false)
    -

    Whether to refuse the connection if the client sends an empty certificate.

    -
    -
    hibernate_after (undefined)
    -

    Time in ms after which SSL socket processes go into hibernation to reduce memory usage.

    -
    -
    honor_cipher_order (false)
    -

    If true, use the server's preference for cipher selection. If false, use the client's preference.

    -
    -
    key
    -

    DER encoded user private key.

    -
    -
    keyfile
    -

    Path to the PEM encoded private key file, if different than the certfile.

    -
    -
    log_alert (true)
    -

    If false, error reports will not be displayed.

    -
    -
    next_protocols_advertised
    -

    List of protocols to send to the client if it supports the Next Protocol extension.

    -
    -
    nodelay (true)
    -

    Whether to enable TCP_NODELAY.

    -
    -
    padding_check
    -

    Allow disabling the block cipher padding check for TLS-1.0 to be able to interoperate with legacy software.

    -
    -
    partial_chain
    -

    Claim an intermediate CA in the chain as trusted.

    -
    -
    password
    -

    Password to the private key file, if password protected.

    -
    -
    psk_identity
    -

    Provide the given PSK identity hint to the client during the handshake.

    -
    -
    reuse_session
    -

    Custom policy to decide whether a session should be reused.

    -
    -
    reuse_sessions (false)
    -

    Whether to allow session reuse.

    -
    -
    secure_renegotiate (false)
    -

    Whether to reject renegotiation attempts that do not conform to RFC5746.

    -
    -
    signature_algs
    -

    The TLS signature algorithm extension may be used, from TLS 1.2, to negotiate which signature algorithm to use during the TLS handshake.

    -
    -
    sni_fun
    -

    Function called when the client requests a host using Server Name Indication. Returns options to apply.

    -
    -
    sni_hosts
    -

    Options to apply for the host that matches what the client requested with Server Name Indication.

    -
    -
    user_lookup_fun
    -

    Function called to determine the shared secret when using PSK, or provide parameters when using SRP.

    -
    -
    v2_hello_compatible
    -

    Accept clients that send hello messages in SSL-2.0 format while offering supported SSL/TLS versions.

    -
    -
    verify (verify_none)
    -

    Use verify_peer to request a certificate from the client.

    -
    -
    verify_fun
    -

    Custom policy to decide whether a client certificate is valid.

    -
    -
    versions
    -

    TLS protocol versions that will be supported.

    -
    -
    -

    Note that the client will not send a certificate unless the value for the verify option is set to verify_peer. This means that the fail_if_no_peer_cert only apply when combined with the verify option. The verify_fun option allows greater control over the client certificate validation.

    -

    The options sni_fun and sni_hosts are mutually exclusive.

    -

    Exports

    -

    None.

    - - - - - - -
    - -
    - - -

    - Ranch - 1.5 - 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.

    - - - -
    -
    -
    -
    - - - - - - - - - diff --git a/docs/en/ranch/1.5/manual/ranch_tcp/index.html b/docs/en/ranch/1.5/manual/ranch_tcp/index.html deleted file mode 100644 index 6f5113bc..00000000 --- a/docs/en/ranch/1.5/manual/ranch_tcp/index.html +++ /dev/null @@ -1,277 +0,0 @@ - - - - - - - - - - Nine Nines: ranch_tcp(3) - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -

    ranch_tcp(3)

    - -

    Name

    -

    ranch_tcp - TCP transport module

    -

    Description

    -

    The ranch_tcp module implements a TCP Ranch transport.

    -

    Note that due to bugs in OTP up to at least R16B02, it is recommended to disable async threads when using the sendfile function of this transport, as it can make the threads stuck indefinitely.

    -

    Types

    -

    opt()

    -
    -
    opt() = {backlog, non_neg_integer()}
    -	| {buffer, non_neg_integer()}
    -	| {delay_send, boolean()}
    -	| {dontroute, boolean()}
    -	| {exit_on_close, boolean()}
    -	| {fd, non_neg_integer()}
    -	| {high_msgq_watermark, non_neg_integer()}
    -	| {high_watermark, non_neg_integer()}
    -	| inet
    -	| inet6
    -	| {ip, inet:ip_address()}
    -	| {ipv6_v6only, boolean()}
    -	| {keepalive, boolean()}
    -	| {linger, {boolean(), non_neg_integer()}}
    -	| {low_msgq_watermark, non_neg_integer()}
    -	| {low_watermark, non_neg_integer()}
    -	| {nodelay, boolean()}
    -	| {port, inet:port_number()}
    -	| {priority, integer()}
    -	| {raw, non_neg_integer(), non_neg_integer(), binary()}
    -	| {recbuf, non_neg_integer()}
    -	| {send_timeout, timeout()}
    -	| {send_timeout_close, boolean()}
    -	| {sndbuf, non_neg_integer()}
    -	| {tos, integer()}
    -
    -

    Listen options.

    -

    This does not represent the entirety of the options that can be set on the socket, but only the options that may be set independently of protocol implementation.

    -

    opts() = [opt()]

    -

    List of listen options.

    -

    Option descriptions

    -

    None of the options are required.

    -

    Please consult the gen_tcp and inet manuals for a more thorough description of these options. This manual only aims to provide a short description along with what the defaults are. Defaults may be different in Ranch compared to gen_tcp. Defaults are given next to the option name.

    -
    backlog (1024)
    -

    Max length of the queue of pending connections.

    -
    -
    buffer
    -

    Size of the buffer used by the Erlang driver. Default is system-dependent.

    -
    -
    delay_send (false)
    -

    Always queue packets before sending, to send fewer, larger packets over the network.

    -
    -
    dontroute (false)
    -

    Don't send via a gateway, only send to directly connected hosts.

    -
    -
    exit_on_close (true)
    -

    Disable to allow sending data after a close has been detected.

    -
    -
    fd
    -

    File descriptor of the socket, if it was opened externally.

    -
    -
    high_msgq_watermark (8192)
    -

    Limit in the amount of data in the socket message queue before the socket queue becomes busy.

    -
    -
    high_watermark (8192)
    -

    Limit in the amount of data in the ERTS socket implementation's queue before the socket becomes busy.

    -
    -
    inet
    -

    Set up the socket for IPv4.

    -
    -
    inet6
    -

    Set up the socket for IPv6.

    -
    -
    ip
    -

    Interface to listen on. Listen on all interfaces by default.

    -
    -
    ipv6_v6only (false)
    -

    Listen on IPv4 and IPv6 (false) or only on IPv6 (true). Use with inet6.

    -
    -
    keepalive (false)
    -

    Enable sending of keep-alive messages.

    -
    -
    linger ({false, 0})
    -

    Whether to wait and how long to flush data sent before closing the socket.

    -
    -
    low_msgq_watermark (4096)
    -

    Amount of data in the socket message queue before the socket queue leaves busy state.

    -
    -
    low_watermark (4096)
    -

    Amount of data in the ERTS socket implementation's queue before the socket leaves busy state.

    -
    -
    nodelay (true)
    -

    Whether to enable TCP_NODELAY.

    -
    -
    port (0)
    -

    TCP port number to listen on. 0 means a random port will be used.

    -
    -
    priority (0)
    -

    Priority value for all packets to be sent by this socket.

    -
    -
    recbuf
    -

    Minimum size of the socket's receive buffer. Default is system-dependent.

    -
    -
    send_timeout (30000)
    -

    How long the send call may wait for confirmation before returning.

    -
    -
    send_timeout_close (true)
    -

    Whether to close the socket when the confirmation wasn't received.

    -
    -
    sndbuf
    -

    Minimum size of the socket's send buffer. Default is system-dependent.

    -
    -
    tos
    -

    Value for the IP_TOS IP level option. Use with caution.

    -
    -
    -

    In addition, the raw option can be used to set system-specific options by specifying the protocol level, the option number and the actual option value specified as a binary. This option is not portable. Use with caution.

    -

    Exports

    -

    None.

    - - - - - - -
    - -
    - - -

    - Ranch - 1.5 - 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.

    - - - -
    -
    -
    -
    - - - - - - - - - diff --git a/docs/en/ranch/1.5/manual/ranch_transport/index.html b/docs/en/ranch/1.5/manual/ranch_transport/index.html deleted file mode 100644 index a5057cfa..00000000 --- a/docs/en/ranch/1.5/manual/ranch_transport/index.html +++ /dev/null @@ -1,381 +0,0 @@ - - - - - - - - - - Nine Nines: ranch_transport(3) - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -

    ranch_transport(3)

    - -

    Name

    -

    ranch_transport - behaviour for transport modules

    -

    Description

    -

    The ranch_transport behaviour defines the interface used by Ranch transports.

    -

    Types

    -

    sendfile_opts() = [{chunk_size, non_neg_integer()}]

    -

    Options used by the sendfile function and callbacks.

    -

    Allows configuring the chunk size, in bytes. Defaults to 8191 bytes.

    -

    Callbacks

    -

    accept(LSocket, Timeout) -> {ok, CSocket} | {error, closed | timeout | atom()}

    -
    LSocket = CSocket = any()
    -

    Listening socket.

    -
    -
    Timeout = timeout()
    -

    Accept timeout.

    -
    -
    -

    Accept a connection on the given listening socket.

    -

    The accept_ack callback will be used to initialize the socket after accepting the connection. This is most useful when the transport is not raw TCP, like with SSL for example.

    -

    accept_ack(CSocket, Timeout) -> ok

    -
    CSocket = any()
    -

    Socket for this connection.

    -
    -
    Timeout = timeout()
    -

    Ack timeout.

    -
    -
    -

    Perform post-accept initialization of the connection.

    -

    This function will be called by connection processes before performing any socket operation. It allows transports that require extra initialization to perform their task and make the socket ready to use.

    -

    close(Socket) -> ok

    -
    Socket = any()
    -

    Socket opened with listen/1 or accept/2.

    -
    -
    -

    Close the given socket.

    -

    controlling_process(Socket, Pid) -> ok | {error, closed | not_owner | atom()}

    -
    Socket = any()
    -

    Socket opened with listen/1 or accept/2.

    -
    -
    Pid = pid()
    -

    Pid of the new owner of the socket.

    -
    -
    -

    Change the controlling process for the given socket.

    -

    The controlling process is the process that is allowed to perform operations on the socket, and that will receive messages from the socket when active mode is used. When the controlling process dies, the socket is closed.

    -

    listen(TransOpts) -> {ok, LSocket} | {error, atom()}

    -
    TransOpts = any()
    -

    Transport options.

    -
    -
    LSocket = any()
    -

    Listening socket.

    -
    -
    -

    Listen for connections on the given port.

    -

    The port is given as part of the transport options under the key port. Any other option is transport dependent.

    -

    The socket returned by this call can then be used to accept connections. It is not possible to send or receive data from the listening socket.

    -

    messages() -> {OK, Closed, Error}

    -
    OK = Closed = Error = atom()
    -

    Tuple names.

    -
    -
    -

    Return the atoms used to identify messages sent in active mode.

    -

    name() -> Name

    -
    Name = atom()
    -

    Transport module name.

    -
    -
    -

    Return the name of the transport.

    -

    peername(CSocket) -> {ok, {IP, Port}} | {error, atom()}

    -
    CSocket = any()
    -

    Socket for this connection.

    -
    -
    IP = inet:ip_address()
    -

    IP of the remote endpoint.

    -
    -
    Port = inet:port_number()
    -

    Port of the remote endpoint.

    -
    -
    -

    Return the IP and port of the remote endpoint.

    -

    recv(CSocket, Length, Timeout) -> {ok, Packet} | {error, closed | timeout | atom()}

    -
    CSocket = any()
    -

    Socket for this connection.

    -
    -
    Length = non_neg_integer()
    -

    Requested length.

    -
    -
    Timeout = timeout()
    -

    Receive timeout.

    -
    -
    Packet = iodata() | any()
    -

    Data received.

    -
    -
    -

    Receive data from the given socket when in passive mode.

    -

    Trying to receive data from a socket that is in active mode will return an error.

    -

    A length of 0 will return any data available on the socket.

    -

    While it is possible to use the timeout value infinity, this is highly discouraged as this could cause your process to get stuck waiting for data that will never come. This may happen when a socket becomes half-open due to a crash of the remote endpoint. Wi-Fi going down is another common culprit of this issue.

    -

    send(CSocket, Packet) -> ok | {error, atom()}

    -
    CSocket = any()
    -

    Socket for this connection.

    -
    -
    Packet = iodata()
    -

    Data to be sent.

    -
    -
    -

    Send data to the given socket.

    -

    sendfile(CSocket, File) -> sendfile(CSocket, File, 0, 0, [])

    -

    Alias of ranch_transport:sendfile/5.

    -

    sendfile(CSocket, File, Offset, Bytes) -> sendfile(CSocket, File, Offset, Bytes, [])

    -

    Alias of ranch_transport:sendfile/5.

    -

    sendfile(CSocket, File, Offset, Bytes, SfOpts) -> {ok, SentBytes} | {error, atom()}

    -
    CSocket = any()
    -

    Socket for this connection.

    -
    -
    File = file:filename_all() | file:fd()
    -

    Filename or file descriptor for the file to be sent.

    -
    -
    Offset = non_neg_integer()
    -

    Begin sending at this position in the file.

    -
    -
    Bytes = non_neg_integer()
    -

    Send this many bytes.

    -
    -
    SentBytes = non_neg_integer()
    -

    This many bytes were sent.

    -
    -
    SfOpts = sendfile_opts()
    -

    Sendfile options.

    -
    -
    -

    Send data from a file to the given socket.

    -

    The file may be sent full or in parts, and may be specified by its filename or by an already open file descriptor.

    -

    Transports that manipulate TCP directly may use the file:sendfile/{2,4,5} function, which calls the sendfile syscall where applicable (on Linux, for example). Other transports can use the sendfile/6 function exported from this module.

    -

    setopts(CSocket, SockOpts) -> ok | {error, atom()}

    -
    CSocket = any()
    -

    Socket for this connection.

    -
    -
    SockOpts = any()
    -

    Socket options.

    -
    -
    -

    Change options for the given socket.

    -

    This is mainly useful for switching to active or passive mode or to set protocol-specific options.

    -

    getopts(CSocket, SockOpts) -> {ok, SockOptValues} | {error, atom()}

    -
    CSocket = any()
    -

    Socket for this connection.

    -
    -
    SockOpts = [atom]
    -

    Socket option names.

    -
    -
    SockOptValues = list()
    -

    Socket options.

    -
    -
    -

    Get options for the given socket.

    -

    getstat(CSocket) -> {ok, SockStatValues} | {error, atom()}

    -
    CSocket = any()
    -

    Socket for this connection.

    -
    -
    SockStatValues = list()
    -

    Socket statistics.

    -
    -
    -

    Get statistics for the given socket.

    -

    getstat(CSocket, SockStats) -> {ok, SockStatValues} | {error, atom()}

    -
    CSocket = any()
    -

    Socket for this connection.

    -
    -
    SockStats = [atom()]
    -

    Socket statistic names.

    -
    -
    SockStatValues = list()
    -

    Socket statistics.

    -
    -
    -

    Get statistics for the given socket.

    -

    shutdown(CSocket, How) -> ok | {error, atom()}

    -
    CSocket = any()
    -

    Socket for this connection.

    -
    -
    How = read | write | read_write
    -

    Which side(s) of the socket to close.

    -
    -
    -

    Immediately close the socket in one or two directions.

    -

    sockname(Socket) -> {ok, {IP, Port}} | {error, atom()}

    -
    Socket = any()
    -

    Socket opened with listen/1 or accept/2.

    -
    -
    IP = inet:ip_address()
    -

    IP of the local endpoint.

    -
    -
    Port = inet:port_number()
    -

    Port of the local endpoint.

    -
    -
    -

    Return the IP and port of the local endpoint.

    -

    Exports

    -

    sendfile(Transport, CSocket, File, Offset, Bytes, SfOpts) -> {ok, SentBytes} | {error, atom()}

    -
    Transport = module()
    -

    Transport module for this socket.

    -
    -
    CSocket = any()
    -

    Socket for this connection.

    -
    -
    File = file:filename_all() | file:fd()
    -

    Filename or file descriptor for the file to be sent.

    -
    -
    Offset = non_neg_integer()
    -

    Begin sending at this position in the file.

    -
    -
    Bytes = non_neg_integer()
    -

    Send this many bytes.

    -
    -
    SentBytes = non_neg_integer()
    -

    This many bytes were sent.

    -
    -
    SfOpts = sendfile_opts()
    -

    Sendfile options.

    -
    -
    -

    Send data from a file to the given socket.

    -

    This function emulates the function file:sendfile/{2,4,5} and may be used when transports are not manipulating TCP directly.

    - - - - - - -
    - -
    - - -

    - Ranch - 1.5 - 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.

    - - - -
    -
    -
    -
    - - - - - - - - - diff --git a/docs/en/ranch/1.6/guide/embedded/index.html b/docs/en/ranch/1.6/guide/embedded/index.html index c4c06ce5..d8a8477e 100644 --- a/docs/en/ranch/1.6/guide/embedded/index.html +++ b/docs/en/ranch/1.6/guide/embedded/index.html @@ -142,6 +142,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -150,8 +152,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/guide/index.html b/docs/en/ranch/1.6/guide/index.html index 0709c58a..cf8045ce 100644 --- a/docs/en/ranch/1.6/guide/index.html +++ b/docs/en/ranch/1.6/guide/index.html @@ -129,6 +129,8 @@ +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -137,8 +139,6 @@
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/guide/internals/index.html b/docs/en/ranch/1.6/guide/internals/index.html index 6f81096b..23d817eb 100644 --- a/docs/en/ranch/1.6/guide/internals/index.html +++ b/docs/en/ranch/1.6/guide/internals/index.html @@ -146,6 +146,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -154,8 +156,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/guide/introduction/index.html b/docs/en/ranch/1.6/guide/introduction/index.html index 09bf2d5b..0a7def62 100644 --- a/docs/en/ranch/1.6/guide/introduction/index.html +++ b/docs/en/ranch/1.6/guide/introduction/index.html @@ -126,6 +126,8 @@ +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -134,8 +136,6 @@
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/guide/listeners/index.html b/docs/en/ranch/1.6/guide/listeners/index.html index 68bcbe3e..0cd4fd9e 100644 --- a/docs/en/ranch/1.6/guide/listeners/index.html +++ b/docs/en/ranch/1.6/guide/listeners/index.html @@ -361,6 +361,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -369,8 +371,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/guide/migrating_from_1.5/index.html b/docs/en/ranch/1.6/guide/migrating_from_1.5/index.html index 4f3d4f52..0157963a 100644 --- a/docs/en/ranch/1.6/guide/migrating_from_1.5/index.html +++ b/docs/en/ranch/1.6/guide/migrating_from_1.5/index.html @@ -161,6 +161,8 @@ +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -169,8 +171,6 @@
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/guide/migrating_from_1.6/index.html b/docs/en/ranch/1.6/guide/migrating_from_1.6/index.html index 749ac6eb..0f2acbf7 100644 --- a/docs/en/ranch/1.6/guide/migrating_from_1.6/index.html +++ b/docs/en/ranch/1.6/guide/migrating_from_1.6/index.html @@ -124,6 +124,8 @@ +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -132,8 +134,6 @@
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/guide/migrating_from_1.x/index.html b/docs/en/ranch/1.6/guide/migrating_from_1.x/index.html index 8364a90f..96416f93 100644 --- a/docs/en/ranch/1.6/guide/migrating_from_1.x/index.html +++ b/docs/en/ranch/1.6/guide/migrating_from_1.x/index.html @@ -214,6 +214,8 @@ +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -222,8 +224,6 @@
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/guide/parsers/index.html b/docs/en/ranch/1.6/guide/parsers/index.html index 627d524b..399b0607 100644 --- a/docs/en/ranch/1.6/guide/parsers/index.html +++ b/docs/en/ranch/1.6/guide/parsers/index.html @@ -181,6 +181,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -189,8 +191,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/guide/protocols/index.html b/docs/en/ranch/1.6/guide/protocols/index.html index 4939bfdf..4510e620 100644 --- a/docs/en/ranch/1.6/guide/protocols/index.html +++ b/docs/en/ranch/1.6/guide/protocols/index.html @@ -188,6 +188,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -196,8 +198,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/guide/ssl_auth/index.html b/docs/en/ranch/1.6/guide/ssl_auth/index.html index 058a22b3..50e46572 100644 --- a/docs/en/ranch/1.6/guide/ssl_auth/index.html +++ b/docs/en/ranch/1.6/guide/ssl_auth/index.html @@ -194,6 +194,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -202,8 +204,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/guide/transports/index.html b/docs/en/ranch/1.6/guide/transports/index.html index ab24caec..fbb14f9e 100644 --- a/docs/en/ranch/1.6/guide/transports/index.html +++ b/docs/en/ranch/1.6/guide/transports/index.html @@ -228,6 +228,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -236,8 +238,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/guide/upcoming_2.0_changes/index.html b/docs/en/ranch/1.6/guide/upcoming_2.0_changes/index.html index 007b4b6f..3b0a6958 100644 --- a/docs/en/ranch/1.6/guide/upcoming_2.0_changes/index.html +++ b/docs/en/ranch/1.6/guide/upcoming_2.0_changes/index.html @@ -135,6 +135,8 @@ +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -143,8 +145,6 @@
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/manual/index.html b/docs/en/ranch/1.6/manual/index.html index d9b2ad1d..4eae9350 100644 --- a/docs/en/ranch/1.6/manual/index.html +++ b/docs/en/ranch/1.6/manual/index.html @@ -139,6 +139,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -147,8 +149,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/manual/ranch.child_spec/index.html b/docs/en/ranch/1.6/manual/ranch.child_spec/index.html index 686de6a3..d0f631f8 100644 --- a/docs/en/ranch/1.6/manual/ranch.child_spec/index.html +++ b/docs/en/ranch/1.6/manual/ranch.child_spec/index.html @@ -159,6 +159,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -167,8 +169,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/manual/ranch.get_addr/index.html b/docs/en/ranch/1.6/manual/ranch.get_addr/index.html index ed9ef2fb..2455e766 100644 --- a/docs/en/ranch/1.6/manual/ranch.get_addr/index.html +++ b/docs/en/ranch/1.6/manual/ranch.get_addr/index.html @@ -127,6 +127,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -135,8 +137,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/manual/ranch.get_max_connections/index.html b/docs/en/ranch/1.6/manual/ranch.get_max_connections/index.html index 340305de..48be0cb5 100644 --- a/docs/en/ranch/1.6/manual/ranch.get_max_connections/index.html +++ b/docs/en/ranch/1.6/manual/ranch.get_max_connections/index.html @@ -125,6 +125,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -133,8 +135,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/manual/ranch.get_port/index.html b/docs/en/ranch/1.6/manual/ranch.get_port/index.html index aead1e9c..cee3b87d 100644 --- a/docs/en/ranch/1.6/manual/ranch.get_port/index.html +++ b/docs/en/ranch/1.6/manual/ranch.get_port/index.html @@ -126,6 +126,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -134,8 +136,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/manual/ranch.get_protocol_options/index.html b/docs/en/ranch/1.6/manual/ranch.get_protocol_options/index.html index efd2a073..c724256a 100644 --- a/docs/en/ranch/1.6/manual/ranch.get_protocol_options/index.html +++ b/docs/en/ranch/1.6/manual/ranch.get_protocol_options/index.html @@ -125,6 +125,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -133,8 +135,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/manual/ranch.get_status/index.html b/docs/en/ranch/1.6/manual/ranch.get_status/index.html index bff164d4..4cee6a3f 100644 --- a/docs/en/ranch/1.6/manual/ranch.get_status/index.html +++ b/docs/en/ranch/1.6/manual/ranch.get_status/index.html @@ -128,6 +128,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -136,8 +138,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/manual/ranch.get_transport_options/index.html b/docs/en/ranch/1.6/manual/ranch.get_transport_options/index.html index 0b8bc9a8..29435094 100644 --- a/docs/en/ranch/1.6/manual/ranch.get_transport_options/index.html +++ b/docs/en/ranch/1.6/manual/ranch.get_transport_options/index.html @@ -125,6 +125,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -133,8 +135,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/manual/ranch.handshake/index.html b/docs/en/ranch/1.6/manual/ranch.handshake/index.html index cb0631b5..fd4da6d9 100644 --- a/docs/en/ranch/1.6/manual/ranch.handshake/index.html +++ b/docs/en/ranch/1.6/manual/ranch.handshake/index.html @@ -148,6 +148,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -156,8 +158,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/manual/ranch.info/index.html b/docs/en/ranch/1.6/manual/ranch.info/index.html index 9363446d..0ea48a08 100644 --- a/docs/en/ranch/1.6/manual/ranch.info/index.html +++ b/docs/en/ranch/1.6/manual/ranch.info/index.html @@ -173,6 +173,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -181,8 +183,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/manual/ranch.procs/index.html b/docs/en/ranch/1.6/manual/ranch.procs/index.html index 41cade9b..58088a61 100644 --- a/docs/en/ranch/1.6/manual/ranch.procs/index.html +++ b/docs/en/ranch/1.6/manual/ranch.procs/index.html @@ -136,6 +136,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -144,8 +146,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/manual/ranch.remove_connection/index.html b/docs/en/ranch/1.6/manual/ranch.remove_connection/index.html index 9ce3b568..668aef67 100644 --- a/docs/en/ranch/1.6/manual/ranch.remove_connection/index.html +++ b/docs/en/ranch/1.6/manual/ranch.remove_connection/index.html @@ -126,6 +126,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -134,8 +136,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/manual/ranch.resume_listener/index.html b/docs/en/ranch/1.6/manual/ranch.resume_listener/index.html index bab4fc9f..f522a68f 100644 --- a/docs/en/ranch/1.6/manual/ranch.resume_listener/index.html +++ b/docs/en/ranch/1.6/manual/ranch.resume_listener/index.html @@ -132,6 +132,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -140,8 +142,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/manual/ranch.set_max_connections/index.html b/docs/en/ranch/1.6/manual/ranch.set_max_connections/index.html index 866e7010..dcff4933 100644 --- a/docs/en/ranch/1.6/manual/ranch.set_max_connections/index.html +++ b/docs/en/ranch/1.6/manual/ranch.set_max_connections/index.html @@ -130,6 +130,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -138,8 +140,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/manual/ranch.set_protocol_options/index.html b/docs/en/ranch/1.6/manual/ranch.set_protocol_options/index.html index 1dc723e1..749e8396 100644 --- a/docs/en/ranch/1.6/manual/ranch.set_protocol_options/index.html +++ b/docs/en/ranch/1.6/manual/ranch.set_protocol_options/index.html @@ -130,6 +130,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -138,8 +140,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/manual/ranch.set_transport_options/index.html b/docs/en/ranch/1.6/manual/ranch.set_transport_options/index.html index 41ec2431..4403a015 100644 --- a/docs/en/ranch/1.6/manual/ranch.set_transport_options/index.html +++ b/docs/en/ranch/1.6/manual/ranch.set_transport_options/index.html @@ -135,6 +135,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -143,8 +145,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/manual/ranch.start_listener/index.html b/docs/en/ranch/1.6/manual/ranch.start_listener/index.html index 1024db56..8ba4b206 100644 --- a/docs/en/ranch/1.6/manual/ranch.start_listener/index.html +++ b/docs/en/ranch/1.6/manual/ranch.start_listener/index.html @@ -184,6 +184,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -192,8 +194,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/manual/ranch.stop_listener/index.html b/docs/en/ranch/1.6/manual/ranch.stop_listener/index.html index 17dc1ba5..b7b2a58e 100644 --- a/docs/en/ranch/1.6/manual/ranch.stop_listener/index.html +++ b/docs/en/ranch/1.6/manual/ranch.stop_listener/index.html @@ -129,6 +129,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -137,8 +139,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/manual/ranch.suspend_listener/index.html b/docs/en/ranch/1.6/manual/ranch.suspend_listener/index.html index 147a6ba3..0495dead 100644 --- a/docs/en/ranch/1.6/manual/ranch.suspend_listener/index.html +++ b/docs/en/ranch/1.6/manual/ranch.suspend_listener/index.html @@ -133,6 +133,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -141,8 +143,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/manual/ranch.wait_for_connections/index.html b/docs/en/ranch/1.6/manual/ranch.wait_for_connections/index.html index f38e6c82..3b8224a8 100644 --- a/docs/en/ranch/1.6/manual/ranch.wait_for_connections/index.html +++ b/docs/en/ranch/1.6/manual/ranch.wait_for_connections/index.html @@ -153,6 +153,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -161,8 +163,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/manual/ranch/index.html b/docs/en/ranch/1.6/manual/ranch/index.html index 1ffd585f..b887ff53 100644 --- a/docs/en/ranch/1.6/manual/ranch/index.html +++ b/docs/en/ranch/1.6/manual/ranch/index.html @@ -236,6 +236,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -244,8 +246,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/manual/ranch_app/index.html b/docs/en/ranch/1.6/manual/ranch_app/index.html index c8acc2e0..ef944841 100644 --- a/docs/en/ranch/1.6/manual/ranch_app/index.html +++ b/docs/en/ranch/1.6/manual/ranch_app/index.html @@ -139,6 +139,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -147,8 +149,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/manual/ranch_protocol/index.html b/docs/en/ranch/1.6/manual/ranch_protocol/index.html index e97c765e..1c038948 100644 --- a/docs/en/ranch/1.6/manual/ranch_protocol/index.html +++ b/docs/en/ranch/1.6/manual/ranch_protocol/index.html @@ -125,6 +125,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -133,8 +135,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/manual/ranch_ssl/index.html b/docs/en/ranch/1.6/manual/ranch_ssl/index.html index c9ddbcdd..aaee0ef6 100644 --- a/docs/en/ranch/1.6/manual/ranch_ssl/index.html +++ b/docs/en/ranch/1.6/manual/ranch_ssl/index.html @@ -277,6 +277,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -285,8 +287,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/manual/ranch_tcp/index.html b/docs/en/ranch/1.6/manual/ranch_tcp/index.html index eb34b470..743f61f9 100644 --- a/docs/en/ranch/1.6/manual/ranch_tcp/index.html +++ b/docs/en/ranch/1.6/manual/ranch_tcp/index.html @@ -224,6 +224,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -232,8 +234,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/manual/ranch_transport.sendfile/index.html b/docs/en/ranch/1.6/manual/ranch_transport.sendfile/index.html index 870c5616..1ef6bbfa 100644 --- a/docs/en/ranch/1.6/manual/ranch_transport.sendfile/index.html +++ b/docs/en/ranch/1.6/manual/ranch_transport.sendfile/index.html @@ -160,6 +160,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -168,8 +170,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.6/manual/ranch_transport/index.html b/docs/en/ranch/1.6/manual/ranch_transport/index.html index b5995224..f99ac9e9 100644 --- a/docs/en/ranch/1.6/manual/ranch_transport/index.html +++ b/docs/en/ranch/1.6/manual/ranch_transport/index.html @@ -325,6 +325,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -333,8 +335,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/guide/embedded/index.html b/docs/en/ranch/1.7/guide/embedded/index.html index 2b7e5a77..2aee8a4c 100644 --- a/docs/en/ranch/1.7/guide/embedded/index.html +++ b/docs/en/ranch/1.7/guide/embedded/index.html @@ -142,6 +142,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -150,8 +152,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/guide/index.html b/docs/en/ranch/1.7/guide/index.html index 747923c4..cb3a7468 100644 --- a/docs/en/ranch/1.7/guide/index.html +++ b/docs/en/ranch/1.7/guide/index.html @@ -131,6 +131,8 @@ +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -139,8 +141,6 @@
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/guide/internals/index.html b/docs/en/ranch/1.7/guide/internals/index.html index 7584b9c1..801992ae 100644 --- a/docs/en/ranch/1.7/guide/internals/index.html +++ b/docs/en/ranch/1.7/guide/internals/index.html @@ -146,6 +146,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -154,8 +156,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/guide/introduction/index.html b/docs/en/ranch/1.7/guide/introduction/index.html index f5f99166..2dbd25e3 100644 --- a/docs/en/ranch/1.7/guide/introduction/index.html +++ b/docs/en/ranch/1.7/guide/introduction/index.html @@ -125,6 +125,8 @@ +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -133,8 +135,6 @@
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/guide/listeners/index.html b/docs/en/ranch/1.7/guide/listeners/index.html index 15f0979d..3313160a 100644 --- a/docs/en/ranch/1.7/guide/listeners/index.html +++ b/docs/en/ranch/1.7/guide/listeners/index.html @@ -361,6 +361,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -369,8 +371,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/guide/migrating_from_1.5/index.html b/docs/en/ranch/1.7/guide/migrating_from_1.5/index.html index 2b9cb65c..a753fb00 100644 --- a/docs/en/ranch/1.7/guide/migrating_from_1.5/index.html +++ b/docs/en/ranch/1.7/guide/migrating_from_1.5/index.html @@ -161,6 +161,8 @@ +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -169,8 +171,6 @@
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/guide/migrating_from_1.6/index.html b/docs/en/ranch/1.7/guide/migrating_from_1.6/index.html index 94d71407..1a774165 100644 --- a/docs/en/ranch/1.7/guide/migrating_from_1.6/index.html +++ b/docs/en/ranch/1.7/guide/migrating_from_1.6/index.html @@ -141,6 +141,8 @@ +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -149,8 +151,6 @@
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/guide/migrating_from_1.7/index.html b/docs/en/ranch/1.7/guide/migrating_from_1.7/index.html index b88e54d4..ec18978b 100644 --- a/docs/en/ranch/1.7/guide/migrating_from_1.7/index.html +++ b/docs/en/ranch/1.7/guide/migrating_from_1.7/index.html @@ -123,6 +123,8 @@ +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -131,8 +133,6 @@
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/guide/migrating_from_1.x/index.html b/docs/en/ranch/1.7/guide/migrating_from_1.x/index.html index 17bb5aac..a52d1a37 100644 --- a/docs/en/ranch/1.7/guide/migrating_from_1.x/index.html +++ b/docs/en/ranch/1.7/guide/migrating_from_1.x/index.html @@ -214,6 +214,8 @@ +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -222,8 +224,6 @@
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/guide/parsers/index.html b/docs/en/ranch/1.7/guide/parsers/index.html index 78a49adc..41cb4646 100644 --- a/docs/en/ranch/1.7/guide/parsers/index.html +++ b/docs/en/ranch/1.7/guide/parsers/index.html @@ -181,6 +181,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -189,8 +191,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/guide/protocols/index.html b/docs/en/ranch/1.7/guide/protocols/index.html index 93e8e08a..e33735a7 100644 --- a/docs/en/ranch/1.7/guide/protocols/index.html +++ b/docs/en/ranch/1.7/guide/protocols/index.html @@ -188,6 +188,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -196,8 +198,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/guide/ssl_auth/index.html b/docs/en/ranch/1.7/guide/ssl_auth/index.html index 6b5601b2..a8ca8ba4 100644 --- a/docs/en/ranch/1.7/guide/ssl_auth/index.html +++ b/docs/en/ranch/1.7/guide/ssl_auth/index.html @@ -194,6 +194,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -202,8 +204,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/guide/transports/index.html b/docs/en/ranch/1.7/guide/transports/index.html index 110de678..5d5dca76 100644 --- a/docs/en/ranch/1.7/guide/transports/index.html +++ b/docs/en/ranch/1.7/guide/transports/index.html @@ -228,6 +228,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -236,8 +238,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/guide/upcoming_2.0_changes/index.html b/docs/en/ranch/1.7/guide/upcoming_2.0_changes/index.html index d6378b69..07de8d28 100644 --- a/docs/en/ranch/1.7/guide/upcoming_2.0_changes/index.html +++ b/docs/en/ranch/1.7/guide/upcoming_2.0_changes/index.html @@ -135,6 +135,8 @@ +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -143,8 +145,6 @@
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/manual/index.html b/docs/en/ranch/1.7/manual/index.html index ef95ccba..52a5c153 100644 --- a/docs/en/ranch/1.7/manual/index.html +++ b/docs/en/ranch/1.7/manual/index.html @@ -141,6 +141,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -149,8 +151,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/manual/ranch.child_spec/index.html b/docs/en/ranch/1.7/manual/ranch.child_spec/index.html index adb5f09d..24f20684 100644 --- a/docs/en/ranch/1.7/manual/ranch.child_spec/index.html +++ b/docs/en/ranch/1.7/manual/ranch.child_spec/index.html @@ -159,6 +159,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -167,8 +169,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/manual/ranch.get_addr/index.html b/docs/en/ranch/1.7/manual/ranch.get_addr/index.html index 76bce6c0..9dec1419 100644 --- a/docs/en/ranch/1.7/manual/ranch.get_addr/index.html +++ b/docs/en/ranch/1.7/manual/ranch.get_addr/index.html @@ -127,6 +127,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -135,8 +137,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/manual/ranch.get_max_connections/index.html b/docs/en/ranch/1.7/manual/ranch.get_max_connections/index.html index 3d224ad6..91c4ff69 100644 --- a/docs/en/ranch/1.7/manual/ranch.get_max_connections/index.html +++ b/docs/en/ranch/1.7/manual/ranch.get_max_connections/index.html @@ -125,6 +125,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -133,8 +135,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/manual/ranch.get_port/index.html b/docs/en/ranch/1.7/manual/ranch.get_port/index.html index fdd4ccc1..3f3cd8fd 100644 --- a/docs/en/ranch/1.7/manual/ranch.get_port/index.html +++ b/docs/en/ranch/1.7/manual/ranch.get_port/index.html @@ -126,6 +126,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -134,8 +136,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/manual/ranch.get_protocol_options/index.html b/docs/en/ranch/1.7/manual/ranch.get_protocol_options/index.html index 56aa1927..0a8e6c1d 100644 --- a/docs/en/ranch/1.7/manual/ranch.get_protocol_options/index.html +++ b/docs/en/ranch/1.7/manual/ranch.get_protocol_options/index.html @@ -125,6 +125,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -133,8 +135,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/manual/ranch.get_status/index.html b/docs/en/ranch/1.7/manual/ranch.get_status/index.html index bd793db6..8b7ba404 100644 --- a/docs/en/ranch/1.7/manual/ranch.get_status/index.html +++ b/docs/en/ranch/1.7/manual/ranch.get_status/index.html @@ -128,6 +128,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -136,8 +138,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/manual/ranch.get_transport_options/index.html b/docs/en/ranch/1.7/manual/ranch.get_transport_options/index.html index 4d3c3549..57998529 100644 --- a/docs/en/ranch/1.7/manual/ranch.get_transport_options/index.html +++ b/docs/en/ranch/1.7/manual/ranch.get_transport_options/index.html @@ -125,6 +125,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -133,8 +135,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/manual/ranch.handshake/index.html b/docs/en/ranch/1.7/manual/ranch.handshake/index.html index 1fae618b..3c6a12bc 100644 --- a/docs/en/ranch/1.7/manual/ranch.handshake/index.html +++ b/docs/en/ranch/1.7/manual/ranch.handshake/index.html @@ -148,6 +148,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -156,8 +158,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/manual/ranch.info/index.html b/docs/en/ranch/1.7/manual/ranch.info/index.html index 2d4823fc..fe4dd77a 100644 --- a/docs/en/ranch/1.7/manual/ranch.info/index.html +++ b/docs/en/ranch/1.7/manual/ranch.info/index.html @@ -173,6 +173,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -181,8 +183,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/manual/ranch.procs/index.html b/docs/en/ranch/1.7/manual/ranch.procs/index.html index 6c8e9034..4d0e7130 100644 --- a/docs/en/ranch/1.7/manual/ranch.procs/index.html +++ b/docs/en/ranch/1.7/manual/ranch.procs/index.html @@ -136,6 +136,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -144,8 +146,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/manual/ranch.recv_proxy_header/index.html b/docs/en/ranch/1.7/manual/ranch.recv_proxy_header/index.html index 96c75337..41d19cd8 100644 --- a/docs/en/ranch/1.7/manual/ranch.recv_proxy_header/index.html +++ b/docs/en/ranch/1.7/manual/ranch.recv_proxy_header/index.html @@ -146,6 +146,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -154,8 +156,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/manual/ranch.remove_connection/index.html b/docs/en/ranch/1.7/manual/ranch.remove_connection/index.html index 9652c8f9..7afb4065 100644 --- a/docs/en/ranch/1.7/manual/ranch.remove_connection/index.html +++ b/docs/en/ranch/1.7/manual/ranch.remove_connection/index.html @@ -126,6 +126,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -134,8 +136,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/manual/ranch.resume_listener/index.html b/docs/en/ranch/1.7/manual/ranch.resume_listener/index.html index bdf1da3a..da075483 100644 --- a/docs/en/ranch/1.7/manual/ranch.resume_listener/index.html +++ b/docs/en/ranch/1.7/manual/ranch.resume_listener/index.html @@ -132,6 +132,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -140,8 +142,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/manual/ranch.set_max_connections/index.html b/docs/en/ranch/1.7/manual/ranch.set_max_connections/index.html index 479ea53d..456ce625 100644 --- a/docs/en/ranch/1.7/manual/ranch.set_max_connections/index.html +++ b/docs/en/ranch/1.7/manual/ranch.set_max_connections/index.html @@ -130,6 +130,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -138,8 +140,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/manual/ranch.set_protocol_options/index.html b/docs/en/ranch/1.7/manual/ranch.set_protocol_options/index.html index 59c46623..d5386bb5 100644 --- a/docs/en/ranch/1.7/manual/ranch.set_protocol_options/index.html +++ b/docs/en/ranch/1.7/manual/ranch.set_protocol_options/index.html @@ -130,6 +130,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -138,8 +140,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/manual/ranch.set_transport_options/index.html b/docs/en/ranch/1.7/manual/ranch.set_transport_options/index.html index ca1d12f0..e8d4323d 100644 --- a/docs/en/ranch/1.7/manual/ranch.set_transport_options/index.html +++ b/docs/en/ranch/1.7/manual/ranch.set_transport_options/index.html @@ -135,6 +135,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -143,8 +145,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/manual/ranch.start_listener/index.html b/docs/en/ranch/1.7/manual/ranch.start_listener/index.html index c9dd2bff..6a92205f 100644 --- a/docs/en/ranch/1.7/manual/ranch.start_listener/index.html +++ b/docs/en/ranch/1.7/manual/ranch.start_listener/index.html @@ -184,6 +184,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -192,8 +194,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/manual/ranch.stop_listener/index.html b/docs/en/ranch/1.7/manual/ranch.stop_listener/index.html index 3ff73f48..fdc123da 100644 --- a/docs/en/ranch/1.7/manual/ranch.stop_listener/index.html +++ b/docs/en/ranch/1.7/manual/ranch.stop_listener/index.html @@ -129,6 +129,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -137,8 +139,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/manual/ranch.suspend_listener/index.html b/docs/en/ranch/1.7/manual/ranch.suspend_listener/index.html index cc9262ce..aaa5e741 100644 --- a/docs/en/ranch/1.7/manual/ranch.suspend_listener/index.html +++ b/docs/en/ranch/1.7/manual/ranch.suspend_listener/index.html @@ -133,6 +133,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -141,8 +143,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/manual/ranch.wait_for_connections/index.html b/docs/en/ranch/1.7/manual/ranch.wait_for_connections/index.html index 919c1c35..eaccbe5e 100644 --- a/docs/en/ranch/1.7/manual/ranch.wait_for_connections/index.html +++ b/docs/en/ranch/1.7/manual/ranch.wait_for_connections/index.html @@ -153,6 +153,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -161,8 +163,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/manual/ranch/index.html b/docs/en/ranch/1.7/manual/ranch/index.html index cbdf432c..98cdd679 100644 --- a/docs/en/ranch/1.7/manual/ranch/index.html +++ b/docs/en/ranch/1.7/manual/ranch/index.html @@ -238,6 +238,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -246,8 +248,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/manual/ranch_app/index.html b/docs/en/ranch/1.7/manual/ranch_app/index.html index f58475f7..0fca4b09 100644 --- a/docs/en/ranch/1.7/manual/ranch_app/index.html +++ b/docs/en/ranch/1.7/manual/ranch_app/index.html @@ -141,6 +141,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -149,8 +151,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/manual/ranch_protocol/index.html b/docs/en/ranch/1.7/manual/ranch_protocol/index.html index a52f14bb..a7971ae3 100644 --- a/docs/en/ranch/1.7/manual/ranch_protocol/index.html +++ b/docs/en/ranch/1.7/manual/ranch_protocol/index.html @@ -125,6 +125,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -133,8 +135,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/manual/ranch_proxy_header.header/index.html b/docs/en/ranch/1.7/manual/ranch_proxy_header.header/index.html index 60ef4508..e4778a53 100644 --- a/docs/en/ranch/1.7/manual/ranch_proxy_header.header/index.html +++ b/docs/en/ranch/1.7/manual/ranch_proxy_header.header/index.html @@ -160,6 +160,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -168,8 +170,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/manual/ranch_proxy_header.parse/index.html b/docs/en/ranch/1.7/manual/ranch_proxy_header.parse/index.html index 52c8f30b..8b0aff92 100644 --- a/docs/en/ranch/1.7/manual/ranch_proxy_header.parse/index.html +++ b/docs/en/ranch/1.7/manual/ranch_proxy_header.parse/index.html @@ -131,6 +131,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -139,8 +141,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/manual/ranch_proxy_header/index.html b/docs/en/ranch/1.7/manual/ranch_proxy_header/index.html index ad564bf8..3c9b33ce 100644 --- a/docs/en/ranch/1.7/manual/ranch_proxy_header/index.html +++ b/docs/en/ranch/1.7/manual/ranch_proxy_header/index.html @@ -214,6 +214,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -222,8 +224,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/manual/ranch_ssl/index.html b/docs/en/ranch/1.7/manual/ranch_ssl/index.html index d470490d..03e1c65c 100644 --- a/docs/en/ranch/1.7/manual/ranch_ssl/index.html +++ b/docs/en/ranch/1.7/manual/ranch_ssl/index.html @@ -277,6 +277,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -285,8 +287,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/manual/ranch_tcp/index.html b/docs/en/ranch/1.7/manual/ranch_tcp/index.html index 41b43189..5c098b60 100644 --- a/docs/en/ranch/1.7/manual/ranch_tcp/index.html +++ b/docs/en/ranch/1.7/manual/ranch_tcp/index.html @@ -224,6 +224,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -232,8 +234,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/manual/ranch_transport.sendfile/index.html b/docs/en/ranch/1.7/manual/ranch_transport.sendfile/index.html index 1c2b1e9c..95f76cda 100644 --- a/docs/en/ranch/1.7/manual/ranch_transport.sendfile/index.html +++ b/docs/en/ranch/1.7/manual/ranch_transport.sendfile/index.html @@ -160,6 +160,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -168,8 +170,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.7/manual/ranch_transport/index.html b/docs/en/ranch/1.7/manual/ranch_transport/index.html index c03e5d3d..c6ac5e56 100644 --- a/docs/en/ranch/1.7/manual/ranch_transport/index.html +++ b/docs/en/ranch/1.7/manual/ranch_transport/index.html @@ -325,6 +325,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -333,8 +335,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/guide/embedded/index.html b/docs/en/ranch/1.8/guide/embedded/index.html index f217a78c..ecbbb656 100644 --- a/docs/en/ranch/1.8/guide/embedded/index.html +++ b/docs/en/ranch/1.8/guide/embedded/index.html @@ -142,6 +142,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -150,8 +152,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/guide/index.html b/docs/en/ranch/1.8/guide/index.html index 9760e234..19333646 100644 --- a/docs/en/ranch/1.8/guide/index.html +++ b/docs/en/ranch/1.8/guide/index.html @@ -131,6 +131,8 @@ +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -139,8 +141,6 @@
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/guide/internals/index.html b/docs/en/ranch/1.8/guide/internals/index.html index 1fe14387..2fac5f10 100644 --- a/docs/en/ranch/1.8/guide/internals/index.html +++ b/docs/en/ranch/1.8/guide/internals/index.html @@ -146,6 +146,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -154,8 +156,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/guide/introduction/index.html b/docs/en/ranch/1.8/guide/introduction/index.html index a7ae89f8..8d6ec685 100644 --- a/docs/en/ranch/1.8/guide/introduction/index.html +++ b/docs/en/ranch/1.8/guide/introduction/index.html @@ -125,6 +125,8 @@ +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -133,8 +135,6 @@
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/guide/listeners/index.html b/docs/en/ranch/1.8/guide/listeners/index.html index 7614cbd3..a82038ec 100644 --- a/docs/en/ranch/1.8/guide/listeners/index.html +++ b/docs/en/ranch/1.8/guide/listeners/index.html @@ -361,6 +361,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -369,8 +371,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/guide/migrating_from_1.5/index.html b/docs/en/ranch/1.8/guide/migrating_from_1.5/index.html index db170a9d..804ed5aa 100644 --- a/docs/en/ranch/1.8/guide/migrating_from_1.5/index.html +++ b/docs/en/ranch/1.8/guide/migrating_from_1.5/index.html @@ -161,6 +161,8 @@ +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -169,8 +171,6 @@
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/guide/migrating_from_1.6/index.html b/docs/en/ranch/1.8/guide/migrating_from_1.6/index.html index 9d2c5e17..98e3864d 100644 --- a/docs/en/ranch/1.8/guide/migrating_from_1.6/index.html +++ b/docs/en/ranch/1.8/guide/migrating_from_1.6/index.html @@ -141,6 +141,8 @@ +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -149,8 +151,6 @@
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/guide/migrating_from_1.7/index.html b/docs/en/ranch/1.8/guide/migrating_from_1.7/index.html index 1aa9376c..51eb93d1 100644 --- a/docs/en/ranch/1.8/guide/migrating_from_1.7/index.html +++ b/docs/en/ranch/1.8/guide/migrating_from_1.7/index.html @@ -125,6 +125,8 @@ +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -133,8 +135,6 @@
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/guide/migrating_from_1.x/index.html b/docs/en/ranch/1.8/guide/migrating_from_1.x/index.html index ba0cbeb5..0c85e403 100644 --- a/docs/en/ranch/1.8/guide/migrating_from_1.x/index.html +++ b/docs/en/ranch/1.8/guide/migrating_from_1.x/index.html @@ -214,6 +214,8 @@ +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -222,8 +224,6 @@
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/guide/parsers/index.html b/docs/en/ranch/1.8/guide/parsers/index.html index 6bb5cde8..e7bfefe8 100644 --- a/docs/en/ranch/1.8/guide/parsers/index.html +++ b/docs/en/ranch/1.8/guide/parsers/index.html @@ -181,6 +181,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -189,8 +191,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/guide/protocols/index.html b/docs/en/ranch/1.8/guide/protocols/index.html index 427423c2..d36c311b 100644 --- a/docs/en/ranch/1.8/guide/protocols/index.html +++ b/docs/en/ranch/1.8/guide/protocols/index.html @@ -188,6 +188,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -196,8 +198,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/guide/ssl_auth/index.html b/docs/en/ranch/1.8/guide/ssl_auth/index.html index f63a2040..9d08e9b4 100644 --- a/docs/en/ranch/1.8/guide/ssl_auth/index.html +++ b/docs/en/ranch/1.8/guide/ssl_auth/index.html @@ -194,6 +194,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -202,8 +204,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/guide/transports/index.html b/docs/en/ranch/1.8/guide/transports/index.html index aa0274f4..556cb66e 100644 --- a/docs/en/ranch/1.8/guide/transports/index.html +++ b/docs/en/ranch/1.8/guide/transports/index.html @@ -228,6 +228,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -236,8 +238,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/guide/upcoming_2.0_changes/index.html b/docs/en/ranch/1.8/guide/upcoming_2.0_changes/index.html index 59c70a06..aea6fbd6 100644 --- a/docs/en/ranch/1.8/guide/upcoming_2.0_changes/index.html +++ b/docs/en/ranch/1.8/guide/upcoming_2.0_changes/index.html @@ -135,6 +135,8 @@ +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -143,8 +145,6 @@
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/manual/index.html b/docs/en/ranch/1.8/manual/index.html index feaaaf49..a19b87e7 100644 --- a/docs/en/ranch/1.8/manual/index.html +++ b/docs/en/ranch/1.8/manual/index.html @@ -141,6 +141,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -149,8 +151,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/manual/ranch.child_spec/index.html b/docs/en/ranch/1.8/manual/ranch.child_spec/index.html index 768ec5ab..d450cc48 100644 --- a/docs/en/ranch/1.8/manual/ranch.child_spec/index.html +++ b/docs/en/ranch/1.8/manual/ranch.child_spec/index.html @@ -159,6 +159,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -167,8 +169,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/manual/ranch.get_addr/index.html b/docs/en/ranch/1.8/manual/ranch.get_addr/index.html index 75c68874..01f76417 100644 --- a/docs/en/ranch/1.8/manual/ranch.get_addr/index.html +++ b/docs/en/ranch/1.8/manual/ranch.get_addr/index.html @@ -127,6 +127,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -135,8 +137,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/manual/ranch.get_max_connections/index.html b/docs/en/ranch/1.8/manual/ranch.get_max_connections/index.html index a5725f25..99bbb4a4 100644 --- a/docs/en/ranch/1.8/manual/ranch.get_max_connections/index.html +++ b/docs/en/ranch/1.8/manual/ranch.get_max_connections/index.html @@ -125,6 +125,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -133,8 +135,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/manual/ranch.get_port/index.html b/docs/en/ranch/1.8/manual/ranch.get_port/index.html index 654e1bf0..d5f9aef4 100644 --- a/docs/en/ranch/1.8/manual/ranch.get_port/index.html +++ b/docs/en/ranch/1.8/manual/ranch.get_port/index.html @@ -126,6 +126,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -134,8 +136,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/manual/ranch.get_protocol_options/index.html b/docs/en/ranch/1.8/manual/ranch.get_protocol_options/index.html index fb328f7f..242483f7 100644 --- a/docs/en/ranch/1.8/manual/ranch.get_protocol_options/index.html +++ b/docs/en/ranch/1.8/manual/ranch.get_protocol_options/index.html @@ -125,6 +125,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -133,8 +135,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/manual/ranch.get_status/index.html b/docs/en/ranch/1.8/manual/ranch.get_status/index.html index c40608d1..24614cf0 100644 --- a/docs/en/ranch/1.8/manual/ranch.get_status/index.html +++ b/docs/en/ranch/1.8/manual/ranch.get_status/index.html @@ -128,6 +128,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -136,8 +138,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/manual/ranch.get_transport_options/index.html b/docs/en/ranch/1.8/manual/ranch.get_transport_options/index.html index fea15783..9d471dc1 100644 --- a/docs/en/ranch/1.8/manual/ranch.get_transport_options/index.html +++ b/docs/en/ranch/1.8/manual/ranch.get_transport_options/index.html @@ -125,6 +125,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -133,8 +135,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/manual/ranch.handshake/index.html b/docs/en/ranch/1.8/manual/ranch.handshake/index.html index 0397df7b..eba63df5 100644 --- a/docs/en/ranch/1.8/manual/ranch.handshake/index.html +++ b/docs/en/ranch/1.8/manual/ranch.handshake/index.html @@ -148,6 +148,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -156,8 +158,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/manual/ranch.info/index.html b/docs/en/ranch/1.8/manual/ranch.info/index.html index 36ca7392..43af3ff6 100644 --- a/docs/en/ranch/1.8/manual/ranch.info/index.html +++ b/docs/en/ranch/1.8/manual/ranch.info/index.html @@ -173,6 +173,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -181,8 +183,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/manual/ranch.procs/index.html b/docs/en/ranch/1.8/manual/ranch.procs/index.html index e72bfd83..4ab4cfb9 100644 --- a/docs/en/ranch/1.8/manual/ranch.procs/index.html +++ b/docs/en/ranch/1.8/manual/ranch.procs/index.html @@ -136,6 +136,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -144,8 +146,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/manual/ranch.recv_proxy_header/index.html b/docs/en/ranch/1.8/manual/ranch.recv_proxy_header/index.html index 91874776..31ea3a39 100644 --- a/docs/en/ranch/1.8/manual/ranch.recv_proxy_header/index.html +++ b/docs/en/ranch/1.8/manual/ranch.recv_proxy_header/index.html @@ -146,6 +146,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -154,8 +156,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/manual/ranch.remove_connection/index.html b/docs/en/ranch/1.8/manual/ranch.remove_connection/index.html index fd9e107a..14b25dbd 100644 --- a/docs/en/ranch/1.8/manual/ranch.remove_connection/index.html +++ b/docs/en/ranch/1.8/manual/ranch.remove_connection/index.html @@ -126,6 +126,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -134,8 +136,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/manual/ranch.resume_listener/index.html b/docs/en/ranch/1.8/manual/ranch.resume_listener/index.html index cc3eda7d..3e046a78 100644 --- a/docs/en/ranch/1.8/manual/ranch.resume_listener/index.html +++ b/docs/en/ranch/1.8/manual/ranch.resume_listener/index.html @@ -132,6 +132,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -140,8 +142,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/manual/ranch.set_max_connections/index.html b/docs/en/ranch/1.8/manual/ranch.set_max_connections/index.html index 7a5d226b..202bd8ac 100644 --- a/docs/en/ranch/1.8/manual/ranch.set_max_connections/index.html +++ b/docs/en/ranch/1.8/manual/ranch.set_max_connections/index.html @@ -130,6 +130,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -138,8 +140,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/manual/ranch.set_protocol_options/index.html b/docs/en/ranch/1.8/manual/ranch.set_protocol_options/index.html index 3e4e4632..bfaaafcc 100644 --- a/docs/en/ranch/1.8/manual/ranch.set_protocol_options/index.html +++ b/docs/en/ranch/1.8/manual/ranch.set_protocol_options/index.html @@ -130,6 +130,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -138,8 +140,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/manual/ranch.set_transport_options/index.html b/docs/en/ranch/1.8/manual/ranch.set_transport_options/index.html index 9b174655..aede9fc2 100644 --- a/docs/en/ranch/1.8/manual/ranch.set_transport_options/index.html +++ b/docs/en/ranch/1.8/manual/ranch.set_transport_options/index.html @@ -135,6 +135,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -143,8 +145,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/manual/ranch.start_listener/index.html b/docs/en/ranch/1.8/manual/ranch.start_listener/index.html index 9a4d173d..e4d3418c 100644 --- a/docs/en/ranch/1.8/manual/ranch.start_listener/index.html +++ b/docs/en/ranch/1.8/manual/ranch.start_listener/index.html @@ -184,6 +184,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -192,8 +194,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/manual/ranch.stop_listener/index.html b/docs/en/ranch/1.8/manual/ranch.stop_listener/index.html index f5e820b2..37676c28 100644 --- a/docs/en/ranch/1.8/manual/ranch.stop_listener/index.html +++ b/docs/en/ranch/1.8/manual/ranch.stop_listener/index.html @@ -129,6 +129,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -137,8 +139,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/manual/ranch.suspend_listener/index.html b/docs/en/ranch/1.8/manual/ranch.suspend_listener/index.html index 61549a9c..a509cc61 100644 --- a/docs/en/ranch/1.8/manual/ranch.suspend_listener/index.html +++ b/docs/en/ranch/1.8/manual/ranch.suspend_listener/index.html @@ -133,6 +133,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -141,8 +143,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/manual/ranch.wait_for_connections/index.html b/docs/en/ranch/1.8/manual/ranch.wait_for_connections/index.html index 7a661190..c2ac44ed 100644 --- a/docs/en/ranch/1.8/manual/ranch.wait_for_connections/index.html +++ b/docs/en/ranch/1.8/manual/ranch.wait_for_connections/index.html @@ -153,6 +153,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -161,8 +163,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/manual/ranch/index.html b/docs/en/ranch/1.8/manual/ranch/index.html index b12eadbc..5dafb28b 100644 --- a/docs/en/ranch/1.8/manual/ranch/index.html +++ b/docs/en/ranch/1.8/manual/ranch/index.html @@ -202,7 +202,7 @@ http://www.gnu.org/software/src-highlite -->

    See also

    -

    ranch(7)

    +

    ranch(7)

    @@ -238,6 +238,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -246,8 +248,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/manual/ranch_app/index.html b/docs/en/ranch/1.8/manual/ranch_app/index.html index 95a21bc1..88e73a3d 100644 --- a/docs/en/ranch/1.8/manual/ranch_app/index.html +++ b/docs/en/ranch/1.8/manual/ranch_app/index.html @@ -141,6 +141,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -149,8 +151,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/manual/ranch_protocol/index.html b/docs/en/ranch/1.8/manual/ranch_protocol/index.html index 9607bb31..5a6721c9 100644 --- a/docs/en/ranch/1.8/manual/ranch_protocol/index.html +++ b/docs/en/ranch/1.8/manual/ranch_protocol/index.html @@ -89,7 +89,7 @@ http://www.gnu.org/software/src-highlite -->

    See also

    -

    ranch:handshake(3), ranch(7)

    +

    ranch:handshake(3), ranch(7)

    @@ -125,6 +125,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -133,8 +135,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/manual/ranch_proxy_header.header/index.html b/docs/en/ranch/1.8/manual/ranch_proxy_header.header/index.html index a8d3e9d0..93f1cb82 100644 --- a/docs/en/ranch/1.8/manual/ranch_proxy_header.header/index.html +++ b/docs/en/ranch/1.8/manual/ranch_proxy_header.header/index.html @@ -160,6 +160,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -168,8 +170,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/manual/ranch_proxy_header.parse/index.html b/docs/en/ranch/1.8/manual/ranch_proxy_header.parse/index.html index 2489ce91..bb4d0f71 100644 --- a/docs/en/ranch/1.8/manual/ranch_proxy_header.parse/index.html +++ b/docs/en/ranch/1.8/manual/ranch_proxy_header.parse/index.html @@ -131,6 +131,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -139,8 +141,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/manual/ranch_proxy_header/index.html b/docs/en/ranch/1.8/manual/ranch_proxy_header/index.html index 3aae5bda..68a13091 100644 --- a/docs/en/ranch/1.8/manual/ranch_proxy_header/index.html +++ b/docs/en/ranch/1.8/manual/ranch_proxy_header/index.html @@ -178,7 +178,7 @@ http://www.gnu.org/software/src-highlite -->

    See also

    -

    ranch(7)

    +

    ranch(7)

    @@ -214,6 +214,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -222,8 +224,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/manual/ranch_ssl/index.html b/docs/en/ranch/1.8/manual/ranch_ssl/index.html index ff227404..b67b5281 100644 --- a/docs/en/ranch/1.8/manual/ranch_ssl/index.html +++ b/docs/en/ranch/1.8/manual/ranch_ssl/index.html @@ -241,7 +241,7 @@ http://www.gnu.org/software/src-highlite -->

    Note that the client will not send a certificate unless the value for the verify option is set to verify_peer. This means that fail_if_no_peer_cert only applies when combined with the verify option. The verify_fun option allows greater control over the client certificate validation.

    The options sni_fun and sni_hosts are mutually exclusive.

    See also

    -

    ranch(7), ranch_transport(3), ranch_tcp(3), ssl(3)

    +

    ranch(7), ranch_transport(3), ranch_tcp(3), ssl(3)

    @@ -277,6 +277,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -285,8 +287,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/manual/ranch_tcp/index.html b/docs/en/ranch/1.8/manual/ranch_tcp/index.html index e23ed610..a5e8deef 100644 --- a/docs/en/ranch/1.8/manual/ranch_tcp/index.html +++ b/docs/en/ranch/1.8/manual/ranch_tcp/index.html @@ -188,7 +188,7 @@ http://www.gnu.org/software/src-highlite -->

    List of listen options.

    See also

    -

    ranch(7), ranch_transport(3), ranch_ssl(3), gen_tcp(3), inet(3)

    +

    ranch(7), ranch_transport(3), ranch_ssl(3), gen_tcp(3), inet(3)

    @@ -224,6 +224,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -232,8 +234,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/manual/ranch_transport.sendfile/index.html b/docs/en/ranch/1.8/manual/ranch_transport.sendfile/index.html index 86134512..741b8513 100644 --- a/docs/en/ranch/1.8/manual/ranch_transport.sendfile/index.html +++ b/docs/en/ranch/1.8/manual/ranch_transport.sendfile/index.html @@ -160,6 +160,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -168,8 +170,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/1.8/manual/ranch_transport/index.html b/docs/en/ranch/1.8/manual/ranch_transport/index.html index add1765d..0871b6ae 100644 --- a/docs/en/ranch/1.8/manual/ranch_transport/index.html +++ b/docs/en/ranch/1.8/manual/ranch_transport/index.html @@ -289,7 +289,7 @@ http://www.gnu.org/software/src-highlite -->

    See also

    -

    ranch(7), ranch_tcp(3), ranch_ssl(3)

    +

    ranch(7), ranch_tcp(3), ranch_ssl(3)

    @@ -325,6 +325,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -333,8 +335,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/guide/connection_draining/index.html b/docs/en/ranch/2.0/guide/connection_draining/index.html index 3c3e2a00..ec39b4c5 100644 --- a/docs/en/ranch/2.0/guide/connection_draining/index.html +++ b/docs/en/ranch/2.0/guide/connection_draining/index.html @@ -198,6 +198,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -206,8 +208,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/guide/embedded/index.html b/docs/en/ranch/2.0/guide/embedded/index.html index 77e08615..0abf4c25 100644 --- a/docs/en/ranch/2.0/guide/embedded/index.html +++ b/docs/en/ranch/2.0/guide/embedded/index.html @@ -139,6 +139,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -147,8 +149,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/guide/index.html b/docs/en/ranch/2.0/guide/index.html index 2959cb6c..dd2624a9 100644 --- a/docs/en/ranch/2.0/guide/index.html +++ b/docs/en/ranch/2.0/guide/index.html @@ -131,6 +131,8 @@ +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -139,8 +141,6 @@
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/guide/internals/index.html b/docs/en/ranch/2.0/guide/internals/index.html index e0bb9256..5d5b98b3 100644 --- a/docs/en/ranch/2.0/guide/internals/index.html +++ b/docs/en/ranch/2.0/guide/internals/index.html @@ -147,6 +147,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -155,8 +157,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/guide/introduction/index.html b/docs/en/ranch/2.0/guide/introduction/index.html index b9fa77ca..ae5552dc 100644 --- a/docs/en/ranch/2.0/guide/introduction/index.html +++ b/docs/en/ranch/2.0/guide/introduction/index.html @@ -125,6 +125,8 @@ +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -133,8 +135,6 @@
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/guide/listeners/index.html b/docs/en/ranch/2.0/guide/listeners/index.html index 1a50fe1c..c67f51a3 100644 --- a/docs/en/ranch/2.0/guide/listeners/index.html +++ b/docs/en/ranch/2.0/guide/listeners/index.html @@ -388,6 +388,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -396,8 +398,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/guide/migrating_from_1.5/index.html b/docs/en/ranch/2.0/guide/migrating_from_1.5/index.html index b86e59d2..766206dc 100644 --- a/docs/en/ranch/2.0/guide/migrating_from_1.5/index.html +++ b/docs/en/ranch/2.0/guide/migrating_from_1.5/index.html @@ -161,6 +161,8 @@ +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -169,8 +171,6 @@
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/guide/migrating_from_1.6/index.html b/docs/en/ranch/2.0/guide/migrating_from_1.6/index.html index 9d717153..ca1ba8ef 100644 --- a/docs/en/ranch/2.0/guide/migrating_from_1.6/index.html +++ b/docs/en/ranch/2.0/guide/migrating_from_1.6/index.html @@ -141,6 +141,8 @@ +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -149,8 +151,6 @@
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/guide/migrating_from_1.7/index.html b/docs/en/ranch/2.0/guide/migrating_from_1.7/index.html index e5514929..2ac250ed 100644 --- a/docs/en/ranch/2.0/guide/migrating_from_1.7/index.html +++ b/docs/en/ranch/2.0/guide/migrating_from_1.7/index.html @@ -198,6 +198,8 @@ +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -206,8 +208,6 @@
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/guide/migrating_from_1.x/index.html b/docs/en/ranch/2.0/guide/migrating_from_1.x/index.html index 5b3585f3..a4483266 100644 --- a/docs/en/ranch/2.0/guide/migrating_from_1.x/index.html +++ b/docs/en/ranch/2.0/guide/migrating_from_1.x/index.html @@ -214,6 +214,8 @@ +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -222,8 +224,6 @@
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/guide/parsers/index.html b/docs/en/ranch/2.0/guide/parsers/index.html index e4106ea9..fbbf57fa 100644 --- a/docs/en/ranch/2.0/guide/parsers/index.html +++ b/docs/en/ranch/2.0/guide/parsers/index.html @@ -181,6 +181,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -189,8 +191,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/guide/protocols/index.html b/docs/en/ranch/2.0/guide/protocols/index.html index f7e98c58..70bfc22a 100644 --- a/docs/en/ranch/2.0/guide/protocols/index.html +++ b/docs/en/ranch/2.0/guide/protocols/index.html @@ -188,6 +188,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -196,8 +198,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/guide/ssl_auth/index.html b/docs/en/ranch/2.0/guide/ssl_auth/index.html index 5f3a2fa3..a4877c5c 100644 --- a/docs/en/ranch/2.0/guide/ssl_auth/index.html +++ b/docs/en/ranch/2.0/guide/ssl_auth/index.html @@ -194,6 +194,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -202,8 +204,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/guide/transports/index.html b/docs/en/ranch/2.0/guide/transports/index.html index 5b5ee18e..e29de37c 100644 --- a/docs/en/ranch/2.0/guide/transports/index.html +++ b/docs/en/ranch/2.0/guide/transports/index.html @@ -228,6 +228,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -236,8 +238,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/manual/index.html b/docs/en/ranch/2.0/manual/index.html index 261556ba..2b7db009 100644 --- a/docs/en/ranch/2.0/manual/index.html +++ b/docs/en/ranch/2.0/manual/index.html @@ -141,6 +141,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -149,8 +151,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/manual/ranch.child_spec/index.html b/docs/en/ranch/2.0/manual/ranch.child_spec/index.html index 3348e51e..3b4ebb7f 100644 --- a/docs/en/ranch/2.0/manual/ranch.child_spec/index.html +++ b/docs/en/ranch/2.0/manual/ranch.child_spec/index.html @@ -163,6 +163,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -171,8 +173,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/manual/ranch.get_addr/index.html b/docs/en/ranch/2.0/manual/ranch.get_addr/index.html index 69771ad5..1a718b21 100644 --- a/docs/en/ranch/2.0/manual/ranch.get_addr/index.html +++ b/docs/en/ranch/2.0/manual/ranch.get_addr/index.html @@ -137,6 +137,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -145,8 +147,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/manual/ranch.get_max_connections/index.html b/docs/en/ranch/2.0/manual/ranch.get_max_connections/index.html index 13fc2150..6014e8bd 100644 --- a/docs/en/ranch/2.0/manual/ranch.get_max_connections/index.html +++ b/docs/en/ranch/2.0/manual/ranch.get_max_connections/index.html @@ -129,6 +129,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -137,8 +139,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/manual/ranch.get_port/index.html b/docs/en/ranch/2.0/manual/ranch.get_port/index.html index eed1a6d4..5d2fe4e7 100644 --- a/docs/en/ranch/2.0/manual/ranch.get_port/index.html +++ b/docs/en/ranch/2.0/manual/ranch.get_port/index.html @@ -127,6 +127,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -135,8 +137,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/manual/ranch.get_protocol_options/index.html b/docs/en/ranch/2.0/manual/ranch.get_protocol_options/index.html index 85eece21..65fb1915 100644 --- a/docs/en/ranch/2.0/manual/ranch.get_protocol_options/index.html +++ b/docs/en/ranch/2.0/manual/ranch.get_protocol_options/index.html @@ -125,6 +125,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -133,8 +135,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/manual/ranch.get_status/index.html b/docs/en/ranch/2.0/manual/ranch.get_status/index.html index 196e9497..7842e2ab 100644 --- a/docs/en/ranch/2.0/manual/ranch.get_status/index.html +++ b/docs/en/ranch/2.0/manual/ranch.get_status/index.html @@ -128,6 +128,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -136,8 +138,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/manual/ranch.get_transport_options/index.html b/docs/en/ranch/2.0/manual/ranch.get_transport_options/index.html index a308bacd..7b9fa768 100644 --- a/docs/en/ranch/2.0/manual/ranch.get_transport_options/index.html +++ b/docs/en/ranch/2.0/manual/ranch.get_transport_options/index.html @@ -125,6 +125,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -133,8 +135,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/manual/ranch.handshake/index.html b/docs/en/ranch/2.0/manual/ranch.handshake/index.html index 28b331c3..65ea7cc0 100644 --- a/docs/en/ranch/2.0/manual/ranch.handshake/index.html +++ b/docs/en/ranch/2.0/manual/ranch.handshake/index.html @@ -151,6 +151,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -159,8 +161,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/manual/ranch.handshake_cancel/index.html b/docs/en/ranch/2.0/manual/ranch.handshake_cancel/index.html index 12311b26..1ae4e0a1 100644 --- a/docs/en/ranch/2.0/manual/ranch.handshake_cancel/index.html +++ b/docs/en/ranch/2.0/manual/ranch.handshake_cancel/index.html @@ -138,6 +138,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -146,8 +148,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/manual/ranch.handshake_continue/index.html b/docs/en/ranch/2.0/manual/ranch.handshake_continue/index.html index 1121940d..dcc24648 100644 --- a/docs/en/ranch/2.0/manual/ranch.handshake_continue/index.html +++ b/docs/en/ranch/2.0/manual/ranch.handshake_continue/index.html @@ -148,6 +148,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -156,8 +158,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/manual/ranch.info/index.html b/docs/en/ranch/2.0/manual/ranch.info/index.html index 266c8d56..a7175264 100644 --- a/docs/en/ranch/2.0/manual/ranch.info/index.html +++ b/docs/en/ranch/2.0/manual/ranch.info/index.html @@ -174,6 +174,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -182,8 +184,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/manual/ranch.procs/index.html b/docs/en/ranch/2.0/manual/ranch.procs/index.html index e32bed48..b8b829d3 100644 --- a/docs/en/ranch/2.0/manual/ranch.procs/index.html +++ b/docs/en/ranch/2.0/manual/ranch.procs/index.html @@ -136,6 +136,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -144,8 +146,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/manual/ranch.recv_proxy_header/index.html b/docs/en/ranch/2.0/manual/ranch.recv_proxy_header/index.html index 8f6119a7..d9e03bc0 100644 --- a/docs/en/ranch/2.0/manual/ranch.recv_proxy_header/index.html +++ b/docs/en/ranch/2.0/manual/ranch.recv_proxy_header/index.html @@ -146,6 +146,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -154,8 +156,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/manual/ranch.remove_connection/index.html b/docs/en/ranch/2.0/manual/ranch.remove_connection/index.html index 332c443b..426a4c3f 100644 --- a/docs/en/ranch/2.0/manual/ranch.remove_connection/index.html +++ b/docs/en/ranch/2.0/manual/ranch.remove_connection/index.html @@ -126,6 +126,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -134,8 +136,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/manual/ranch.resume_listener/index.html b/docs/en/ranch/2.0/manual/ranch.resume_listener/index.html index 4df6a268..d609a7a6 100644 --- a/docs/en/ranch/2.0/manual/ranch.resume_listener/index.html +++ b/docs/en/ranch/2.0/manual/ranch.resume_listener/index.html @@ -132,6 +132,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -140,8 +142,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/manual/ranch.set_max_connections/index.html b/docs/en/ranch/2.0/manual/ranch.set_max_connections/index.html index 9c72ff6c..a610f0fc 100644 --- a/docs/en/ranch/2.0/manual/ranch.set_max_connections/index.html +++ b/docs/en/ranch/2.0/manual/ranch.set_max_connections/index.html @@ -134,6 +134,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -142,8 +144,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/manual/ranch.set_protocol_options/index.html b/docs/en/ranch/2.0/manual/ranch.set_protocol_options/index.html index a917c3ae..c7aaaccb 100644 --- a/docs/en/ranch/2.0/manual/ranch.set_protocol_options/index.html +++ b/docs/en/ranch/2.0/manual/ranch.set_protocol_options/index.html @@ -130,6 +130,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -138,8 +140,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/manual/ranch.set_transport_options/index.html b/docs/en/ranch/2.0/manual/ranch.set_transport_options/index.html index 1166b6f9..45647113 100644 --- a/docs/en/ranch/2.0/manual/ranch.set_transport_options/index.html +++ b/docs/en/ranch/2.0/manual/ranch.set_transport_options/index.html @@ -169,6 +169,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -177,8 +179,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/manual/ranch.start_listener/index.html b/docs/en/ranch/2.0/manual/ranch.start_listener/index.html index a090c37c..ddb35d9a 100644 --- a/docs/en/ranch/2.0/manual/ranch.start_listener/index.html +++ b/docs/en/ranch/2.0/manual/ranch.start_listener/index.html @@ -186,6 +186,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -194,8 +196,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/manual/ranch.stop_listener/index.html b/docs/en/ranch/2.0/manual/ranch.stop_listener/index.html index 00473f25..a5d050dc 100644 --- a/docs/en/ranch/2.0/manual/ranch.stop_listener/index.html +++ b/docs/en/ranch/2.0/manual/ranch.stop_listener/index.html @@ -129,6 +129,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -137,8 +139,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/manual/ranch.suspend_listener/index.html b/docs/en/ranch/2.0/manual/ranch.suspend_listener/index.html index 99c935ce..66384980 100644 --- a/docs/en/ranch/2.0/manual/ranch.suspend_listener/index.html +++ b/docs/en/ranch/2.0/manual/ranch.suspend_listener/index.html @@ -133,6 +133,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -141,8 +143,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/manual/ranch.wait_for_connections/index.html b/docs/en/ranch/2.0/manual/ranch.wait_for_connections/index.html index 066c069e..08e29667 100644 --- a/docs/en/ranch/2.0/manual/ranch.wait_for_connections/index.html +++ b/docs/en/ranch/2.0/manual/ranch.wait_for_connections/index.html @@ -153,6 +153,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -161,8 +163,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/manual/ranch/index.html b/docs/en/ranch/2.0/manual/ranch/index.html index a1a968bb..f2b5b720 100644 --- a/docs/en/ranch/2.0/manual/ranch/index.html +++ b/docs/en/ranch/2.0/manual/ranch/index.html @@ -249,6 +249,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -257,8 +259,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/manual/ranch_app/index.html b/docs/en/ranch/2.0/manual/ranch_app/index.html index 5c3f9685..3ecbfb25 100644 --- a/docs/en/ranch/2.0/manual/ranch_app/index.html +++ b/docs/en/ranch/2.0/manual/ranch_app/index.html @@ -141,6 +141,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -149,8 +151,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/manual/ranch_protocol/index.html b/docs/en/ranch/2.0/manual/ranch_protocol/index.html index b166cad2..a89a1a82 100644 --- a/docs/en/ranch/2.0/manual/ranch_protocol/index.html +++ b/docs/en/ranch/2.0/manual/ranch_protocol/index.html @@ -126,6 +126,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -134,8 +136,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/manual/ranch_proxy_header.header/index.html b/docs/en/ranch/2.0/manual/ranch_proxy_header.header/index.html index e9d7ead3..126cd51a 100644 --- a/docs/en/ranch/2.0/manual/ranch_proxy_header.header/index.html +++ b/docs/en/ranch/2.0/manual/ranch_proxy_header.header/index.html @@ -160,6 +160,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -168,8 +170,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/manual/ranch_proxy_header.parse/index.html b/docs/en/ranch/2.0/manual/ranch_proxy_header.parse/index.html index 431c6bf1..6caa89b6 100644 --- a/docs/en/ranch/2.0/manual/ranch_proxy_header.parse/index.html +++ b/docs/en/ranch/2.0/manual/ranch_proxy_header.parse/index.html @@ -131,6 +131,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -139,8 +141,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/manual/ranch_proxy_header/index.html b/docs/en/ranch/2.0/manual/ranch_proxy_header/index.html index cbb3303e..f25c7c20 100644 --- a/docs/en/ranch/2.0/manual/ranch_proxy_header/index.html +++ b/docs/en/ranch/2.0/manual/ranch_proxy_header/index.html @@ -214,6 +214,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -222,8 +224,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/manual/ranch_ssl/index.html b/docs/en/ranch/2.0/manual/ranch_ssl/index.html index 34757b18..090cd152 100644 --- a/docs/en/ranch/2.0/manual/ranch_ssl/index.html +++ b/docs/en/ranch/2.0/manual/ranch_ssl/index.html @@ -324,6 +324,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -332,8 +334,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/manual/ranch_tcp/index.html b/docs/en/ranch/2.0/manual/ranch_tcp/index.html index 5d685585..af87b892 100644 --- a/docs/en/ranch/2.0/manual/ranch_tcp/index.html +++ b/docs/en/ranch/2.0/manual/ranch_tcp/index.html @@ -226,6 +226,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -234,8 +236,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/manual/ranch_transport.sendfile/index.html b/docs/en/ranch/2.0/manual/ranch_transport.sendfile/index.html index f27c3d2c..cbfa6cc5 100644 --- a/docs/en/ranch/2.0/manual/ranch_transport.sendfile/index.html +++ b/docs/en/ranch/2.0/manual/ranch_transport.sendfile/index.html @@ -160,6 +160,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -168,8 +170,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.0/manual/ranch_transport/index.html b/docs/en/ranch/2.0/manual/ranch_transport/index.html index 0edb4039..e138261e 100644 --- a/docs/en/ranch/2.0/manual/ranch_transport/index.html +++ b/docs/en/ranch/2.0/manual/ranch_transport/index.html @@ -367,6 +367,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.1
  • +
  • 2.0
  • 1.8
  • @@ -375,8 +377,6 @@ http://www.gnu.org/software/src-highlite -->
  • 1.6
  • -
  • 1.5
  • -

    Like my work? Donate!

    diff --git a/docs/en/ranch/2.1/guide/connection_draining.asciidoc b/docs/en/ranch/2.1/guide/connection_draining.asciidoc new file mode 100644 index 00000000..2ccdbc84 --- /dev/null +++ b/docs/en/ranch/2.1/guide/connection_draining.asciidoc @@ -0,0 +1,98 @@ +== Connection draining + +Stopping a Ranch listener via `ranch:stop_listener/1` will invariably kill +all connection processes the listener hosts. However, you may want to stop +a listener in a graceful fashion, ie by not accepting any new connections, +but allowing the existing connection processes to exit by themselves instead +of being killed. + +For this purpose, you should first suspend the listener you wish to +stop gracefully, and then wait for its connection count to drop to +zero. + +.Draining a single listener + +[source,erlang] +---- +ok = ranch:suspend_listener(Ref), +ok = ranch:wait_for_connections(Ref, '==', 0), +ok = ranch:stop_listener(Ref). +---- + +If you want to drain more than just one listener, it may be important to first suspend +them all before beginning to wait for their connection counts to reach zero. Otherwise, +the not yet suspended listeners will still be accepting connections while you wait for +the suspended ones to be drained. + +.Draining multiple listeners + +[source,erlang] +---- +lists:foreach( + fun (Ref) -> + ok = ranch:suspend_listener(Ref) + end, + Refs +), +lists:foreach( + fun (Ref) -> + ok = ranch:wait_for_connections(Ref, '==', 0), + ok = ranch:stop_listener(Ref) + end, + Refs +). +---- + +If you have long-running connection processes hosted by the listener you want to stop +gracefully, draining may take a long time, possibly forever. If you just want to give +the connection processes a chance to finish, but are not willing to wait for infinity, +the waiting part could be handled in a separate process. + +.Draining a listener with a timeout + +[source,erlang] +---- +ok = ranch:suspend_listener(Ref), +{DrainPid, DrainRef} = spawn_monitor( + fun () -> + ok = ranch:wait_for_connections(Ref, '==', 0) + end +), +receive + {'DOWN', DrainRef, process, DrainPid, _} -> + ok +after DrainTimeout -> + exit(DrainPid, kill), + ok +end, +ok = ranch:stop_listener(Ref). +---- + +To drain listeners automatically as part of your application shutdown routine, +use the `prep_stop/1` function of your application module. + +.Draining listeners automatically on application shutdown + +[source,erlang] +---- +-module(my_app). + +-behavior(application). + +-export([start/2]). +-export([prep_stop/1]). +-export([stop/1]). + +start(_StartType, _StartArgs) -> + {ok, _} = ranch:start_listener(my_listener, ranch_tcp, #{}, my_protocol, []), + my_app_sup:start_link(). + +prep_stop(State) -> + ok = ranch:suspend_listener(my_listener), + ok = ranch:wait_for_connections(my_listener, '==', 0), + ok = ranch:stop_listener(my_listener), + State. + +stop(_State) -> + ok. +---- diff --git a/docs/en/ranch/2.1/guide/connection_draining/index.html b/docs/en/ranch/2.1/guide/connection_draining/index.html new file mode 100644 index 00000000..52a279f3 --- /dev/null +++ b/docs/en/ranch/2.1/guide/connection_draining/index.html @@ -0,0 +1,258 @@ + + + + + + + + + + Nine Nines: Connection draining + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    Connection draining

    + +

    Stopping a Ranch listener via ranch:stop_listener/1 will invariably kill all connection processes the listener hosts. However, you may want to stop a listener in a graceful fashion, ie by not accepting any new connections, but allowing the existing connection processes to exit by themselves instead of being killed.

    +

    For this purpose, you should first suspend the listener you wish to stop gracefully, and then wait for its connection count to drop to zero.

    +
    Draining a single listener
    +
    +
    ok = ranch:suspend_listener(Ref),
    +ok = ranch:wait_for_connections(Ref, '==', 0),
    +ok = ranch:stop_listener(Ref).
    +
    +

    If you want to drain more than just one listener, it may be important to first suspend them all before beginning to wait for their connection counts to reach zero. Otherwise, the not yet suspended listeners will still be accepting connections while you wait for the suspended ones to be drained.

    +
    Draining multiple listeners
    +
    +
    lists:foreach(
    +	fun (Ref) ->
    +		ok = ranch:suspend_listener(Ref)
    +	end,
    +	Refs
    +),
    +lists:foreach(
    +	fun (Ref) ->
    +		ok = ranch:wait_for_connections(Ref, '==', 0),
    +		ok = ranch:stop_listener(Ref)
    +	end,
    +	Refs
    +).
    +
    +

    If you have long-running connection processes hosted by the listener you want to stop gracefully, draining may take a long time, possibly forever. If you just want to give the connection processes a chance to finish, but are not willing to wait for infinity, the waiting part could be handled in a separate process.

    +
    Draining a listener with a timeout
    +
    +
    ok = ranch:suspend_listener(Ref),
    +{DrainPid, DrainRef} = spawn_monitor(
    +	fun () ->
    +		ok = ranch:wait_for_connections(Ref, '==', 0)
    +	end
    +),
    +receive
    +	{'DOWN', DrainRef, process, DrainPid, _} ->
    +		ok
    +after DrainTimeout ->
    +	exit(DrainPid, kill),
    +	ok
    +end,
    +ok = ranch:stop_listener(Ref).
    +
    +

    To drain listeners automatically as part of your application shutdown routine, use the prep_stop/1 function of your application module.

    +
    Draining listeners automatically on application shutdown
    +
    +
    -module(my_app).
    +
    +-behavior(application).
    +
    +-export([start/2]).
    +-export([prep_stop/1]).
    +-export([stop/1]).
    +
    +start(_StartType, _StartArgs) ->
    +	{ok, _} = ranch:start_listener(my_listener, ranch_tcp, #{}, my_protocol, []),
    +	my_app_sup:start_link().
    +
    +prep_stop(State) ->
    +	ok = ranch:suspend_listener(my_listener),
    +	ok = ranch:wait_for_connections(my_listener, '==', 0),
    +	ok = ranch:stop_listener(my_listener),
    +	State.
    +
    +stop(_State) ->
    +	ok.
    +
    + + + + + + + + + + + + + + + + +
    + +
    + + +

    + Ranch + 2.1 + + User Guide +

    + + + +

    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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/guide/embedded.asciidoc b/docs/en/ranch/2.1/guide/embedded.asciidoc new file mode 100644 index 00000000..28f567bc --- /dev/null +++ b/docs/en/ranch/2.1/guide/embedded.asciidoc @@ -0,0 +1,47 @@ +== Embedded mode + +Embedded mode allows you to insert Ranch listeners directly +in your supervision tree. This allows for greater fault tolerance +control by permitting the shutdown of a listener due to the +failure of another part of the application and vice versa. + +However, just as for non-embedded listeners that were started via +`ranch:start_listener/5`, it is required that the `ranch` application +is running before you can start embedded listeners. Furthermore, +this also means that embedded listeners will restart when `ranch_sup` fails. + +WARNING: By using embedded mode, it is possible to start a listener with the same name +as an already existing listener. This will corrupt the information Ranch +keeps for that listener, so you should take care to ensure unique listener +names yourself. A good way to achieve this is by combining the embedded +listener's name with `?MODULE`, or the name of the application it is used +in. + +=== Embedding + +To embed Ranch in your application you can simply add the child specs +to your supervision tree. This can all be done in the `init/1` function +of one of your application supervisors. + +Ranch has a convenience function for getting the listeners child specs +called `ranch:child_spec/5`, that works like `ranch:start_listener/5`, +except that it doesn't start anything, it only returns child specs. + +The following example adds one listener to another application's +supervision tree. + +.Embed Ranch directly in your supervision tree + +[source,erlang] +---- +init([]) -> + ListenerSpec = ranch:child_spec({?MODULE, echo}, + ranch_tcp, #{socket_opts => [{port, 5555}]}, + echo_protocol, [] + ), + {ok, {#{}, [ListenerSpec]}}. +---- + +Embedded listeners cannot be stopped via `ranch:stop_listener/1`. Instead, +are to be stopped as part of the shutdown of your application's supervison +tree. diff --git a/docs/en/ranch/2.1/guide/embedded/index.html b/docs/en/ranch/2.1/guide/embedded/index.html new file mode 100644 index 00000000..7d8c0075 --- /dev/null +++ b/docs/en/ranch/2.1/guide/embedded/index.html @@ -0,0 +1,199 @@ + + + + + + + + + + Nine Nines: Embedded mode + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    Embedded mode

    + +

    Embedded mode allows you to insert Ranch listeners directly in your supervision tree. This allows for greater fault tolerance control by permitting the shutdown of a listener due to the failure of another part of the application and vice versa.

    +

    However, just as for non-embedded listeners that were started via ranch:start_listener/5, it is required that the ranch application is running before you can start embedded listeners. Furthermore, this also means that embedded listeners will restart when ranch_sup fails.

    +

    WARNING: By using embedded mode, it is possible to start a listener with the same name as an already existing listener. This will corrupt the information Ranch keeps for that listener, so you should take care to ensure unique listener names yourself. A good way to achieve this is by combining the embedded listener's name with ?MODULE, or the name of the application it is used in.

    +

    Embedding

    +

    To embed Ranch in your application you can simply add the child specs to your supervision tree. This can all be done in the init/1 function of one of your application supervisors.

    +

    Ranch has a convenience function for getting the listeners child specs called ranch:child_spec/5, that works like ranch:start_listener/5, except that it doesn't start anything, it only returns child specs.

    +

    The following example adds one listener to another application's supervision tree.

    +
    Embed Ranch directly in your supervision tree
    +
    +
    init([]) ->
    +	ListenerSpec = ranch:child_spec({?MODULE, echo},
    +		ranch_tcp, #{socket_opts => [{port, 5555}]},
    +		echo_protocol, []
    +	),
    +	{ok, {#{}, [ListenerSpec]}}.
    +
    +

    Embedded listeners cannot be stopped via ranch:stop_listener/1. Instead, are to be stopped as part of the shutdown of your application's supervison tree.

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

    + Ranch + 2.1 + + User Guide +

    + + + +

    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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/guide/index.html b/docs/en/ranch/2.1/guide/index.html new file mode 100644 index 00000000..016fe7dd --- /dev/null +++ b/docs/en/ranch/2.1/guide/index.html @@ -0,0 +1,193 @@ + + + + + + + + + + Nine Nines: Ranch User Guide + + + + + + + + + + + + + + + + +
    +
    +
    + + +
    + + +

    + Ranch + 2.1 + + User Guide +

    + + + +

    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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/guide/internals.asciidoc b/docs/en/ranch/2.1/guide/internals.asciidoc new file mode 100644 index 00000000..600920fc --- /dev/null +++ b/docs/en/ranch/2.1/guide/internals.asciidoc @@ -0,0 +1,99 @@ +== Internals + +This chapter may not apply to embedded Ranch as embedding allows you +to use an architecture specific to your application, which may or may +not be compatible with the description of the Ranch application. + +Note that for everything related to efficiency and performance, +you should perform the benchmarks yourself to get the numbers that +matter to you. Generic benchmarks found on the web may or may not +be of use to you, you can never know until you benchmark your own +system. + +A third party dive into the internals of Ranch is available should +you be interested: https://baozi.technology/ranch-under-the-hood/[Ranch: what's under the hood?] +We make no claims with regard to its freshness or accuracy but this +is a nice document to read along this section. + +=== Architecture + +Ranch is an OTP application. + +Like all OTP applications, Ranch has a top supervisor. It is responsible +for supervising the `ranch_server` process and all the listeners that +will be started. + +The `ranch_server` gen_server is a central process keeping track of the +listeners and their acceptors. It does so through the use of a public ets +table called `ranch_server`. The table is owned by the top supervisor +to improve fault tolerance. This way if the `ranch_server` gen_server +fails, it doesn't lose any information and the restarted process can +continue as if nothing happened. + +Ranch uses a custom supervisor for managing connections. This supervisor +keeps track of the number of connections and handles connection limits +directly. While it is heavily optimized to perform the task of creating +connection processes for accepted connections, it is still following the +OTP principles and the usual `sys` and `supervisor` calls will work on +it as expected. + +Listeners are grouped into the `ranch_listener_sup` supervisor and +consist of three kinds of processes: the listener gen_server, the +acceptor processes and the connection processes, both grouped under +their own supervisor. All of these processes are registered to the +`ranch_server` gen_server with varying amount of information. + +All socket operations, including listening for connections, go through +transport handlers. Accepted connections are given to the protocol handler. +Transport handlers are simple callback modules for performing operations on +sockets. Protocol handlers start a new process, which receives socket +ownership, with no requirements on how the code should be written inside +that new process. + +=== Number of acceptors + +The second argument to `ranch:start_listener/5` is the number of +processes that will be accepting connections. Care should be taken +when choosing this number. + +First of all, it should not be confused with the maximum number +of connections. Acceptor processes are only used for accepting and +have nothing else in common with connection processes. Therefore +there is nothing to be gained from setting this number too high, +in fact it can slow everything else down. + +Second, this number should be high enough to allow Ranch to accept +connections concurrently. But the number of cores available doesn't +seem to be the only factor for choosing this number, as we can +observe faster accepts if we have more acceptors than cores. It +might be entirely dependent on the protocol, however. + +Our observations suggest that using 100 acceptors on modern hardware +is a good solution, as it's big enough to always have acceptors ready +and it's low enough that it doesn't have a negative impact on the +system's performances. + +=== Platform-specific TCP features + +Some socket options are platform-specific and not supported by `inet`. +They can be of interest because they generally are related to +optimizations provided by the underlying OS. They can still be enabled +thanks to the `raw` option, for which we will see an example. + +One of these features is `TCP_DEFER_ACCEPT` on Linux. It is a simplified +accept mechanism which will wait for application data to come in before +handing out the connection to the Erlang process. + +This is especially useful if you expect many connections to be mostly +idle, perhaps part of a connection pool. They can be handled by the +kernel directly until they send any real data, instead of allocating +resources to idle connections. + +To enable this mechanism, the following option can be used. + +.Using raw transport options + +[source,erlang] +{raw, 6, 9, << 30:32/native >>} + +It means go on layer 6, turn on option 9 with the given integer parameter. diff --git a/docs/en/ranch/2.1/guide/internals/index.html b/docs/en/ranch/2.1/guide/internals/index.html new file mode 100644 index 00000000..35082102 --- /dev/null +++ b/docs/en/ranch/2.1/guide/internals/index.html @@ -0,0 +1,207 @@ + + + + + + + + + + Nine Nines: Internals + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    Internals

    + +

    This chapter may not apply to embedded Ranch as embedding allows you to use an architecture specific to your application, which may or may not be compatible with the description of the Ranch application.

    +

    Note that for everything related to efficiency and performance, you should perform the benchmarks yourself to get the numbers that matter to you. Generic benchmarks found on the web may or may not be of use to you, you can never know until you benchmark your own system.

    +

    A third party dive into the internals of Ranch is available should you be interested: Ranch: what's under the hood? We make no claims with regard to its freshness or accuracy but this is a nice document to read along this section.

    +

    Architecture

    +

    Ranch is an OTP application.

    +

    Like all OTP applications, Ranch has a top supervisor. It is responsible for supervising the ranch_server process and all the listeners that will be started.

    +

    The ranch_server gen_server is a central process keeping track of the listeners and their acceptors. It does so through the use of a public ets table called ranch_server. The table is owned by the top supervisor to improve fault tolerance. This way if the ranch_server gen_server fails, it doesn't lose any information and the restarted process can continue as if nothing happened.

    +

    Ranch uses a custom supervisor for managing connections. This supervisor keeps track of the number of connections and handles connection limits directly. While it is heavily optimized to perform the task of creating connection processes for accepted connections, it is still following the OTP principles and the usual sys and supervisor calls will work on it as expected.

    +

    Listeners are grouped into the ranch_listener_sup supervisor and consist of three kinds of processes: the listener gen_server, the acceptor processes and the connection processes, both grouped under their own supervisor. All of these processes are registered to the ranch_server gen_server with varying amount of information.

    +

    All socket operations, including listening for connections, go through transport handlers. Accepted connections are given to the protocol handler. Transport handlers are simple callback modules for performing operations on sockets. Protocol handlers start a new process, which receives socket ownership, with no requirements on how the code should be written inside that new process.

    +

    Number of acceptors

    +

    The second argument to ranch:start_listener/5 is the number of processes that will be accepting connections. Care should be taken when choosing this number.

    +

    First of all, it should not be confused with the maximum number of connections. Acceptor processes are only used for accepting and have nothing else in common with connection processes. Therefore there is nothing to be gained from setting this number too high, in fact it can slow everything else down.

    +

    Second, this number should be high enough to allow Ranch to accept connections concurrently. But the number of cores available doesn't seem to be the only factor for choosing this number, as we can observe faster accepts if we have more acceptors than cores. It might be entirely dependent on the protocol, however.

    +

    Our observations suggest that using 100 acceptors on modern hardware is a good solution, as it's big enough to always have acceptors ready and it's low enough that it doesn't have a negative impact on the system's performances.

    +

    Platform-specific TCP features

    +

    Some socket options are platform-specific and not supported by inet. They can be of interest because they generally are related to optimizations provided by the underlying OS. They can still be enabled thanks to the raw option, for which we will see an example.

    +

    One of these features is TCP_DEFER_ACCEPT on Linux. It is a simplified accept mechanism which will wait for application data to come in before handing out the connection to the Erlang process.

    +

    This is especially useful if you expect many connections to be mostly idle, perhaps part of a connection pool. They can be handled by the kernel directly until they send any real data, instead of allocating resources to idle connections.

    +

    To enable this mechanism, the following option can be used.

    +
    Using raw transport options
    +
    +
    {raw, 6, 9, << 30:32/native >>}
    +
    +

    It means go on layer 6, turn on option 9 with the given integer parameter.

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

    + Ranch + 2.1 + + User Guide +

    + + + +

    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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/guide/introduction.asciidoc b/docs/en/ranch/2.1/guide/introduction.asciidoc new file mode 100644 index 00000000..a682c46f --- /dev/null +++ b/docs/en/ranch/2.1/guide/introduction.asciidoc @@ -0,0 +1,25 @@ +== Introduction + +Ranch is a socket acceptor pool for TCP protocols. + +Ranch aims to provide everything you need to accept TCP connections +with a small code base and low latency while being easy to use directly +as an application or to embed into your own. + +=== Prerequisites + +It is assumed the developer already knows Erlang and has some experience +with socket programming and TCP protocols. + +=== Supported platforms + +Ranch is tested and supported on Linux, FreeBSD, macOS and Windows. + +Ranch is developed for Erlang/OTP 22+. + +Ranch may be compiled on earlier Erlang versions with small source code +modifications but there is no guarantee that it will work as expected. + +=== Versioning + +Ranch uses http://semver.org/[Semantic Versioning 2.0.0] diff --git a/docs/en/ranch/2.1/guide/introduction/index.html b/docs/en/ranch/2.1/guide/introduction/index.html new file mode 100644 index 00000000..9c62fc75 --- /dev/null +++ b/docs/en/ranch/2.1/guide/introduction/index.html @@ -0,0 +1,185 @@ + + + + + + + + + + Nine Nines: Introduction + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    Introduction

    + +

    Ranch is a socket acceptor pool for TCP protocols.

    +

    Ranch aims to provide everything you need to accept TCP connections with a small code base and low latency while being easy to use directly as an application or to embed into your own.

    +

    Prerequisites

    +

    It is assumed the developer already knows Erlang and has some experience with socket programming and TCP protocols.

    +

    Supported platforms

    +

    Ranch is tested and supported on Linux, FreeBSD, macOS and Windows.

    +

    Ranch is developed for Erlang/OTP 22+.

    +

    Ranch may be compiled on earlier Erlang versions with small source code modifications but there is no guarantee that it will work as expected.

    +

    Versioning

    +

    Ranch uses Semantic Versioning 2.0.0

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

    + Ranch + 2.1 + + User Guide +

    + + + +

    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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/guide/listeners.asciidoc b/docs/en/ranch/2.1/guide/listeners.asciidoc new file mode 100644 index 00000000..9ee2d987 --- /dev/null +++ b/docs/en/ranch/2.1/guide/listeners.asciidoc @@ -0,0 +1,479 @@ +== Listeners + +A listener is a set of processes whose role is to listen on a port +for new connections. It manages a pool of acceptor processes, each +of them indefinitely accepting connections. When it does, it starts +a new process executing the protocol handler code. All the socket +programming is abstracted through the use of transport handlers. + +The listener takes care of supervising all the acceptor and connection +processes, allowing developers to focus on building their application. + +=== Starting a listener + +Ranch does nothing by default. It is up to the application developer +to request that Ranch listens for connections. + +A listener can be started and stopped at will. + +When starting a listener, a number of different settings are required: + +* A name to identify it locally and be able to interact with it. +* A transport handler and its associated options. +* A protocol handler and its associated options. + +Ranch includes both TCP and SSL transport handlers, respectively +`ranch_tcp` and `ranch_ssl`. + +A listener can be started by calling the `ranch:start_listener/5` +function. Before doing so however, you must ensure that the `ranch` +application is started. + +.Starting the Ranch application + +[source,erlang] +ok = application:start(ranch). + +You are then ready to start a listener. Let's call it `tcp_echo`. It will +have a pool of 100 acceptors, use a TCP transport and forward connections +to the `echo_protocol` handler. + +.Starting a listener for TCP connections on port 5555 + +[source,erlang] +{ok, _} = ranch:start_listener(tcp_echo, + ranch_tcp, #{socket_opts => [{port, 5555}]}, + echo_protocol, [] +). + +You can try this out by compiling and running the `tcp_echo` example in the +examples directory. To do so, open a shell in the 'examples/tcp_echo/' +directory and run the following command: + +.Building and starting a Ranch example + +[source,bash] +$ make run + +You can then connect to it using telnet and see the echo server reply +everything you send to it. Then when you're done testing, you can use +the `Ctrl+]` key to escape to the telnet command line and type +`quit` to exit. + +.Connecting to the example listener with telnet + +[source,bash] +---- +$ telnet localhost 5555 +Trying 127.0.0.1... +Connected to localhost. +Escape character is '^]'. +Hello! +Hello! +It works! +It works! +^] + +telnet> quit +Connection closed. +---- + +=== Stopping a listener + +All you need to stop a Ranch listener is to call the +`ranch:stop_listener/1` function with the listener's name +as argument. In the previous section we started the listener +named `tcp_echo`. We can now stop it. + +.Stopping a listener + +[source,erlang] +ranch:stop_listener(tcp_echo). + +=== Suspending and resuming a listener + +Listeners can be suspended and resumed by calling +`ranch:suspend_listener/1` and `ranch:resume_listener/1`, +respectively, with the name of the listener as argument. + +Suspending a listener will cause it to stop listening and not accept +new connections, but existing connection processes will not be stopped. + +.Suspending a listener + +[source,erlang] +ranch:suspend_listener(tcp_echo). + +Resuming a listener will cause it to start listening and accept new +connections again. +It is worth mentioning, however, that if the listener is configured +to listen on a random port, it will listen on a different port than +before it was suspended. + +.Resuming a listener + +[source,erlang] +ranch:resume_listener(tcp_echo). + +Whether a listener is currently running or suspended can be queried +by calling `ranch:get_status/1` with the listener name as argument. + +=== Default transport options + +By default the socket will be set to return `binary` data, with the +options `{active, false}`, `{packet, raw}`, `{reuseaddr, true}` set. +These values can't be overridden when starting the listener, but +they can be overridden using `Transport:setopts/2` in the protocol. + +It will also set `{backlog, 1024}` and `{nodelay, true}`, which +can be overridden at listener startup. + +=== Listening on a random port + +You do not have to specify a specific port to listen on. If you give +the port number 0, or if you omit the port number entirely, Ranch will +start listening on a random port. + +You can retrieve this port number by calling `ranch:get_port/1`. The +argument is the name of the listener you gave in `ranch:start_listener/5`. + +.Starting a listener for TCP connections on a random port + +[source,erlang] +{ok, _} = ranch:start_listener(tcp_echo, + ranch_tcp, #{socket_opts => [{port, 0}]}, + echo_protocol, [] +). +Port = ranch:get_port(tcp_echo). + +=== Listening on privileged ports + +Some systems limit access to ports below 1024 for security reasons. +This can easily be identified by an `{error, eacces}` error when trying +to open a listening socket on such a port. + +The methods for listening on privileged ports vary between systems, +please refer to your system's documentation for more information. + +We recommend the use of port rewriting for systems with a single server, +and load balancing for systems with multiple servers. Documenting these +solutions is however out of the scope of this guide. + +=== Listening on a UNIX Domain socket + +On UNIX systems, it is also possible to use Ranch to listen on a UNIX +domain socket by specifying `{local, SocketFile}` for the `ip` socket +option. In this case, the port must be set to 0 or omitted. The given +file must not exist: Ranch must be able to create it. + +.Starting a listener for TCP connections on a UNIX Domain socket + +[source,erlang] +{ok, _} = ranch:start_listener(tcp_echo, + ranch_tcp, #{socket_opts => [ + {ip, {local, "/tmp/ranch_echo.sock"}}, + {port, 0} + ]}, echo_protocol, [] +). + +=== Performing additional setup steps on a listening socket + +If it is necessary to perform additional setup steps on the listening +socket, it is possible to specify a function with the transport option +`post_listen_callback`. This function will be called after the listening +socket has been created but before accepting connections on it, +with the socket as the single argument. + +The function must return either the atom `ok`, after which the listener +will start accepting connections on the socket, or a tuple +`{error, Reason}` which will cause the listener to fail starting with +`Reason`. + +.Setting permissions on a UNIX Domain socket file + +[source,erlang] +---- +PostListenCb = fun (Sock) -> + case ranch_tcp:sockname(Sock) of + {ok, {local, SockFile}} -> + file:change_mode(SockFile, 8#777); + {ok, _} -> + ok; + Error = {error, _} -> + Error + end +end, + +{ok, _} = ranch:start_listener(tcp_echo, + ranch_tcp, #{ + socket_opts => [ + {ip, {local, "/tmp/ranch_echo.sock"}}, + {port, 0}], + post_listen_callback => PostListenCb}, + echo_protocol, [] +). +---- + +=== Accepting connections on an existing socket + +If you want to accept connections on an existing socket, you can write +a custom `ranch_transport` implementation that fetches or otherwise +acquires a listening socket in the `listen/1` callback and returns it +in the form of `{ok, ListenSocket}`. + +The custom `listen/1` function must ensure that the listener process +(usually the process calling it) is also made the controlling process +of the socket it returns. Failing to do so will result in stop/start +and suspend/resume not working properly for that listener. + +=== Limiting the number of concurrent connections + +The `max_connections` transport option allows you to limit the number +of concurrent connections per connection supervisor (see below). +It defaults to 1024. Its purpose is to prevent your system from being +overloaded and ensuring all the connections are handled optimally. + +.Customizing the maximum number of concurrent connections + +[source,erlang] +{ok, _} = ranch:start_listener(tcp_echo, + ranch_tcp, #{socket_opts => [{port, 5555}], max_connections => 100}, + echo_protocol, [] +). + +You can disable this limit by setting its value to the atom `infinity`. + +.Disabling the limit for the number of connections + +[source,erlang] +{ok, _} = ranch:start_listener(tcp_echo, + ranch_tcp, #{socket_opts => [{port, 5555}], max_connections => infinity}, + echo_protocol, [] +). + +The maximum number of connections is a soft limit. In practice, it +can reach `max_connections` + the number of acceptors. + +When the maximum number of connections is reached, Ranch will stop +accepting connections. This will not result in further connections +being rejected, as the kernel option allows queueing incoming +connections. The size of this queue is determined by the `backlog` +option and defaults to 1024. Ranch does not know about the number +of connections that are in the backlog. + +You may not always want connections to be counted when checking for +`max_connections`. For example you might have a protocol where both +short-lived and long-lived connections are possible. If the long-lived +connections are mostly waiting for messages, then they don't consume +much resources and can safely be removed from the count. + +To remove the connection from the count, you must call the +`ranch:remove_connection/1` from within the connection process, +with the name of the listener as the only argument. + +.Removing a connection from the count of connections + +[source,erlang] +ranch:remove_connection(Ref). + +As seen in the chapter covering protocols, this reference is received +as the first argument of the protocol's `start_link/3` callback. + +You can modify the `max_connections` value on a running listener by +using the `ranch:set_max_connections/2` function, with the name of the +listener as first argument and the new value as the second. + +.Upgrading the maximum number of connections + +[source,erlang] +ranch:set_max_connections(tcp_echo, MaxConns). + +The change will occur immediately. + +=== Customizing the number of acceptor processes + +By default Ranch will use 10 acceptor processes. Their role is +to accept connections and spawn a connection process for every +new connection. + +This number can be tweaked to improve performance. A good +number is typically between 10 or 100 acceptors. You must +measure to find the best value for your application. + +.Specifying a custom number of acceptor processes + +[source,erlang] +{ok, _} = ranch:start_listener(tcp_echo, + ranch_tcp, #{socket_opts => [{port, 5555}], num_acceptors => 42}, + echo_protocol, [] +). + +=== Customizing the number of connection supervisors + +By default Ranch will use one connection supervisor for each +acceptor process (but not vice versa). Their task is to +supervise the connection processes started by an acceptor. +The number of connection supervisors can be tweaked. + +Note that the association between the individual acceptors and +connection supervisors is fixed, meaning that acceptors will +always use the same connection supervisor to start connection +processes. + +.Specifying a custom number of connection supervisors + +[source,erlang] +{ok, _} = ranch:start_listener(tcp_echo, + ranch_tcp, #{socket_opts => [{port, 5555}], num_conns_sups => 42}, + echo_protocol, [] +). + +=== Setting connection count alarms + +The `alarms` transport option allows you to configure alarms +which will be triggered when the number of connections tracked +by one connection supervisor reaches or exceeds the defined treshold. + +The `alarms` transport option takes a map with alarm names as keys and alarm +options as values. + +Any term is allowed as an alarm name. + +Alarm options include the alarm type and a treshold that, when reached, +triggers the given callback. A cooldown prevents the alarm from being +triggered too often. + +.Log warnings when the number of connections exceeds 100 + +[source,erlang] +---- +Alarms = #{ + my_alarm => #{ + type => num_connections, + treshold => 100, + callback => fun(Ref, Name, ConnSup, ConnPids]) -> + logger:warning("Warning (~s): " + "Supervisor ~s of listener ~s " + "has ~b connections", + [Name, Ref, ConnSup, length(ConnPids)]) + end + } +}, +{ok, _} = ranch:start_listener(tcp_echo, + ranch_tcp, #{alarms => Alarms, socket_opts => [{port, 5555}]}, + echo_protocol, [] +). +---- + +In the example code, an alarm named `my_alarm` is defined, which will +call the given function when the number of connections tracked +by the connection supervisor reaches or exceeds 100. When the number of +connections is still (or again) above 100 after the default cooldown +period of 5 seconds, the alarm will trigger again. + +=== When running out of file descriptors + +Operating systems have limits on the number of sockets +which can be opened by applications. When this maximum is +reached the listener can no longer accept new connections. The +accept rate of the listener will be automatically reduced, and a +warning message will be logged. + +---- +=ERROR REPORT==== 13-Jan-2016::12:24:38 === +Ranch acceptor reducing accept rate: out of file descriptors +---- + +If you notice messages like this you should increase the number +of file-descriptors which can be opened by your application. How +this should be done is operating-system dependent. Please consult +the documentation of your operating system. + +=== Using a supervisor for connection processes + +Ranch allows you to define the type of process that will be used +for the connection processes. By default it expects a `worker`. +When the `connection_type` configuration value is set to `supervisor`, +Ranch will consider that the connection process it manages is a +supervisor and will reflect that in its supervision tree. + +Connection processes of type `supervisor` can either handle the +socket directly or through one of their children. In the latter +case the start function for the connection process must return +two pids: the pid of the supervisor you created (that will be +supervised) and the pid of the protocol handling process (that +will receive the socket). + +Instead of returning `{ok, ConnPid}`, simply return +`{ok, SupPid, ConnPid}`. + +It is very important that the connection process be created +under the supervisor process so that everything works as intended. +If not, you will most likely experience issues when the supervised +process is stopped. + +=== Upgrading + +Ranch allows you to upgrade the protocol options. This takes effect +immediately and for all subsequent connections. + +To upgrade the protocol options, call `ranch:set_protocol_options/2` +with the name of the listener as first argument and the new options +as the second. + +.Upgrading the protocol options + +[source,erlang] +ranch:set_protocol_options(tcp_echo, NewOpts). + +All future connections will use the new options. + +You can also retrieve the current options similarly by +calling `ranch:get_protocol_options/1`. + +.Retrieving the current protocol options + +[source,erlang] +Opts = ranch:get_protocol_options(tcp_echo). + +=== Changing transport options + +Ranch allows you to change the transport options of a listener with +the `ranch:set_transport_options/2` function, for example to change the +number of acceptors or to make it listen on a different port. + +.Changing the transport options + +[source,erlang] +ranch:set_transport_options(tcp_echo, NewOpts). + +You can retrieve the current transport options by calling +`ranch:get_transport_options/1`. + +.Retrieving the current transport options + +[source,erlang] +Opts = ranch:get_transport_options(tcp_echo). + +=== Obtaining information about listeners + +Ranch provides two functions for retrieving information about the +listeners, for reporting and diagnostic purposes. + +The `ranch:info/0` function will return detailed information +about all listeners. + +.Retrieving detailed information +[source,erlang] +ranch:info(). + +The `ranch:procs/2` function will return all acceptor or listener +processes for a given listener. + +.Get all acceptor processes +[source,erlang] +ranch:procs(tcp_echo, acceptors). + +.Get all connection processes +[source,erlang] +ranch:procs(tcp_echo, connections). diff --git a/docs/en/ranch/2.1/guide/listeners/index.html b/docs/en/ranch/2.1/guide/listeners/index.html new file mode 100644 index 00000000..1a3bf448 --- /dev/null +++ b/docs/en/ranch/2.1/guide/listeners/index.html @@ -0,0 +1,502 @@ + + + + + + + + + + Nine Nines: Listeners + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    Listeners

    + +

    A listener is a set of processes whose role is to listen on a port for new connections. It manages a pool of acceptor processes, each of them indefinitely accepting connections. When it does, it starts a new process executing the protocol handler code. All the socket programming is abstracted through the use of transport handlers.

    +

    The listener takes care of supervising all the acceptor and connection processes, allowing developers to focus on building their application.

    +

    Starting a listener

    +

    Ranch does nothing by default. It is up to the application developer to request that Ranch listens for connections.

    +

    A listener can be started and stopped at will.

    +

    When starting a listener, a number of different settings are required:

    +
    • A name to identify it locally and be able to interact with it. +
    • +
    • A transport handler and its associated options. +
    • +
    • A protocol handler and its associated options. +
    • +
    +

    Ranch includes both TCP and SSL transport handlers, respectively ranch_tcp and ranch_ssl.

    +

    A listener can be started by calling the ranch:start_listener/5 function. Before doing so however, you must ensure that the ranch application is started.

    +
    Starting the Ranch application
    +
    +
    ok = application:start(ranch).
    +
    +

    You are then ready to start a listener. Let's call it tcp_echo. It will have a pool of 100 acceptors, use a TCP transport and forward connections to the echo_protocol handler.

    +
    Starting a listener for TCP connections on port 5555
    +
    +
    {ok, _} = ranch:start_listener(tcp_echo,
    +    ranch_tcp, #{socket_opts => [{port, 5555}]},
    +    echo_protocol, []
    +).
    +
    +

    You can try this out by compiling and running the tcp_echo example in the examples directory. To do so, open a shell in the examples/tcp_echo/ directory and run the following command:

    +
    Building and starting a Ranch example
    +
    +
    $ make run
    +
    +

    You can then connect to it using telnet and see the echo server reply everything you send to it. Then when you're done testing, you can use the Ctrl+] key to escape to the telnet command line and type quit to exit.

    +
    Connecting to the example listener with telnet
    +
    +
    $ telnet localhost 5555
    +Trying 127.0.0.1...
    +Connected to localhost.
    +Escape character is '^]'.
    +Hello!
    +Hello!
    +It works!
    +It works!
    +^]
    +
    +telnet> quit
    +Connection closed.
    +
    +

    Stopping a listener

    +

    All you need to stop a Ranch listener is to call the ranch:stop_listener/1 function with the listener's name as argument. In the previous section we started the listener named tcp_echo. We can now stop it.

    +
    Stopping a listener
    +
    +
    ranch:stop_listener(tcp_echo).
    +
    +

    Suspending and resuming a listener

    +

    Listeners can be suspended and resumed by calling ranch:suspend_listener/1 and ranch:resume_listener/1, respectively, with the name of the listener as argument.

    +

    Suspending a listener will cause it to stop listening and not accept new connections, but existing connection processes will not be stopped.

    +
    Suspending a listener
    +
    +
    ranch:suspend_listener(tcp_echo).
    +
    +

    Resuming a listener will cause it to start listening and accept new connections again. It is worth mentioning, however, that if the listener is configured to listen on a random port, it will listen on a different port than before it was suspended.

    +
    Resuming a listener
    +
    +
    ranch:resume_listener(tcp_echo).
    +
    +

    Whether a listener is currently running or suspended can be queried by calling ranch:get_status/1 with the listener name as argument.

    +

    Default transport options

    +

    By default the socket will be set to return binary data, with the options {active, false}, {packet, raw}, {reuseaddr, true} set. These values can't be overridden when starting the listener, but they can be overridden using Transport:setopts/2 in the protocol.

    +

    It will also set {backlog, 1024} and {nodelay, true}, which can be overridden at listener startup.

    +

    Listening on a random port

    +

    You do not have to specify a specific port to listen on. If you give the port number 0, or if you omit the port number entirely, Ranch will start listening on a random port.

    +

    You can retrieve this port number by calling ranch:get_port/1. The argument is the name of the listener you gave in ranch:start_listener/5.

    +
    Starting a listener for TCP connections on a random port
    +
    +
    {ok, _} = ranch:start_listener(tcp_echo,
    +    ranch_tcp, #{socket_opts => [{port, 0}]},
    +    echo_protocol, []
    +).
    +Port = ranch:get_port(tcp_echo).
    +
    +

    Listening on privileged ports

    +

    Some systems limit access to ports below 1024 for security reasons. This can easily be identified by an {error, eacces} error when trying to open a listening socket on such a port.

    +

    The methods for listening on privileged ports vary between systems, please refer to your system's documentation for more information.

    +

    We recommend the use of port rewriting for systems with a single server, and load balancing for systems with multiple servers. Documenting these solutions is however out of the scope of this guide.

    +

    Listening on a UNIX Domain socket

    +

    On UNIX systems, it is also possible to use Ranch to listen on a UNIX domain socket by specifying {local, SocketFile} for the ip socket option. In this case, the port must be set to 0 or omitted. The given file must not exist: Ranch must be able to create it.

    +
    Starting a listener for TCP connections on a UNIX Domain socket
    +
    +
    {ok, _} = ranch:start_listener(tcp_echo,
    +    ranch_tcp, #{socket_opts => [
    +        {ip, {local, "/tmp/ranch_echo.sock"}},
    +        {port, 0}
    +    ]}, echo_protocol, []
    +).
    +
    +

    Performing additional setup steps on a listening socket

    +

    If it is necessary to perform additional setup steps on the listening socket, it is possible to specify a function with the transport option post_listen_callback. This function will be called after the listening socket has been created but before accepting connections on it, with the socket as the single argument.

    +

    The function must return either the atom ok, after which the listener will start accepting connections on the socket, or a tuple {error, Reason} which will cause the listener to fail starting with Reason.

    +
    Setting permissions on a UNIX Domain socket file
    +
    +
    PostListenCb = fun (Sock) ->
    +    case ranch_tcp:sockname(Sock) of
    +        {ok, {local, SockFile}} ->
    +            file:change_mode(SockFile, 8#777);
    +	{ok, _} ->
    +	    ok;
    +	Error = {error, _} ->
    +            Error
    +    end
    +end,
    +
    +{ok, _} = ranch:start_listener(tcp_echo,
    +    ranch_tcp, #{
    +        socket_opts => [
    +            {ip, {local, "/tmp/ranch_echo.sock"}},
    +            {port, 0}],
    +        post_listen_callback => PostListenCb},
    +    echo_protocol, []
    +).
    +
    +

    Accepting connections on an existing socket

    +

    If you want to accept connections on an existing socket, you can write a custom ranch_transport implementation that fetches or otherwise acquires a listening socket in the listen/1 callback and returns it in the form of {ok, ListenSocket}.

    +

    The custom listen/1 function must ensure that the listener process (usually the process calling it) is also made the controlling process of the socket it returns. Failing to do so will result in stop/start and suspend/resume not working properly for that listener.

    +

    Limiting the number of concurrent connections

    +

    The max_connections transport option allows you to limit the number of concurrent connections per connection supervisor (see below). It defaults to 1024. Its purpose is to prevent your system from being overloaded and ensuring all the connections are handled optimally.

    +
    Customizing the maximum number of concurrent connections
    +
    +
    {ok, _} = ranch:start_listener(tcp_echo,
    +    ranch_tcp, #{socket_opts => [{port, 5555}], max_connections => 100},
    +    echo_protocol, []
    +).
    +
    +

    You can disable this limit by setting its value to the atom infinity.

    +
    Disabling the limit for the number of connections
    +
    +
    {ok, _} = ranch:start_listener(tcp_echo,
    +    ranch_tcp, #{socket_opts => [{port, 5555}], max_connections => infinity},
    +    echo_protocol, []
    +).
    +
    +

    The maximum number of connections is a soft limit. In practice, it can reach max_connections + the number of acceptors.

    +

    When the maximum number of connections is reached, Ranch will stop accepting connections. This will not result in further connections being rejected, as the kernel option allows queueing incoming connections. The size of this queue is determined by the backlog option and defaults to 1024. Ranch does not know about the number of connections that are in the backlog.

    +

    You may not always want connections to be counted when checking for max_connections. For example you might have a protocol where both short-lived and long-lived connections are possible. If the long-lived connections are mostly waiting for messages, then they don't consume much resources and can safely be removed from the count.

    +

    To remove the connection from the count, you must call the ranch:remove_connection/1 from within the connection process, with the name of the listener as the only argument.

    +
    Removing a connection from the count of connections
    +
    +
    ranch:remove_connection(Ref).
    +
    +

    As seen in the chapter covering protocols, this reference is received as the first argument of the protocol's start_link/3 callback.

    +

    You can modify the max_connections value on a running listener by using the ranch:set_max_connections/2 function, with the name of the listener as first argument and the new value as the second.

    +
    Upgrading the maximum number of connections
    +
    +
    ranch:set_max_connections(tcp_echo, MaxConns).
    +
    +

    The change will occur immediately.

    +

    Customizing the number of acceptor processes

    +

    By default Ranch will use 10 acceptor processes. Their role is to accept connections and spawn a connection process for every new connection.

    +

    This number can be tweaked to improve performance. A good number is typically between 10 or 100 acceptors. You must measure to find the best value for your application.

    +
    Specifying a custom number of acceptor processes
    +
    +
    {ok, _} = ranch:start_listener(tcp_echo,
    +    ranch_tcp, #{socket_opts => [{port, 5555}], num_acceptors => 42},
    +    echo_protocol, []
    +).
    +
    +

    Customizing the number of connection supervisors

    +

    By default Ranch will use one connection supervisor for each acceptor process (but not vice versa). Their task is to supervise the connection processes started by an acceptor. The number of connection supervisors can be tweaked.

    +

    Note that the association between the individual acceptors and connection supervisors is fixed, meaning that acceptors will always use the same connection supervisor to start connection processes.

    +
    Specifying a custom number of connection supervisors
    +
    +
    {ok, _} = ranch:start_listener(tcp_echo,
    +    ranch_tcp, #{socket_opts => [{port, 5555}], num_conns_sups => 42},
    +    echo_protocol, []
    +).
    +
    +

    Setting connection count alarms

    +

    The alarms transport option allows you to configure alarms which will be triggered when the number of connections tracked by one connection supervisor reaches or exceeds the defined treshold.

    +

    The alarms transport option takes a map with alarm names as keys and alarm options as values.

    +

    Any term is allowed as an alarm name.

    +

    Alarm options include the alarm type and a treshold that, when reached, triggers the given callback. A cooldown prevents the alarm from being triggered too often.

    +
    Log warnings when the number of connections exceeds 100
    +
    +
    Alarms = #{
    +    my_alarm => #{
    +        type => num_connections,
    +        treshold => 100,
    +        callback => fun(Ref, Name, ConnSup, ConnPids]) ->
    +            logger:warning("Warning (~s): "
    +                    "Supervisor ~s of listener ~s "
    +                    "has ~b connections",
    +                [Name, Ref, ConnSup, length(ConnPids)])
    +        end
    +    }
    +},
    +{ok, _} = ranch:start_listener(tcp_echo,
    +    ranch_tcp, #{alarms => Alarms, socket_opts => [{port, 5555}]},
    +    echo_protocol, []
    +).
    +
    +

    In the example code, an alarm named my_alarm is defined, which will call the given function when the number of connections tracked by the connection supervisor reaches or exceeds 100. When the number of connections is still (or again) above 100 after the default cooldown period of 5 seconds, the alarm will trigger again.

    +

    When running out of file descriptors

    +

    Operating systems have limits on the number of sockets which can be opened by applications. When this maximum is reached the listener can no longer accept new connections. The accept rate of the listener will be automatically reduced, and a warning message will be logged.

    +
    =ERROR REPORT==== 13-Jan-2016::12:24:38 ===
    +Ranch acceptor reducing accept rate: out of file descriptors
    +

    If you notice messages like this you should increase the number of file-descriptors which can be opened by your application. How this should be done is operating-system dependent. Please consult the documentation of your operating system.

    +

    Using a supervisor for connection processes

    +

    Ranch allows you to define the type of process that will be used for the connection processes. By default it expects a worker. When the connection_type configuration value is set to supervisor, Ranch will consider that the connection process it manages is a supervisor and will reflect that in its supervision tree.

    +

    Connection processes of type supervisor can either handle the socket directly or through one of their children. In the latter case the start function for the connection process must return two pids: the pid of the supervisor you created (that will be supervised) and the pid of the protocol handling process (that will receive the socket).

    +

    Instead of returning {ok, ConnPid}, simply return {ok, SupPid, ConnPid}.

    +

    It is very important that the connection process be created under the supervisor process so that everything works as intended. If not, you will most likely experience issues when the supervised process is stopped.

    +

    Upgrading

    +

    Ranch allows you to upgrade the protocol options. This takes effect immediately and for all subsequent connections.

    +

    To upgrade the protocol options, call ranch:set_protocol_options/2 with the name of the listener as first argument and the new options as the second.

    +
    Upgrading the protocol options
    +
    +
    ranch:set_protocol_options(tcp_echo, NewOpts).
    +
    +

    All future connections will use the new options.

    +

    You can also retrieve the current options similarly by calling ranch:get_protocol_options/1.

    +
    Retrieving the current protocol options
    +
    +
    Opts = ranch:get_protocol_options(tcp_echo).
    +
    +

    Changing transport options

    +

    Ranch allows you to change the transport options of a listener with the ranch:set_transport_options/2 function, for example to change the number of acceptors or to make it listen on a different port.

    +
    Changing the transport options
    +
    +
    ranch:set_transport_options(tcp_echo, NewOpts).
    +
    +

    You can retrieve the current transport options by calling ranch:get_transport_options/1.

    +
    Retrieving the current transport options
    +
    +
    Opts = ranch:get_transport_options(tcp_echo).
    +
    +

    Obtaining information about listeners

    +

    Ranch provides two functions for retrieving information about the listeners, for reporting and diagnostic purposes.

    +

    The ranch:info/0 function will return detailed information about all listeners.

    +
    Retrieving detailed information
    +
    +
    ranch:info().
    +
    +

    The ranch:procs/2 function will return all acceptor or listener processes for a given listener.

    +
    Get all acceptor processes
    +
    +
    ranch:procs(tcp_echo, acceptors).
    +
    +
    Get all connection processes
    +
    +
    ranch:procs(tcp_echo, connections).
    +
    + + + + + + + + + + + + + + + + +
    + +
    + + +

    + Ranch + 2.1 + + User Guide +

    + + + +

    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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/guide/migrating_from_1.5.asciidoc b/docs/en/ranch/2.1/guide/migrating_from_1.5.asciidoc new file mode 100644 index 00000000..a454f932 --- /dev/null +++ b/docs/en/ranch/2.1/guide/migrating_from_1.5.asciidoc @@ -0,0 +1,76 @@ +[appendix] +== Migrating from Ranch 1.5 to 1.6 + +Ranch 1.6 added the ability to suspend and resume listeners. +It also deprecates a number of features and add interfaces +that will be used in Ranch 2.0. + +Ranch 1.6 is compatible with Erlang/OTP 18.0 onward. Support +for older releases has been removed. + +=== Features added + +* Listeners can now be suspended/resumed without stopping existing + connection processes. This effectively closes the listening socket + and stops the acceptor processes. + +* Transport options can now be updated for suspended listeners. + +* The `Socket` argument given when the protocol starts has been + deprecated. In Ranch 2.0 the socket will be obtainable only + by calling `ranch:handshake/1,2`. + +* Ranch-specific transport options and socket options are now + better separated. When passing Ranch-specific transport options, + Ranch now expects to receive a map, in which case socket + options are passed in the `socket_opts` value. When there + are only socket options they can be passed to Ranch directly + as a convenience. + +* Any future transport option will only be added to the map + type. This includes transport options added in this release. + +* The transport option `ack_timeout` was renamed to `handshake_timeout` + in the map type. + +* The `cacerts` socket option is now silenced in error logs + just like the `certs` and `key` options. + +* The manual has been heavily updated and now features one + manual page per function and module, complete with a per-function + changelog, examples and more. + +=== Experimental features added + +* It is now possible to configure the restart intensity for + `ranch_sup` using the OTP application environment. This + feature will remain undocumented unless there is popular + demand for it. + +* Add the transport option `logger` that allows configuring + which logger module will be used. The logger module must + follow the interface of the new `logger` module in Erlang/OTP 21, + or be set to `error_logger` to keep the old behavior. + +=== Changed behaviors + +* Transport modules must now implement `Transport:handshake/2,3` + which deprecates and will replace `Transport:accept_ack/1` in + Ranch 2.0. It returns a new socket and can therefore be used + for implementing TLS upgrade mechanisms. + +=== New functions + +* The functions `ranch:suspend_listener/1` and `ranch:resume_listener/1` + were added. In addition the function `ranch:get_state/1` can be used + to obtain the running state of a listener. + +* A function `ranch:wait_for_connections/3` was added. + +* A function `ranch:handshake/1,2` was added to replace the + function `ranch:accept_ack/1`. + +=== Bugs fixed + +* The specs for the function `Transport:sendfile/2,4,5` have been + corrected. The type used for the filename was too restricting. diff --git a/docs/en/ranch/2.1/guide/migrating_from_1.5/index.html b/docs/en/ranch/2.1/guide/migrating_from_1.5/index.html new file mode 100644 index 00000000..ae89f9ed --- /dev/null +++ b/docs/en/ranch/2.1/guide/migrating_from_1.5/index.html @@ -0,0 +1,221 @@ + + + + + + + + + + Nine Nines: Migrating from Ranch 1.5 to 1.6 + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    Migrating from Ranch 1.5 to 1.6

    + +

    Ranch 1.6 added the ability to suspend and resume listeners. It also deprecates a number of features and add interfaces that will be used in Ranch 2.0.

    +

    Ranch 1.6 is compatible with Erlang/OTP 18.0 onward. Support for older releases has been removed.

    +

    Features added

    +
    • Listeners can now be suspended/resumed without stopping existing connection processes. This effectively closes the listening socket and stops the acceptor processes. +
    • +
    • Transport options can now be updated for suspended listeners. +
    • +
    • The Socket argument given when the protocol starts has been deprecated. In Ranch 2.0 the socket will be obtainable only by calling ranch:handshake/1,2. +
    • +
    • Ranch-specific transport options and socket options are now better separated. When passing Ranch-specific transport options, Ranch now expects to receive a map, in which case socket options are passed in the socket_opts value. When there are only socket options they can be passed to Ranch directly as a convenience. +
    • +
    • Any future transport option will only be added to the map type. This includes transport options added in this release. +
    • +
    • The transport option ack_timeout was renamed to handshake_timeout in the map type. +
    • +
    • The cacerts socket option is now silenced in error logs just like the certs and key options. +
    • +
    • The manual has been heavily updated and now features one manual page per function and module, complete with a per-function changelog, examples and more. +
    • +
    +

    Experimental features added

    +
    • It is now possible to configure the restart intensity for ranch_sup using the OTP application environment. This feature will remain undocumented unless there is popular demand for it. +
    • +
    • Add the transport option logger that allows configuring which logger module will be used. The logger module must follow the interface of the new logger module in Erlang/OTP 21, or be set to error_logger to keep the old behavior. +
    • +
    +

    Changed behaviors

    +
    • Transport modules must now implement Transport:handshake/2,3 which deprecates and will replace Transport:accept_ack/1 in Ranch 2.0. It returns a new socket and can therefore be used for implementing TLS upgrade mechanisms. +
    • +
    +

    New functions

    +
    • The functions ranch:suspend_listener/1 and ranch:resume_listener/1 were added. In addition the function ranch:get_state/1 can be used to obtain the running state of a listener. +
    • +
    • A function ranch:wait_for_connections/3 was added. +
    • +
    • A function ranch:handshake/1,2 was added to replace the function ranch:accept_ack/1. +
    • +
    +

    Bugs fixed

    +
    • The specs for the function Transport:sendfile/2,4,5 have been corrected. The type used for the filename was too restricting. +
    • +
    + + + + + + + + + + + + + + + + +
    + +
    + + +

    + Ranch + 2.1 + + User Guide +

    + + + +

    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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/guide/migrating_from_1.6.asciidoc b/docs/en/ranch/2.1/guide/migrating_from_1.6.asciidoc new file mode 100644 index 00000000..f0c32e88 --- /dev/null +++ b/docs/en/ranch/2.1/guide/migrating_from_1.6.asciidoc @@ -0,0 +1,46 @@ +[appendix] +== Migrating from Ranch 1.6 to 1.7 + +Ranch 1.7 adds built-in support for the PROXY protocol. + +The PROXY protocol is a simple and efficient way for proxies +to transmit information about the client. + +While a third-party library already existed, it was not +entirely compatible with the Ranch interface, in particular +when socket active mode was involved. This new implementation +fixes that and supports the full protocol with as little +overhead as possible compared to normal operations: just one +extra function call. + +Ranch 1.7 is compatible with Erlang/OTP 19.0 onward. Support +for Erlang/OTP 18 has been removed. + +=== Features added + +* Full support for the PROXY protocol was added. + +=== New functions + +* Add the function `ranch:recv_proxy_header/2` to receive + the PROXY protocol header and parse it. It must be called + before `ranch:handshake/1,2`. + +* Add the functions `ranch_proxy_header:parse/1` and + `ranch_proxy_header:header/1,2` to parse and build a + PROXY protocol header, respectively. + +=== Bugs fixed + +* Fix a race condition when the listener is restarted + after `ranch_listener_sup` crashes. This resulted in + the original options being used even if the options + were updated at runtime. + +* Make the acceptors exit instead of crash when the + listening socket has been closed to prevent + unnecessary logs. + +* Fix an issue where listener information would not get + cleaned up when an embedded listener was stopped. This + was fixed in Ranch 1.6.2. diff --git a/docs/en/ranch/2.1/guide/migrating_from_1.6/index.html b/docs/en/ranch/2.1/guide/migrating_from_1.6/index.html new file mode 100644 index 00000000..13ff2201 --- /dev/null +++ b/docs/en/ranch/2.1/guide/migrating_from_1.6/index.html @@ -0,0 +1,201 @@ + + + + + + + + + + Nine Nines: Migrating from Ranch 1.6 to 1.7 + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    Migrating from Ranch 1.6 to 1.7

    + +

    Ranch 1.7 adds built-in support for the PROXY protocol.

    +

    The PROXY protocol is a simple and efficient way for proxies to transmit information about the client.

    +

    While a third-party library already existed, it was not entirely compatible with the Ranch interface, in particular when socket active mode was involved. This new implementation fixes that and supports the full protocol with as little overhead as possible compared to normal operations: just one extra function call.

    +

    Ranch 1.7 is compatible with Erlang/OTP 19.0 onward. Support for Erlang/OTP 18 has been removed.

    +

    Features added

    +
    • Full support for the PROXY protocol was added. +
    • +
    +

    New functions

    +
    • Add the function ranch:recv_proxy_header/2 to receive the PROXY protocol header and parse it. It must be called before ranch:handshake/1,2. +
    • +
    • Add the functions ranch_proxy_header:parse/1 and ranch_proxy_header:header/1,2 to parse and build a PROXY protocol header, respectively. +
    • +
    +

    Bugs fixed

    +
    • Fix a race condition when the listener is restarted after ranch_listener_sup crashes. This resulted in the original options being used even if the options were updated at runtime. +
    • +
    • Make the acceptors exit instead of crash when the listening socket has been closed to prevent unnecessary logs. +
    • +
    • Fix an issue where listener information would not get cleaned up when an embedded listener was stopped. This was fixed in Ranch 1.6.2. +
    • +
    + + + + + + + + + + + + + + + + +
    + +
    + + +

    + Ranch + 2.1 + + User Guide +

    + + + +

    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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/guide/migrating_from_1.7.asciidoc b/docs/en/ranch/2.1/guide/migrating_from_1.7.asciidoc new file mode 100644 index 00000000..e9b1c96e --- /dev/null +++ b/docs/en/ranch/2.1/guide/migrating_from_1.7.asciidoc @@ -0,0 +1,163 @@ +[appendix] +== Migrating from Ranch 1.7+ to Ranch 2.0 + +Ranch 2.0 adds support for multiple connection supervisors. + +Ranch 1.x had a bottleneck because it used only a single +connection supervisor. This was more evident when many +connections were dropped at once as the supervisor couldn't +keep up and failed to accept new connections while cleaning +up the old ones. Ranch 2.0 behaves much better in this scenario +by default. Multiple connection supervisors also helps with +concurrently accepting new connections. + +Ranch 2.0 also adds experimental support for opening more +than one listening socket on a single port. + +Starting with Ranch 2.0 we are also providing a +https://github.com/juhlig/prometheus_ranch[Prometheus collector] +as a separate project as well as a +https://github.com/juhlig/prometheus_ranch/blob/master/dashboards/ranch-dashboard.json[Grafana dashboard]. + +Ranch 2.0 is compatible with Erlang/OTP 21.0 onward. Support +for Erlang/OTP 19 and 20 has been removed. + +=== Features added + +* Ranch now comes with a `ranch.appup` file necessary for + performing release upgrades. A test suite has been added + to confirm release upgrades work from one tag to the next. + Numerous fixes were made that will also improve error recovery. + Release upgrades will only be supported from Ranch 2.0 + onward. + +* The `num_conns_sups` option has been added. It allows + configuring the number of connection supervisors. It + now defaults to `num_accceptors`. The old behavior can + be obtained by setting this value to 1. + +* The `logger` option is no longer experimental. It now + defaults to `logger` instead of `error_logger`. + +* UNIX domain sockets are now supported. + +* The active N socket option is now supported. It requires + Erlang/OTP 21.3 or above for TLS, however. + +* Embedded listeners are now failing in a predictable + manner when `ranch_server` goes down. It is no longer + necessary to embed `ranch_sup` and the recommendation + is now to just start Ranch normally when using embedded + listeners. + +* Two steps handshake is now supported. This allows + obtaining TLS extensions and updating options before + resuming the handshake. The handshake can also be + canceled. + +=== Experimental features added + +* The experimental `num_listen_sockets` option has been + added. It allows opening more than one listening socket + per listener. It can only be used alongside the Linux + `SO_REUSEPORT` socket option or equivalent. It allows + working around a bottleneck in the kernel and maximizes + resource usage, leading to increased rates for accepting + new connections. + +=== Features removed + +* The `socket` option was removed. A more viable solution + is to define a custom transport module that returns a fresh + socket when `Transport:listen/1` is called. + +=== Changed behaviors + +* The callback function `Transport:listen/1` and its + implementations in `ranch_tcp` and `ranch_ssl` have changed + to accept a map of transport options instead of only + socket options. + +* The callback function `Transport:messages/0` return value + now includes the tag used for passive messages. + +* The `Socket` argument was removed from `Protocol:start_link/3`. + The socket must now be obtained by calling `ranch:handshake/1,2`. + +=== Added functions + +* The functions `ranch:handshake_continue/1,2` and + `ranch:handshake_cancel/1` can be used to perform + a two steps handshake. These functions may not be + supported by all transports. + +=== Changed functions + +* The `NumAcceptors` argument was removed from `ranch:start_listener/5` + and `ranch:child_spec/5` and moved to the transport options. + +* Ranch options can no longer be passed along with socket options + as a proplist. The only forms allowed are now the `ranch:opts()` + map or only socket options as-is. Individual transport options + are now validated as well. The `ranch:opts()` map must + be used when socket options also use a map. This applies to the + `ranch:start_listener/5`, `ranch:child_spec/5` and + `ranch:set_transport_options/2` functions. + +* The function `ranch:info/1,2` now returns a map containing + each listener's information rather than a list of key/values. + The key `num_acceptors` was removed as it can be found in the + transport options. + +* The function `ranch:set_transport_options/2` no longer requires + the listener to be suspended. Which options apply immediately, + on suspend/resume or on restart has been documented. Some work + has also been done to make these option changes more predictable. + +=== Removed functions + +* The function `ranch:accept_ack/1` has been removed in favor + of `ranch:handshake/1,2`. + +=== Bugs fixed + +* Calling `ranch:remove_connection/1` will now resume a sleeping + acceptor process when applicable. + +* Repeatedly calling `ranch:remove_connection/1` from a connection + process would crash the respective connection supervisor. This has + now been fixed. + +* When a connection process was failing to start, the socket was + not closed and this lead to leaking sockets. This is now corrected. + +=== Other changes + +* Connection draining has now been documented in the guide + following user feedback and discussions. + +* Ranch is now tested against https://concuerror.com/[Concuerror], + a model checking tool for debugging, testing and verifying + concurrent Erlang programs. Two tests have been added in this + release and more will follow in the future. + +* Ranch is now tested against `stampede`, a chaos monkey style + testing tool. Currently includes three scenarios: normal + TCP and TLS listeners and embedded TCP listener. This new + test suite helped uncover a misplaced `monitor/2` call + added during the development of Ranch 2.0 (we were using a + similar tool, `havoc`, at the time of finding that issue). + +* The supervisor for acceptors and the parent supervisor for + connection supervisors now have an adaptive restart + intensity limit set to `1 + ceil(math:log2(NumChildren))` + to allow room for errors when they have many children. + +* Ranch now uses stricter compiler options. Missing function + specs were added to internal modules. + +* Ranch now calls `ssl:handshake/1,2,3` instead of + `ssl:ssl_accept/1,2`. + +* The `ranch_ssl:ssl_opt()` type has been updated to conform + with Erlang/OTP 23.0. diff --git a/docs/en/ranch/2.1/guide/migrating_from_1.7/index.html b/docs/en/ranch/2.1/guide/migrating_from_1.7/index.html new file mode 100644 index 00000000..ee99259a --- /dev/null +++ b/docs/en/ranch/2.1/guide/migrating_from_1.7/index.html @@ -0,0 +1,258 @@ + + + + + + + + + + Nine Nines: Migrating from Ranch 1.7+ to Ranch 2.0 + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    Migrating from Ranch 1.7+ to Ranch 2.0

    + +

    Ranch 2.0 adds support for multiple connection supervisors.

    +

    Ranch 1.x had a bottleneck because it used only a single connection supervisor. This was more evident when many connections were dropped at once as the supervisor couldn't keep up and failed to accept new connections while cleaning up the old ones. Ranch 2.0 behaves much better in this scenario by default. Multiple connection supervisors also helps with concurrently accepting new connections.

    +

    Ranch 2.0 also adds experimental support for opening more than one listening socket on a single port.

    +

    Starting with Ranch 2.0 we are also providing a Prometheus collector as a separate project as well as a Grafana dashboard.

    +

    Ranch 2.0 is compatible with Erlang/OTP 21.0 onward. Support for Erlang/OTP 19 and 20 has been removed.

    +

    Features added

    +
    • Ranch now comes with a ranch.appup file necessary for performing release upgrades. A test suite has been added to confirm release upgrades work from one tag to the next. Numerous fixes were made that will also improve error recovery. Release upgrades will only be supported from Ranch 2.0 onward. +
    • +
    • The num_conns_sups option has been added. It allows configuring the number of connection supervisors. It now defaults to num_accceptors. The old behavior can be obtained by setting this value to 1. +
    • +
    • The logger option is no longer experimental. It now defaults to logger instead of error_logger. +
    • +
    • UNIX domain sockets are now supported. +
    • +
    • The active N socket option is now supported. It requires Erlang/OTP 21.3 or above for TLS, however. +
    • +
    • Embedded listeners are now failing in a predictable manner when ranch_server goes down. It is no longer necessary to embed ranch_sup and the recommendation is now to just start Ranch normally when using embedded listeners. +
    • +
    • Two steps handshake is now supported. This allows obtaining TLS extensions and updating options before resuming the handshake. The handshake can also be canceled. +
    • +
    +

    Experimental features added

    +
    • The experimental num_listen_sockets option has been added. It allows opening more than one listening socket per listener. It can only be used alongside the Linux SO_REUSEPORT socket option or equivalent. It allows working around a bottleneck in the kernel and maximizes resource usage, leading to increased rates for accepting new connections. +
    • +
    +

    Features removed

    +
    • The socket option was removed. A more viable solution is to define a custom transport module that returns a fresh socket when Transport:listen/1 is called. +
    • +
    +

    Changed behaviors

    +
    • The callback function Transport:listen/1 and its implementations in ranch_tcp and ranch_ssl have changed to accept a map of transport options instead of only socket options. +
    • +
    • The callback function Transport:messages/0 return value now includes the tag used for passive messages. +
    • +
    • The Socket argument was removed from Protocol:start_link/3. The socket must now be obtained by calling ranch:handshake/1,2. +
    • +
    +

    Added functions

    +
    • The functions ranch:handshake_continue/1,2 and ranch:handshake_cancel/1 can be used to perform a two steps handshake. These functions may not be supported by all transports. +
    • +
    +

    Changed functions

    +
    • The NumAcceptors argument was removed from ranch:start_listener/5 and ranch:child_spec/5 and moved to the transport options. +
    • +
    • Ranch options can no longer be passed along with socket options as a proplist. The only forms allowed are now the ranch:opts() map or only socket options as-is. Individual transport options are now validated as well. The ranch:opts() map must be used when socket options also use a map. This applies to the ranch:start_listener/5, ranch:child_spec/5 and ranch:set_transport_options/2 functions. +
    • +
    • The function ranch:info/1,2 now returns a map containing each listener's information rather than a list of key/values. The key num_acceptors was removed as it can be found in the transport options. +
    • +
    • The function ranch:set_transport_options/2 no longer requires the listener to be suspended. Which options apply immediately, on suspend/resume or on restart has been documented. Some work has also been done to make these option changes more predictable. +
    • +
    +

    Removed functions

    +
    • The function ranch:accept_ack/1 has been removed in favor of ranch:handshake/1,2. +
    • +
    +

    Bugs fixed

    +
    • Calling ranch:remove_connection/1 will now resume a sleeping acceptor process when applicable. +
    • +
    • Repeatedly calling ranch:remove_connection/1 from a connection process would crash the respective connection supervisor. This has now been fixed. +
    • +
    • When a connection process was failing to start, the socket was not closed and this lead to leaking sockets. This is now corrected. +
    • +
    +

    Other changes

    +
    • Connection draining has now been documented in the guide following user feedback and discussions. +
    • +
    • Ranch is now tested against Concuerror, a model checking tool for debugging, testing and verifying concurrent Erlang programs. Two tests have been added in this release and more will follow in the future. +
    • +
    • Ranch is now tested against stampede, a chaos monkey style testing tool. Currently includes three scenarios: normal TCP and TLS listeners and embedded TCP listener. This new test suite helped uncover a misplaced monitor/2 call added during the development of Ranch 2.0 (we were using a similar tool, havoc, at the time of finding that issue). +
    • +
    • The supervisor for acceptors and the parent supervisor for connection supervisors now have an adaptive restart intensity limit set to 1 + ceil(math:log2(NumChildren)) to allow room for errors when they have many children. +
    • +
    • Ranch now uses stricter compiler options. Missing function specs were added to internal modules. +
    • +
    • Ranch now calls ssl:handshake/1,2,3 instead of ssl:ssl_accept/1,2. +
    • +
    • The ranch_ssl:ssl_opt() type has been updated to conform with Erlang/OTP 23.0. +
    • +
    + + + + + + + + + + + + + + + + +
    + +
    + + +

    + Ranch + 2.1 + + User Guide +

    + + + +

    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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/guide/migrating_from_1.x.asciidoc b/docs/en/ranch/2.1/guide/migrating_from_1.x.asciidoc new file mode 100644 index 00000000..44babf17 --- /dev/null +++ b/docs/en/ranch/2.1/guide/migrating_from_1.x.asciidoc @@ -0,0 +1,70 @@ +[appendix] +== Migrating from Ranch 1.x + +The changelog for Ranch releases before 1.6 can be found +in this section. + +=== 1.5.0 + +* Add transport functions getopts/2, getstat/1 and getstat/2 +* Fix ranch:info/0 and ranch:procs/2 in embedded mode +* Prevent ranch_conns_sup from stopping on unexpected messages + +=== 1.4.0 + +* Add new transport option num_acceptor +* Deprecate ranch:start_listener/6 in favor of start_listener/5 +* Deprecate ranch:child_spec/6 in favor of child_spec/5 + +=== 1.3.0 + +The version numbers 1.3.1 and 1.3.2 were later made to fix +small mistakes made during the 1.3.0 release process. They +do not include code changes. + +* Tested with OTP R16B+ on Linux, FreeBSD, OSX and Windows +* Add ssl to the list of dependencies +* Add ranch:info/0 and ranch:procs/2 to retrieve Ranch state information +* Allow configuring a listener with only SNI, without a default certificate +* Blacklist transport options instead of whitelist +** Unknown options are now allowed, but will result in a Dialyzer warning +* Add many transport options typespecs and documentation +* Don't silently drop the accept rate when running out of fds +* Prevent a race condition when stopping listeners +* Improve reporting for common errors, for example eaddrinuse +* Fix double removal of connections bug +** The number of active connections should now be exact +* Fix stuck acceptor bug when controlling_socket returned errors +* Numerous documentation and examples improvements + +=== 1.2.1 + +* Fix bug preventing node shutdown when SSL is used with OTP 17.1+ +* Tune restart intensity in all supervisors + +=== 1.2.0 + +* Allow the supervised process and the process owning the socket to be different +* Add many transport options (please refer to the documentation) +* Add function ranch:get_addr/1 to retrieve both IP and port of listener +* Don't pass Ranch-specific options down to transports +** Should make Dialyzer happy in user projects +** New types ranch:opt(), ranch_tcp:opt(), ranch_ssl:ssl_opt() and ranch_ssl:opt() +* Fix crash when filtering unknown options out +* Print a warning for each option filtered out +* Handle Transport:controlling_socket/2 errors and close the socket +* Handle Protocol:start_link/4 crashes to avoid killing all active connections +* Use Asciidoc for documentation +* Test Ranch across 14 Erlang versions on CircleCI +* Improve and document test suites with recent ct_helper improvements +* Fix a number of intermittent test issues + +=== 1.1.0 + +* Add Transport:secure/0 +* Add SSL partial_chain option +* Stop reporting errors on {error, closed} in accept_ack + +=== 1.0.0 + +* Initial release diff --git a/docs/en/ranch/2.1/guide/migrating_from_1.x/index.html b/docs/en/ranch/2.1/guide/migrating_from_1.x/index.html new file mode 100644 index 00000000..fd3bcab9 --- /dev/null +++ b/docs/en/ranch/2.1/guide/migrating_from_1.x/index.html @@ -0,0 +1,274 @@ + + + + + + + + + + Nine Nines: Migrating from Ranch 1.x + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    Migrating from Ranch 1.x

    + +

    The changelog for Ranch releases before 1.6 can be found in this section.

    +

    1.5.0

    +
    • Add transport functions getopts/2, getstat/1 and getstat/2 +
    • +
    • Fix ranch:info/0 and ranch:procs/2 in embedded mode +
    • +
    • Prevent ranch_conns_sup from stopping on unexpected messages +
    • +
    +

    1.4.0

    +
    • Add new transport option num_acceptor +
    • +
    • Deprecate ranch:start_listener/6 in favor of start_listener/5 +
    • +
    • Deprecate ranch:child_spec/6 in favor of child_spec/5 +
    • +
    +

    1.3.0

    +

    The version numbers 1.3.1 and 1.3.2 were later made to fix small mistakes made during the 1.3.0 release process. They do not include code changes.

    +
    • Tested with OTP R16B+ on Linux, FreeBSD, OSX and Windows +
    • +
    • Add ssl to the list of dependencies +
    • +
    • Add ranch:info/0 and ranch:procs/2 to retrieve Ranch state information +
    • +
    • Allow configuring a listener with only SNI, without a default certificate +
    • +
    • Blacklist transport options instead of whitelist +
      • Unknown options are now allowed, but will result in a Dialyzer warning +
      • +
      +
    • +
    • Add many transport options typespecs and documentation +
    • +
    • Don't silently drop the accept rate when running out of fds +
    • +
    • Prevent a race condition when stopping listeners +
    • +
    • Improve reporting for common errors, for example eaddrinuse +
    • +
    • Fix double removal of connections bug +
      • The number of active connections should now be exact +
      • +
      +
    • +
    • Fix stuck acceptor bug when controlling_socket returned errors +
    • +
    • Numerous documentation and examples improvements +
    • +
    +

    1.2.1

    +
    • Fix bug preventing node shutdown when SSL is used with OTP 17.1+ +
    • +
    • Tune restart intensity in all supervisors +
    • +
    +

    1.2.0

    +
    • Allow the supervised process and the process owning the socket to be different +
    • +
    • Add many transport options (please refer to the documentation) +
    • +
    • Add function ranch:get_addr/1 to retrieve both IP and port of listener +
    • +
    • Don't pass Ranch-specific options down to transports +
      • Should make Dialyzer happy in user projects +
      • +
      • New types ranch:opt(), ranch_tcp:opt(), ranch_ssl:ssl_opt() and ranch_ssl:opt() +
      • +
      +
    • +
    • Fix crash when filtering unknown options out +
    • +
    • Print a warning for each option filtered out +
    • +
    • Handle Transport:controlling_socket/2 errors and close the socket +
    • +
    • Handle Protocol:start_link/4 crashes to avoid killing all active connections +
    • +
    • Use Asciidoc for documentation +
    • +
    • Test Ranch across 14 Erlang versions on CircleCI +
    • +
    • Improve and document test suites with recent ct_helper improvements +
    • +
    • Fix a number of intermittent test issues +
    • +
    +

    1.1.0

    +
    • Add Transport:secure/0 +
    • +
    • Add SSL partial_chain option +
    • +
    • Stop reporting errors on {error, closed} in accept_ack +
    • +
    +

    1.0.0

    +
    • Initial release +
    • +
    + + + + + + + + + + + + + + + + +
    + +
    + + +

    + Ranch + 2.1 + + User Guide +

    + + + +

    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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/guide/migrating_from_2.0.asciidoc b/docs/en/ranch/2.1/guide/migrating_from_2.0.asciidoc new file mode 100644 index 00000000..2b4b192c --- /dev/null +++ b/docs/en/ranch/2.1/guide/migrating_from_2.0.asciidoc @@ -0,0 +1,70 @@ +[appendix] +== Migrating from Ranch 2.0 to Ranch 2.1 + +Ranch 2.1 adds counters and alarms. + +The https://github.com/juhlig/prometheus_ranch[Prometheus collector] +was updated to include accepted/terminated connections +metrics. + +Ranch 2.1 is compatible with Erlang/OTP 22.0 onward. Support +for Erlang/OTP 21 has been removed. + +=== Features added + +* Metrics are now provided by `ranch:info/0,1`. Currently + includes accepted/terminated connection counts per + connection supervisor. + +* Alarms can now be configured. The only alarm currently + available is `num_connections`. When the number of + connections goes over a configurable treshold Ranch + will call the given callback. This can be used to + programmatically shut down idle connections to + make up space for new connections, for example. + +* A `post_listen` callback option has been added. It + receives sockets immediately after the `Transport:listen/1` + call. It can be used for some additional initialization + of the socket, such as setting file permissions on + Unix domain sockets. + +* It is now possible to use TLS-PSK authentication + without having to specify a default certificate + for TLS < 1.3. + +=== Experimental features added + +* The `inet_backend` option is now properly handled + and tested for TCP listeners. This allows using + the experimental `socket` backend. The `socket` + backend is now tested with Ranch. Note that + there are known issues and Windows support is not + currently implemented. + +=== Changed behaviors + +* Ranch will now remove unsupported SSL/TLS options + where applicable. A warning will be logged when + this happens. Options are only removed when they + are not compatible with the selected TLS version + and leaving them would prevent the listener from + starting. ++ + The following options are removed when using TLS + 1.1, 1.2 or 1.3: `beast_mitigation` and `padding_check`. ++ + The following options are removed when using TLS + 1.3 exclusively: `client_renegotiation`, + `next_protocols_advertised`, `psk_identity`, + `reuse_session`, `reuse_sessions`, + `secure_renegotiate` and `user_lookup_fun`. + +=== Added functions + +* The function `ranch_proxy_header:to_connection_info/1` + converts PROXY protocol information to the same + format as `ssl:connection_information/1`. Because + there is little overlap only the `protocol`, + `selected_cipher_suite` and `sni_hostname` will + be available, however. diff --git a/docs/en/ranch/2.1/guide/migrating_from_2.0/index.html b/docs/en/ranch/2.1/guide/migrating_from_2.0/index.html new file mode 100644 index 00000000..2e17a487 --- /dev/null +++ b/docs/en/ranch/2.1/guide/migrating_from_2.0/index.html @@ -0,0 +1,206 @@ + + + + + + + + + + Nine Nines: Migrating from Ranch 2.0 to Ranch 2.1 + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    Migrating from Ranch 2.0 to Ranch 2.1

    + +

    Ranch 2.1 adds counters and alarms.

    +

    The Prometheus collector was updated to include accepted/terminated connections metrics.

    +

    Ranch 2.1 is compatible with Erlang/OTP 22.0 onward. Support for Erlang/OTP 21 has been removed.

    +

    Features added

    +
    • Metrics are now provided by ranch:info/0,1. Currently includes accepted/terminated connection counts per connection supervisor. +
    • +
    • Alarms can now be configured. The only alarm currently available is num_connections. When the number of connections goes over a configurable treshold Ranch will call the given callback. This can be used to programmatically shut down idle connections to make up space for new connections, for example. +
    • +
    • A post_listen callback option has been added. It receives sockets immediately after the Transport:listen/1 call. It can be used for some additional initialization of the socket, such as setting file permissions on Unix domain sockets. +
    • +
    • It is now possible to use TLS-PSK authentication without having to specify a default certificate for TLS < 1.3. +
    • +
    +

    Experimental features added

    +
    • The inet_backend option is now properly handled and tested for TCP listeners. This allows using the experimental socket backend. The socket backend is now tested with Ranch. Note that there are known issues and Windows support is not currently implemented. +
    • +
    +

    Changed behaviors

    +
    • Ranch will now remove unsupported SSL/TLS options where applicable. A warning will be logged when this happens. Options are only removed when they are not compatible with the selected TLS version and leaving them would prevent the listener from starting. +

      The following options are removed when using TLS 1.1, 1.2 or 1.3: beast_mitigation and padding_check.

      +

      The following options are removed when using TLS 1.3 exclusively: client_renegotiation, next_protocols_advertised, psk_identity, reuse_session, reuse_sessions, secure_renegotiate and user_lookup_fun.

      +
    • +
    +

    Added functions

    +
    • The function ranch_proxy_header:to_connection_info/1 converts PROXY protocol information to the same format as ssl:connection_information/1. Because there is little overlap only the protocol, selected_cipher_suite and sni_hostname will be available, however. +
    • +
    + + + + + + + + + + + + + + + + +
    + +
    + + +

    + Ranch + 2.1 + + User Guide +

    + + + +

    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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/guide/parsers.asciidoc b/docs/en/ranch/2.1/guide/parsers.asciidoc new file mode 100644 index 00000000..7a9c5a53 --- /dev/null +++ b/docs/en/ranch/2.1/guide/parsers.asciidoc @@ -0,0 +1,92 @@ +== Writing parsers + +There are three kinds of protocols: + +* Text protocols +* Schema-less binary protocols +* Schema-based binary protocols + +This chapter introduces the first two kinds. It will not cover +more advanced topics such as continuations or parser generators. + +This chapter isn't specifically about Ranch, we assume here that +you know how to read data from the socket. The data you read and +the data that hasn't been parsed is saved in a buffer. Every +time you read from the socket, the data read is appended to the +buffer. What happens next depends on the kind of protocol. We +will only cover the first two. + +=== Parsing text + +Text protocols are generally line based. This means that we can't +do anything with them until we receive the full line. + +A simple way to get a full line is to use `binary:split/2,3`. + +.Using binary:split/2 to get a line of input + +[source,erlang] +case binary:split(Buffer, <<"\n">>) of + [_] -> + get_more_data(Buffer); + [Line, Rest] -> + handle_line(Line, Rest) +end. + +In the above example, we can have two results. Either there was +a line break in the buffer and we get it split into two parts, +the line and the rest of the buffer; or there was no line break +in the buffer and we need to get more data from the socket. + +Next, we need to parse the line. The simplest way is to again +split, here on space. The difference is that we want to split +on all spaces character, as we want to tokenize the whole string. + +.Using binary:split/3 to split text + +[source,erlang] +case binary:split(Line, <<" ">>, [global]) of + [<<"HELLO">>] -> + be_polite(); + [<<"AUTH">>, User, Password] -> + authenticate_user(User, Password); + [<<"QUIT">>, Reason] -> + quit(Reason) + %% ... +end. + +Pretty simple, right? Match on the command name, get the rest +of the tokens in variables and call the respective functions. + +After doing this, you will want to check if there is another +line in the buffer, and handle it immediately if any. +Otherwise wait for more data. + +=== Parsing binary + +Binary protocols can be more varied, although most of them are +pretty similar. The first four bytes of a frame tend to be +the size of the frame, which is followed by a certain number +of bytes for the type of frame and then various parameters. + +Sometimes the size of the frame includes the first four bytes, +sometimes not. Other times this size is encoded over two bytes. +And even other times little-endian is used instead of big-endian. + +The general idea stays the same though. + +.Using binary pattern matching to split frames + +[source,erlang] +<< Size:32, _/bits >> = Buffer, +case Buffer of + << Frame:Size/binary, Rest/bits >> -> + handle_frame(Frame, Rest); + _ -> + get_more_data(Buffer) +end. + +You will then need to parse this frame using binary pattern +matching, and handle it. Then you will want to check if there +is another frame fully received in the buffer, and handle it +immediately if any. Otherwise wait for more data. diff --git a/docs/en/ranch/2.1/guide/parsers/index.html b/docs/en/ranch/2.1/guide/parsers/index.html new file mode 100644 index 00000000..ffcb0932 --- /dev/null +++ b/docs/en/ranch/2.1/guide/parsers/index.html @@ -0,0 +1,241 @@ + + + + + + + + + + Nine Nines: Writing parsers + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    Writing parsers

    + +

    There are three kinds of protocols:

    +
    • Text protocols +
    • +
    • Schema-less binary protocols +
    • +
    • Schema-based binary protocols +
    • +
    +

    This chapter introduces the first two kinds. It will not cover more advanced topics such as continuations or parser generators.

    +

    This chapter isn't specifically about Ranch, we assume here that you know how to read data from the socket. The data you read and the data that hasn't been parsed is saved in a buffer. Every time you read from the socket, the data read is appended to the buffer. What happens next depends on the kind of protocol. We will only cover the first two.

    +

    Parsing text

    +

    Text protocols are generally line based. This means that we can't do anything with them until we receive the full line.

    +

    A simple way to get a full line is to use binary:split/2,3.

    +
    Using binary:split/2 to get a line of input
    +
    +
    case binary:split(Buffer, <<"\n">>) of
    +	[_] ->
    +		get_more_data(Buffer);
    +	[Line, Rest] ->
    +		handle_line(Line, Rest)
    +end.
    +
    +

    In the above example, we can have two results. Either there was a line break in the buffer and we get it split into two parts, the line and the rest of the buffer; or there was no line break in the buffer and we need to get more data from the socket.

    +

    Next, we need to parse the line. The simplest way is to again split, here on space. The difference is that we want to split on all spaces character, as we want to tokenize the whole string.

    +
    Using binary:split/3 to split text
    +
    +
    case binary:split(Line, <<" ">>, [global]) of
    +	[<<"HELLO">>] ->
    +		be_polite();
    +	[<<"AUTH">>, User, Password] ->
    +		authenticate_user(User, Password);
    +	[<<"QUIT">>, Reason] ->
    +		quit(Reason)
    +	%% ...
    +end.
    +
    +

    Pretty simple, right? Match on the command name, get the rest of the tokens in variables and call the respective functions.

    +

    After doing this, you will want to check if there is another line in the buffer, and handle it immediately if any. Otherwise wait for more data.

    +

    Parsing binary

    +

    Binary protocols can be more varied, although most of them are pretty similar. The first four bytes of a frame tend to be the size of the frame, which is followed by a certain number of bytes for the type of frame and then various parameters.

    +

    Sometimes the size of the frame includes the first four bytes, sometimes not. Other times this size is encoded over two bytes. And even other times little-endian is used instead of big-endian.

    +

    The general idea stays the same though.

    +
    Using binary pattern matching to split frames
    +
    +
    << Size:32, _/bits >> = Buffer,
    +case Buffer of
    +	<< Frame:Size/binary, Rest/bits >> ->
    +		handle_frame(Frame, Rest);
    +	_ ->
    +		get_more_data(Buffer)
    +end.
    +
    +

    You will then need to parse this frame using binary pattern matching, and handle it. Then you will want to check if there is another frame fully received in the buffer, and handle it immediately if any. Otherwise wait for more data.

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

    + Ranch + 2.1 + + User Guide +

    + + + +

    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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/guide/protocols.asciidoc b/docs/en/ranch/2.1/guide/protocols.asciidoc new file mode 100644 index 00000000..8f55cea2 --- /dev/null +++ b/docs/en/ranch/2.1/guide/protocols.asciidoc @@ -0,0 +1,113 @@ +== Protocols + +A protocol handler starts a connection process and defines the +protocol logic executed in this process. + +=== Writing a protocol handler + +All protocol handlers must implement the `ranch_protocol` behavior +which defines a single callback, `start_link/3`. This callback is +responsible for spawning a new process for handling the connection. +It receives three arguments: the name of the listener, the +transport handler being used and the protocol options defined in +the call to `ranch:start_listener/5`. This callback must +return `{ok, Pid}`, with `Pid` the pid of the new process. + +The newly started process can then freely initialize itself. However, +it must call `ranch:handshake/1,2` before doing any socket operation. +This will ensure the connection process is the owner of the socket. +It expects the listener's name as argument. + +.Perform the socket handshake + +[source,erlang] +{ok, Socket} = ranch:handshake(Ref). + +If your protocol code requires specific socket options, you should +set them while initializing your connection process, after +calling `ranch:handshake/1,2`. You can use `Transport:setopts/2` +for that purpose. + +Following is the complete protocol code for the example found +in `examples/tcp_echo/`. + +.Protocol module that echoes everything it receives + +[source,erlang] +---- +-module(echo_protocol). +-behaviour(ranch_protocol). + +-export([start_link/3]). +-export([init/3]). + +start_link(Ref, Transport, Opts) -> + Pid = spawn_link(?MODULE, init, [Ref, Transport, Opts]), + {ok, Pid}. + +init(Ref, Transport, _Opts = []) -> + {ok, Socket} = ranch:handshake(Ref), + loop(Socket, Transport). + +loop(Socket, Transport) -> + case Transport:recv(Socket, 0, 5000) of + {ok, Data} -> + Transport:send(Socket, Data), + loop(Socket, Transport); + _ -> + ok = Transport:close(Socket) + end. +---- + +=== Using gen_statem and gen_server + +Special processes like the ones that use the `gen_statem` or `gen_server` +behaviours have the particularity of having their `start_link` call not +return until the `init` function returns. This is problematic, because +you won't be able to call `ranch:handshake/1,2` from the `init` callback +as this would cause a deadlock to happen. + +This problem can be addressed in several ways. + +==== gen_statem + +* Use state enter calls and place the `ranch:handshake/1,2` call in the enter + clause of the initial state. Check the `tcp_reverse` example for a complete + example. +* Use a `next_event` action in the return from `init/1` and place the + `ranch:handshake/1,2` call in the clause handling the event in the initial + state. +* Use the `gen_statem:enter_loop/4` function and start your process with + `proc_lib:spawn_link/3` or `proc_lib:start_link/3,4,5`. See below for an + example. + +.Using gen_statem:enter_loop/4 to start a protocol + +[source,erlang] +---- +-module(my_protocol). +-behaviour(gen_statem). +-behaviour(ranch_protocol). + +-export([start_link/3]). +-export([init/1]). +%% Exports of other gen_statem callbacks here. + +start_link(Ref, Transport, Opts) -> + {ok, proc_lib:spawn_link(?MODULE, init, [{Ref, Transport, Opts}])}. + +init({Ref, Transport, _Opts}) -> + %% Perform any required state initialization here. + {ok, Socket} = ranch:handshake(Ref), + ok = Transport:setopts(Socket, [{active, once}]), + gen_statem:enter_loop(?MODULE, [], state_name, {state_data, Socket, Transport}). + +%% Other gen_statem callbacks here. +---- + +==== gen_server + +* Use `{continue, Continue}` in the return from `init/1` and place the + `ranch:handshake/1,2` call in a corresponding `handle_continue/2` clause. +* Use the `gen_server:enter_loop/3` function and start your process with + `proc_lib:spawn_link/3` or `proc_lib:start_link/3,4,5`. diff --git a/docs/en/ranch/2.1/guide/protocols/index.html b/docs/en/ranch/2.1/guide/protocols/index.html new file mode 100644 index 00000000..d275248c --- /dev/null +++ b/docs/en/ranch/2.1/guide/protocols/index.html @@ -0,0 +1,261 @@ + + + + + + + + + + Nine Nines: Protocols + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    Protocols

    + +

    A protocol handler starts a connection process and defines the protocol logic executed in this process.

    +

    Writing a protocol handler

    +

    All protocol handlers must implement the ranch_protocol behavior which defines a single callback, start_link/3. This callback is responsible for spawning a new process for handling the connection. It receives three arguments: the name of the listener, the transport handler being used and the protocol options defined in the call to ranch:start_listener/5. This callback must return {ok, Pid}, with Pid the pid of the new process.

    +

    The newly started process can then freely initialize itself. However, it must call ranch:handshake/1,2 before doing any socket operation. This will ensure the connection process is the owner of the socket. It expects the listener's name as argument.

    +
    Perform the socket handshake
    +
    +
    {ok, Socket} = ranch:handshake(Ref).
    +
    +

    If your protocol code requires specific socket options, you should set them while initializing your connection process, after calling ranch:handshake/1,2. You can use Transport:setopts/2 for that purpose.

    +

    Following is the complete protocol code for the example found in examples/tcp_echo/.

    +
    Protocol module that echoes everything it receives
    +
    +
    -module(echo_protocol).
    +-behaviour(ranch_protocol).
    +
    +-export([start_link/3]).
    +-export([init/3]).
    +
    +start_link(Ref, Transport, Opts) ->
    +	Pid = spawn_link(?MODULE, init, [Ref, Transport, Opts]),
    +	{ok, Pid}.
    +
    +init(Ref, Transport, _Opts = []) ->
    +	{ok, Socket} = ranch:handshake(Ref),
    +	loop(Socket, Transport).
    +
    +loop(Socket, Transport) ->
    +	case Transport:recv(Socket, 0, 5000) of
    +		{ok, Data} ->
    +			Transport:send(Socket, Data),
    +			loop(Socket, Transport);
    +		_ ->
    +			ok = Transport:close(Socket)
    +	end.
    +
    +

    Using gen_statem and gen_server

    +

    Special processes like the ones that use the gen_statem or gen_server behaviours have the particularity of having their start_link call not return until the init function returns. This is problematic, because you won't be able to call ranch:handshake/1,2 from the init callback as this would cause a deadlock to happen.

    +

    This problem can be addressed in several ways.

    +

    gen_statem

    +
    • Use state enter calls and place the ranch:handshake/1,2 call in the enter clause of the initial state. Check the tcp_reverse example for a complete example. +
    • +
    • Use a next_event action in the return from init/1 and place the ranch:handshake/1,2 call in the clause handling the event in the initial state. +
    • +
    • Use the gen_statem:enter_loop/4 function and start your process with proc_lib:spawn_link/3 or proc_lib:start_link/3,4,5. See below for an example. +
    • +
    +
    Using gen_statem:enter_loop/4 to start a protocol
    +
    +
    -module(my_protocol).
    +-behaviour(gen_statem).
    +-behaviour(ranch_protocol).
    +
    +-export([start_link/3]).
    +-export([init/1]).
    +%% Exports of other gen_statem callbacks here.
    +
    +start_link(Ref, Transport, Opts) ->
    +	{ok, proc_lib:spawn_link(?MODULE, init, [{Ref, Transport, Opts}])}.
    +
    +init({Ref, Transport, _Opts}) ->
    +	%% Perform any required state initialization here.
    +	{ok, Socket} = ranch:handshake(Ref),
    +	ok = Transport:setopts(Socket, [{active, once}]),
    +	gen_statem:enter_loop(?MODULE, [], state_name, {state_data, Socket, Transport}).
    +
    +%% Other gen_statem callbacks here.
    +
    +

    gen_server

    +
    • Use {continue, Continue} in the return from init/1 and place the ranch:handshake/1,2 call in a corresponding handle_continue/2 clause. +
    • +
    • Use the gen_server:enter_loop/3 function and start your process with proc_lib:spawn_link/3 or proc_lib:start_link/3,4,5. +
    • +
    + + + + + + + + + + + + + + + + +
    + +
    + + +

    + Ranch + 2.1 + + User Guide +

    + + + +

    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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/guide/ssl_auth.asciidoc b/docs/en/ranch/2.1/guide/ssl_auth.asciidoc new file mode 100644 index 00000000..f4364d06 --- /dev/null +++ b/docs/en/ranch/2.1/guide/ssl_auth.asciidoc @@ -0,0 +1,120 @@ +== SSL client authentication + +=== Purpose + +SSL client authentication is a mechanism allowing applications to +identify certificates. This allows your application to make sure that +the client is an authorized certificate, but makes no claim about +whether the user can be trusted. This can be combined with a password +based authentication to attain greater security. + +The server only needs to retain the certificate serial number and +the certificate issuer to authenticate the certificate. Together, +they can be used to uniquely identify a certificate. + +As Ranch allows the same protocol code to be used for both SSL and +non-SSL transports, you need to make sure you are in an SSL context +before attempting to perform an SSL client authentication. This +can be done by checking the return value of `Transport:name/0`. + +=== Obtaining client certificates + +You can obtain client certificates from various sources. You can +generate them yourself, or you can use a service like CAcert.org +which allows you to generate client and server certificates for +free. + +Following are the steps you need to take to create a CAcert.org +account, generate a certificate and install it in your favorite +browser. + +* Open http://cacert.org in your favorite browser +* Root Certificate link: install both certificates +* Join (Register an account) +* Verify your account (check your email inbox!) +* Log in +* Client Certificates: New +* Follow instructions to create the certificate +* Install the certificate in your browser + +You can optionally save the certificate for later use, for example +to extract the `IssuerID` information as will be detailed later on. + +=== Transport configuration + +The SSL transport does not request a client certificate by default. +You need to specify the `{verify, verify_peer}` option when starting +the listener to enable this behavior. + +.Configure a listener for SSL authentication + +[source,erlang] +{ok, _} = ranch:start_listener(my_ssl, + ranch_ssl, #{socket_opts => [ + {port, SSLPort}, + {certfile, PathToCertfile}, + {cacertfile, PathToCACertfile}, + {verify, verify_peer} + ]}, + my_protocol, [] +). + +In this example we set the required `port` and `certfile`, but also +the `cacertfile` containing the CACert.org root certificate, and +the option to request the client certificate. + +If you enable the `{verify, verify_peer}` option and the client does +not have a client certificate configured for your domain, then no +certificate will be sent. This allows you to use SSL for more than +just authenticated clients. + +=== Authentication + +To authenticate users, you must first save the certificate information +required. If you have your users' certificate files, you can simply +load the certificate and retrieve the information directly. + +.Retrieve the issuer ID from a certificate + +[source,erlang] +---- +certfile_to_issuer_id(Filename) -> + {ok, Data} = file:read_file(Filename), + [{'Certificate', Cert, not_encrypted}] = public_key:pem_decode(Data), + {ok, IssuerID} = public_key:pkix_issuer_id(Cert, self), + IssuerID. +---- + +The `IssuerID` variable contains both the certificate serial number +and the certificate issuer stored in a tuple, so this value alone can +be used to uniquely identify the user certificate. You can save this +value in a database, a configuration file or any other place where an +Erlang term can be stored and retrieved. + +To retrieve the `IssuerID` from a running connection, you need to first +retrieve the client certificate and then extract this information from +it. Ranch does not provide a function to retrieve the client certificate. +Instead you can use the `ssl:peercert/1` function. Once you have the +certificate, you can again use the `public_key:pkix_issuer_id/2` to +extract the `IssuerID` value. + +The following function returns the `IssuerID` or `false` if no client +certificate was found. This snippet is intended to be used from your +protocol code. + +.Retrieve the issuer ID from the certificate for the current connection + +[source,erlang] +---- +socket_to_issuer_id(Socket) -> + case ssl:peercert(Socket) of + {error, no_peercert} -> + false; + {ok, Cert} -> + {ok, IssuerID} = public_key:pkix_issuer_id(Cert, self), + IssuerID + end. +---- + +You then only need to match the `IssuerID` value to authenticate the +user. diff --git a/docs/en/ranch/2.1/guide/ssl_auth/index.html b/docs/en/ranch/2.1/guide/ssl_auth/index.html new file mode 100644 index 00000000..2ad9a96a --- /dev/null +++ b/docs/en/ranch/2.1/guide/ssl_auth/index.html @@ -0,0 +1,254 @@ + + + + + + + + + + Nine Nines: SSL client authentication + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    SSL client authentication

    + +

    Purpose

    +

    SSL client authentication is a mechanism allowing applications to identify certificates. This allows your application to make sure that the client is an authorized certificate, but makes no claim about whether the user can be trusted. This can be combined with a password based authentication to attain greater security.

    +

    The server only needs to retain the certificate serial number and the certificate issuer to authenticate the certificate. Together, they can be used to uniquely identify a certificate.

    +

    As Ranch allows the same protocol code to be used for both SSL and non-SSL transports, you need to make sure you are in an SSL context before attempting to perform an SSL client authentication. This can be done by checking the return value of Transport:name/0.

    +

    Obtaining client certificates

    +

    You can obtain client certificates from various sources. You can generate them yourself, or you can use a service like CAcert.org which allows you to generate client and server certificates for free.

    +

    Following are the steps you need to take to create a CAcert.org account, generate a certificate and install it in your favorite browser.

    +
    • Open http://cacert.org in your favorite browser +
    • +
    • Root Certificate link: install both certificates +
    • +
    • Join (Register an account) +
    • +
    • Verify your account (check your email inbox!) +
    • +
    • Log in +
    • +
    • Client Certificates: New +
    • +
    • Follow instructions to create the certificate +
    • +
    • Install the certificate in your browser +
    • +
    +

    You can optionally save the certificate for later use, for example to extract the IssuerID information as will be detailed later on.

    +

    Transport configuration

    +

    The SSL transport does not request a client certificate by default. You need to specify the {verify, verify_peer} option when starting the listener to enable this behavior.

    +
    Configure a listener for SSL authentication
    +
    +
    {ok, _} = ranch:start_listener(my_ssl,
    +	ranch_ssl, #{socket_opts => [
    +		{port, SSLPort},
    +		{certfile, PathToCertfile},
    +		{cacertfile, PathToCACertfile},
    +		{verify, verify_peer}
    +	]},
    +	my_protocol, []
    +).
    +
    +

    In this example we set the required port and certfile, but also the cacertfile containing the CACert.org root certificate, and the option to request the client certificate.

    +

    If you enable the {verify, verify_peer} option and the client does not have a client certificate configured for your domain, then no certificate will be sent. This allows you to use SSL for more than just authenticated clients.

    +

    Authentication

    +

    To authenticate users, you must first save the certificate information required. If you have your users' certificate files, you can simply load the certificate and retrieve the information directly.

    +
    Retrieve the issuer ID from a certificate
    +
    +
    certfile_to_issuer_id(Filename) ->
    +	{ok, Data} = file:read_file(Filename),
    +	[{'Certificate', Cert, not_encrypted}] = public_key:pem_decode(Data),
    +	{ok, IssuerID} = public_key:pkix_issuer_id(Cert, self),
    +	IssuerID.
    +
    +

    The IssuerID variable contains both the certificate serial number and the certificate issuer stored in a tuple, so this value alone can be used to uniquely identify the user certificate. You can save this value in a database, a configuration file or any other place where an Erlang term can be stored and retrieved.

    +

    To retrieve the IssuerID from a running connection, you need to first retrieve the client certificate and then extract this information from it. Ranch does not provide a function to retrieve the client certificate. Instead you can use the ssl:peercert/1 function. Once you have the certificate, you can again use the public_key:pkix_issuer_id/2 to extract the IssuerID value.

    +

    The following function returns the IssuerID or false if no client certificate was found. This snippet is intended to be used from your protocol code.

    +
    Retrieve the issuer ID from the certificate for the current connection
    +
    +
    socket_to_issuer_id(Socket) ->
    +	case ssl:peercert(Socket) of
    +		{error, no_peercert} ->
    +			false;
    +		{ok, Cert} ->
    +			{ok, IssuerID} = public_key:pkix_issuer_id(Cert, self),
    +			IssuerID
    +	end.
    +
    +

    You then only need to match the IssuerID value to authenticate the user.

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

    + Ranch + 2.1 + + User Guide +

    + + + +

    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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/guide/transports.asciidoc b/docs/en/ranch/2.1/guide/transports.asciidoc new file mode 100644 index 00000000..73747fd5 --- /dev/null +++ b/docs/en/ranch/2.1/guide/transports.asciidoc @@ -0,0 +1,177 @@ +== Transports + +A transport defines the interface to interact with a socket. + +Transports can be used for connecting, listening and accepting +connections, but also for receiving and sending data. Both +passive and active mode are supported, although all sockets +are initialized as passive. + +=== TCP transport + +The TCP transport is a thin wrapper around `gen_tcp`. + +=== SSL transport + +The SSL transport is a thin wrapper around `ssl`. + +Ranch depends on `ssl` by default so any necessary +dependencies will start when Ranch is started. It is +possible to remove the dependency when the SSL transport +will not be used. Refer to your release build tool's +documentation for more information. + +When embedding Ranch listeners that have an SSL transport, +your application must depend on the `ssl` application for +proper behavior. + +=== Sending and receiving data + +This section assumes that `Transport` is a valid transport handler +(like `ranch_tcp` or `ranch_ssl`) and `Socket` is a connected +socket obtained through the listener. + +You can send data to a socket by calling the `Transport:send/2` +function. The data can be given as `iodata()`, which is defined as +`binary() | iolist()`. All the following calls will work: + +.Sending data to the socket + +[source,erlang] +---- +Transport:send(Socket, <<"Ranch is cool!">>). +Transport:send(Socket, "Ranch is cool!"). +Transport:send(Socket, ["Ranch", ["is", "cool!"]]). +Transport:send(Socket, ["Ranch", [<<"is">>, "cool!"]]). +---- + +You can receive data either in passive or in active mode. Passive mode +means that you will perform a blocking `Transport:recv/3` call, while +active mode means that you will receive the data as a message. + +By default, all data will be received as binary. It is possible to +receive data as strings, although this is not recommended as binaries +are a more efficient construct, especially for binary protocols. + +Receiving data using passive mode requires a single function call. The +first argument is the socket, and the third argument is a timeout duration +before the call returns with `{error, timeout}`. + +The second argument is the amount of data in bytes that we want to receive. +The function will wait for data until it has received exactly this amount. +If you are not expecting a precise size, you can specify 0 which will make +this call return as soon as data was read, regardless of its size. + +.Receiving data from the socket in passive mode + +[source,erlang] +{ok, Data} = Transport:recv(Socket, 0, 5000). + +Active mode requires you to inform the socket that you want to receive +data as a message and to write the code to actually receive it. + +There are three kinds of active modes: `{active, once}`, `{active, N}` +and `{active, true}`. The first will send a single message before going +back to passive mode; the second will send `N` messages followed by +a `Passive` message when switching back to passive mode; the third +will send messages indefinitely. We recommend not using the `{active, true}` +mode as it could quickly flood your process mailbox. It's better to keep +the data in the socket and read it only when required. + +Four different messages can be received: + +* Incoming data: `{OK, Socket, Data}` +* Socket closed: `{Closed, Socket}` +* Socket error: `{Error, Socket, Reason}` +* Switch to passive mode: `{Passive, Socket}` + +The value of `OK`, `Closed`, `Error` and `Passive` can be different +depending on the transport being used. To be able to properly match +on them you must first call the `Transport:messages/0` function. + +.Retrieving the transport's active message identifiers + +[source,erlang] +{OK, Closed, Error, Passive} = Transport:messages(). + +To start receiving messages you will need to call the `Transport:setopts/2` +function, and do so every time you want to receive data. + +.Receiving messages from the socket in active mode + +[source,erlang] +---- +{OK, Closed, Error, Passive} = Transport:messages(), +Transport:setopts(Socket, [{active, once}]), +receive + {OK, Socket, Data} -> + io:format("data received: ~p~n", [Data]); + {Closed, Socket} -> + io:format("socket got closed!~n"); + {Error, Socket, Reason} -> + io:format("error happened: ~p~n", [Reason]) +end. +---- + +You can easily integrate active sockets with existing Erlang code as all +you really need is just a few more clauses when receiving messages. + +=== Sending files + +As in the previous section it is assumed `Transport` is a valid transport +handler and `Socket` is a connected socket obtained through the listener. + +To send a whole file, with name `Filename`, over a socket: + +.Sending a file by filename + +[source,erlang] +{ok, SentBytes} = Transport:sendfile(Socket, Filename). + +Or part of a file, with `Offset` greater than or equal to 0, `Bytes` number of +bytes and chunks of size `ChunkSize`: + +.Sending part of a file by filename in chunks + +[source,erlang] +Opts = [{chunk_size, ChunkSize}], +{ok, SentBytes} = Transport:sendfile(Socket, Filename, Offset, Bytes, Opts). + +To improve efficiency when sending multiple parts of the same file it is also +possible to use a file descriptor opened in raw mode: + +.Sending a file opened in raw mode + +[source,erlang] +{ok, RawFile} = file:open(Filename, [raw, read, binary]), +{ok, SentBytes} = Transport:sendfile(Socket, RawFile, Offset, Bytes, Opts). + +=== Upgrading a TCP socket to SSL + +A connected TCP socket can be upgraded to a SSL socket via the function +`ranch_ssl:handshake/3`. The socket *must* be in `{active, false}` mode +before telling the client that the server is ready to upgrade in order +to avoid race conditions. + +IMPORTANT: The new socket received from `ranch_ssl:handshake/3` must be +used via the `ranch_ssl` transport. + +.Performing a TLS handshake on a TCP socket +[source,erlang] +{ok, SslSocket} = ranch_ssl:handshake(TcpSocket, SslOpts, 5000). + +=== Writing a transport handler + +A transport handler is a module implementing the `ranch_transport` behavior. +It defines a certain number of callbacks that must be written in order to +allow transparent usage of the transport handler. + +The behavior doesn't define the socket options available when opening a +socket. These do not need to be common to all transports as it's easy enough +to write different initialization functions for the different transports that +will be used. With one exception though. The `setopts/2` function *must* +implement the `{active, once}` and the `{active, true}` options. + +If the transport handler doesn't have a native implementation of `sendfile/5` a +fallback is available, `ranch_transport:sendfile/6`. The extra first argument +is the transport's module. See `ranch_ssl` for an example. diff --git a/docs/en/ranch/2.1/guide/transports/index.html b/docs/en/ranch/2.1/guide/transports/index.html new file mode 100644 index 00000000..b6238f4b --- /dev/null +++ b/docs/en/ranch/2.1/guide/transports/index.html @@ -0,0 +1,291 @@ + + + + + + + + + + Nine Nines: Transports + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    Transports

    + +

    A transport defines the interface to interact with a socket.

    +

    Transports can be used for connecting, listening and accepting connections, but also for receiving and sending data. Both passive and active mode are supported, although all sockets are initialized as passive.

    +

    TCP transport

    +

    The TCP transport is a thin wrapper around gen_tcp.

    +

    SSL transport

    +

    The SSL transport is a thin wrapper around ssl.

    +

    Ranch depends on ssl by default so any necessary dependencies will start when Ranch is started. It is possible to remove the dependency when the SSL transport will not be used. Refer to your release build tool's documentation for more information.

    +

    When embedding Ranch listeners that have an SSL transport, your application must depend on the ssl application for proper behavior.

    +

    Sending and receiving data

    +

    This section assumes that Transport is a valid transport handler (like ranch_tcp or ranch_ssl) and Socket is a connected socket obtained through the listener.

    +

    You can send data to a socket by calling the Transport:send/2 function. The data can be given as iodata(), which is defined as binary() | iolist(). All the following calls will work:

    +
    Sending data to the socket
    +
    +
    Transport:send(Socket, <<"Ranch is cool!">>).
    +Transport:send(Socket, "Ranch is cool!").
    +Transport:send(Socket, ["Ranch", ["is", "cool!"]]).
    +Transport:send(Socket, ["Ranch", [<<"is">>, "cool!"]]).
    +
    +

    You can receive data either in passive or in active mode. Passive mode means that you will perform a blocking Transport:recv/3 call, while active mode means that you will receive the data as a message.

    +

    By default, all data will be received as binary. It is possible to receive data as strings, although this is not recommended as binaries are a more efficient construct, especially for binary protocols.

    +

    Receiving data using passive mode requires a single function call. The first argument is the socket, and the third argument is a timeout duration before the call returns with {error, timeout}.

    +

    The second argument is the amount of data in bytes that we want to receive. The function will wait for data until it has received exactly this amount. If you are not expecting a precise size, you can specify 0 which will make this call return as soon as data was read, regardless of its size.

    +
    Receiving data from the socket in passive mode
    +
    +
    {ok, Data} = Transport:recv(Socket, 0, 5000).
    +
    +

    Active mode requires you to inform the socket that you want to receive data as a message and to write the code to actually receive it.

    +

    There are three kinds of active modes: {active, once}, {active, N} and {active, true}. The first will send a single message before going back to passive mode; the second will send N messages followed by a Passive message when switching back to passive mode; the third will send messages indefinitely. We recommend not using the {active, true} mode as it could quickly flood your process mailbox. It's better to keep the data in the socket and read it only when required.

    +

    Four different messages can be received:

    +
    • Incoming data: {OK, Socket, Data} +
    • +
    • Socket closed: {Closed, Socket} +
    • +
    • Socket error: {Error, Socket, Reason} +
    • +
    • Switch to passive mode: {Passive, Socket} +
    • +
    +

    The value of OK, Closed, Error and Passive can be different depending on the transport being used. To be able to properly match on them you must first call the Transport:messages/0 function.

    +
    Retrieving the transport's active message identifiers
    +
    +
    {OK, Closed, Error, Passive} = Transport:messages().
    +
    +

    To start receiving messages you will need to call the Transport:setopts/2 function, and do so every time you want to receive data.

    +
    Receiving messages from the socket in active mode
    +
    +
    {OK, Closed, Error, Passive} = Transport:messages(),
    +Transport:setopts(Socket, [{active, once}]),
    +receive
    +	{OK, Socket, Data} ->
    +		io:format("data received: ~p~n", [Data]);
    +	{Closed, Socket} ->
    +		io:format("socket got closed!~n");
    +	{Error, Socket, Reason} ->
    +		io:format("error happened: ~p~n", [Reason])
    +end.
    +
    +

    You can easily integrate active sockets with existing Erlang code as all you really need is just a few more clauses when receiving messages.

    +

    Sending files

    +

    As in the previous section it is assumed Transport is a valid transport handler and Socket is a connected socket obtained through the listener.

    +

    To send a whole file, with name Filename, over a socket:

    +
    Sending a file by filename
    +
    +
    {ok, SentBytes} = Transport:sendfile(Socket, Filename).
    +
    +

    Or part of a file, with Offset greater than or equal to 0, Bytes number of bytes and chunks of size ChunkSize:

    +
    Sending part of a file by filename in chunks
    +
    +
    Opts = [{chunk_size, ChunkSize}],
    +{ok, SentBytes} = Transport:sendfile(Socket, Filename, Offset, Bytes, Opts).
    +
    +

    To improve efficiency when sending multiple parts of the same file it is also possible to use a file descriptor opened in raw mode:

    +
    Sending a file opened in raw mode
    +
    +
    {ok, RawFile} = file:open(Filename, [raw, read, binary]),
    +{ok, SentBytes} = Transport:sendfile(Socket, RawFile, Offset, Bytes, Opts).
    +
    +

    Upgrading a TCP socket to SSL

    +

    A connected TCP socket can be upgraded to a SSL socket via the function ranch_ssl:handshake/3. The socket must be in {active, false} mode before telling the client that the server is ready to upgrade in order to avoid race conditions.

    +

    IMPORTANT: The new socket received from ranch_ssl:handshake/3 must be used via the ranch_ssl transport.

    +
    Performing a TLS handshake on a TCP socket
    +
    +
    {ok, SslSocket} = ranch_ssl:handshake(TcpSocket, SslOpts, 5000).
    +
    +

    Writing a transport handler

    +

    A transport handler is a module implementing the ranch_transport behavior. It defines a certain number of callbacks that must be written in order to allow transparent usage of the transport handler.

    +

    The behavior doesn't define the socket options available when opening a socket. These do not need to be common to all transports as it's easy enough to write different initialization functions for the different transports that will be used. With one exception though. The setopts/2 function must implement the {active, once} and the {active, true} options.

    +

    If the transport handler doesn't have a native implementation of sendfile/5 a fallback is available, ranch_transport:sendfile/6. The extra first argument is the transport's module. See ranch_ssl for an example.

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

    + Ranch + 2.1 + + User Guide +

    + + + +

    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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/index.html b/docs/en/ranch/2.1/manual/index.html new file mode 100644 index 00000000..9a90e7ec --- /dev/null +++ b/docs/en/ranch/2.1/manual/index.html @@ -0,0 +1,201 @@ + + + + + + + + + + Nine Nines: Ranch Function Reference + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    Ranch Function Reference

    + +

    Name

    +

    ranch - Socket acceptor pool for TCP protocols

    +

    Description

    +

    Ranch is a socket acceptor pool for TCP protocols.

    +

    Ranch manages listeners which are a set of processes that accept and manage connections. The connection's transport and protocol modules are configured per listener. Listeners can be inspected and reconfigured without interruptions in service.

    +

    Modules

    +

    Functions:

    + +

    Transports:

    + +

    Behaviors:

    + +

    Dependencies

    +
    • ssl - Secure communication over sockets +
    • +
    +

    All these applications must be started before the ranch application. To start Ranch and all dependencies at once:

    +
    +
    {ok, _} = application:ensure_all_started(ranch).
    +
    +

    Environment

    +

    The ranch application defines one application environment configuration parameter.

    +
    profile (false)
    +

    When enabled, Ranch will start eprof profiling automatically.

    +

    You can use the ranch_app:profile_output/0 function to stop profiling and output the results to the files procs.profile and total.profile. Do not use in production.

    +
    +
    +

    See also

    +

    ssl(7)

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

    + Ranch + 2.1 + 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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/ranch.child_spec/index.html b/docs/en/ranch/2.1/manual/ranch.child_spec/index.html new file mode 100644 index 00000000..b244d9ca --- /dev/null +++ b/docs/en/ranch/2.1/manual/ranch.child_spec/index.html @@ -0,0 +1,222 @@ + + + + + + + + + + Nine Nines: ranch:child_spec(3) + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    ranch:child_spec(3)

    + +

    Name

    +

    ranch:child_spec - Build child specifications for a new listener

    +

    Description

    +
    +
    child_spec(Ref       :: ranch_ref(),
    +           Transport :: module(),
    +           TransOpts :: ranch:opts(),
    +           Protocol  :: module(),
    +           ProtoOpts :: any())
    +    -> supervisor:child_spec()
    +
    +

    Build child specifications for a new listener which can be embedded directly in an application's supervision tree.

    +

    The actual listener is placed under a supervisor which monitors ranch_server via a proxy process and will restart the listener if ranch_server crashes.

    +

    Arguments

    +
    Ref
    +

    The listener name is used to refer to this listener in future calls, for example when updating the configuration.

    +

    It can be any Erlang term. An atom is generally good enough, for example api, my_app_clear or my_app_tls.

    +
    +
    Transport
    +

    The transport module that will be used by Ranch to accept connections and that will be passed to the protocol module along with the socket.

    +

    The interface of the transport module is documented in the ranch_transport(3) manual.

    +
    +
    TransportOpts
    +

    Transport options include the Ranch-specific options and the socket options. The listener's port number must be defined in the socket options.

    +

    The available options for the built-in Ranch transports are documented in the ranch_tcp(3) and ranch_ssl(3) manuals.

    +
    +
    Protocol
    +

    The protocol module that will be used by Ranch after the connection has been accepted.

    +

    The interface of the protocol module is documented in the ranch_protocol(3) manual.

    +
    +
    ProtocolOpts
    +

    The protocol options given when calling the protocol module. Please consult the documentation of the protocol module you are using for more details.

    +
    +
    +

    Return value

    +

    Child specifications are returned.

    +

    Changelog

    +
    • 2.0: The actual listener is placed under a supervisor in order to restart the listener if ranch_server crashes. +
    • +
    • 2.0: The TransOpts argument must no longer contain Ranch-specific options if given as a list. Use a map. +
    • +
    • 1.4: The NumAcceptors argument was moved to the transport options. +
    • +
    +

    Examples

    +
    Embed a listener
    +
    +
    -behavior(supervisor).
    +
    +init(_) ->
    +    {ok, {#{strategy => one_for_one}, [
    +        ranch:child_spec(echo,
    +            ranch_tcp, [{port, 5555}],
    +            echo_protocol, []
    +        )
    +    ]}}.
    +
    +

    See also

    +

    ranch:start_listener(3), ranch:stop_listener(3), ranch(3), ranch_tcp(3), ranch_ssl(3), ranch_transport(3), ranch_protocol(3)

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

    + Ranch + 2.1 + 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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/ranch.get_addr/index.html b/docs/en/ranch/2.1/manual/ranch.get_addr/index.html new file mode 100644 index 00000000..12ce9487 --- /dev/null +++ b/docs/en/ranch/2.1/manual/ranch.get_addr/index.html @@ -0,0 +1,197 @@ + + + + + + + + + + Nine Nines: ranch:get_addr(3) + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    ranch:get_addr(3)

    + +

    Name

    +

    ranch:get_addr - Get the listening address

    +

    Description

    +
    +
    get_addr(Ref :: ranch:ref())
    +    -> {IP   :: inet:ip_address(),
    +        Port :: inet:port_number()}
    +     | {local, SocketFile :: binary()}
    +     | {undefined, undefined}
    +
    +

    Get the listening address.

    +

    Arguments

    +
    Ref
    +

    The listener name.

    +
    +
    +

    Return value

    +

    The address of the listener is returned as a tuple of the form {IP, Port} when listening on a network interface, or {local, SocketFile} when listening on a UNIX Domain socket. When the listener is suspended, {undefined, undefined} will be returned.

    +

    The IP address is the IP of the network interface the socket is bound to.

    +

    The socket file is the path of a file on your system the socket is bound to.

    +

    Examples

    +
    Get the listening port and IP
    +
    +
    {IP, Port} = ranch:get_addr(example).
    +
    +
    Get the listening UNIX Domain socket file
    +
    +
    {local, SocketFile} = ranch:get_addr(example).
    +
    +

    See also

    +

    ranch:start_listener(3), ranch:get_port(3), ranch:info(3), ranch(3)

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

    + Ranch + 2.1 + 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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/ranch.get_max_connections/index.html b/docs/en/ranch/2.1/manual/ranch.get_max_connections/index.html new file mode 100644 index 00000000..70966780 --- /dev/null +++ b/docs/en/ranch/2.1/manual/ranch.get_max_connections/index.html @@ -0,0 +1,189 @@ + + + + + + + + + + Nine Nines: ranch:get_max_connections(3) + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    ranch:get_max_connections(3)

    + +

    Name

    +

    ranch:get_max_connections - Get the max number of connections per connection supervisor

    +

    Description

    +
    +
    get_max_connections(Ref :: ranch:ref())
    +    -> MaxConns :: ranch:max_conns()
    +
    +

    Get the max number of connections per connection supervisor.

    +

    Arguments

    +
    Ref
    +

    The listener name.

    +
    +
    +

    Return value

    +

    The maximum number of connections per connection supervisor is returned.

    +

    Changelog

    +
    • 2.0: The maximum number of connections is now per connection supervisor. +
    • +
    +

    Examples

    +
    Get the max number of connections per connection supervisor
    +
    +
    MaxConns = ranch:get_max_connections(example).
    +
    +

    See also

    +

    ranch:get_protocol_options(3), ranch:get_transport_options(3), ranch:set_max_connections(3), ranch(3)

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

    + Ranch + 2.1 + 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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/ranch.get_port/index.html b/docs/en/ranch/2.1/manual/ranch.get_port/index.html new file mode 100644 index 00000000..be771dc5 --- /dev/null +++ b/docs/en/ranch/2.1/manual/ranch.get_port/index.html @@ -0,0 +1,187 @@ + + + + + + + + + + Nine Nines: ranch:get_port(3) + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    ranch:get_port(3)

    + +

    Name

    +

    ranch:get_port - Get the listening port

    +

    Description

    +
    +
    get_port(Ref :: ranch:ref())
    +    -> Port :: inet:port_number() | undefined
    +
    +

    Get the listening port.

    +

    This function is particularly useful to retrieve the listening port number when it was not provided in the options and was chosen randomly instead.

    +

    Arguments

    +
    Ref
    +

    The listener name.

    +
    +
    +

    Return value

    +

    The listening port is returned.

    +

    When the listener is suspended or using a UNIX Domain socket instead of a network interface, undefined will be returned.

    +

    Examples

    +
    Get the listening port
    +
    +
    Port = ranch:get_port(example).
    +
    +

    See also

    +

    ranch:start_listener(3), ranch:get_addr(3), ranch:info(3), ranch(3)

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

    + Ranch + 2.1 + 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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/ranch.get_protocol_options/index.html b/docs/en/ranch/2.1/manual/ranch.get_protocol_options/index.html new file mode 100644 index 00000000..f60777b5 --- /dev/null +++ b/docs/en/ranch/2.1/manual/ranch.get_protocol_options/index.html @@ -0,0 +1,185 @@ + + + + + + + + + + Nine Nines: ranch:get_protocol_options(3) + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    ranch:get_protocol_options(3)

    + +

    Name

    +

    ranch:get_protocol_options - Get the current protocol options

    +

    Description

    +
    +
    get_protocol_options(Ref :: ranch:ref())
    +    -> ProtoOpts :: any()
    +
    +

    Get the current protocol options.

    +

    Arguments

    +
    Ref
    +

    The listener name.

    +
    +
    +

    Return value

    +

    The current protocol options are returned.

    +

    Examples

    +
    Get the current protocol options
    +
    +
    ProtoOpts = ranch:get_protocol_options(example).
    +
    +

    See also

    +

    ranch:get_max_connections(3), ranch:get_transport_options(3), ranch:set_protocol_options(3), ranch(3)

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

    + Ranch + 2.1 + 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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/ranch.get_status/index.html b/docs/en/ranch/2.1/manual/ranch.get_status/index.html new file mode 100644 index 00000000..64d2cf25 --- /dev/null +++ b/docs/en/ranch/2.1/manual/ranch.get_status/index.html @@ -0,0 +1,188 @@ + + + + + + + + + + Nine Nines: ranch:get_status(3) + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    ranch:get_status(3)

    + +

    Name

    +

    ranch:get_status - Get a listener's running state

    +

    Description

    +
    +
    get_status(Ref :: ranch_ref()) -> running | suspended
    +
    +

    Get a listener's running state.

    +

    Arguments

    +
    Ref
    +

    The listener name.

    +
    +
    +

    Return value

    +

    An atom is returned indicating the running status of the listener.

    +

    Changelog

    +
    • 1.6: Function introduced. +
    • +
    +

    Examples

    +
    Get a listener's running state
    +
    +
    ranch:get_status(example).
    +
    +

    See also

    +

    ranch:start_listener(3), ranch:stop_listener(3), ranch:suspend_listener(3), ranch:resume_listener(3), ranch:set_transport_options(3), ranch:wait_for_connections(3), ranch(3)

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

    + Ranch + 2.1 + 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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/ranch.get_transport_options/index.html b/docs/en/ranch/2.1/manual/ranch.get_transport_options/index.html new file mode 100644 index 00000000..89c97f1e --- /dev/null +++ b/docs/en/ranch/2.1/manual/ranch.get_transport_options/index.html @@ -0,0 +1,185 @@ + + + + + + + + + + Nine Nines: ranch:get_transport_options(3) + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    ranch:get_transport_options(3)

    + +

    Name

    +

    ranch:get_transport_options - Get the current transport options

    +

    Description

    +
    +
    get_transport_options(Ref :: ranch:ref())
    +    -> TransOpts :: ranch:transport_opts(any())
    +
    +

    Get the current transport options.

    +

    Arguments

    +
    Ref
    +

    The listener name.

    +
    +
    +

    Return value

    +

    The current transport options are returned.

    +

    Examples

    +
    Get the current transport options
    +
    +
    TransOpts = ranch:get_transport_options(example).
    +
    +

    See also

    +

    ranch:get_max_connections(3), ranch:get_protocol_options(3), ranch:set_transport_options(3), ranch(3)

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

    + Ranch + 2.1 + 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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/ranch.handshake/index.html b/docs/en/ranch/2.1/manual/ranch.handshake/index.html new file mode 100644 index 00000000..4672ce45 --- /dev/null +++ b/docs/en/ranch/2.1/manual/ranch.handshake/index.html @@ -0,0 +1,211 @@ + + + + + + + + + + Nine Nines: ranch:handshake(3) + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    ranch:handshake(3)

    + +

    Name

    +

    ranch:handshake - Perform the transport handshake

    +

    Description

    +
    +
    handshake(Ref)       -> {ok, Socket} | {continue, Info}
    +handshake(Ref, Opts) -> {ok, Socket} | {continue, Info}
    +
    +Ref    :: ranch:ref()
    +Opts   :: any()
    +Socket :: any()
    +Info   :: any()
    +
    +

    Perform the transport handshake.

    +

    This function must be called by the protocol process in order to retrieve the socket for the connection. Ranch performs the handshake necessary to give control of the socket to this process and also does the transport handshake, for example setting up the TLS connection.

    +

    Arguments

    +
    Ref
    +

    The listener name.

    +
    +
    Opts
    +

    Transport handshake options.

    +

    Allowed options depend on the transport module.

    +
    +
    +

    Return value

    +

    An ok tuple is returned containing the socket for the connection by default.

    +

    Depending on configuration, a continue tuple can otherwise be returned when the handshake operation is paused. It contains data provided by the transport that can be used to inform further decisions before resuming the handshake, for example to provide new transport options. The handshake can be resumed using ranch:handshake_continue(3) or canceled using ranch:handshake_cancel(3).

    +

    This function will trigger an exception when an error occurs.

    +

    Changelog

    +
    • 2.0: The continue tuple can now be returned. +
    • +
    • 1.6: Function introduced. Replaces ranch:accept_ack/1. +
    • +
    +

    Examples

    +
    Initialize the connection process
    +
    +
    start_link(Ref, Transport, Opts) ->
    +    Pid = proc_lib:spawn_link(?MODULE, init,
    +        [Ref, Transport, Opts]),
    +    {ok, Pid}.
    +
    +init(Ref, Transport, Opts) ->
    +    {ok, Socket} = ranch:handshake(Ref),
    +    loop(#state{ref=Ref, socket=Socket,
    +        transport=Transport, opts=Opts}).
    +
    +

    See also

    +

    ranch:start_listener(3), ranch:handshake_continue(3), ranch:handshake_cancel(3), ranch:recv_proxy_header(3), ranch:remove_connection(3), ranch(3)

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

    + Ranch + 2.1 + 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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/ranch.handshake_cancel/index.html b/docs/en/ranch/2.1/manual/ranch.handshake_cancel/index.html new file mode 100644 index 00000000..d759ac8a --- /dev/null +++ b/docs/en/ranch/2.1/manual/ranch.handshake_cancel/index.html @@ -0,0 +1,198 @@ + + + + + + + + + + Nine Nines: ranch:handshake_cancel(3) + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    ranch:handshake_cancel(3)

    + +

    Name

    +

    ranch:handshake_cancel - Cancel the paused transport handshake

    +

    Description

    +
    +
    handshake_cancel(Ref :: ranch:ref()) -> ok
    +
    +

    Cancel the paused transport handshake.

    +

    This function may be called by the protocol process to cancel a paused handshake.

    +

    Arguments

    +
    Ref
    +

    The listener name.

    +

    Allowed options depend on the transport module.

    +
    +
    +

    Return value

    +

    The return value depends on the transport module.

    +

    Changelog

    +
    • 2.0: Function introduced. +
    • +
    +

    Examples

    +
    Cancel a paused transport handshake
    +
    +
    start_link(Ref, Transport, Opts) ->
    +    Pid = proc_lib:spawn_link(?MODULE, init,
    +        [Ref, Transport, Opts]),
    +    {ok, Pid}.
    +
    +init(Ref, Transport, Opts) ->
    +    {continue, _Info} = ranch:handshake(Ref),
    +    ranch:handshake_cancel(Ref),
    +    exit(handshake_cancelled).
    +
    +

    See also

    +

    ranch:handshake(3), ranch:handshake_continue(3), ranch(3)

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

    + Ranch + 2.1 + 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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/ranch.handshake_continue/index.html b/docs/en/ranch/2.1/manual/ranch.handshake_continue/index.html new file mode 100644 index 00000000..58974738 --- /dev/null +++ b/docs/en/ranch/2.1/manual/ranch.handshake_continue/index.html @@ -0,0 +1,208 @@ + + + + + + + + + + Nine Nines: ranch:handshake_continue(3) + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    ranch:handshake_continue(3)

    + +

    Name

    +

    ranch:handshake_continue - Resume the paused transport handshake

    +

    Description

    +
    +
    handshake_continue(Ref)       -> {ok, Socket}
    +handshake_continue(Ref, Opts) -> {ok, Socket}
    +
    +Ref    :: ranch:ref()
    +Opts   :: any()
    +Socket :: any()
    +
    +

    Resume the paused transport handshake.

    +

    This function must be called by the protocol process in order to resume a paused handshake.

    +

    Arguments

    +
    Ref
    +

    The listener name.

    +
    +
    Opts
    +

    Transport handshake options.

    +

    Allowed options depend on the transport module.

    +
    +
    +

    Return value

    +

    An ok tuple is returned containing the socket for the connection.

    +

    This function will trigger an exception when an error occurs.

    +

    Changelog

    +
    • 2.0: Function introduced. +
    • +
    +

    Examples

    +
    Continue a paused transport handshake
    +
    +
    start_link(Ref, Transport, Opts) ->
    +    Pid = proc_lib:spawn_link(?MODULE, init,
    +        [Ref, Transport, Opts]),
    +    {ok, Pid}.
    +
    +init(Ref, Transport, Opts) ->
    +    {continue, _Info} = ranch:handshake(Ref),
    +    {ok, Socket} = ranch:handshake_continue(Ref),
    +    loop(#state{ref=Ref, socket=Socket,
    +        transport=Transport, opts=Opts}).
    +
    +

    See also

    +

    ranch:handshake(3), ranch:handshake_cancel(3), ranch(3)

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

    + Ranch + 2.1 + 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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/ranch.info/index.html b/docs/en/ranch/2.1/manual/ranch.info/index.html new file mode 100644 index 00000000..96f5b77a --- /dev/null +++ b/docs/en/ranch/2.1/manual/ranch.info/index.html @@ -0,0 +1,248 @@ + + + + + + + + + + Nine Nines: ranch:info(3) + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    ranch:info(3)

    + +

    Name

    +

    ranch:info - Overview of Ranch listeners

    +

    Description

    +
    +
    info() -> #{Ref := Info}
    +info(Ref) -> Info
    +
    +Info :: #{Key :: atom() := Value :: any()}
    +
    +

    Overview of Ranch listeners.

    +

    Arguments

    +
    Ref
    +

    The listener name.

    +
    +
    +

    Return value

    +

    Returns detailed information about one or all Ranch listeners. The following keys are returned:

    +
    pid
    +

    Pid of the listener's top-level supervisor.

    +
    +
    status
    +

    Listener status, either running or suspended.

    +
    +
    ip
    +

    Interface Ranch listens on.

    +
    +
    port
    +

    Port number Ranch listens on.

    +
    +
    max_connections
    +

    Maximum number of connections per connection supervisor.

    +
    +
    active_connections
    +

    Number of active connections.

    +
    +
    all_connections
    +

    Number of connections, including those removed from the count.

    +
    +
    transport
    +

    Transport module.

    +
    +
    transport_options
    +

    Transport options.

    +
    +
    protocol
    +

    Protocol module.

    +
    +
    protocol_options
    +

    Protocol options.

    +
    +
    metrics
    +

    Listener metrics.

    +
    +
    +

    Metrics

    +

    Listener metrics are provided as a map, with the following keys:

    +
    {conns_sup, Index, accept}
    +

    Number of accepted connections, per connection supervisor.

    +
    +
    {conns_sup, Index, terminate}
    +

    Number of terminated connection processes, per connection supervisor.

    +
    +
    +

    Changelog

    +
    • 2.1: Added accept/terminate metrics to the output of ranch:info/0,1. +
    • +
    • 2.0: The listener info is now returned as a map. +
    • +
    • 2.0: The num_acceptors key has been removed. +
    • +
    +

    Examples

    +
    Get information about all listeners
    +
    +
    AllInfo = ranch:info().
    +
    +
    Get information about a specific listener
    +
    +
    Info = ranch:info(example).
    +
    +

    See also

    +

    ranch:get_addr(3), ranch:get_port(3), ranch:procs(3), ranch(3)

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

    + Ranch + 2.1 + 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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/ranch.procs/index.html b/docs/en/ranch/2.1/manual/ranch.procs/index.html new file mode 100644 index 00000000..3e2a35f2 --- /dev/null +++ b/docs/en/ranch/2.1/manual/ranch.procs/index.html @@ -0,0 +1,196 @@ + + + + + + + + + + Nine Nines: ranch:procs(3) + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    ranch:procs(3)

    + +

    Name

    +

    ranch:procs - Retrieve pids from a listener

    +

    Description

    +
    +
    procs(Ref  :: ranch:ref(),
    +      Type :: acceptors | connections)
    +    -> Pids :: [pid()]
    +
    +

    Retrieve pids from a listener.

    +

    Arguments

    +
    Ref
    +

    The listener name.

    +
    +
    Type
    +

    The type of process that will be returned.

    +
    +
    +

    Return value

    +

    A list of pids is returned.

    +

    Examples

    +
    Get the pids of the acceptor processes
    +
    +
    Pids = ranch:procs(acceptors).
    +
    +
    Get the pids of the connection processes
    +
    +
    Pids = ranch:procs(connections).
    +
    +

    See also

    +

    ranch:get_addr(3), ranch:get_port(3), ranch:info(3), ranch(3)

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

    + Ranch + 2.1 + 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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/ranch.recv_proxy_header/index.html b/docs/en/ranch/2.1/manual/ranch.recv_proxy_header/index.html new file mode 100644 index 00000000..ff86375e --- /dev/null +++ b/docs/en/ranch/2.1/manual/ranch.recv_proxy_header/index.html @@ -0,0 +1,206 @@ + + + + + + + + + + Nine Nines: ranch:recv_proxy_header(3) + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    ranch:recv_proxy_header(3)

    + +

    Name

    +

    ranch:recv_proxy_header - Receive the PROXY protocol header

    +

    Description

    +
    +
    recv_proxy_header(ranch:ref(), timeout())
    +    -> {ok, ranch_proxy_header:proxy_info()}
    +     | {error, Reason :: atom()}
    +     | {error, protocol_error, HumanReadable :: atom()}
    +
    +

    Receive the PROXY protocol header.

    +

    This function must be called before ranch:handshake/1,2 on newly accepted connections to read and parse the PROXY protocol header, if any.

    +

    Arguments

    +
    Ref
    +

    The listener name.

    +
    +
    Timeout
    +

    Receive timeout in milliseconds.

    +
    +
    +

    Return value

    +

    An ok tuple is returned containing PROXY header information on success.

    +

    An error 2-tuple is returned when a socket error occurs.

    +

    An error 3-tuple is returned when a protocol error occurs and Ranch was not able to parse the PROXY header information. The third element contains a human-readable description of the error.

    +

    Changelog

    +
    • 1.7: Function introduced. +
    • +
    +

    Examples

    +
    Receive the PROXY protocol header
    +
    +
    start_link(Ref, Transport, Opts) ->
    +    Pid = proc_lib:spawn_link(?MODULE, init,
    +        [Ref, Transport, Opts]),
    +    {ok, Pid}.
    +
    +init(Ref, Transport, Opts) ->
    +    {ok, ProxyInfo} = ranch:recv_proxy_header(Ref, 1000),
    +    {ok, Socket} = ranch:handshake(Ref),
    +    loop(#state{ref=Ref, socket=Socket, transport=Transport,
    +        proxy_info=ProxyInfo, opts=Opts}).
    +
    +

    See also

    +

    ranch:start_listener(3), ranch:handshake(3), ranch:remove_connection(3), ranch(3)

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

    + Ranch + 2.1 + 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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/ranch.remove_connection/index.html b/docs/en/ranch/2.1/manual/ranch.remove_connection/index.html new file mode 100644 index 00000000..b8ba83c0 --- /dev/null +++ b/docs/en/ranch/2.1/manual/ranch.remove_connection/index.html @@ -0,0 +1,186 @@ + + + + + + + + + + Nine Nines: ranch:remove_connection(3) + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    ranch:remove_connection(3)

    + +

    Name

    +

    ranch:remove_connection - Remove connection from the count

    +

    Description

    +
    +
    remove_connection(Ref :: ranch:ref()) -> ok
    +
    +

    Remove connection from the count.

    +

    This connection will no longer be included in the count when limiting the number of connections. This can be useful in a mixed environment where some connections are active and others are passive. Passive connections spend most of their time idling and are not consuming much resources.

    +

    This function may only be called from a connection process.

    +

    Arguments

    +
    Ref
    +

    The listener name.

    +
    +
    +

    Return value

    +

    The atom ok is always returned. It can be safely ignored.

    +

    Examples

    +
    Remove the connection process from the count
    +
    +
    ranch:remove_connection(example).
    +
    +

    See also

    +

    ranch:start_listener(3), ranch:handshake(3), ranch(3)

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

    + Ranch + 2.1 + 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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/ranch.resume_listener/index.html b/docs/en/ranch/2.1/manual/ranch.resume_listener/index.html new file mode 100644 index 00000000..e94a7874 --- /dev/null +++ b/docs/en/ranch/2.1/manual/ranch.resume_listener/index.html @@ -0,0 +1,192 @@ + + + + + + + + + + Nine Nines: ranch:resume_listener(3) + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    ranch:resume_listener(3)

    + +

    Name

    +

    ranch:resume_listener - Resume a suspended listener

    +

    Description

    +
    +
    resume_listener(Ref :: ranch_ref())
    +    -> ok | {error, any()}
    +
    +

    Resume a suspended listener.

    +

    Ranch will start listening for and accepting connections again. The function ranch:set_transport_options(3) can be used to change the transport options before resuming the listener.

    +

    Nothing is done when the listener is already running.

    +

    Arguments

    +
    Ref
    +

    The listener name.

    +
    +
    +

    Return value

    +

    The atom ok is returned on success.

    +

    An error tuple is returned when the listener could not be restarted.

    +

    Changelog

    +
    • 1.6: Function introduced. +
    • +
    +

    Examples

    +
    Resume a listener
    +
    +
    ok = ranch:resume_listener(example).
    +
    +

    See also

    +

    ranch:start_listener(3), ranch:stop_listener(3), ranch:suspend_listener(3), ranch:get_status(3), ranch:set_transport_options(3), ranch:wait_for_connections(3), ranch(3)

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

    + Ranch + 2.1 + 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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/ranch.set_max_connections/index.html b/docs/en/ranch/2.1/manual/ranch.set_max_connections/index.html new file mode 100644 index 00000000..4905c8b7 --- /dev/null +++ b/docs/en/ranch/2.1/manual/ranch.set_max_connections/index.html @@ -0,0 +1,194 @@ + + + + + + + + + + Nine Nines: ranch:set_max_connections(3) + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    ranch:set_max_connections(3)

    + +

    Name

    +

    ranch:set_max_connections - Set the max number of connections per connection supervisor

    +

    Description

    +
    +
    set_max_connections(Ref      :: ranch:ref(),
    +                    MaxConns :: ranch:max_conns())
    +    -> ok
    +
    +

    Set the max number of connections per connection supervisor.

    +

    The change will be applied immediately. If the new value is smaller than the previous one, Ranch will wait for the extra connections to terminate and will not accept new connections until the number of connections goes below the limit.

    +

    Arguments

    +
    Ref
    +

    The listener name.

    +
    +
    MaxConns
    +

    The new maximum number of connections per connection supervisor.

    +
    +
    +

    Return value

    +

    The atom ok is always returned. It can be safely ignored.

    +

    Changelog

    +
    • 2.0: The maximum number of connections is now per connection supervisor. +
    • +
    +

    Examples

    +
    Set the max number of connections per connection supervisor
    +
    +
    ranch:set_max_connections(example, 10000).
    +
    +

    See also

    +

    ranch:get_max_connections(3), ranch:set_protocol_options(3), ranch:set_transport_options(3), ranch(3)

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

    + Ranch + 2.1 + 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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/ranch.set_protocol_options/index.html b/docs/en/ranch/2.1/manual/ranch.set_protocol_options/index.html new file mode 100644 index 00000000..1391a86b --- /dev/null +++ b/docs/en/ranch/2.1/manual/ranch.set_protocol_options/index.html @@ -0,0 +1,200 @@ + + + + + + + + + + Nine Nines: ranch:set_protocol_options(3) + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    ranch:set_protocol_options(3)

    + +

    Name

    +

    ranch:set_protocol_options - Set the protocol options

    +

    Description

    +
    +
    set_protocol_options(Ref       :: ranch:ref(),
    +                     ProtoOpts :: any())
    +    -> ok
    +
    +

    Set the protocol options.

    +

    The change will be applied immediately for all new connections. Old connections will not receive the new options.

    +

    Note that the complete set of protocol options is replaced. To update a subset of the options, it is recommended to get the current protocol options using ranch:get_protocol_options(3), update them and then set them back using this function.

    +

    Arguments

    +
    Ref
    +

    The listener name.

    +
    +
    ProtoOpts
    +

    The new protocol options.

    +
    +
    +

    Return value

    +

    The atom ok is always returned. It can be safely ignored.

    +

    Examples

    +
    Set the protocol options
    +
    +
    ranch:set_protocol_options(example, ProtoOpts).
    +
    +
    Update some of the protocol options
    +
    +
    ProtoOpts0 = ranch:get_protocol_options(example),
    +ProtoOpts = ProtoOpts0#{request_timeout => 2000},
    +ranch:set_protocol_options(example, ProtoOpts).
    +
    +

    See also

    +

    ranch:get_protocol_options(3), ranch:set_max_connections(3), ranch:set_transport_options(3), ranch(3)

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

    + Ranch + 2.1 + 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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/ranch.set_transport_options/index.html b/docs/en/ranch/2.1/manual/ranch.set_transport_options/index.html new file mode 100644 index 00000000..e614dc57 --- /dev/null +++ b/docs/en/ranch/2.1/manual/ranch.set_transport_options/index.html @@ -0,0 +1,248 @@ + + + + + + + + + + Nine Nines: ranch:set_transport_options(3) + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    ranch:set_transport_options(3)

    + +

    Name

    +

    ranch:set_transport_options - Set the transport options

    +

    Description

    +
    +
    set_transport_options(Ref       :: ranch:ref(),
    +                      TransOpts :: ranch:opts())
    +    -> ok | {error, Reason :: term()}
    +
    +

    Set the transport options.

    +

    The complete set of transport options is replaced. To update a subset of the transport options, it is recommended to get the current transport options using ranch:get_transport_options(3), update them and then set them back using this function.

    +

    Changes to the following options will take effect...

    +
    • immediately: +
      • max_connections +
      • +
      • handshake_timeout +
      • +
      • shutdown +
      • +
      +
    • +
    • only after the listener has been suspended and resumed: +
      • num_acceptors +
      • +
      • num_listen_sockets +
      • +
      • post_listen_callback +
      • +
      • socket_opts +
      • +
      +
    • +
    • only when the entire listener is restarted: +
      • connection_type +
      • +
      • num_conns_sups +
      • +
      • logger +
      • +
      +
    • +
    +

    Arguments

    +
    Ref
    +

    The listener name.

    +
    +
    TransOpts
    +

    The new transport options.

    +
    +
    +

    Return value

    +

    The atom ok is returned on success.

    +

    An error tuple is returned on failure, for example if the given transport options contain invalid values.

    +

    Changelog

    +
    • 2.0: The restriction that the listener must be suspended has been removed. +
    • +
    • 2.0: The TransOpts argument must no longer contain Ranch-specific options if given as a list. Use a map. +
    • +
    +

    Examples

    +
    Set the transport options
    +
    +
    Ref = example,
    +
    +ok = ranch:suspend_listener(Ref),
    +ok = ranch:set_transport_options(Ref, TransOpts),
    +ok = ranch:resume_listener(Ref).
    +
    +
    Update the listener TCP port within the `socket_opts` transport option
    +
    +
    Ref = example,
    +
    +TransOpts0 = ranch:get_transport_options(Ref),
    +#{socket_opts = SocketOpts0} = TransOpts0,
    +SocketOpts = [{port, 12345}|proplists:delete(port, SocketOpts0)],
    +TransOpts = TransOpts0#{socket_opts = SocketOpts},
    +
    +ok = ranch:suspend_listener(Ref),
    +ok = ranch:set_transport_options(Ref, TransOpts),
    +ok = ranch:resume_listener(Ref).
    +
    +

    See also

    +

    ranch:suspend_listener(3), ranch:resume_listener(3), ranch:get_transport_options(3), ranch:set_max_connections(3), ranch:set_protocol_options(3), ranch(3)

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

    + Ranch + 2.1 + 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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/ranch.start_listener/index.html b/docs/en/ranch/2.1/manual/ranch.start_listener/index.html new file mode 100644 index 00000000..c36d91e7 --- /dev/null +++ b/docs/en/ranch/2.1/manual/ranch.start_listener/index.html @@ -0,0 +1,246 @@ + + + + + + + + + + Nine Nines: ranch:start_listener(3) + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    ranch:start_listener(3)

    + +

    Name

    +

    ranch:start_listener - Start a listener

    +

    Description

    +
    +
    start_listener(Ref       :: ranch_ref(),
    +               Transport :: module(),
    +               TransOpts :: ranch:opts(),
    +               Protocol  :: module(),
    +               ProtoOpts :: any())
    +    -> {ok, ListenerPid :: pid()}
    +     | {error, any()}
    +
    +

    Start a listener.

    +

    A listener is a set of processes that accepts and manages connections using the given transport and protocol modules.

    +

    Arguments

    +
    Ref
    +

    The listener name is used to refer to this listener in future calls, for example when stopping it or when updating the configuration.

    +

    It can be any Erlang term. An atom is generally good enough, for example api, my_app_clear or my_app_tls.

    +
    +
    Transport
    +

    The transport module that will be used by Ranch to accept connections and that will be passed to the protocol module along with the socket.

    +

    The interface of the transport module is documented in the ranch_transport(3) manual.

    +
    +
    TransportOpts
    +

    Transport options include the Ranch-specific options and the socket options. The listener's port number must be defined in the socket options.

    +

    Socket options may be given directly if there are no Ranch-specific options.

    +

    The available options for the built-in Ranch transports are documented in the ranch_tcp(3) and ranch_ssl(3) manuals.

    +
    +
    Protocol
    +

    The protocol module that will be used by Ranch after the connection has been accepted.

    +

    The interface of the protocol module is documented in the ranch_protocol(3) manual.

    +
    +
    ProtocolOpts
    +

    The protocol options given when calling the protocol module. Please consult the documentation of the protocol module you are using for more details.

    +
    +
    +

    Return value

    +

    An ok tuple is returned on success. It contains the pid of the top-level supervisor for the listener.

    +

    An error tuple is returned on error. The error reason may be any Erlang term.

    +

    A common error is eaddrinuse. It indicates that the port configured for Ranch is already in use.

    +

    Changelog

    +
    • 2.0: The TransOpts argument must no longer contain Ranch-specific options if given as a list. Use a map. +
    • +
    • 1.4: The NumAcceptors argument was moved to the transport options. +
    • +
    +

    Examples

    +
    Start a listener
    +
    +
    {ok, _} = ranch:start_listener(example,
    +    ranch_tcp, [{port, 8080}],
    +    cowboy_http2, #{}
    +).
    +
    +
    Start a listener with Ranch-specific options
    +
    +
    {ok, _} = ranch:start_listener(example,
    +    ranch_tcp, #{
    +        num_acceptors => 75,
    +        socket_opts => [{port, 8080}]
    +    },
    +    cowboy_http2, #{}
    +).
    +
    +
    Start a listener on a random port
    +
    +
    Ref = example,
    +
    +{ok, _} = ranch:start_listener(Ref,
    +    ranch_tcp, #{},
    +    cowboy_http2, #{}
    +),
    +
    +Port = ranch:get_port(Ref).
    +
    +

    See also

    +

    ranch:stop_listener(3), ranch:child_spec(3), ranch(3), ranch_tcp(3), ranch_ssl(3), ranch_transport(3), ranch_protocol(3)

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

    + Ranch + 2.1 + 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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/ranch.stop_listener/index.html b/docs/en/ranch/2.1/manual/ranch.stop_listener/index.html new file mode 100644 index 00000000..04f4e62c --- /dev/null +++ b/docs/en/ranch/2.1/manual/ranch.stop_listener/index.html @@ -0,0 +1,189 @@ + + + + + + + + + + Nine Nines: ranch:stop_listener(3) + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    ranch:stop_listener(3)

    + +

    Name

    +

    ranch:stop_listener - Stop a listener

    +

    Description

    +
    +
    stop_listener(Ref :: ranch_ref())
    +    -> ok | {error, not_found}
    +
    +

    Stop a listener.

    +

    The listener is stopped gracefully, first by closing the listening port, then by stopping the connection processes. These processes are stopped according to the shutdown transport option, which may be set to brutally kill all connection processes or give them some time to stop properly.

    +

    In order for the connection processes to exit gracefully, they need to trap exit signals and stop before the configured shutdown timeout. If greater control over the shutdown is required the functions ranch:suspend_listener(3) and ranch:wait_for_connections(3) can be used.

    +

    This function does not return until the listener is completely stopped.

    +

    Arguments

    +
    Ref
    +

    The listener name.

    +
    +
    +

    Return value

    +

    The atom ok is returned on success.

    +

    An error tuple is returned when the listener is not found.

    +

    Examples

    +
    Stop a listener
    +
    +
    ok = ranch:stop_listener(example).
    +
    +

    See also

    +

    ranch:start_listener(3), ranch:child_spec(3), ranch:suspend_listener(3), ranch(3)

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

    + Ranch + 2.1 + 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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/ranch.suspend_listener/index.html b/docs/en/ranch/2.1/manual/ranch.suspend_listener/index.html new file mode 100644 index 00000000..7f49de7d --- /dev/null +++ b/docs/en/ranch/2.1/manual/ranch.suspend_listener/index.html @@ -0,0 +1,193 @@ + + + + + + + + + + Nine Nines: ranch:suspend_listener(3) + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    ranch:suspend_listener(3)

    + +

    Name

    +

    ranch:suspend_listener - Suspend a running listener

    +

    Description

    +
    +
    suspend_listener(Ref :: ranch_ref())
    +    -> ok | {error, any()}
    +
    +

    Suspend a running listener.

    +

    Ranch will stop listening for and accepting connections and the listening socket will be closed. Existing connections will continue undisturbed. The function ranch:wait_for_connections(3) can be used to wait for connections to be closed if necessary.

    +

    Some transport options can only be changed when the listener is suspended. Please consult the ranch:set_transport_options(3) manual for more information.

    +

    Nothing is done when the listener is already suspended.

    +

    Arguments

    +
    Ref
    +

    The listener name.

    +
    +
    +

    Return value

    +

    The atom ok is returned on success.

    +

    An error tuple is returned when the listener could not be suspended.

    +

    Changelog

    +
    • 1.6: Function introduced. +
    • +
    +

    Examples

    +
    Suspend a listener
    +
    +
    ok = ranch:suspend_listener(example).
    +
    +

    See also

    +

    ranch:start_listener(3), ranch:stop_listener(3), ranch:resume_listener(3), ranch:get_status(3), ranch:set_transport_options(3), ranch:wait_for_connections(3), ranch(3)

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

    + Ranch + 2.1 + 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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/ranch.wait_for_connections/index.html b/docs/en/ranch/2.1/manual/ranch.wait_for_connections/index.html new file mode 100644 index 00000000..596caa0e --- /dev/null +++ b/docs/en/ranch/2.1/manual/ranch.wait_for_connections/index.html @@ -0,0 +1,213 @@ + + + + + + + + + + Nine Nines: ranch:wait_for_connections(3) + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    ranch:wait_for_connections(3)

    + +

    Name

    +

    ranch:wait_for_connections - Wait for a specific number of connections

    +

    Description

    +
    +
    wait_for_connections(Ref      :: ranch:ref(),
    +                     Operator,
    +                     NumConns :: non_neg_integer())
    +    -> ok
    +
    +Operator :: '>' | '>=' | '==' | '=<' | '<'
    +
    +

    Wait for a specific number of connections.

    +

    This function waits until the number of connections on the given listener becomes higher than, equal to or lower than the given number. It never returns otherwise.

    +

    This function can be used to gracefully shutdown a listener by first suspending the listener and then waiting for connections to terminate before finally stopping the listener.

    + +

    Arguments

    +
    Ref
    +

    The listener name.

    +
    +
    Operator
    +

    The operator to use for the comparison.

    +
    +
    NumConns
    +

    The number of connections to reach.

    +
    +
    +

    Return value

    +

    The atom ok is always returned. It can be safely ignored.

    +

    Changelog

    +
    • 1.6: Function introduced. +
    • +
    +

    Examples

    +
    Wait for at least 100 connections
    +
    +
    ranch:wait_for_connections(example, '>=', 100).
    +
    +
    Gracefully shutdown a listener
    +
    +
    Ref = example,
    +
    +ok = ranch:suspend_listener(Ref),
    +ranch:wait_for_connections(Ref, '==', 0),
    +ok = ranch:stop_listener(Ref).
    +
    +

    See also

    +

    ranch:stop_listener(3), ranch:suspend_listener(3), ranch:resume_listener(3), ranch(3)

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

    + Ranch + 2.1 + 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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/ranch/index.html b/docs/en/ranch/2.1/manual/ranch/index.html new file mode 100644 index 00000000..656d8d80 --- /dev/null +++ b/docs/en/ranch/2.1/manual/ranch/index.html @@ -0,0 +1,338 @@ + + + + + + + + + + Nine Nines: ranch(3) + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    ranch(3)

    + +

    Name

    +

    ranch - Socket acceptor pool

    +

    Description

    +

    The module ranch provides functions for starting and manipulating Ranch listeners.

    +

    Exports

    +

    Start/stop:

    + +

    Suspend/resume:

    + +

    Connections:

    + +

    Options:

    + +

    Introspection:

    + +

    Types

    +

    max_conns()

    +
    +
    max_conns() = non_neg_integer() | infinity
    +
    +

    Maximum number of connections allowed per connection supervisor.

    +

    This is a soft limit. The actual number of connections might be slightly above the limit due to concurrency when accepting new connections. Some connections may also be removed from this count explicitly by the user code.

    +

    opts()

    +
    +
    opts() = any() | transport_opts(any())
    +
    +

    Transport or socket options.

    +

    ref()

    +
    +
    ref() = any()
    +
    +

    Unique name used to refer to a listener.

    +

    transport_opts(SocketOpts)

    +
    +
    transport_opts(SocketOpts) = #{
    +    alarms               => #{
    +                                term() => #{
    +                                    type := num_connections,
    +                                    treshold := non_neg_integer(),
    +                                    callback := fun((ref(), term(), pid(), [pid()]) -> any()),
    +                                    cooldown => non_neg_integer()
    +                                }
    +                            },
    +    connection_type      => worker | supervisor,
    +    handshake_timeout    => timeout(),
    +    max_connections      => max_conns(),
    +    logger               => module(),
    +    num_acceptors        => pos_integer(),
    +    num_conns_sups       => pos_integer(),
    +    post_listen_callback => fun((term()) -> ok | {error, term()}),
    +    shutdown             => timeout() | brutal_kill,
    +    socket_opts          => SocketOpts
    +}
    +
    +

    Transport options.

    +

    The transport options are a combination of Ranch-specific options and transport-specific socket options.

    +

    None of the options are required.

    +
    alarms (#{})
    +

    Alarms to call a function when the number of connections tracked by one connection supervisor reaches or exceeds a defined treshold.

    +

    The map keys are the alarm names, which can be any term. The associated values are the respective alarm options, again in a map with the following keys:

    +
    type
    +

    Must be set to num_connections.

    +
    +
    treshold
    +

    Treshold value, which must be a non_neg_integer. When the number of connections tracked by a single connection supervisor reaches or exceeds this value, The alarm will trigger and call the function defined in the callback key (see below).

    +
    +
    callback
    +

    The alarm function, which takes the listener name, the alarm name, the pid of the connection supervisor and a list of the pids of all connection processes under that supervisor as arguments. The return value is ignored.

    +
    +
    cooldown (5000)
    +

    The minimum time after which the alarm can be triggered again, in milliseconds.

    +
    +
    +
    +
    connection_type (worker)
    +

    Type of process that will handle the connection.

    +
    +
    handshake_timeout (5000)
    +

    Maximum allowed time for the ranch:handshake/1,2 call to finish.

    +
    +
    logger (logger)
    +

    The module that will be used to write log messages.

    +
    +
    max_connections (1024)
    +

    Maximum number of active connections per connection supervisor. Soft limit. Use infinity to disable the limit entirely.

    +
    +
    num_acceptors (10)
    +

    Number of processes that accept connections.

    +
    +
    num_conns_sups - see below
    +

    Number of processes that supervise connection processes. If not specified, defaults to be equal to num_acceptors.

    +
    +
    post_listen_callback (fun(_ListenSock) -> ok end)
    +

    A function which will be called after a listen socket has been successfully created, with the socket as argument. It can be used to perform any necessary setup steps on the socket.

    +

    If the callback function returns ok, the listener will start accepting connections on the socket. If it returns {error, Reason}, the listener will fail to start.

    +
    +
    shutdown (5000)
    +

    Maximum allowed time for children to stop on listener shutdown.

    +
    +
    socket_opts
    +

    Socket options to be used by Transport:listen/1. Please refer to the documentation of the transport module you are using for more details.

    +
    +
    +

    Changelog

    +
    • 2.0: The type transport_opts(SocketOpts) was added. +
    • +
    • 2.0: The function ranch:accept_ack/1 was removed in favor of ranch:handshake(3). +
    • +
    • 2.0: The option max_connections is now per connection supervisor. +
    • +
    • 2.0: The num_conns_sup option was added. +
    • +
    • 2.0: The socket option was removed. +
    • +
    • 2.0: The logger option is no longer experimental. It now defaults to logger instead of error_logger. +
    • +
    • 2.0: The opt() type was removed. +
    • +
    • 1.6: The experimental logger option was added. +
    • +
    • 1.6: The opt() type was deprecated in favor of the new opts() type. +
    • +
    +

    See also

    +

    ranch(7)

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

    + Ranch + 2.1 + 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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/ranch_app/index.html b/docs/en/ranch/2.1/manual/ranch_app/index.html new file mode 100644 index 00000000..ea3ec7d8 --- /dev/null +++ b/docs/en/ranch/2.1/manual/ranch_app/index.html @@ -0,0 +1,201 @@ + + + + + + + + + + Nine Nines: ranch(7) + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    ranch(7)

    + +

    Name

    +

    ranch - Socket acceptor pool for TCP protocols

    +

    Description

    +

    Ranch is a socket acceptor pool for TCP protocols.

    +

    Ranch manages listeners which are a set of processes that accept and manage connections. The connection's transport and protocol modules are configured per listener. Listeners can be inspected and reconfigured without interruptions in service.

    +

    Modules

    +

    Functions:

    + +

    Transports:

    + +

    Behaviors:

    + +

    Dependencies

    +
    • ssl - Secure communication over sockets +
    • +
    +

    All these applications must be started before the ranch application. To start Ranch and all dependencies at once:

    +
    +
    {ok, _} = application:ensure_all_started(ranch).
    +
    +

    Environment

    +

    The ranch application defines one application environment configuration parameter.

    +
    profile (false)
    +

    When enabled, Ranch will start eprof profiling automatically.

    +

    You can use the ranch_app:profile_output/0 function to stop profiling and output the results to the files procs.profile and total.profile. Do not use in production.

    +
    +
    +

    See also

    +

    ssl(7)

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

    + Ranch + 2.1 + 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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/ranch_protocol/index.html b/docs/en/ranch/2.1/manual/ranch_protocol/index.html new file mode 100644 index 00000000..8ef9d06f --- /dev/null +++ b/docs/en/ranch/2.1/manual/ranch_protocol/index.html @@ -0,0 +1,186 @@ + + + + + + + + + + Nine Nines: ranch_protocol(3) + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    ranch_protocol(3)

    + +

    Name

    +

    ranch_protocol - Protocol modules

    +

    Description

    +

    The module ranch_protocol defines the interface used by Ranch protocols.

    +

    Callbacks

    +

    Ranch protocols implement the following interface:

    +
    +
    start_link(Ref       :: ranch:ref(),
    +           Transport :: module(),
    +           ProtoOpts :: any())
    +    -> {ok, ConnPid :: pid()}
    +     | {ok, SupPid :: pid(), ConnPid :: pid()}
    +
    +

    Start a new connection process.

    +

    The only purpose of this callback is to start a process that will handle the socket. It must spawn the process, link and then return the new pid. This function will always be called from inside a supervisor.

    +

    This callback can also return two pids. The first pid is the pid of the process that will be supervised. The second pid is the pid of the process that will receive ownership of the socket. This second process must be a child of the first. This form is only available when connection_type is set to supervisor.

    +

    If any other value is returned, the supervisor will close the socket and assume no process has been started.

    +

    Do not perform any operations in this callback, as this would block the supervisor responsible for starting connection processes and degrade performance severely.

    +

    Changelog

    +
    • 2.0: The second argument Socket was removed. +
    • +
    • 1.6: The second argument Socket was deprecated. Call ranch:handshake(3) to obtain the socket. +
    • +
    +

    See also

    +

    ranch:handshake(3), ranch(7)

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

    + Ranch + 2.1 + 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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/ranch_proxy_header.header/index.html b/docs/en/ranch/2.1/manual/ranch_proxy_header.header/index.html new file mode 100644 index 00000000..14a6546f --- /dev/null +++ b/docs/en/ranch/2.1/manual/ranch_proxy_header.header/index.html @@ -0,0 +1,220 @@ + + + + + + + + + + Nine Nines: ranch_proxy_header:header(3) + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    ranch_proxy_header:header(3)

    + +

    Name

    +

    ranch_proxy_header:header - Build a PROXY protocol header

    +

    Description

    +
    +
    header(ProxyInfo)            -> header(ProxyInfo, #{})
    +header(ProxyInfo, BuildOpts) -> iodata()
    +
    +ProxyInfo :: ranch_proxy_header:proxy_info()
    +BuildOpts :: #{
    +    checksum => crc32c,
    +    padding  => pos_integer() %% >= 3
    +}
    +
    +

    Build a PROXY protocol header.

    +

    Arguments

    +
    ProxyInfo
    +

    The proxy information to encode.

    +
    +
    BuildOpts
    +

    Options to control whether to add a checksum or padding should be included in the encoded PROXY protocol header.

    +
    +
    +

    Return value

    +

    The PROXY protocol header is returned.

    +

    Changelog

    +
    • 1.7: Function introduced. +
    • +
    +

    Examples

    +
    Build a PROXY protocol header
    +
    +
    ProxyInfo = #{
    +    version => 2,
    +    command => proxy,
    +
    +    transport_family   => ipv4,
    +    transport_protocol => stream,
    +
    +    src_address  => {192, 168, 1, 11},
    +    src_port     => 54321,
    +    dest_address => {192, 168, 1, 42},
    +    dest_port    => 443
    +},
    +Data = ranch_proxy_header:parse(ProxyInfo).
    +
    +
    Build a PROXY protocol header with checksum and padding
    +
    +
    Data = ranch_proxy_header:parse(ProxyInfo, #{
    +    checksum => crc32c,
    +    padding  => 7
    +}).
    +
    +

    See also

    +

    ranch_proxy_header:header(3), ranch_proxy_header(3)

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

    + Ranch + 2.1 + 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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/ranch_proxy_header.parse/index.html b/docs/en/ranch/2.1/manual/ranch_proxy_header.parse/index.html new file mode 100644 index 00000000..4206fead --- /dev/null +++ b/docs/en/ranch/2.1/manual/ranch_proxy_header.parse/index.html @@ -0,0 +1,191 @@ + + + + + + + + + + Nine Nines: ranch_proxy_header:parse(3) + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    ranch_proxy_header:parse(3)

    + +

    Name

    +

    ranch_proxy_header:parse - Parse a PROXY protocol header

    +

    Description

    +
    +
    parse(Data :: binary())
    +    -> {ok, ranch_proxy_header:proxy_info(), Rest :: binary()}
    +     | {error, HumanReadable :: atom()}
    +
    +

    Parse a PROXY protocol header.

    +

    Arguments

    +
    Data
    +

    The PROXY protocol header optionally followed by more data.

    +
    +
    +

    Return value

    +

    An ok tuple is returned on success, containing the proxy information found in the header and the rest of the data if more was provided.

    +

    An error tuple is returned when a protocol error is detected. It contains a human readable message about the error.

    +

    Changelog

    +
    • 1.7: Function introduced. +
    • +
    +

    Examples

    +
    Parse the PROXY protocol header
    +
    +
    {ok ProxyInfo, Rest} = ranch_proxy_header:parse(Data).
    +
    +

    See also

    +

    ranch_proxy_header:header(3), ranch_proxy_header:to_connection_info(3), ranch_proxy_header(3)

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

    + Ranch + 2.1 + 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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/ranch_proxy_header.to_connection_info/index.html b/docs/en/ranch/2.1/manual/ranch_proxy_header.to_connection_info/index.html new file mode 100644 index 00000000..2515bcae --- /dev/null +++ b/docs/en/ranch/2.1/manual/ranch_proxy_header.to_connection_info/index.html @@ -0,0 +1,190 @@ + + + + + + + + + + Nine Nines: ranch_proxy_header:to_connection_info(3) + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    ranch_proxy_header:to_connection_info(3)

    + +

    Name

    +

    ranch_proxy_header:to_connection_info - Convert proxy_info() to ssl:connection_info()

    +

    Description

    +
    +
    to_connection_info(ProxyInfo :: proxy_info())
    +    -> ssl:connection_info()
    +
    +

    Convert ranch_proxy_header:proxy_info() information to the ssl:connection_info() format returned by ssl:connection_information/1,2.

    +

    Arguments

    +
    ProxyInfo
    +

    The PROXY protocol information.

    +
    +
    +

    Return value

    +

    Connection information is returned as a proplist.

    +

    Because the PROXY protocol header includes limited information, only the keys protocol, selected_cipher_suite and sni_hostname will be returned, at most. All keys are optional.

    +

    Changelog

    +
    • 2.1: Function introduced. +
    • +
    +

    Examples

    +
    Convert the PROXY protocol information
    +
    +
    ConnInfo = ranch_proxy_header:to_connection_info(ProxyInfo).
    +
    +

    See also

    +

    ranch_proxy_header:parse(3), ranch_proxy_header(3)

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

    + Ranch + 2.1 + 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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/ranch_proxy_header/index.html b/docs/en/ranch/2.1/manual/ranch_proxy_header/index.html new file mode 100644 index 00000000..ac7e16c5 --- /dev/null +++ b/docs/en/ranch/2.1/manual/ranch_proxy_header/index.html @@ -0,0 +1,276 @@ + + + + + + + + + + Nine Nines: ranch_proxy_header(3) + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    ranch_proxy_header(3)

    + +

    Name

    +

    ranch_proxy_header - PROXY protocol

    +

    Description

    +

    The module ranch_proxy_header provides functions for parsing and building the PROXY protocol header.

    +

    Exports

    + +

    Types

    +

    proxy_info()

    +
    +
    proxy_info() = #{
    +    %% Mandatory part.
    +    version := 1 | 2,
    +    command := local | proxy,
    +    transport_family   => undefined | ipv4 | ipv6 | unix,
    +    transport_protocol => undefined | stream | dgram,
    +
    +    %% Addresses.
    +    src_address  => inet:ip_address() | binary(),
    +    src_port     => inet:port_number(),
    +    dest_address => inet:ip_address() | binary(),
    +    dest_port    => inet:port_number(),
    +
    +    %% Extra TLV-encoded data.
    +    alpn      => binary(), %% US-ASCII.
    +    authority => binary(), %% UTF-8.
    +    netns     => binary(), %% US-ASCII.
    +    ssl       => #{
    +        client   := [ssl | cert_conn | cert_sess],
    +        verified := boolean(),
    +        version  => binary(), %% US-ASCII.
    +        cipher   => binary(), %% US-ASCII.
    +        sig_alg  => binary(), %% US-ASCII.
    +        key_alg  => binary(), %% US-ASCII.
    +        cn       => binary()  %% UTF-8.
    +    },
    +
    +    %% Unknown TLVs can't be parsed so the raw data is given.
    +    raw_tlvs => [{0..255, binary()}]
    +}.
    +
    +

    The PROXY protocol information.

    +

    The following fields may be found, although most of them are optional:

    +
    version
    +

    The PROXY protocol version used.

    +
    +
    command
    +

    proxy is used for proxied connections. local for non-proxied connections. Those do not have any additional information.

    +
    +
    transport_family
    +

    The transport family of the original connection.

    +
    +
    transport_protocol
    +

    The transport protocol of the original connection.

    +
    +
    src_address
    +

    The source address of the original connection. This is the original address of the client.

    +
    +
    src_port
    +

    The source port of the original connection. This is the port the client opened on its end for the connection. It is not defined for UNIX domain sockets.

    +
    +
    dest_address
    +

    The destination address of the original connection.

    +
    +
    dest_port
    +

    The destination port of the original connection. It is not defined for UNIX domain sockets.

    +
    +
    alpn
    +

    The upper layer protocol in use over the connection. This is typically negotiated via the ALPN extension for TLS.

    +
    +
    authority
    +

    The host name serving as authority for the connection. This is typically passed using the SNI extension for TLS.

    +
    +
    netns
    +

    The namespace's name for the original connection.

    +
    +
    ssl
    +

    Various information pertaining to the original SSL/TLS connection.

    +
    client
    +

    A list containing a number of flags. ssl indicates that the client connected over SSL/TLS. cert_conn indicates that the client provided a certificate over the original connection. cert_sess indicates that the client provided a certificate at least once over the TLS session this connection belongs to.

    +
    +
    verified
    +

    Whether the client presented a certificate and it was successfully verified.

    +
    +
    version
    +

    The US-ASCII string containing the SSL/TLS version used for the original connection.

    +
    +
    cipher
    +

    The US-ASCII string name of the cipher used.

    +
    +
    sig_alg
    +

    The US-ASCII string name of the algorithm used to sign the certificate provided by the client.

    +
    +
    key_alg
    +

    The US-ASCII string name of the algorithm used to generate the key of the certificate provided by the client.

    +
    +
    cn
    +

    The UTF-8 string representation of the Common Name field of the client certificate's Distinguished Name.

    +
    +
    +
    +
    raw_tlvs
    +

    The non-standard TLVs that Ranch was not able to parse.

    +
    +
    +

    Changelog

    +
    • 1.7: Module introduced. +
    • +
    +

    See also

    +

    ranch(7)

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

    + Ranch + 2.1 + 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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/ranch_ssl/index.html b/docs/en/ranch/2.1/manual/ranch_ssl/index.html new file mode 100644 index 00000000..ca990304 --- /dev/null +++ b/docs/en/ranch/2.1/manual/ranch_ssl/index.html @@ -0,0 +1,384 @@ + + + + + + + + + + Nine Nines: ranch_ssl(3) + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    ranch_ssl(3)

    + +

    Name

    +

    ranch_ssl - SSL transport

    +

    Description

    +

    The module ranch_ssl implements an SSL Ranch transport.

    +

    Exports

    +

    The module ranch_ssl implements the interface defined by ranch_transport(3).

    +

    Types

    +

    opt()

    +
    +
    opt() :: ranch_tcp:opt() | ssl_opt()
    +
    +

    Listen options.

    +

    The TCP options are defined in ranch_tcp(3).

    +

    opts()

    +
    +
    opts() :: [opt()]
    +
    +

    List of listen options.

    +

    ssl_opt()

    +
    +
    ssl_opt() = {alpn_preferred_protocols, [binary()]}
    +          | {anti_replay, '10k' | '100k' | {integer(), integer(), integer()}}
    +          | {beast_mitigation, one_n_minus_one | zero_n | disabled}
    +          | {cacertfile, file:filename()}
    +          | {cacerts, [public_key:der_encoded()]}
    +          | {cert, public_key:der_encoded()}
    +          | {certfile, file:filename()}
    +          | {ciphers, ssl:ciphers()}
    +          | {client_renegotiation, boolean()}
    +          | {crl_cache, [any()]}
    +          | {crl_check, boolean() | peer | best_effort}
    +          | {depth, integer()}
    +          | {dh, binary()}
    +          | {dhfile, file:filename()}
    +          | {eccs, [ssl:named_curve()]}
    +          | {fail_if_no_peer_cert, boolean()}
    +          | {handshake, hello | full}
    +          | {hibernate_after, timeout()}
    +          | {honor_cipher_order, boolean()}
    +          | {honor_ecc_order, boolean()}
    +          | {key, ssl:key()}
    +          | {key_update_at, pos_integer()}
    +          | {keyfile, file:filename()}
    +          | {log_alert, boolean()}
    +          | {log_level, logger:level()}
    +          | {max_handshake_size, integer()}
    +          | {middlebox_comp_mode, boolean()}
    +          | {next_protocols_advertised, [binary()]}
    +          | {padding_check, boolean()}
    +          | {partial_chain, fun()}
    +          | {password, string()}
    +          | {protocol, tls | dtls}
    +          | {psk_identity, string()}
    +          | {reuse_session, fun()}
    +          | {reuse_sessions, boolean()}
    +          | {secure_renegotiate, boolean()}
    +          | {session_tickets, disabled | stateful | stateless}
    +          | {signature_algs, [{ssl:hash(), ssl:sign_algo()}]}
    +          | {signature_algs_cert, [ssl:sign_scheme()]}
    +          | {sni_fun, fun()}
    +          | {sni_hosts, [{string(), ssl_opt()}]}
    +          | {supported_groups, [ssl:group()]}
    +          | {user_lookup_fun, {fun(), any()}}
    +          | {verify, verify_none | verify_peer}
    +          | {verify_fun, {fun(), any()}}
    +          | {versions, [ssl:protocol_version()]}
    +
    +

    SSL-specific listen options.

    +

    Specifying a certificate is mandatory, either through the cert or certfile option, or by configuring SNI. None of the other options are required.

    +

    The default value is given next to the option name:

    +
    alpn_preferred_protocols
    +

    Perform Application-Layer Protocol Negotiation with the given list of preferred protocols.

    +
    +
    anti_replay
    +

    Configures the server's built-in anti replay feature based on Bloom filters.

    +
    +
    beast_mitigation (one_n_minus_one)
    +

    Change the BEAST mitigation strategy for SSL-3.0 and TLS-1.0 to interoperate with legacy software.

    +
    +
    cacertfile
    +

    Path to PEM encoded trusted certificates file used to verify peer certificates.

    +
    +
    cacerts
    +

    List of DER encoded trusted certificates.

    +
    +
    cert
    +

    DER encoded user certificate.

    +
    +
    certfile
    +

    Path to the PEM encoded user certificate file. May also contain the private key.

    +
    +
    ciphers
    +

    List of ciphers that clients are allowed to use.

    +
    +
    client_renegotiation (true)
    +

    Whether to allow client-initiated renegotiation.

    +
    +
    crl_cache ({ssl_crl_cache, {internal, []}})
    +

    Customize the module used to cache Certificate Revocation Lists.

    +
    +
    crl_check (false)
    +

    Whether to perform CRL check on all certificates in the chain during validation.

    +
    +
    depth (1)
    +

    Maximum of intermediate certificates allowed in the certification path.

    +
    +
    dh
    +

    DER encoded Diffie-Hellman parameters.

    +
    +
    dhfile
    +

    Path to the PEM encoded Diffie-Hellman parameters file.

    +
    +
    eccs
    +

    List of named ECC curves.

    +
    +
    fail_if_no_peer_cert (false)
    +

    Whether to refuse the connection if the client sends an empty certificate.

    +
    +
    handshake (full)
    +

    If hello is specified for this option, the handshake is paused after receiving the client hello message. The handshake can then be resumed via handshake_continue/3, or cancelled via handshake_cancel/1.

    +

    This option cannot be given to ranch:handshake/1,2.

    +
    +
    hibernate_after (undefined)
    +

    Time in ms after which SSL socket processes go into hibernation to reduce memory usage.

    +
    +
    honor_cipher_order (false)
    +

    If true, use the server's preference for cipher selection. If false, use the client's preference.

    +
    +
    honor_ecc_order (false)
    +

    If true, use the server's preference for ECC curve selection. If false, use the client's preference.

    +
    +
    key
    +

    DER encoded user private key.

    +
    +
    key_update_at
    +

    Configures the maximum amount of bytes that can be sent on a TLS 1.3 connection before an automatic key update is performed.

    +
    +
    keyfile
    +

    Path to the PEM encoded private key file, if different from the certfile.

    +
    +
    log_alert (true)
    +

    If false, error reports will not be displayed.

    +
    +
    log_level
    +

    Specifies the log level for TLS/DTLS.

    +
    +
    max_handshake_size (256*1024)
    +

    Used to limit the size of valid TLS handshake packets to avoid DoS attacks.

    +
    +
    middlebox_comp_mode (true)
    +

    Configures the middlebox compatibility mode on a TLS 1.3 connection.

    +
    +
    next_protocols_advertised
    +

    List of protocols to send to the client if it supports the Next Protocol extension.

    +
    +
    padding_check
    +

    Allow disabling the block cipher padding check for TLS-1.0 to be able to interoperate with legacy software.

    +
    +
    partial_chain
    +

    Claim an intermediate CA in the chain as trusted.

    +
    +
    password
    +

    Password to the private key file, if password protected.

    +
    +
    protocol (tls)
    +

    Choose TLS or DTLS protocol for the transport layer security.

    +
    +
    psk_identity
    +

    Provide the given PSK identity hint to the client during the handshake.

    +
    +
    reuse_session
    +

    Custom policy to decide whether a session should be reused.

    +
    +
    reuse_sessions (false)
    +

    Whether to allow session reuse.

    +
    +
    secure_renegotiate (false)
    +

    Whether to reject renegotiation attempts that do not conform to RFC5746.

    +
    +
    session_tickets
    +

    Configures the session ticket functionality.

    +
    +
    signature_algs
    +

    The TLS signature algorithm extension may be used, from TLS 1.2, to negotiate which signature algorithm to use during the TLS handshake.

    +
    +
    signature_algs_cert
    +

    List of signature schemes for the signature_algs_cert extension introduced in TLS 1.3, in order to make special requirements on signatures used in certificates.

    +
    +
    sni_fun
    +

    Function called when the client requests a host using Server Name Indication. Returns options to apply.

    +
    +
    sni_hosts
    +

    Options to apply for the host that matches what the client requested with Server Name Indication.

    +
    +
    supported_groups([x25519, x448, secp256r1, secp384r1])
    +

    TLS 1.3 introduces the supported_groups extension that is used for negotiating the Diffie-Hellman parameters in a TLS 1.3 handshake. Both client and server can specify a list of parameters that they are willing to use.

    +
    +
    user_lookup_fun
    +

    Function called to determine the shared secret when using PSK, or provide parameters when using SRP.

    +
    +
    verify (verify_none)
    +

    Use verify_peer to request a certificate from the client.

    +
    +
    verify_fun
    +

    Custom policy to decide whether a client certificate is valid.

    +
    +
    versions
    +

    TLS protocol versions that will be supported.

    +
    +
    +

    Note that the client will not send a certificate unless the value for the verify option is set to verify_peer. This means that fail_if_no_peer_cert only applies when combined with the verify option. The verify_fun option allows greater control over the client certificate validation.

    +

    The options sni_fun and sni_hosts are mutually exclusive.

    +

    Changelog

    +
    • 2.0: The ssl_opt() type was updated for OTP-23.0. +
    • +
    +

    See also

    +

    ranch(7), ranch_transport(3), ranch_tcp(3), ssl(3)

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

    + Ranch + 2.1 + 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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/ranch_tcp/index.html b/docs/en/ranch/2.1/manual/ranch_tcp/index.html new file mode 100644 index 00000000..f5bfa2aa --- /dev/null +++ b/docs/en/ranch/2.1/manual/ranch_tcp/index.html @@ -0,0 +1,286 @@ + + + + + + + + + + Nine Nines: ranch_tcp(3) + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    ranch_tcp(3)

    + +

    Name

    +

    ranch_tcp - TCP transport

    +

    Description

    +

    The module ranch_tcp implements a TCP Ranch transport.

    +

    The function sendfile may not work correctly when used against files stored in a VirtualBox shared folder.

    +

    Exports

    +

    The module ranch_tcp implements the interface defined by ranch_transport(3).

    +

    Types

    +

    opt()

    +
    +
    opt() = {backlog, non_neg_integer()}
    +      | {buffer, non_neg_integer()}
    +      | {delay_send, boolean()}
    +      | {dontroute, boolean()}
    +      | {exit_on_close, boolean()}
    +      | {fd, non_neg_integer()}
    +      | {high_msgq_watermark, non_neg_integer()}
    +      | {high_watermark, non_neg_integer()}
    +      | inet
    +      | inet6
    +      | {ip, inet:ip_address() | inet:local_address()}
    +      | {ipv6_v6only, boolean()}
    +      | {keepalive, boolean()}
    +      | {linger, {boolean(), non_neg_integer()}}
    +      | {low_msgq_watermark, non_neg_integer()}
    +      | {low_watermark, non_neg_integer()}
    +      | {nodelay, boolean()}
    +      | {port, inet:port_number()}
    +      | {priority, integer()}
    +      | {raw, non_neg_integer(), non_neg_integer(), binary()}
    +      | {recbuf, non_neg_integer()}
    +      | {send_timeout, timeout()}
    +      | {send_timeout_close, boolean()}
    +      | {sndbuf, non_neg_integer()}
    +      | {tos, integer()}
    +
    +

    Listen options.

    +

    Note that additional options may be set by the protocol module using Transport:setopts/2.

    +

    None of the options are required.

    +

    Please consult the gen_tcp and inet manuals for a more thorough description of these options. This manual only aims to provide a short description along with what the defaults are. Defaults may be different in Ranch compared to gen_tcp. Defaults are given next to the option name:

    +
    backlog (1024)
    +

    Max length of the queue of pending connections.

    +
    +
    buffer
    +

    Size of the buffer used by the Erlang driver. Default is system-dependent.

    +
    +
    delay_send (false)
    +

    Always queue data before sending, to send fewer, larger packets over the network.

    +
    +
    dontroute (false)
    +

    Don't send via a gateway, only send to directly connected hosts.

    +
    +
    exit_on_close (true)
    +

    Disable to allow sending data after a close has been detected.

    +
    +
    fd
    +

    File descriptor of the socket, if it was opened externally.

    +
    +
    high_msgq_watermark (8192)
    +

    Limit in the amount of data in the socket message queue before the queue becomes busy.

    +
    +
    high_watermark (8192)
    +

    Limit in the amount of data in the ERTS socket implementation's queue before the socket becomes busy.

    +
    +
    inet
    +

    Set up the socket for IPv4.

    +
    +
    inet6
    +

    Set up the socket for IPv6.

    +
    +
    ip
    +

    Interface to listen on. Listen on all network interfaces by default.

    +
    +
    +

    On UNIX systems, it is also possible to use a UNIX Domain socket file by specifying {local, SocketFile}.

    +
    ipv6_v6only (false)
    +

    Listen on IPv4 and IPv6 (false) or only on IPv6 (true). Use with inet6.

    +
    +
    keepalive (false)
    +

    Enable sending of keep-alive messages.

    +
    +
    linger ({false, 0})
    +

    Whether to wait and how long to flush data sent before closing the socket.

    +
    +
    low_msgq_watermark (4096)
    +

    Amount of data in the socket message queue before the queue leaves busy state.

    +
    +
    low_watermark (4096)
    +

    Amount of data in the ERTS socket implementation's queue before the socket leaves busy state.

    +
    +
    nodelay (true)
    +

    Whether to enable TCP_NODELAY.

    +
    +
    port (0)
    +

    TCP port number to listen on. 0 means a random port will be used.

    +
    +
    priority (0)
    +

    Priority value for all packets to be sent on this socket.

    +
    +
    recbuf
    +

    Minimum size of the socket's receive buffer. Default is system-dependent.

    +
    +
    send_timeout (30000)
    +

    How long the send call may wait for confirmation before returning.

    +
    +
    send_timeout_close (true)
    +

    Whether to close the socket when the confirmation wasn't received.

    +
    +
    sndbuf
    +

    Minimum size of the socket's send buffer. Default is system-dependent.

    +
    +
    tos
    +

    Value for the IP_TOS IP level option. Use with caution.

    +
    +
    +

    In addition, the raw option can be used to set system-specific options by specifying the protocol level, the option number and the actual option value specified as a binary. This option is not portable. Use with caution.

    +

    opts()

    +
    +
    opts() :: [opt()]
    +
    +

    List of listen options.

    +

    See also

    +

    ranch(7), ranch_transport(3), ranch_ssl(3), gen_tcp(3), inet(3)

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

    + Ranch + 2.1 + 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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/ranch_transport.sendfile/index.html b/docs/en/ranch/2.1/manual/ranch_transport.sendfile/index.html new file mode 100644 index 00000000..3677b19f --- /dev/null +++ b/docs/en/ranch/2.1/manual/ranch_transport.sendfile/index.html @@ -0,0 +1,220 @@ + + + + + + + + + + Nine Nines: ranch_transport:sendfile(3) + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    ranch_transport:sendfile(3)

    + +

    Name

    +

    ranch_transport:sendfile - Send a file on the socket

    +

    Description

    +
    +
    sendfile(Transport :: module(),
    +         Socket    :: ranch_transport:socket(),
    +         File      :: file:name_all() | file:fd(),
    +         Offset    :: non_neg_integer(),
    +         Bytes     :: non_neg_integer(),
    +         Opts      :: ranch_transport:sendfile_opts())
    +    -> {ok, SentBytes :: non_neg_integer()} | {error, atom()}
    +
    +

    Send a file on the socket.

    +

    The file may be sent full or in parts, and may be specified by its filename or by an already open file descriptor.

    +

    This function emulates the function file:sendfile/2,4,5 and may be used when transports are not manipulating TCP directly.

    +

    Arguments

    +
    Transport
    +

    The transport module.

    +
    +
    Socket
    +

    The socket.

    +
    +
    File
    +

    The filename or file descriptor for the file to be sent.

    +
    +
    Offset
    +

    Start position in the file, in bytes.

    +
    +
    Bytes
    +

    Length in bytes.

    +
    +
    Opts
    +

    Additional options.

    +
    +
    +

    Return value

    +

    The number of bytes actually sent is returned on success inside an ok tuple.

    +

    An error tuple is returned otherwise.

    +

    Changelog

    +
    • 1.6: The type of the File argument was extended. +
    • +
    +

    Examples

    +
    Implement Transport:sendfile using the fallback
    +
    +
    sendfile(Socket, Filename) ->
    +    sendfile(Socket, Filename, 0, 0, []).
    +
    +sendfile(Socket, File, Offset, Bytes) ->
    +    sendfile(Socket, File, Offset, Bytes, []).
    +
    +sendfile(Socket, File, Offset, Bytes, Opts) ->
    +    ranch_transport:sendfile(?MODULE, Socket,
    +        File, Offset, Bytes, Opts).
    +
    +

    See also

    +

    ranch_transport(3)

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

    + Ranch + 2.1 + 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.

    + + + +
    +
    +
    +
    + + + + + + + + + diff --git a/docs/en/ranch/2.1/manual/ranch_transport/index.html b/docs/en/ranch/2.1/manual/ranch_transport/index.html new file mode 100644 index 00000000..dea04f2c --- /dev/null +++ b/docs/en/ranch/2.1/manual/ranch_transport/index.html @@ -0,0 +1,427 @@ + + + + + + + + + + Nine Nines: ranch_transport(3) + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    ranch_transport(3)

    + +

    Name

    +

    ranch_transport - Transport modules

    +

    Description

    +

    The module ranch_transport defines the interface used by Ranch transports.

    +

    Callbacks

    +

    Ranch transports implement the following interface:

    +

    accept

    +
    +
    accept(LSocket :: socket(), Timeout :: timeout())
    +    -> {ok, Socket :: socket()}
    +     | {error, closed | timeout | atom()}
    +
    +

    Use the listening socket returned by listen/1 to accept a new connection. The timeout is specified in milliseconds.

    +

    close

    +
    +
    close(Socket :: socket()) -> ok
    +
    +

    Close the socket.

    +

    controlling_process

    +
    +
    controlling_process(Socket :: socket(), Pid :: pid())
    +    -> ok | {error, closed | not_owner | atom()}
    +
    +

    Assign a new controlling process to the socket. The controlling process is the process that is linked to and receives messages from the socket.

    +

    getopts

    +
    +
    getopts(Socket :: socket(), SockOpts :: [atom()])
    +    -> {ok, any()} | {error, atom()}
    +
    +

    Get one or more options for the socket.

    +

    getstat

    +
    +
    getstat(Socket :: socket())
    +    -> {ok, SockStatValues :: any()} | {error, atom()}
    +
    +

    Get all statistics for the socket.

    +
    +
    getstat(Socket :: socket(), SockStats :: [atom()])
    +    -> {ok, SockStatValues :: any()} | {error, atom()}
    +
    +

    Get one or more statistic options for the socket.

    +

    handshake

    +
    +
    handshake(Socket0  :: socket(),
    +          Timeout  :: timeout())
    +    -> {ok, Socket :: socket()}
    +     | {ok, Socket :: socket(), Info :: any()}
    +     | {error, any()}
    +
    +handshake(Socket0  :: socket(),
    +          SockOpts :: opts(),
    +          Timeout  :: timeout())
    +    -> {ok, Socket :: socket()}
    +     | {ok, Socket :: socket(), Info :: any()}
    +     | {error, any()}
    +
    +

    Perform the transport-level handshake.

    +

    This function will be called by connection processes before performing any socket operation. It allows transports that require extra initialization to perform their task and return a socket that is ready to use.

    +

    If the handshake is completed by this call, the function will return {ok, Socket}. However, some transports (notably, ranch_ssl if {handshake, hello} is specified in the socket options) may pause the handshake at a certain point and return {ok, Socket, Info} instead, in order to allow for additional decisions to be made before resuming the handshake with handshake_continue/3 or cancelling it with handshake_cancel/1.

    +

    This function may also be used to upgrade a connection from a transport to another depending on the capabilities of the transports. For example a ranch_tcp socket may be upgraded to a ranch_ssl one using this function.

    +

    handshake_continue

    +
    +
    handshake_continue(Socket0  :: socket(),
    +                   Timeout  :: timeout())
    +    -> {ok, Socket :: socket()}
    +     | {error, any()}
    +
    +handshake_continue(Socket0  :: socket(),
    +                   SockOpts :: opts(),
    +                   Timeout  :: timeout())
    +    -> {ok, Socket :: socket()}
    +     | {error, any()}
    +
    +

    Resume the paused transport-level handshake and return a socket that is ready to use.

    +

    This function will be called by connection processes to resume a paused handshake.

    +

    handshake_cancel

    +
    +
    handshake_cancel(Socket :: socket()) -> ok
    +
    +

    Cancel the paused transport-level handshake.

    +

    listen

    +
    +
    listen(TransportOpts :: ranch:transport_opts(any()))
    +    -> {ok, LSocket :: socket()} | {error, atom()}
    +
    +

    Create a socket that listens on the port given in the socket options.

    +

    The port may not be specified or may be set to 0, which means a random available port number will be chosen.

    +

    messages

    +
    +
    messages()
    +    -> {OK      :: atom(),
    +        Closed  :: atom(),
    +        Error   :: atom(),
    +        Passive :: atom()}
    +
    +

    Return the tuple keys for the messages sent by the socket.

    +

    name

    +
    +
    name() -> Name :: atom()
    +
    +

    Return the name of the transport.

    +

    peername

    +
    +
    peername(Socket :: socket())
    +    -> {ok, {inet:ip_address(), inet:port_number()}}
    +     | {local, binary()} | {error, atom()}.
    +
    +

    Return the address and port number for the other end of the connection.

    +

    For UNIX Domain sockets the return value will be {local, PeerSocket}, with PeerSocket typically an empty binary.

    +

    recv

    +
    +
    recv(Socket :: socket(),
    +     Length :: non_neg_integer(),
    +     Timeout :: timeout())
    +    -> {ok, Packet :: any()}
    +     | {error, closed | timeout | atom()}
    +
    +

    Receive a packet from the socket in passive mode.

    +

    Attempting to receive data from a socket that is in active mode will return an error.

    +

    A length of 0 will return the data available on the socket as soon as possible, regardless of length.

    +

    While it is possible to use the timeout value infinity, it is highly discouraged as it could cause your process to get stuck waiting for data that will never come. This may happen when a socket becomes half-open due to a crash of the remote endpoint. Wi-Fi going down is another common culprit.

    +

    secure

    +
    +
    secure() -> boolean()
    +
    +

    Return whether the transport can be used for secure connections.

    +

    send

    +
    +
    send(Socket :: socket(), Packet :: iodata())
    +    -> ok | {error, atom()}
    +
    +

    Send a packet on the socket.

    +

    sendfile

    +
    +
    sendfile(Socket, File)
    +    -> sendfile(Socket, File, 0, 0, [])
    +
    +sendfile(Socket, File, Offset, Bytes)
    +    -> sendfile(Socket, File, Offset, Bytes, [])
    +
    +sendfile(Socket :: socket(),
    +         File   :: file:name_all() | file:fd(),
    +         Offset :: non_neg_integer(),
    +         Bytes  :: non_neg_integer(),
    +         Opts   :: sendfile_opts())
    +    -> {ok, SentBytes :: non_neg_integer()} | {error, atom()}
    +
    +

    Send a file on the socket.

    +

    The file may be sent full or in parts, and may be specified by its filename or by an already open file descriptor.

    +

    Transports that manipulate TCP directly may use the file:sendfile/2,4,5 function, which calls the sendfile syscall where applicable (on Linux, for example). Other transports can use the sendfile/6 function exported from this module.

    +

    setopts

    +
    +
    setopts(Socket :: socket(), SockOpts :: any())
    +    -> ok | {error, atom()}
    +
    +

    Set one or more options for the socket.

    +

    shutdown

    +
    +
    shutdown(Socket :: socket(),
    +         How    :: read | write | read_write)
    +    -> ok | {error, atom()}
    +
    +

    Close the socket for reading and/or writing.

    +

    sockname

    +
    +
    sockname(Socket :: socket())
    +    -> {ok, {inet:ip_address(), inet:port_number()}}
    +     | {error, atom()}.
    +
    +

    Return the address and port number for the local end of the connection.

    +

    For UNIX Domain sockets the return value will be {local, SocketFile}.

    +

    Exports

    +

    The following function can be used when implementing transport modules:

    + +

    Types

    +

    sendfile_opts()

    +
    +
    sendfile_opts() :: [{chunk_size, non_neg_integer()}]
    +
    +

    Options accepted by the sendfile function and callbacks:

    +
    chunk_size (8191)
    +

    The chunk size, in bytes.

    +
    +
    +

    socket()

    +
    +
    socket() :: any()
    +
    +

    The socket.

    +

    The exact type will vary depending on the transport module.

    +

    Changelog

    +
    • 2.0: The callback listen/1 has changed to accept a map of transport options instead of socket options. +
    • +
    • 2.0: The callback messages/0 return value was updated to include the passive message for {active, N}. +
    • +
    • 1.6: The socket() type was added for documentation purposes. +
    • +
    • 1.6: The type of the sendfile filename was extended. +
    • +
    +

    See also

    +

    ranch(7), ranch_tcp(3), ranch_ssl(3)

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

    + Ranch + 2.1 + 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