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

After installation, run it as get_local_address.

Usage

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.0a1.tar.gz (3.2 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.0a1-py2.py3-none-any.whl (3.8 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

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

File hashes

Hashes for get_local_address-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 367d797edf01dbd1941f453ce96a7df1a02d66cbd9e96645098bb6f51749888b
MD5 e37065ce5a79807ab2edabc6fa854a0a
BLAKE2b-256 fc809c94b69b13e1621f92b4500e9a8a2e09272308bdea4d94bfa5bad9fdaa5a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for get_local_address-0.1.0a1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 5bfd057dac553eb105d9bc76a78c2499d6c10a7047a5a08310fc1b2044a8e790
MD5 5eb5af3fcdd0f2ceaba768891df80506
BLAKE2b-256 728f3e8b13e6a7a108af0e3cf0bddd83d0a1a52fbdc7dcc0483fcb04054e41aa

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