def __init__(self, port: int, node: Any, api: Any, local_type: NodeType, ping_interval: int, network_id: str, inbound_rate_limit_percent: int, outbound_rate_limit_percent: int, root_path: Path, config: Dict, private_ca_crt_key: Tuple[(Path, Path)], greenberry_ca_crt_key: Tuple[(Path, Path)], name: str=None, introducer_peers: Optional[IntroducerPeers]=None):
    logging.basicConfig(level=logging.DEBUG)
    self.all_connections: Dict[(bytes32, WSGreenBerryConnection)] = {}
    self.tasks: Set[asyncio.Task] = set()
    self.connection_by_type: Dict[(NodeType, Dict[(bytes32, WSGreenBerryConnection)])] = {NodeType.FULL_NODE: {}, NodeType.WALLET: {}, NodeType.HARVESTER: {}, NodeType.FARMER: {}, NodeType.TIMELORD: {}, NodeType.INTRODUCER: {}}
    self._port = port
    self._local_type: NodeType = local_type
    self._ping_interval = ping_interval
    self._network_id = network_id
    self._inbound_rate_limit_percent = inbound_rate_limit_percent
    self._outbound_rate_limit_percent = outbound_rate_limit_percent
    self._tasks: List[asyncio.Task] = []
    if name:
        self.log = logging.getLogger(name)
    else:
        self.log = logging.getLogger(__name__)
    self.api = api
    self.node = node
    self.root_path = root_path
    self.config = config
    self.on_connect: Optional[Callable] = None
    self.incoming_messages: asyncio.Queue = asyncio.Queue()
    self.shut_down_event = asyncio.Event()
    if (self._local_type is NodeType.INTRODUCER):
        self.introducer_peers = IntroducerPeers()
    if (self._local_type is not NodeType.INTRODUCER):
        (self._private_cert_path, self._private_key_path) = private_ssl_paths(root_path, config)
    if (self._local_type is not NodeType.HARVESTER):
        (self.p2p_crt_path, self.p2p_key_path) = public_ssl_paths(root_path, config)
    else:
        (self.p2p_crt_path, self.p2p_key_path) = (None, None)
    (self.ca_private_crt_path, self.ca_private_key_path) = private_ca_crt_key
    (self.greenberry_ca_crt_path, self.greenberry_ca_key_path) = greenberry_ca_crt_key
    self.node_id = self.my_id()
    self.incoming_task = asyncio.create_task(self.incoming_api_task())
    self.gc_task: asyncio.Task = asyncio.create_task(self.garbage_collect_connections_task())
    self.app: Optional[Application] = None
    self.runner: Optional[web.AppRunner] = None
    self.site: Optional[TCPSite] = None
    self.connection_close_task: Optional[asyncio.Task] = None
    self.site_shutdown_task: Optional[asyncio.Task] = None
    self.app_shut_down_task: Optional[asyncio.Task] = None
    self.received_message_callback: Optional[Callable] = None
    self.api_tasks: Dict[(bytes32, asyncio.Task)] = {}
    self.execute_tasks: Set[bytes32] = set()
    self.tasks_from_peer: Dict[(bytes32, Set[bytes32])] = {}
    self.banned_peers: Dict[(str, float)] = {}
    self.invalid_protocol_ban_seconds = 10
    self.api_exception_ban_seconds = 10
    self.exempt_peer_networks: List[Union[(IPv4Network, IPv6Network)]] = [ip_network(net, strict=False) for net in config.get('exempt_peer_networks', [])]
def __init__(self, port: int, node: Any, api: Any, local_type: NodeType, ping_interval: int, network_id: str, inbound_rate_limit_percent: int, outbound_rate_limit_percent: int, root_path: Path, config: Dict, private_ca_crt_key: Tuple[(Path, Path)], greenberry_ca_crt_key: Tuple[(Path, Path)], name: str=None, introducer_peers: Optional[IntroducerPeers]=None):
    logging.basicConfig(level=logging.DEBUG)
    self.all_connections: Dict[(bytes32, WSGreenBerryConnection)] = {}
    self.tasks: Set[asyncio.Task] = set()
    self.connection_by_type: Dict[(NodeType, Dict[(bytes32, WSGreenBerryConnection)])] = {NodeType.FULL_NODE: {}, NodeType.WALLET: {}, NodeType.HARVESTER: {}, NodeType.FARMER: {}, NodeType.TIMELORD: {}, NodeType.INTRODUCER: {}}
    self._port = port
    self._local_type: NodeType = local_type
    self._ping_interval = ping_interval
    self._network_id = network_id
    self._inbound_rate_limit_percent = inbound_rate_limit_percent
    self._outbound_rate_limit_percent = outbound_rate_limit_percent
    self._tasks: List[asyncio.Task] = []
    if name:
        self.log = logging.getLogger(name)
    else:
        self.log = logging.getLogger(__name__)
    self.api = api
    self.node = node
    self.root_path = root_path
    self.config = config
    self.on_connect: Optional[Callable] = None
    self.incoming_messages: asyncio.Queue = asyncio.Queue()
    self.shut_down_event = asyncio.Event()
    if (self._local_type is NodeType.INTRODUCER):
        self.introducer_peers = IntroducerPeers()
    if (self._local_type is not NodeType.INTRODUCER):
        (self._private_cert_path, self._private_key_path) = private_ssl_paths(root_path, config)
    if (self._local_type is not NodeType.HARVESTER):
        (self.p2p_crt_path, self.p2p_key_path) = public_ssl_paths(root_path, config)
    else:
        (self.p2p_crt_path, self.p2p_key_path) = (None, None)
    (self.ca_private_crt_path, self.ca_private_key_path) = private_ca_crt_key
    (self.greenberry_ca_crt_path, self.greenberry_ca_key_path) = greenberry_ca_crt_key
    self.node_id = self.my_id()
    self.incoming_task = asyncio.create_task(self.incoming_api_task())
    self.gc_task: asyncio.Task = asyncio.create_task(self.garbage_collect_connections_task())
    self.app: Optional[Application] = None
    self.runner: Optional[web.AppRunner] = None
    self.site: Optional[TCPSite] = None
    self.connection_close_task: Optional[asyncio.Task] = None
    self.site_shutdown_task: Optional[asyncio.Task] = None
    self.app_shut_down_task: Optional[asyncio.Task] = None
    self.received_message_callback: Optional[Callable] = None
    self.api_tasks: Dict[(bytes32, asyncio.Task)] = {}
    self.execute_tasks: Set[bytes32] = set()
    self.tasks_from_peer: Dict[(bytes32, Set[bytes32])] = {}
    self.banned_peers: Dict[(str, float)] = {}
    self.invalid_protocol_ban_seconds = 10
    self.api_exception_ban_seconds = 10
    self.exempt_peer_networks: List[Union[(IPv4Network, IPv6Network)]] = [ip_network(net, strict=False) for net in config.get('exempt_peer_networks', [])]