Debian Codegraph @

README.rst

raw
1 rfc6555
2 =======
3
4 .. image:: https://img.shields.io/travis/SethMichaelLarson/rfc6555/master.svg?style=flat-square
5 :target: https://travis-ci.org/SethMichaelLarson/rfc6555
6
7 .. image:: https://img.shields.io/appveyor/ci/SethMichaelLarson/rfc6555/master.svg?style=flat-square
8 :target: https://ci.appveyor.com/project/SethMichaelLarson/rfc6555
9
10 .. image:: https://img.shields.io/codecov/c/github/SethMichaelLarson/rfc6555/master.svg?style=flat-square
11 :target: https://codecov.io/gh/SethMichaelLarson/rfc6555
12
13 .. image:: https://img.shields.io/pypi/v/rfc6555.svg?style=flat-square
14 :target: https://pypi.python.org/pypi/rfc6555
15
16 .. image:: https://img.shields.io/badge/say-thanks-ff69b4.svg?style=flat-square
17 :target: https://saythanks.io/to/SethMichaelLarson
18
19 Python implementation of the Happy Eyeballs Algorithm described in `RFC 6555 <https://tools.ietf.org/html/rfc6555>`_.
20 Provided with a single file and dead-simple API to allow easy vendoring
21 and integration into other projects.
22
23 Abstract
24 --------
25
26 When a server's IPv4 path and protocol are working, but the server's
27 IPv6 path and protocol are not working, a dual-stack client
28 application experiences significant connection delay compared to an
29 IPv4-only client. This is undesirable because it causes the dual-
30 stack client to have a worse user experience. This document
31 specifies requirements for algorithms that reduce this user-visible
32 delay and provides an algorithm.
33
34 ~ `Abstract from RFC 6555 <https://tools.ietf.org/html/rfc6555>`_
35
36 Installation
37 ------------
38
39 ``$ python -m pip install rfc6555``
40
41 Usage
42 -----
43
44 The main API for the ``rfc6555`` module is via ``rfc6555.create_connection()`` which
45 functions identically to ``socket.create_connection()`` with the same arguments.
46 This function will automatically fall back on a ``socket.create_connection()`` call if
47 RFC 6555 is not supported (for instance on platforms not capable of IPv6) or if
48 RFC 6555 is disabled via setting ``rfc6555.RFC6555_ENABLED`` equal to ``False``.
49
50 **IMPORTANT:** Caching is **NOT** thread-safe by default. If you require thread-safe caching
51 one should create their own implementation of ``rfc6555._RFC6555CacheManager`` object that
52 is thread-safe and assign an instance to ``rfc6555.cache``.
53
54 .. code-block:: python
55
56 import rfc6555
57 sock = rfc6555.create_connection(('www.google.com', 80), timeout=10, source_address=('::1', 0))
58
59 # This will disable the Happy Eyeballs algorithm for future
60 # calls to create_connection()
61 rfc6555.RFC6555_ENABLED = False
62
63 # Use this to set a different duration for cache entries.
64 rfc6555.cache.validity_duration = 10 # 10 second validity time.
65
66 # Use this to disable caching.
67 rfc6555.cache.enabled = False
68
69 Support
70 -------
71
72 This module supports Python 2.6 or newer and supports all major platforms.
73 Additionally if you have ``selectors2>=2.0.0`` installed this module will
74 also support Jython in addition to CPython.
75
76 License
77 -------
78
79 The ``rfc6555`` package is released under the ``Apache-2.0`` license.
80
81 See `full license text in LICENSE file <https://github.com/SethMichaelLarson/rfc6555/blob/master/LICENSE>`_ for more information.
82
83 .. code-block::
84
85 Copyright 2017 Seth Michael Larson
86
87 Licensed under the Apache License, Version 2.0 (the "License");
88 you may not use this file except in compliance with the License.
89 You may obtain a copy of the License at
90
91 http://www.apache.org/licenses/LICENSE-2.0
92
93 Unless required by applicable law or agreed to in writing, software
94 distributed under the License is distributed on an "AS IS" BASIS,
95 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
96 See the License for the specific language governing permissions and
97 limitations under the License.
98
99 Alternatives
100 ------------
101
102 For asyncio support check out https://pypi.org/project/async-stagger/