Esempio n. 1
0
 def test_pack_xor_address_unknown_protocol(self):
     transaction_id = unhexlify("b7e7a701bc34d686fa87dfae")
     with self.assertRaises(ValueError) as cm:
         stun.pack_xor_address(("foo", 32853), transaction_id)
     self.assertEqual(
         str(cm.exception),
         "'foo' does not appear to be an IPv4 or IPv6 address")
Esempio n. 2
0
 def test_pack_xor_address_ipv6(self):
     transaction_id = unhexlify("b7e7a701bc34d686fa87dfae")
     data = stun.pack_xor_address(
         ("2001:db8:1234:5678:11:2233:4455:6677", 32853), transaction_id)
     self.assertEqual(data,
                      unhexlify("0002a1470113a9faa5d3f179bc25f4b5bed2b9d9"))
Esempio n. 3
0
 def test_pack_xor_address_ipv4(self):
     transaction_id = unhexlify("b7e7a701bc34d686fa87dfae")
     data = stun.pack_xor_address(("192.0.2.1", 32853), transaction_id)
     self.assertEqual(data, unhexlify("0001a147e112a643"))