Skip to content

Cannot bind ipv6 address #68

@Julien00859

Description

@Julien00859

Hello there,

At the moment it is not possible to bind a ipv6 address:

>>> import tlslib.tlslib
>>> import tlslib.stdlib
>>> config = tlslib.tlslib.TLSServerConfiguration()
>>> ctx = tlslib.stdlib.OpenSSLServerContext(config)
>>> ctx.connect(('::1', 8080))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/julien/Projects/tlslib.py/src/tlslib/stdlib.py", line 973, in connect
    return OpenSSLTLSSocket._create(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/julien/Projects/tlslib.py/src/tlslib/stdlib.py", line 450, in _create
    sock = socket.create_server(address)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/socket.py", line 935, in create_server
    raise error(err.errno, msg) from None
OSError: [Errno -9] Address family for hostname not supported (while attempting to bind on address ('::1', 8080))

Would it be possible to expose the other arguments of socket.create_server? Btw server_context.connect is kinda strange, we're not connecting to anybody, we're binding the address.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions