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.IPv4AddressRangeandIPv6AddressRange: These classes inherit fromIPAddressRangeand represent IP ranges for IPv4 and IPv6 addresses respectively.IPAddressGenerator: This is an abstract class that provides an interface for generating IP addresses.IPv4AddressGeneratorandIPv6AddressGenerator: These classes inherit fromIPAddressGeneratorand 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f78f36bdef562937b5204a016b585c54e34e630c6e5c632f68dae67bcb7f248
|
|
| MD5 |
c314ff058bc026dd77fc47445acaa62c
|
|
| BLAKE2b-256 |
98aaea5f1ccc5a8ed4a2b5f66049336599847047013b24d68577f9f481d1da99
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b9ad5eeda7e282393be14673adc2360a66f0b90cf12a1df57a5e0c597e1536a
|
|
| MD5 |
b35ed4c3f1f36a99af451f1d1557af96
|
|
| BLAKE2b-256 |
7932319217c231c3f1217e6e06bfd93078f9bdf764856899f5f0d491e35a7007
|