示例#1
0
 def test_read_mapped_address_xor(self):
     attr_type = '\x00\x20'
     attr_body = '\x00\x01%\xc0\xe1\xba\xafC'
     attr_len = 8
     mapped_address = stun.read_mapped_address(attr_type, attr_body, attr_len)
     self.assertEqual(
         dict(ip='192.168.11.1', port=1234, family='IPv4', name='XOR-MAPPED-ADDRESS'),
         mapped_address
     )
示例#2
0
 def test_read_mapped_address(self):
     attr_type = '\x00\x01'
     attr_body = '\x00\x01\x04\xd2\xc0\xa8\x0b\x01'
     attr_len = 8
     mapped_address = stun.read_mapped_address(attr_type, attr_body, attr_len)
     self.assertEqual(
         dict(ip='192.168.11.1', port=1234, family='IPv4', name='MAPPED-ADDRESS'),
         mapped_address
     )
示例#3
0
 def test_read_mapped_address_xor(self):
     attr_type = '\x00\x20'
     attr_body = '\x00\x01%\xc0\xe1\xba\xafC'
     attr_len = 8
     mapped_address = stun.read_mapped_address(attr_type, attr_body,
                                               attr_len)
     self.assertEqual(
         dict(ip='192.168.11.1',
              port=1234,
              family='IPv4',
              name='XOR-MAPPED-ADDRESS'), mapped_address)
示例#4
0
 def test_read_mapped_address(self):
     attr_type = '\x00\x01'
     attr_body = '\x00\x01\x04\xd2\xc0\xa8\x0b\x01'
     attr_len = 8
     mapped_address = stun.read_mapped_address(attr_type, attr_body,
                                               attr_len)
     self.assertEqual(
         dict(ip='192.168.11.1',
              port=1234,
              family='IPv4',
              name='MAPPED-ADDRESS'), mapped_address)