compare

package
v0.0.0-...-b359386 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package compare provides various compare operators with binary codecs useful for macaroon-based authorization.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnmarshalBinary

func UnmarshalBinary(b []byte) (interface{}, error)

Types

type Bool

type Bool bool

func (Bool) Compare

func (b Bool) Compare(have bool) bool

func (Bool) MarshalBinary

func (b Bool) MarshalBinary() ([]byte, error)

func (*Bool) UnmarshalBinary

func (b *Bool) UnmarshalBinary(buf []byte) error

type CIDRs

type CIDRs []net.IPNet

func (CIDRs) Compare

func (c CIDRs) Compare(have net.IP) bool

func (CIDRs) MarshalBinary

func (c CIDRs) MarshalBinary() ([]byte, error)

func (*CIDRs) UnmarshalBinary

func (c *CIDRs) UnmarshalBinary(b []byte) error

type Integer

type Integer struct {
	Op  IntegerOp
	Int int64
}

func (Integer) Compare

func (c Integer) Compare(have int64) bool

type IntegerOp

type IntegerOp uint8
const (
	IntegerOpEq  IntegerOp = 0
	IntegerOpGt  IntegerOp = 1
	IntegerOpLt  IntegerOp = 2
	IntegerOpGte IntegerOp = 3
	IntegerOpLte IntegerOp = 4
)

type Integers

type Integers []Integer

func (Integers) Compare

func (c Integers) Compare(have int64) bool

func (Integers) MarshalBinary

func (c Integers) MarshalBinary() ([]byte, error)

func (*Integers) UnmarshalBinary

func (c *Integers) UnmarshalBinary(b []byte) error

type Regexp

type Regexp regexp.Regexp

func (*Regexp) Compare

func (r *Regexp) Compare(have string) bool

func (*Regexp) MarshalBinary

func (r *Regexp) MarshalBinary() ([]byte, error)

func (*Regexp) UnmarshalBinary

func (r *Regexp) UnmarshalBinary(b []byte) error

type Strings

type Strings []string

func (Strings) Compare

func (ss Strings) Compare(have string) bool

func (Strings) MarshalBinary

func (ss Strings) MarshalBinary() ([]byte, error)

func (*Strings) UnmarshalBinary

func (ss *Strings) UnmarshalBinary(b []byte) error

type Type

type Type uint8
const (
	TypeFalse    Type = 0
	TypeTrue     Type = 1
	TypeIntegers Type = 2
	TypeStrings  Type = 3
	TypeRegexp   Type = 4
	TypeCIDRs    Type = 5
)

Jump to

Keyboard shortcuts

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