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

Method send_udp

sshuttle/methods/ipfw.py:136–150  ·  view source on GitHub ↗
(self, sock, srcip, dstip, data)

Source from the content-addressed store, hash-verified

134 return srcip, dstip, data
135
136 def send_udp(self, sock, srcip, dstip, data):
137 if not srcip:
138 debug1(
139 "-- ignored UDP to %r: "
140 "couldn't determine source IP address" % (dstip,))
141 return
142
143 # debug3('Sending SRC: %r DST: %r' % (srcip, dstip))
144 sender = socket.socket(sock.family, socket.SOCK_DGRAM)
145 sender.setsockopt(socket.SOL_IP, IP_BINDANY, 1)
146 sender.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
147 sender.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
148 sender.bind(srcip)
149 sender.sendto(data, dstip)
150 sender.close()
151
152 def setup_udp_listener(self, udp_listener):
153 if udp_listener.v4 is not None:

Callers 5

test_send_udpFunction · 0.45
test_send_udpFunction · 0.45
test_send_udpFunction · 0.45
udp_doneFunction · 0.45
dns_doneFunction · 0.45

Calls 4

debug1Function · 0.90
setsockoptMethod · 0.80
bindMethod · 0.80
closeMethod · 0.80

Tested by 3

test_send_udpFunction · 0.36
test_send_udpFunction · 0.36
test_send_udpFunction · 0.36