mxcubeweb.core.util.networkutils#
Functions
|
|
|
|
|
Determines whether the remote client making the request is a "local host". |
|
Determines whether a given IP address belongs to the local network. |
|
|
|
|
|
|
|
|
|
|
|
- mxcubeweb.core.util.networkutils.is_local_host(local_domains: list)[source]#
Determines whether the remote client making the request is a “local host”.
A client is considered a “local host” if it runs on the same host as the mxcube-server, or if it belongs to the local network. The local network can also be identified by providing a list of domain suffixes considered local.
- mxcubeweb.core.util.networkutils.is_local_network(ip: str, local_domains: list)[source]#
Determines whether a given IP address belongs to the local network.
The function compares the first two octets of the given IP address with the local host’s IP address. It also checks if the reverse-resolved hostname of the IP ends with any of the specified local domains.
- Parameters:
- Returns:
- True if the IP is in the same network range as the local host
(i.e. mxcube server) or its hostname ends with any of the specified local domains; False otherwise.
- Return type: