This repository has been archived by the owner on Jan 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
5 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,13 @@ | ||
[![CI](https://github.com/gaissmai/go-inet/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/gaissmai/go-inet/actions/workflows/ci.yml) | ||
[![Go Reference](https://pkg.go.dev/badge/github.com/gaissmai/go-inet.svg)](https://pkg.go.dev/github.com/gaissmai/go-inet/v2) | ||
[![GitHub](https://img.shields.io/github/license/gaissmai/go-inet)](https://github.com/gaissmai/go-inet/blob/master/LICENSE) | ||
[![Go Report Card](https://goreportcard.com/badge/github.com/gaissmai/go-inet)](https://goreportcard.com/report/github.com/gaissmai/go-inet/v2) | ||
[![Coverage Status](https://coveralls.io/repos/github/gaissmai/go-inet/badge.svg)](https://coveralls.io/github/gaissmai/go-inet) | ||
|
||
# go-inet | ||
|
||
A Go library for reading, formatting, sorting and converting IP-addresses and IP-blocks. | ||
|
||
## ATTENTION: DEVELOPMENT STOPPED | ||
|
||
Go has since v1.18 a usable stdlib for IP addresses and prefixes, net/netip, so the package go-inet/inet will be rebuilt on top of the new stdlib and released either as v3 or possibly under a completely new package name. | ||
|
||
## v2 with new API | ||
|
||
Version v2 uses the math based on `type uint128 struct {hi uint64, lo uint64}`, no longer bytes fiddling in network byte order. | ||
The API is reduced to the bare minimum, the tree representation is abstracted with an Interface. | ||
|
||
## github.com/gaissmai/go-inet/v2/inet | ||
|
||
Package inet represents IP-addresses and IP-Blocks as comparable types. | ||
|
||
Some missing utility functions in the standard library for IP-addresses and IP-blocks are provided. | ||
|
||
This IP representation is comparable and can be sorted very quickly without prior conversions to/from the different IP versions. | ||
|
||
The library is mainly intended for fast ACL-lookups and for IP address management (IPAM) in global scope | ||
and not for host related systems programming. | ||
|
||
So, no IP address zone indices are supported and IPv4-mapped IPv6 addresses are stripped down to plain IPv4 addresses. | ||
The information of the prior mapping is discarded. | ||
|
||
Blocks are IP-networks or arbitrary IP-ranges, e.g. | ||
|
||
192.168.0.1/24 // CIDR | ||
::1/128 // CIDR | ||
10.0.0.3-10.0.17.134 // IP range, no CIDR | ||
2001:db8::1-2001:db8::f6 // IP range, no CIDR | ||
|
||
## github.com/gaissmai/go-inet/v2/tree | ||
|
||
Package tree is a minimal interval tree implementation. | ||
|
||
All interval types implementing the tree.Interface can use this library for fast lookups | ||
and a stringified tree representation. | ||
|
||
The tree can be visualized as: | ||
|
||
``` | ||
▼ | ||
├─ 10.0.0.0/9 | ||
│ ├─ 10.0.0.0/11 | ||
│ │ ├─ 10.0.0.0-10.0.0.29 | ||
│ │ ├─ 10.0.16.0/20 | ||
│ │ └─ 10.0.32.0/20 | ||
│ └─ 10.32.0.0/11 | ||
│ ├─ 10.32.8.0/22 | ||
│ ├─ 10.32.12.0-10.32.13.77 | ||
│ └─ 10.32.16.0/22 | ||
├─ 2001:db8:900::/48 | ||
│ ├─ 2001:db8:900::/49 | ||
│ │ ├─ 2001:db8:900::/52 | ||
``` | ||
|
||
## github.com/gaissmai/go-inet/v2/inettree | ||
|
||
Package inettree implements the tree.Interface for inet.Block. | ||
|
||
## Documentation | ||
## DEPRECATED: | ||
|
||
Please study the applications in the [examples directory](https://github.com/gaissmai/go-inet/tree/master/examples) | ||
to get familiar with the API. | ||
Go has since v1.18 a usable stdlib `net/netip` for IP addresses and prefixes and also introduced generics, so the package `go-inet/inet` and `go-inet/tree` has been rebuilt. | ||
|
||
## License | ||
## NEW: | ||
|
||
go-inet is licensed under the MIT License. | ||
* https://github.com/gaissmai/iprange | ||
* https://gibthub.com/gaissmai/interval | ||
|