Skip to main content

IPSet written in C

Project description

ipset_c

IPSet is written in C. It is designed to fast calculating ip/subnet/prefixes intersection, inclusion, joining, subtracting and other operations on IP sets. If you use pytricia or py-radix over netaddr.IPSet because of performance reasons, you should try this library. Runs on Windows, Linux, macOS. Wheels are available for supported versions. Tens of times faster than pure Python netaddr IPSet. Supports both IPv4 and IPv6. Picklable. Can be compiled for free-threading usage.

[!IMPORTANT] Due to the max sequence size in python(sys.maxsize), using len() with a large IPv6 IPSet raising an error. Use the IPSet([]).size attribute instead.

[!IMPORTANT] Do not mix IPv4 and IPv6 in one IPSet without converting to IPv4-mapped IPv6. For example, instead of "0.0.0.0/32" pass "::ffff:0.0.0.0/128".

Installation

pip install ipset_c

Usage

from ipset_c import IPSet
a = IPSet(['12.12.12.0/25', '12.12.12.128/25'])
a.getCidrs()  # ['12.12.12.0/24']
a.addCidr('8.8.8.8/30')
a.getCidrs()  # ['8.8.8.8/30', '12.12.12.0/24']
b = IPSet(['12.12.12.0/25'])
a.isSubset(b)  # False
a.isSuperset(b)  # True
a == b  # False
a < b  # False
a <= b  # False
a > b  # True
a >= b  # True
a.isContainsCidr("12.12.0.0/16")  # False
a.isIntersectsCidr("12.12.0.0/16")  # True
b.addCidr('4.4.4.4/32')
a.getCidrs()  # ['8.8.8.8/30', '12.12.12.0/24']
b.getCidrs()  # ['4.4.4.4/32', '12.12.12.0/25']
c = a & b
c.getCidrs()  # ['12.12.12.0/25']
c = a | b
c.getCidrs()  # ['4.4.4.4/32', '8.8.8.8/30', '12.12.12.0/24']
c = a ^ b
c.getCidrs()  # ['4.4.4.4/32', '8.8.8.8/30', '12.12.12.128/25']
c = a - b
c.getCidrs()  # ['8.8.8.8/30', '12.12.12.128/25']
a.removeCidr('8.8.8.8/30')
a.getCidrs()  # ['12.12.12.0/24']
len(a)  # 256
a.size  # 256
c = a.copy()
bool(IPSet([]))  # False
str(IPSet(['8.8.8.8/30']))  # "IPSet(['8.8.8.8/30'])"

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

ipset_c-0.1.1.tar.gz (20.1 kB view details)

Uploaded Source

Built Distributions

ipset_c-0.1.1-cp313-cp313-win_amd64.whl (19.2 kB view details)

Uploaded CPython 3.13Windows x86-64

ipset_c-0.1.1-cp313-cp313-manylinux_2_39_x86_64.whl (53.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.39+ x86-64

ipset_c-0.1.1-cp313-cp313-macosx_14_0_arm64.whl (26.3 kB view details)

Uploaded CPython 3.13macOS 14.0+ ARM64

ipset_c-0.1.1-cp312-cp312-win_amd64.whl (19.2 kB view details)

Uploaded CPython 3.12Windows x86-64

ipset_c-0.1.1-cp312-cp312-manylinux_2_39_x86_64.whl (53.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

ipset_c-0.1.1-cp312-cp312-macosx_14_0_arm64.whl (26.3 kB view details)

Uploaded CPython 3.12macOS 14.0+ ARM64

ipset_c-0.1.1-cp311-cp311-win_amd64.whl (19.2 kB view details)

Uploaded CPython 3.11Windows x86-64

ipset_c-0.1.1-cp311-cp311-manylinux_2_39_x86_64.whl (52.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.39+ x86-64

ipset_c-0.1.1-cp311-cp311-macosx_14_0_arm64.whl (26.2 kB view details)

Uploaded CPython 3.11macOS 14.0+ ARM64

ipset_c-0.1.1-cp310-cp310-win_amd64.whl (19.2 kB view details)

Uploaded CPython 3.10Windows x86-64

ipset_c-0.1.1-cp310-cp310-manylinux_2_39_x86_64.whl (52.0 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.39+ x86-64

ipset_c-0.1.1-cp310-cp310-macosx_14_0_arm64.whl (26.2 kB view details)

Uploaded CPython 3.10macOS 14.0+ ARM64

ipset_c-0.1.1-cp39-cp39-win_amd64.whl (19.2 kB view details)

Uploaded CPython 3.9Windows x86-64

ipset_c-0.1.1-cp39-cp39-manylinux_2_39_x86_64.whl (51.5 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.39+ x86-64

ipset_c-0.1.1-cp39-cp39-macosx_14_0_arm64.whl (26.2 kB view details)

Uploaded CPython 3.9macOS 14.0+ ARM64

ipset_c-0.1.1-cp38-cp38-win_amd64.whl (19.2 kB view details)

Uploaded CPython 3.8Windows x86-64

ipset_c-0.1.1-cp38-cp38-manylinux_2_39_x86_64.whl (52.3 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.39+ x86-64

ipset_c-0.1.1-cp38-cp38-macosx_14_0_arm64.whl (26.2 kB view details)

Uploaded CPython 3.8macOS 14.0+ ARM64

File details

Details for the file ipset_c-0.1.1.tar.gz.

File metadata

  • Download URL: ipset_c-0.1.1.tar.gz
  • Upload date:
  • Size: 20.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.0 CPython/3.12.10

File hashes

Hashes for ipset_c-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7e58688642ce79ce88d526471a44ce1f36639dd16d841fc59d6022dc7aa86b47
MD5 304e2e925a38f9566abd1a92a7d3c6b3
BLAKE2b-256 10f1f2b2e254b83be56a79309f43aa012a07e422af539ac915839a931578fd91

See more details on using hashes here.

File details

Details for the file ipset_c-0.1.1-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: ipset_c-0.1.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 19.2 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.0 CPython/3.13.3

File hashes

Hashes for ipset_c-0.1.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 81dfd0f9aba47771775832d018394deafe31f9a6e6af91d593e1f08824c8d66f
MD5 4407774f443abc5f67e593c3d22edf79
BLAKE2b-256 bd1675421dd69b285c36a20407999d1d0e1cc352b413bba18d7bb1554ada3417

See more details on using hashes here.

File details

Details for the file ipset_c-0.1.1-cp313-cp313-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for ipset_c-0.1.1-cp313-cp313-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 8ca6ea663c9684c54520d7282be429be9223b816a7b74f5c4b5acfaa8dddf822
MD5 3491595adac62cf25277d952a37f3dc8
BLAKE2b-256 1826d71de37ea52b5b703fda9439c251123faec66bd8c82418fa0a78b585c07c

See more details on using hashes here.

File details

Details for the file ipset_c-0.1.1-cp313-cp313-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for ipset_c-0.1.1-cp313-cp313-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 530e611451e002646463529a81b54029a5fa2d456fa613b167dcffcef5c66c97
MD5 48cabbed2ebbdb535888642c56f95b8f
BLAKE2b-256 bfc36554a3fb2657381478620c6a9edfd3cbaaf2efc5a2a4c28e3358525bef9f

See more details on using hashes here.

File details

Details for the file ipset_c-0.1.1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: ipset_c-0.1.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 19.2 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.0 CPython/3.12.10

File hashes

Hashes for ipset_c-0.1.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 959a953f2479f04a3673a0d68ce6c4a32761e3d6a569c256740e20e464272eba
MD5 4c8ad12aa9e22cd2600ba207c7f1bf41
BLAKE2b-256 ef0e36916355a1f0f11376b3c3b298193da3f12bb17417f0ae487e109484682f

See more details on using hashes here.

File details

Details for the file ipset_c-0.1.1-cp312-cp312-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for ipset_c-0.1.1-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 d28112714ed932eb3a43543c002eb354ccef3f10a3884197db1925907173ac15
MD5 010266c9fe32edc76d0ebac22baa746d
BLAKE2b-256 cc336d112b5f45a582ba971618927e47a7040b4c50963a97cdd41984e9159fe1

See more details on using hashes here.

File details

Details for the file ipset_c-0.1.1-cp312-cp312-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for ipset_c-0.1.1-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 a9a4f4e48c033248dd497aec54225bb551a1db9ad2682b5eda1bc46b07f1a4b7
MD5 c8dc60f9fd0a74ab591ce616c68d130d
BLAKE2b-256 d36c2824fc5a063db1b4615bcf4d2ef4c054a4d0d402f6b97c7b0d96e64ee10e

See more details on using hashes here.

File details

Details for the file ipset_c-0.1.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: ipset_c-0.1.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 19.2 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.0 CPython/3.11.9

File hashes

Hashes for ipset_c-0.1.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 58c240c1ee80fd84ac8a313db91403a9822a7476511f9c65261f48d546d6eff3
MD5 b55ad849294c3e3fe38bc45947c22973
BLAKE2b-256 274ebb0a95d83f3b1a523c69ecfe44697cc0ed85f63256a5fd1b2f7e9c128392

See more details on using hashes here.

File details

Details for the file ipset_c-0.1.1-cp311-cp311-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for ipset_c-0.1.1-cp311-cp311-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 21f6f4ade7f69c2ebc07ac3a97d12bed528dd2f3f1b349b32b65cf645dfe7f8d
MD5 a5e4af422ec32490e158395ef9c61bd9
BLAKE2b-256 67b4e0664936728de88313a64c193bed60849f502c822cf6b1da07c639819e88

See more details on using hashes here.

File details

Details for the file ipset_c-0.1.1-cp311-cp311-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for ipset_c-0.1.1-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 256079cb4fbb72ddd048748ea73831d25deab9a795a509c5e2c91ea309023e6e
MD5 784f221ddd963bebc81a838700a0c86f
BLAKE2b-256 7d8db624c96919579c25c8dcbbbfa66309563f4466698fe96142e25aba87795e

See more details on using hashes here.

File details

Details for the file ipset_c-0.1.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: ipset_c-0.1.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 19.2 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.0 CPython/3.10.11

File hashes

Hashes for ipset_c-0.1.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 a813053ba170d4abfb29e73314ca6dda50ea655cfa18fe8d9456f54d7980bf1d
MD5 26cdfdc1b17029a45711967a98eca041
BLAKE2b-256 865d978346dff6f5c7eac3806e1fc348355a4c3c345e86e280445b6dabebccd1

See more details on using hashes here.

File details

Details for the file ipset_c-0.1.1-cp310-cp310-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for ipset_c-0.1.1-cp310-cp310-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 833c6b8610def8ae597d7ab4d559593fe8b7a56bdbf5f73988ea15dadf0d3a98
MD5 26d8e9b42bec45f9ddc86b4f0882934c
BLAKE2b-256 e906f9a22ebcf51d82e5eca28feb0bb325db6ae1cf0a29f07a162a52ec82d1bf

See more details on using hashes here.

File details

Details for the file ipset_c-0.1.1-cp310-cp310-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for ipset_c-0.1.1-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 87655b2ae1d311340d5f21d9bf5860a3614c99d819e5d1499524eddcecf64ae2
MD5 17cdc55e6a740de3faf5df0d9583255c
BLAKE2b-256 ba59d995799aa25807c354023c8bbb587f445be09c8ef4b26431445265ddae45

See more details on using hashes here.

File details

Details for the file ipset_c-0.1.1-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: ipset_c-0.1.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 19.2 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.0 CPython/3.9.13

File hashes

Hashes for ipset_c-0.1.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 30bfa42028deb55c078985334658e31b4c8db9e3e9e703406f4c54b78edb44cb
MD5 373c46094768ccd26117490a845c38c4
BLAKE2b-256 be54ac2cc61fd28333f7e658c536a92f5f795e8c4fb9c131117f7fcf520c6d63

See more details on using hashes here.

File details

Details for the file ipset_c-0.1.1-cp39-cp39-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for ipset_c-0.1.1-cp39-cp39-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 cb4d0d94aedc52d84f76b1f76ce00087c18799701b07d4daf95736be876cff66
MD5 057ef9fc62a8a1aa9de03e1f1814b879
BLAKE2b-256 e94bdb9b8e2cfab56582789546ed15c665e4213233ad95a7f1bc835c8d8db9e6

See more details on using hashes here.

File details

Details for the file ipset_c-0.1.1-cp39-cp39-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for ipset_c-0.1.1-cp39-cp39-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 bbcf862c29abe73fad340bb0f13aeb9e5c8470d2c0c51d25b5a1b6b7a5d3048a
MD5 00946b602e6b0f0e25dd249c190abdb9
BLAKE2b-256 bfebf6ca612b0cb5671b20d6b995633fbb39b4375752503391076ea083fb18fd

See more details on using hashes here.

File details

Details for the file ipset_c-0.1.1-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: ipset_c-0.1.1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 19.2 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.0 CPython/3.8.10

File hashes

Hashes for ipset_c-0.1.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 0fe874df24f706fd8e5752ec22b86dc9d839b91bbd1140bd845e3bdf035b971e
MD5 04af9479d4e5fb975112e9e9cda6a1e9
BLAKE2b-256 bbd9bd38d6b4f2e49a0f9ce9559468562a592152d7f1a46258a32b364addac03

See more details on using hashes here.

File details

Details for the file ipset_c-0.1.1-cp38-cp38-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for ipset_c-0.1.1-cp38-cp38-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 f33be7a4f3483d1599fb46d577d7a549ddc199b2c68c91287c4fb35a81e9f113
MD5 6621ab7a8bce17ff69b6c80088b7c1b7
BLAKE2b-256 410a60c85cb571ea031c758f1ec27b29d56771e129c2df9def8c53e65fb3adfc

See more details on using hashes here.

File details

Details for the file ipset_c-0.1.1-cp38-cp38-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for ipset_c-0.1.1-cp38-cp38-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 aabd66133d37e076500e933f1696e70a8dbf3105c04d34c5dacc1605cd518b87
MD5 ac4bdfcd7670ce01e58d6c403d2b66b2
BLAKE2b-256 3aca28b01a39f5aca37bbc5c3813bb10f7c32064d3bc38a304d662933d497ff8

See more details on using hashes here.

Supported by

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