enum

package
v0.0.0-...-f304f82 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2017 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertEnumToInt

func ConvertEnumToInt(enum string) (uint64, error)

Convert a enum DNS request to unsigned integer

func PrefixToE164

func PrefixToE164(number uint64) (uint64, error)

Make any number 15 digits long by padding zeros

func Reverse

func Reverse(s string) string

Reverse returns its argument string reversed rune-wise left to right.

Types

type Backend

type Backend interface {
	// RangesBetween returns a list of ranges that enclose the given range l(ower) to u(pper) or
	// nil if no range matches.
	// The c parameter is the maximum count of values to return. If a negative c value is used
	// it will return the ranges in reverse order.
	RangesBetween(l, u uint64, c int) ([]NumberRange, error)

	// Add a range to the backend. Any range overlapping with the one added will be deleted or
	// adjusted to make room for the new one and returned.
	PushRange(r NumberRange) ([]NumberRange, error)

	// Close the backend.
	Close() error
}

type NumberRange

type NumberRange struct {
	Upper   uint64   `json:"upper"`
	Lower   uint64   `json:"lower"`
	Records []Record `json:"records"`
}

func (*NumberRange) Contains

func (r *NumberRange) Contains(o NumberRange) bool

func (*NumberRange) Equals

func (r *NumberRange) Equals(o NumberRange) bool

func (*NumberRange) Finishes

func (r *NumberRange) Finishes(o NumberRange) bool

func (*NumberRange) OverlapWith

func (r *NumberRange) OverlapWith(o NumberRange) bool

Check if the range overlaps with another.

func (*NumberRange) Starts

func (r *NumberRange) Starts(o NumberRange) bool

type RangeOverlapError

type RangeOverlapError struct {
	Range    NumberRange
	Overlaps []NumberRange
}

RangeOverlapError is returned when an operation fails because a range overlaps with on or more other ranges.

func (*RangeOverlapError) Error

func (e *RangeOverlapError) Error() string

type Record

type Record struct {
	Order       uint16 `json:"order"`
	Preference  uint16 `json:"preference"`
	Flags       string `json:"flags"`
	Service     string `json:"service"`
	Regexp      string `json:"regexp"`
	Replacement string `json:"replacement"`
}

Directories

Path Synopsis
backend

Jump to

Keyboard shortcuts

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