Skip to content

Allow host masks #180

@mgaitan

Description

@mgaitan

I'm wondering if we could allow a range of IP as a mask. This is covered by the builtin [ipaddress](module.

consider this example

In [8]: from ipaddress import ip_network, ip_address

In [9]: ip_address('178.18.0.23') in ip_network('178.18.0.0/24')
Out[9]: True

In [10]: ip_address('178.18.0.1') in ip_network('178.18.0.0/24')
Out[10]: True

In [11]: ip_address('178.18.0.255') in ip_network('178.18.0.0/24')
Out[11]: True

In [12]: ip_address('178.18.1.1') in ip_network('178.18.0.0/24')
Out[12]: False

that check could complement this line

if host in allowed or (_is_unix_socket(inst.family) and allow_unix_socket):

I could send a PR if you are interested.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions