MOON
Server: Apache
System: Linux server30c.hostingraja.org 3.10.0-962.3.2.lve1.5.63.el7.x86_64 #1 SMP Fri Oct 8 12:03:35 UTC 2021 x86_64
User: jibhires (1887)
PHP: 8.1.30
Disabled: show_source, system, shell_exec, passthru, exec, popen, proc_open, allow_url_fopen, symlink, escapeshellcmd, pcntl_exec
Upload Files
File: //opt/imunify360/venv/lib64/python3.11/site-packages/im360/internals/core/ip_versions.py
from typing import Dict, Set

from im360.utils.net import is_ipv6_enabled
from im360.utils.validate import IP, IPVersion

_state = {}  # type: Dict[IPVersion, bool]


def init() -> None:
    global _state
    _state = {IP.V4: True, IP.V6: is_ipv6_enabled()}


def enable(ip_version: IPVersion) -> None:
    _state[ip_version] = True


def disable(ip_version: IPVersion) -> bool:
    if ip_version == IP.V6:
        _state[ip_version] = False
        return True
    return False


def is_enabled(ip_version: IPVersion) -> bool:
    return _state[ip_version]


def enabled() -> Set[IPVersion]:
    return set(k for k, v in sorted(_state.items()) if v)


def all() -> Set[IPVersion]:
    return set(_state.keys())