Exemple #1
0
 def __init__(self, mux, chan, family):
     sock = socket.socket(family, socket.SOCK_DGRAM)
     Handler.__init__(self, [sock])
     self.timeout = time.time() + 30
     self.mux = mux
     self.chan = chan
     self.sock = sock
Exemple #2
0
 def __init__(self, mux, chan, family):
     sock = socket.socket(family, socket.SOCK_DGRAM)
     Handler.__init__(self, [sock])
     self.timeout = time.time() + 30
     self.mux = mux
     self.chan = chan
     self.sock = sock
     if family == socket.AF_INET:
         self.sock.setsockopt(socket.SOL_IP, socket.IP_TTL, 42)
Exemple #3
0
 def __init__(self, mux, chan, request):
     Handler.__init__(self, [])
     self.timeout = time.time() + 30
     self.mux = mux
     self.chan = chan
     self.tries = 0
     self.request = request
     self.peers = {}
     self.try_send()
Exemple #4
0
 def __init__(self, mux, chan, family):
     sock = socket.socket(family, socket.SOCK_DGRAM)
     Handler.__init__(self, [sock])
     self.timeout = time.time() + 30
     self.mux = mux
     self.chan = chan
     self.sock = sock
     if family == socket.AF_INET:
         self.sock.setsockopt(socket.SOL_IP, socket.IP_TTL, 42)
Exemple #5
0
 def __init__(self, mux, chan, request):
     Handler.__init__(self, [])
     self.timeout = time.time() + 30
     self.mux = mux
     self.chan = chan
     self.tries = 0
     self.request = request
     self.peers = {}
     self.try_send()
Exemple #6
0
 def __init__(self, mux, chan, request, to_nameserver):
     Handler.__init__(self, [])
     self.timeout = time.time() + 30
     self.mux = mux
     self.chan = chan
     self.tries = 0
     self.request = request
     self.peers = {}
     if to_nameserver is None:
         self.to_nameserver = None
     else:
         peer, port = to_nameserver.split("@")
         self.to_nameserver = self._addrinfo(peer, port)
     self.try_send()
Exemple #7
0
 def __init__(self, mux, chan, request, to_nameserver):
     Handler.__init__(self, [])
     self.timeout = time.time() + 30
     self.mux = mux
     self.chan = chan
     self.tries = 0
     self.request = request
     self.peers = {}
     self.to_ns_peer = None
     self.to_ns_port = None
     if to_nameserver is None:
         self.to_nameserver = None
     else:
         self.to_ns_peer, self.to_ns_port = to_nameserver.split("@")
         self.to_nameserver = self._addrinfo(self.to_ns_peer,
                                             self.to_ns_port)
     self.try_send()
Exemple #8
0
    def add_handler(self, handlers, callback, method, mux):
        socks = []
        if self.v6:
            socks.append(self.v6)
        if self.v4:
            socks.append(self.v4)

        handlers.append(
            Handler(socks, lambda sock: callback(sock, method, mux, handlers)))
Exemple #9
0
 def __init__(self, mux, chan, request, to_nameserver):
     Handler.__init__(self, [])
     self.timeout = time.time() + 30
     self.mux = mux
     self.chan = chan
     self.tries = 0
     self.request = request
     self.peers = {}
     if to_nameserver is None:
         self.to_nameserver = None
     else:
         peer, port = to_nameserver.split("@")
         port = int(port)
         if port == 0:
             port = 53
         family = socket.AF_INET6 if ":" in peer else socket.AF_INET
         self.to_nameserver = family, peer, port
     self.try_send()
Exemple #10
0
 def got_host_req(data):
     if not hw.pid:
         (hw.pid, hw.sock) = start_hostwatch(data.strip().split(),
                                             auto_hosts)
         handlers.append(Handler(socks=[hw.sock], callback=hostwatch_ready))