Skip to content

Asynchronous STUN client for Python with UDP, TCP and TLS support

License

Notifications You must be signed in to change notification settings

dmachard/python-aiostun

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Async STUN client for Python

Key Features

  • Support RFC3489
  • Transports UDP, TCP and TLS
  • IPv4 and IPv6 support
  • Support RFC5389
  • Support RFC5780
  • Support RFC8489

Installation

This module can be installed from pypi website

pip install aiostun

Getting your mapped address

import aiostun
import asyncio

async def main():

    async with aiostun.Client(host='openrelay.metered.ca', port=443, ipproto=aiostun.TLS) as stunc:
        mapped_addr = await stunc.get_mapped_address()
        print(mapped_addr)
        {'family': 'IPv4', 'port': 38778, 'ip': 'xx.xx.xx.xx'}

asyncio.run(main())

Default constants for family:

  • aiostun.IP4 (default)
  • aiostun.IP6

Default constants for IP protocol:

  • aiostun.UDP (default)
  • aiostun.TCP
  • aiostun.TLS

The default remote port is 3478 with a timeout connection of 2 seconds.

For developers

Running all test units.

python3 -m unittest discover tests/ -v

About

Asynchronous STUN client for Python with UDP, TCP and TLS support

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages