MCPcopy
hub / github.com/sshuttle/sshuttle / test_get_tcp_dstip

Function test_get_tcp_dstip

tests/client/test_methods_nat.py:19–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17
18
19def test_get_tcp_dstip():
20 sock = Mock()
21 sock.family = AF_INET
22 sock.getsockopt.return_value = struct.pack(
23 '!HHBBBB', socket.ntohs(AF_INET), 1024, 127, 0, 0, 1)
24 method = get_method('nat')
25 assert method.get_tcp_dstip(sock) == ('127.0.0.1', 1024)
26 assert sock.mock_calls == [call.getsockopt(0, 80, 16)]
27
28 sock = Mock()
29 sock.family = AF_INET6
30 sock.getsockopt.return_value = struct.pack(
31 '!HH4xBBBBBBBBBBBBBBBB', socket.ntohs(AF_INET6),
32 1024, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1)
33 method = get_method('nft')
34 assert method.get_tcp_dstip(sock) == ('::1', 1024)
35 assert sock.mock_calls == [call.getsockopt(41, 80, 64)]
36
37
38def test_recv_udp():

Callers

nothing calls this directly

Calls 2

get_methodFunction · 0.90
get_tcp_dstipMethod · 0.45

Tested by

no test coverage detected