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.
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
that check could complement this line
pytest-socket/pytest_socket.py
Line 182 in edb216c
I could send a PR if you are interested.