MCPcopy Index your code
hub / github.com/sshuttle/sshuttle / onaccept_udp

Function onaccept_udp

sshuttle/client.py:541–560  ·  view source on GitHub ↗
(listener, method, mux, handlers)

Source from the content-addressed store, hash-verified

539
540
541def onaccept_udp(listener, method, mux, handlers):
542 now = time.time()
543 t = method.recv_udp(listener, 4096)
544 if t is None:
545 return
546 srcip, dstip, data = t
547 debug1('Accept UDP: %r -> %r.' % (srcip, dstip,))
548 if srcip in udp_by_src:
549 chan, _ = udp_by_src[srcip]
550 else:
551 chan = mux.next_channel()
552 mux.channels[chan] = lambda cmd, data: udp_done(
553 chan, data, method, listener, dstip=srcip)
554 mux.send(chan, ssnet.CMD_UDP_OPEN, b"%d" % listener.family)
555 udp_by_src[srcip] = chan, now + 30
556
557 hdr = b"%s,%d," % (dstip[0].encode("ASCII"), dstip[1])
558 mux.send(chan, ssnet.CMD_UDP_DATA, hdr + data)
559
560 expire_connections(now, mux)
561
562
563def dns_done(chan, data, method, sock, srcip, dstip, mux):

Callers

nothing calls this directly

Calls 6

debug1Function · 0.90
udp_doneFunction · 0.85
expire_connectionsFunction · 0.85
next_channelMethod · 0.80
recv_udpMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected