Skip to main content

Generating a list of IP addresses of IPv4 and IPv6 versions.

Project description

ipaddr_range

This code provides a simple implementation of generating a list of IP addresses of IPv4 and IPv6 versions.

Usage

The code defines three classes:

  • IPAddressRange: This is a data class that holds the start and end IP addresses.
  • IPv4AddressRange and IPv6AddressRange: These classes inherit from IPAddressRange and represent IP ranges for IPv4 and IPv6 addresses respectively.
  • IPAddressGenerator: This is an abstract class that provides an interface for generating IP addresses.
  • IPv4AddressGenerator and IPv6AddressGenerator: These classes inherit from IPAddressGenerator and provide the implementation for generating IPv4 and IPv6 addresses respectively.

To generate a list of IP addresses, you need to create an instance of IPv4AddressGenerator or IPv6AddressGenerator and then call the generate method with the start and end IP addresses.

The generate method returns an object of type IPAddressRange, which can be used to traverse through the generated IP addresses.

Example

if __name__ == '__main__':
    start_ip, end_ip = '192.168.2.1', '192.168.2.10'

    generator = IPv4AddressGenerator()
    ip_range = generator.generate(start_ip, end_ip)

    for ip in ip_range:
        logging.info(ip)

This code generates a list of IP addresses of the IPv4 version and logs the generated IP addresses.

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

ipaddr_range-0.0.1.tar.gz (2.1 kB view details)

Uploaded Source

Built Distribution

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

ipaddr_range-0.0.1-py3-none-any.whl (2.3 kB view details)

Uploaded Python 3

File details

Details for the file ipaddr_range-0.0.1.tar.gz.

File metadata

  • Download URL: ipaddr_range-0.0.1.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.6

File hashes

Hashes for ipaddr_range-0.0.1.tar.gz
Algorithm Hash digest
SHA256 9f78f36bdef562937b5204a016b585c54e34e630c6e5c632f68dae67bcb7f248
MD5 c314ff058bc026dd77fc47445acaa62c
BLAKE2b-256 98aaea5f1ccc5a8ed4a2b5f66049336599847047013b24d68577f9f481d1da99

See more details on using hashes here.

File details

Details for the file ipaddr_range-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: ipaddr_range-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 2.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.6

File hashes

Hashes for ipaddr_range-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0b9ad5eeda7e282393be14673adc2360a66f0b90cf12a1df57a5e0c597e1536a
MD5 b35ed4c3f1f36a99af451f1d1557af96
BLAKE2b-256 7932319217c231c3f1217e6e06bfd93078f9bdf764856899f5f0d491e35a7007

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