-
Notifications
You must be signed in to change notification settings - Fork 445
/
connectivity_utils.py
22 lines (17 loc) · 867 Bytes
/
connectivity_utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from typing import Optional
from sslyze import ServerNetworkLocation, ServerNetworkConfiguration
from sslyze.server_connectivity import ServerConnectivityInfo, check_connectivity_to_server
def check_connectivity_to_server_and_return_info(
server_location: ServerNetworkLocation,
network_configuration: Optional[ServerNetworkConfiguration] = None,
) -> ServerConnectivityInfo:
if network_configuration is None:
final_network_config = ServerNetworkConfiguration.default_for_server_location(server_location)
else:
final_network_config = network_configuration
tls_probing_result = check_connectivity_to_server(server_location, final_network_config)
return ServerConnectivityInfo(
server_location=server_location,
network_configuration=final_network_config,
tls_probing_result=tls_probing_result,
)