All Projects → arantonitis → Pynat

arantonitis / Pynat

Licence: mit
Discover external IP addresses and NAT topologies using STUN.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Pynat

Miniupnp
UPnP IGD implementation
Stars: ✭ 974 (+2463.16%)
Mutual labels:  nat-traversal
Inlets Operator
Add public LoadBalancers to your local Kubernetes clusters
Stars: ✭ 795 (+1992.11%)
Mutual labels:  nat-traversal
Pjproject
PJSIP project
Stars: ✭ 786 (+1968.42%)
Mutual labels:  nat-traversal
Stun
Fast RFC 5389 STUN implementation in go
Stars: ✭ 451 (+1086.84%)
Mutual labels:  nat-traversal
Go Stun
A go implementation of the STUN client (RFC 3489 and RFC 5389)
Stars: ✭ 420 (+1005.26%)
Mutual labels:  nat-traversal
Gortcd
Fast TURN and STUN server: cross-platform, hot reload, flexible config
Stars: ✭ 358 (+842.11%)
Mutual labels:  nat-traversal
Ice4j
A Java implementation of the ICE protocol
Stars: ✭ 332 (+773.68%)
Mutual labels:  nat-traversal
opengnb
GNB is open source de-centralized VPN to achieve layer3 network via p2p with the ultimate capability of NAT Traversal.GNB是一个开源的去中心化的具有极致内网穿透能力的通过P2P进行三层网络交换的VPN。
Stars: ✭ 440 (+1057.89%)
Mutual labels:  nat-traversal
opennotr
开源内网穿透,Open source NAT traversal (http://www.notr.tech)
Stars: ✭ 33 (-13.16%)
Mutual labels:  nat-traversal
ormesh
[UNMAINTAINED: Try https://github.com/cmars/oniongrok instead] onion-routed mesh
Stars: ✭ 65 (+71.05%)
Mutual labels:  nat-traversal
libjuice
JUICE is a UDP Interactive Connectivity Establishment library
Stars: ✭ 197 (+418.42%)
Mutual labels:  nat-traversal
Gnb
GNB is open source de-centralized VPN to achieve layer3 network via p2p with the ultimate capability of NAT Traversal.GNB是一个开源的去中心化的具有极致内网穿透能力的通过P2P进行三层网络交换的VPN。
Stars: ✭ 225 (+492.11%)
Mutual labels:  nat-traversal
Wireguard P2p
A tool for setting up WireGuard connections from peer to peer.
Stars: ✭ 220 (+478.95%)
Mutual labels:  nat-traversal
Internet Hosting Tool
Enable Moonlight streaming from your PC over the Internet with no configuration required
Stars: ✭ 205 (+439.47%)
Mutual labels:  nat-traversal
Piping Server
Infinitely transfer between every device over pure HTTP with pipes or browsers
Stars: ✭ 2,330 (+6031.58%)
Mutual labels:  nat-traversal
Wgsd
A CoreDNS plugin that provides WireGuard peer information via DNS-SD semantics
Stars: ✭ 169 (+344.74%)
Mutual labels:  nat-traversal
Turn
RFC 5766 TURN implementation in go
Stars: ✭ 109 (+186.84%)
Mutual labels:  nat-traversal
Sidedoor
SSH connection daemon for Debian/Raspbian/Ubuntu/etc
Stars: ✭ 97 (+155.26%)
Mutual labels:  nat-traversal
Ice
WIP RFC 8445 ICE implementation in go
Stars: ✭ 95 (+150%)
Mutual labels:  nat-traversal

.. |pypi| image:: https://img.shields.io/pypi/v/pynat.svg .. _pypi: https://pypi.python.org/pypi/pynat .. |license| image:: https://img.shields.io/github/license/arantonitis/pynat.svg .. _license: https://github.com/arantonitis/pynat/tree/master/LICENSE

PyNAT


|pypi|_ |license|_

Discover external IP addresses and NAT topologies using STUN (Simple Traversal of UDP Through Network Address Translators).

PyNAT follows RFC 3489, and is inspired by a similar program for Python 2.x called PyStun. PyNAT supports Python 2.7 and later.

.. _RFC 3489: https://tools.ietf.org/html/rfc3489 .. _PyStun: https://github.com/jtriley/pystun

Installation

PyNAT requires Python 2.7 or later.

From PyPI

Install PyNAT by running pip3 install pynat from the command line.

.. note::

On some Linux systems, installation may require running pip with root permissions, or running pip3 install pynat --user. The latter may require exporting ~/.local/bin to PATH.

From GitHub

Clone or download the git repo_, navigate to the directory, and run::

python3 setup.py sdist
cd dist
pip3 install pynat-<version>.tar.gz

.. _git repo: https://github.com/arantonitis/pynat

Usage

To get information about the network topology and external IP/port used, run pynat::

Network type: UDP Firewall 
Internal address: 127.0.0.1:54320 
External address: 127.0.0.1:54320

Run pynat -h or pynat --help for more options::

usage: pynat [-h] [--source_ip SOURCE_IP] [--source-port SOURCE_PORT]
             [--stun-host STUN_HOST] [--stun-port STUN_PORT]

PyNAT v0.0.0 Discover external IP addresses and NAT topologies using STUN.
Copyright (C) 2018 Ariel Antonitis. Licensed under the MIT License.

optional arguments:
  -h, --help            show this help message and exit
  --source_ip SOURCE_IP
                        The source IPv4 address to bind to.
  --source-port SOURCE_PORT
                        The source port to bind to.
  --stun-host STUN_HOST
                        The STUN host to use for queries.
  --stun-port STUN_PORT
                        The port of the STUN host to use for queries.

To use PyNAT inside a Python shell or project::

from pynat import get_ip_info
topology, ext_ip, ext_port = get_ip_info()

To also get information about the internal IP, if unknown::

topology, ext_ip, ext_port, int_ip = get_ip_info(include_internal=True)

Development

PyNAT versioning functions on a MAJOR.MINOR.PATCH.[DEVELOP] model. Only stable, non development releases will be published to PyPI. Because PyNAT is still a beta project, the MAJOR increment will be 0. Minor increments represent new features. Patch increments represent problems fixed with existing features.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].