nutbreaker

package module
v0.0.0-...-9bac897 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2024 License: MIT Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

nutbreaker [WIP]

nutbreaker, because want to break those hard VPN nuts.

This is a port of my goripr project that uses Redis to store IP ranges. This project uses the embedded database nutsdb which is inspired by Redis but does not require a separete application to run.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrIPv6NotSupported is returned if an IPv6 range or IP input is detected.
	ErrIPv6NotSupported = errors.New("IPv6 ranges are not supported")

	// ErrInvalidRange is returned when a passed string is not a valid range
	ErrInvalidRange = errors.New("invalid range passed, use either of these: <IP>, <IP>/<1-32>, <IP> - <IP>")

	// ErrIPNotFound is returned if the passed IP is not contained in any ranges
	ErrIPNotFound = errors.New("the given IP was not found in any database ranges")
)

Functions

This section is empty.

Types

type NutBreaker

type NutBreaker struct {
	// contains filtered or unexported fields
}

func NewNutBreaker

func NewNutBreaker(opts ...Option) (nb *NutBreaker, err error)

func (*NutBreaker) Close

func (n *NutBreaker) Close() error

func (*NutBreaker) DataDir

func (n *NutBreaker) DataDir() string

func (*NutBreaker) Find

func (n *NutBreaker) Find(ip string) (value []byte, err error)

func (*NutBreaker) Flush

func (n *NutBreaker) Flush() error

func (*NutBreaker) Insert

func (n *NutBreaker) Insert(ipRange string, value []byte) (err error)

func (*NutBreaker) Remove

func (n *NutBreaker) Remove(ipRange string) error

func (*NutBreaker) Reset

func (n *NutBreaker) Reset() error

type Option

type Option func(*options) error

func WithDir

func WithDir(dir string) Option

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址