dictionary

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2023 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package dictionary parses FreeRADIUS dictionary files.

API is currently unstable.

Index

Constants

View Source
const (
	EncryptUserPassword              = 1
	EncryptTunnelPassword            = 2
	EncryptAscendProprietaryPassword = 3
)

Variables

This section is empty.

Functions

func SortAttributes

func SortAttributes(attrs []*Attribute)

func SortValues

func SortValues(values []*Value)

func SortVendors

func SortVendors(vendors []*Vendor)

Types

type Attribute

type Attribute struct {
	Name string
	OID  OID
	Type AttributeType

	Size IntFlag

	FlagEncrypt IntFlag
	FlagHasTag  BoolFlag
	FlagConcat  BoolFlag
}

func AttributeByName

func AttributeByName(attrs []*Attribute, name string) *Attribute

func AttributeByOID

func AttributeByOID(attrs []*Attribute, oid OID) *Attribute

func (*Attribute) Equals

func (a *Attribute) Equals(o *Attribute) bool

func (*Attribute) GoString

func (a *Attribute) GoString() string

func (*Attribute) HasTag

func (a *Attribute) HasTag() bool

type AttributeType

type AttributeType int
const (
	AttributeString AttributeType = iota + 1
	AttributeOctets
	AttributeIPAddr
	AttributeDate
	AttributeInteger
	AttributeIPv6Addr
	AttributeIPv6Prefix
	AttributeIFID
	AttributeInteger64

	AttributeVSA

	AttributeEther
	AttributeABinary
	AttributeByte
	AttributeShort
	AttributeSigned
	AttributeTLV
	AttributeIPv4Prefix
)

func (AttributeType) String

func (t AttributeType) String() string

type BeginVendorIncludeError

type BeginVendorIncludeError struct {
}

func (*BeginVendorIncludeError) Error

func (e *BeginVendorIncludeError) Error() string

type BoolFlag

type BoolFlag struct {
	Bool  bool
	Valid bool
}

type Dictionary

type Dictionary struct {
	Attributes []*Attribute
	Values     []*Value
	Vendors    []*Vendor
}

func Merge

func Merge(d1, d2 *Dictionary) (*Dictionary, error)

func (*Dictionary) GoString

func (d *Dictionary) GoString() string

type DuplicateAttributeError

type DuplicateAttributeError struct {
	Attribute *Attribute
}

func (*DuplicateAttributeError) Error

func (e *DuplicateAttributeError) Error() string

type DuplicateAttributeFlagError

type DuplicateAttributeFlagError struct {
	Flag string
}

func (*DuplicateAttributeFlagError) Error

type DuplicateVendorError

type DuplicateVendorError struct {
	Vendor *Vendor
}

func (*DuplicateVendorError) Error

func (e *DuplicateVendorError) Error() string

type File

type File interface {
	io.Reader
	io.Closer
	Name() string
}

type FileSystemOpener

type FileSystemOpener struct {
	Root string
}

func (*FileSystemOpener) OpenFile

func (f *FileSystemOpener) OpenFile(name string) (File, error)

type IntFlag

type IntFlag struct {
	Int   int
	Valid bool
}

type InvalidAttributeEncryptTypeError

type InvalidAttributeEncryptTypeError struct {
	Type string
}

func (*InvalidAttributeEncryptTypeError) Error

type InvalidEndVendorError

type InvalidEndVendorError struct {
	Vendor string
}

func (*InvalidEndVendorError) Error

func (e *InvalidEndVendorError) Error() string

type InvalidOIDError

type InvalidOIDError struct {
	OID string
}

func (*InvalidOIDError) Error

func (e *InvalidOIDError) Error() string

type InvalidVendorFormatError

type InvalidVendorFormatError struct {
	Format string
}

func (*InvalidVendorFormatError) Error

func (e *InvalidVendorFormatError) Error() string

type NestedVendorBlockError

type NestedVendorBlockError struct {
}

func (*NestedVendorBlockError) Error

func (e *NestedVendorBlockError) Error() string

type OID

type OID []int

func (OID) Equals

func (o OID) Equals(other OID) bool

func (OID) String

func (o OID) String() string

type Opener

type Opener interface {
	OpenFile(name string) (File, error)
}

type ParseError

type ParseError struct {
	Inner error
	File  File
	Line  int
}

func (*ParseError) Error

func (e *ParseError) Error() string

type Parser

type Parser struct {
	Opener Opener

	// IgnoreIdenticalAttributes specifies whether identical attributes are
	// ignored, rather than a parse error being emitted.
	IgnoreIdenticalAttributes bool
}

func (*Parser) Parse

func (p *Parser) Parse(f File) (*Dictionary, error)

func (*Parser) ParseFile

func (p *Parser) ParseFile(filename string) (*Dictionary, error)

type RecursiveIncludeError

type RecursiveIncludeError struct {
	Filename string
}

func (*RecursiveIncludeError) Error

func (e *RecursiveIncludeError) Error() string

type UnclosedVendorBlockError

type UnclosedVendorBlockError struct {
}

func (*UnclosedVendorBlockError) Error

func (e *UnclosedVendorBlockError) Error() string

type UnknownAttributeFlagError

type UnknownAttributeFlagError struct {
	Flag string
}

func (*UnknownAttributeFlagError) Error

func (e *UnknownAttributeFlagError) Error() string

type UnknownAttributeTypeError

type UnknownAttributeTypeError struct {
	Type string
}

func (*UnknownAttributeTypeError) Error

func (e *UnknownAttributeTypeError) Error() string

type UnknownLineError

type UnknownLineError struct {
	Line string
}

func (*UnknownLineError) Error

func (e *UnknownLineError) Error() string

type UnknownVendorError

type UnknownVendorError struct {
	Vendor string
}

func (*UnknownVendorError) Error

func (e *UnknownVendorError) Error() string

type UnmatchedEndVendorError

type UnmatchedEndVendorError struct {
}

func (*UnmatchedEndVendorError) Error

func (e *UnmatchedEndVendorError) Error() string

type Value

type Value struct {
	Attribute string
	Name      string
	Number    int
}

func ValuesByAttribute

func ValuesByAttribute(values []*Value, attribute string) []*Value

type Vendor

type Vendor struct {
	Name   string
	Number int

	TypeOctets   *int
	LengthOctets *int

	Attributes []*Attribute
	Values     []*Value
}

func VendorByName

func VendorByName(vendors []*Vendor, name string) *Vendor

func VendorByNumber

func VendorByNumber(vendors []*Vendor, number int) *Vendor

func (*Vendor) GetLengthOctets

func (v *Vendor) GetLengthOctets() int

func (*Vendor) GetTypeOctets

func (v *Vendor) GetTypeOctets() int

func (*Vendor) GoString

func (v *Vendor) GoString() string

Jump to

Keyboard shortcuts

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