Skip to main content

A simple utility to determine the local IP address that would be used to communicate with a specified remote UDP server.

Project description

get-local-address

A simple utility to determine the local IP address that would be used to communicate with a specified remote UDP server.

Description

This program creates a UDP socket, connects it to a target server (default: Cloudflare's DNS at 1.1.1.1:53), and then retrieves the local IP address that would be used for this connection. This is particularly useful for systems with multiple network interfaces to determine which interface would be used to reach a specific destination.

Features

  • Configurable target address and port
  • Lightweight, dependency-free
  • Cross-platform

Installation

pip install get-local-address

Usage

python -m get_local_address [-a ADDRESS] [-p PORT] [-h]

Options

Option Description
-a, --address ADDRESS Target server address (default: 1.1.1.1)
-p, --port PORT Target server port (default: 53)
-h, --help Show help message

Output

The program outputs the local IP address that would be used to communicate with the specified server, e.g.:

192.168.1.5

Limitations

  • Only supports IPv4 addresses
  • Requires network connectivity to the target server (though no actual packets are sent)
  • May not work correctly with some firewall configurations

License

MIT License

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

get_local_address-0.1.0a0.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

get_local_address-0.1.0a0-py2.py3-none-any.whl (3.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file get_local_address-0.1.0a0.tar.gz.

File metadata

  • Download URL: get_local_address-0.1.0a0.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for get_local_address-0.1.0a0.tar.gz
Algorithm Hash digest
SHA256 b44e04e65d3800e937cf2b5c5477ea8b8aee2a35615fa2b5f855d724118e4648
MD5 4473e9403b7cbedd6c44706f84651d42
BLAKE2b-256 81fecf35b5f4054d5055415e3b3369b153c4bf100a1e9f5a85d302855663ff63

See more details on using hashes here.

File details

Details for the file get_local_address-0.1.0a0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for get_local_address-0.1.0a0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9cb2cd789ca2df63bad83755a7130265ca60e2fa88b3335f0f2aa60dc7362046
MD5 e9c134649caa83b5523e5acc6b34a93a
BLAKE2b-256 38b3253b889781ce322fe91681b421923f86e4f9faf2d5b5a288e96bd4e3ec82

See more details on using hashes here.

Supported by

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