forked from stove/dataset
14 lines
497 B
Python
14 lines
497 B
Python
from ipaddress import ip_network as _ip_network, ip_address as _ip_address
|
|
from rougail.utils import normalize_family as _normalize_family
|
|
|
|
|
|
def get_local_smtp_info(ip_smtp, infos, network_eth, normalize=False):
|
|
if ip_smtp is None:
|
|
return
|
|
ip_smtp_o = _ip_address(ip_smtp)
|
|
for idx, net in enumerate(network_eth):
|
|
if ip_smtp_o in _ip_network(net):
|
|
val = infos[idx]
|
|
if normalize:
|
|
val = _normalize_family(val)
|
|
return val
|