from . import base from source import packets from ...packets import PeerPacket from ...utils.crypto.type import CipherType class DiscoveryEvent(base.BaseEvent): """ Event reacting to a machine trying to discover the network. """ def handle(self, packet: packets.DiscoveryPacket, address: tuple): # create a peer packet containing our important information peerPacket = PeerPacket(self.manager.communication.public_key) # send our information back self.manager.communication.send(peerPacket, CipherType.PLAIN, address)