Skip to main content

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

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiostun-0.3.1.tar.gz (10.6 kB view hashes)

Uploaded Source

Built Distribution

aiostun-0.3.1-py3-none-any.whl (11.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page