コード例 #1
0
ファイル: qturnsocket.py プロジェクト: speed2CZ/client
 def __init__(self, port, data_cb):
     QUdpSocket.__init__(self)
     self._session = QTurnSession(self)
     self._state = TURNState.UNBOUND
     self.bindings = {}
     self.port = port
     self._data_cb = data_cb
     self.turn_host, self.turn_port = config.Settings.get('turn/host', type=unicode, default='dev.faforever.com'), \
                            config.Settings.get('turn/port', type=int, default=3478)
     self._logger.info("Turn socket initialized: {}".format(self.turn_host))
     self.turn_address = None
     QHostInfo.lookupHost(self.turn_host, self._looked_up)
     self.bind(port)
     self.readyRead.connect(self._readyRead)
     self.error.connect(self._error)
コード例 #2
0
ファイル: turn_client.py プロジェクト: MathieuB8/test2
 def __init__(self, port, data_cb):
     QUdpSocket.__init__(self)
     self._session = None
     self._state = TURNState.UNBOUND
     self.bindings = {}
     self.port = port
     self._data_cb = data_cb
     self.turn_host, self.turn_port = config.Settings.get('turn/host', type=unicode, default='dev.faforever.com'), \
                            config.Settings.get('turn/port', type=int, default=3478)
     self._logger.info("Turn socket initialized: {}".format(self.turn_host))
     self.turn_address = None
     QHostInfo.lookupHost(self.turn_host, self._looked_up)
     self.bind(port)
     self.readyRead.connect(self._readyRead)
     self.error.connect(self._error)
コード例 #3
0
 def isHostAccessible(host):
     """ check whether a host can be reached """
     from PyQt4.QtNetwork import QHostInfo
     info = QHostInfo.fromName(host)
     if info.error() == QHostInfo.NoError:
         return True
     return False
コード例 #4
0
    def askUser(self, req_str_in, path_in, pid_in, addr_in, dport_in,
                sport_in):
        print "In askUser"
        #Convert all incoming QString into normal python strings
        req_str = str(req_str_in)
        path = unicode(QString.fromUtf8(path_in))
        pid = str(pid_in)
        addr = str(addr_in)
        dport = str(dport_in)
        sport = str(sport_in)
        if (req_str == 'REQUEST_OUT'):
            dialog = dialogOut
            rport = sport
            lport = dport
        elif (req_str == 'REQUEST_IN'):
            dialog = dialogOut
            rport = dport
            lport = sport

        name = string.rsplit(path, "/", 1)
        dialog.path = path
        dialog.pid = pid
        dialog.label_name.setText(name[1])
        dialog.label_ip.setText(addr)
        dialog.label_domain.setText("Looking up DNS...")
        fullpath = QTableWidgetItem(unicode(QString.fromUtf8(path)))
        dialog.tableWidget_details.setItem(0, 1, fullpath)
        pid_item = QTableWidgetItem(pid)
        dialog.tableWidget_details.setItem(1, 1, pid_item)
        remoteip = QTableWidgetItem(addr)
        dialog.tableWidget_details.setItem(2, 1, remoteip)
        dns = QTableWidgetItem("Looking up DNS...")
        dialog.tableWidget_details.setItem(3, 1, dns)
        rport_item = QTableWidgetItem(rport)
        dialog.tableWidget_details.setItem(4, 1, rport_item)
        lport_item = QTableWidgetItem(lport)
        dialog.tableWidget_details.setItem(5, 1, lport_item)
        QHostInfo.lookupHost(addr, dialog.dnsLookupFinished)
        #we don't want the user to accidentally trigger ALLOW
        dialog.pushButton_deny.setFocus()
        dialog.show()
コード例 #5
0
ファイル: gui.py プロジェクト: jianlins/lpfw
    def askUser(self, req_str_in, path_in, pid_in, addr_in, dport_in, sport_in):
        print "In askUser"
        #Convert all incoming QString into normal python strings
        req_str = str(req_str_in)
        path = unicode(QString.fromUtf8(path_in))
        pid = str(pid_in)
        addr = str(addr_in)
        dport = str(dport_in)
        sport = str(sport_in)
        if (req_str == 'REQUEST_OUT'):
            dialog = dialogOut
            rport = sport
            lport = dport
        elif (req_str == 'REQUEST_IN'):
            dialog = dialogOut            
            rport = dport
            lport = sport

        name = string.rsplit(path,"/",1)
        dialog.path = path
        dialog.pid = pid
        dialog.label_name.setText(name[1])
        dialog.label_ip.setText(addr)
        dialog.label_domain.setText("Looking up DNS...")        
        fullpath = QTableWidgetItem(unicode(QString.fromUtf8(path)))
        dialog.tableWidget_details.setItem(0,1,fullpath)
        pid_item = QTableWidgetItem(pid)
        dialog.tableWidget_details.setItem(1,1,pid_item)
        remoteip = QTableWidgetItem(addr)
        dialog.tableWidget_details.setItem(2,1,remoteip)
        dns = QTableWidgetItem("Looking up DNS...")
        dialog.tableWidget_details.setItem(3,1,dns)
        rport_item = QTableWidgetItem(rport)
        dialog.tableWidget_details.setItem(4,1,rport_item)
        lport_item = QTableWidgetItem(lport)
        dialog.tableWidget_details.setItem(5,1,lport_item)
        QHostInfo.lookupHost(addr, dialog.dnsLookupFinished)
        #we don't want the user to accidentally trigger ALLOW
        dialog.pushButton_deny.setFocus()
        dialog.show()
コード例 #6
0
ファイル: gui.py プロジェクト: jianlins/lpfw
 def dialogFinished(self):
     QHostInfo.abortHostLookup(self.dns_lookup_id)
コード例 #7
0
ファイル: gui-mod.py プロジェクト: Sunplace/biyesheji-myPF
 def dialogFinished(self):
     QHostInfo.abortHostLookup(self.dns_lookup_id)