def send_raw(self, data): message = PIAMessage() message.flags = 0 message.protocol_id = self.protocol_id message.protocol_port = self.protocol_port message.payload = data self.transport.send(self.station, message)
def send(self, station): logger.debug("Sending keep alive packet") message = PIAMessage() message.flags = 0 message.protocol_id = self.PROTOCOL_ID message.protocol_port = 0 message.payload = b"" self.transport.send(station, message)
def send(self, station, data): logger.debug("Sending %i bytes of unreliable data", len(data)) message = PIAMessage() message.flags = 0 message.protocol_id = self.PROTOCOL_ID message.protocol_port = 1 message.payload = data self.transport.send(station, message)
def send(self, station, response, time): logger.debug("Sending rtt info packet") message = PIAMessage() message.flags = 0 message.protocol_id = self.PROTOCOL_ID message.protocol_port = 0 message.payload = struct.pack(">IxxxxQ", response, time) self.transport.send(station, message)
def send_probe(self, station, probe_type, protocol_port, count=1): for i in range(count): probe = NATProbeData(self.session.rvcid, probe_type, int(time.time())) message = PIAMessage() message.flags = 8 message.protocol_id = self.PROTOCOL_ID message.protocol_port = protocol_port message.payload = probe.serialize() self.transport.send(station, message)
def send(self, station, payload, flags, ack=False): message = PIAMessage() message.flags = flags message.protocol_id = self.PROTOCOL_ID message.protocol_port = self.PORT_UNRELIABLE message.payload = payload if ack: self.resender.send(station, message) else: self.transport.send(station, message)