Versions in this module Expand all Collapse all v1 v1.5.1 May 14, 2026 v1.5.0 May 13, 2026 Changes in this version + const SSLModeAllow + const SSLModeDisable + const SSLModePrefer + const SSLModeRequire + const SSLModeVerifyCA + const SSLModeVerifyFull + var DefaultLocalFilePath string + var ErrAlreadyAllocated = errors.New("AlreadyAllocatedError") + var ErrNameTooLong = errors.New("NameTooLong") + var ErrNamespaceDoesNotExist = errors.New("NamespaceDoesNotExist") + var ErrNoIPAvailable = errors.New("NoIPAvailableError") + var ErrNotFound = errors.New("NotFound") + var ErrNotImplemented = errors.New("NotImplemented") + var ErrOptimisticLockError = errors.New("OptimisticLockError") + func NewContextWithNamespace(ctx context.Context, namespace string) context.Context + func PrefixesOverlapping(existingPrefixes []string, newPrefixes []string) error + type BunPrefix struct + Cidr string + Namespace string + Prefix json.RawMessage + type Bundb struct + func NewBunStorage(db *bun.DB, tx *bun.Tx) *Bundb + func (s *Bundb) ApplyDbSchema() error + func (s *Bundb) CreatePrefix(ctx context.Context, prefix Prefix, namespace string) (Prefix, error) + func (s *Bundb) DeleteAllPrefixes(ctx context.Context, namespace string) error + func (s *Bundb) DeleteAllPrefixesFromAllNamespaces(ctx context.Context) error + func (s *Bundb) DeletePrefix(ctx context.Context, prefix Prefix, namespace string) (Prefix, error) + func (s *Bundb) Name() string + func (s *Bundb) ReadAllPrefixCidrs(ctx context.Context, namespace string) ([]string, error) + func (s *Bundb) ReadAllPrefixes(ctx context.Context, namespace string) (Prefixes, error) + func (s *Bundb) ReadPrefix(ctx context.Context, prefix, namespace string) (Prefix, error) + func (s *Bundb) UpdatePrefix(ctx context.Context, prefix Prefix, namespace string) (Prefix, error) + type IP struct + IP netip.Addr + Namespace string + ParentPrefix string + type Ipamer interface + AcquireChildPrefix func(ctx context.Context, parentCidr string, length uint8) (*Prefix, error) + AcquireIP func(ctx context.Context, prefixCidr string) (*IP, error) + AcquireSpecificChildPrefix func(ctx context.Context, parentCidr, childCidr string) (*Prefix, error) + AcquireSpecificIP func(ctx context.Context, prefixCidr, specificIP string) (*IP, error) + CreateNamespace func(ctx context.Context, namespace string) error + DeleteNamespace func(ctx context.Context, namespace string) error + DeletePrefix func(ctx context.Context, cidr string) (*Prefix, error) + Dump func(ctx context.Context) (string, error) + GetSubnetCount func(ctx context.Context, prefixCidr string) uint64 + ListNamespaces func(ctx context.Context) ([]string, error) + Load func(ctx context.Context, dump string) error + NewPrefix func(ctx context.Context, cidr string) (*Prefix, error) + PrefixFrom func(ctx context.Context, cidr string) *Prefix + ReadAllPrefixCidrs func(ctx context.Context) ([]string, error) + ReleaseChildPrefix func(ctx context.Context, child *Prefix) error + ReleaseIP func(ctx context.Context, ip *IP) (*Prefix, error) + ReleaseIPFromPrefix func(ctx context.Context, prefixCidr, ip string) error + SetNamespace func(namespace string) + func New(ctx context.Context) Ipamer + func NewWithStorage(storage Storage) Ipamer + type MongoConfig struct + CollectionName string + DatabaseName string + MongoClientOptions *options.ClientOptions + type Prefix struct + Cidr string + Namespace string + ParentCidr string + func (p *Prefix) GobDecode(buf []byte) error + func (p *Prefix) GobEncode() ([]byte, error) + func (p *Prefix) Network() (netip.Addr, error) + func (p *Prefix) String() string + func (p *Prefix) Usage() Usage + type Prefixes []Prefix + type RedisConfig struct + IP string + Password string + Port string + TLSConfig *tls.Config + Username string + type SSLMode string + func (s SSLMode) String() string + type Storage interface + CreateNamespace func(ctx context.Context, namespace string) error + CreatePrefix func(ctx context.Context, prefix Prefix, namespace string) (Prefix, error) + DeleteAllPrefixes func(ctx context.Context, namespace string) error + DeleteNamespace func(ctx context.Context, namespace string) error + DeletePrefix func(ctx context.Context, prefix Prefix, namespace string) (Prefix, error) + ListNamespaces func(ctx context.Context) ([]string, error) + Name func() string + ReadAllPrefixCidrs func(ctx context.Context, namespace string) ([]string, error) + ReadAllPrefixes func(ctx context.Context, namespace string) (Prefixes, error) + ReadPrefix func(ctx context.Context, prefix string, namespace string) (Prefix, error) + UpdatePrefix func(ctx context.Context, prefix Prefix, namespace string) (Prefix, error) + func NewEtcd(ctx context.Context, ip, port string, cert, key []byte, insecureskip bool) (Storage, error) + func NewLocalFile(ctx context.Context, path string) Storage + func NewMemory(ctx context.Context) Storage + func NewMongo(ctx context.Context, config MongoConfig) (Storage, error) + func NewPostgresStorage(host, port, user, password, dbname string, sslmode SSLMode) (Storage, error) + func NewRedis(ctx context.Context, ip, port string) (Storage, error) + func NewRedisFromConfig(ctx context.Context, cfg RedisConfig) (Storage, error) + type Usage struct + AcquiredIPs uint64 + AcquiredPrefixes uint64 + AvailableIPs uint64 + AvailablePrefixes []string + AvailableSmallestPrefixes uint64 + func (u *Usage) String() string