dirsyn

package module
v0.0.0-...-808a36e Latest Latest
Warning

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

Go to latest
Published: May 18, 2025 License: MIT Imports: 26 Imported by: 0

README


dirsyn_logo_small

Go Report Card CodeQL Code Coverage GitHub Workflow Status (with event) Reference License Issues Experimental Volatility Warning Help Animals Help Wanted

Package dirsyn implements low-level directory syntax parsing and assertion matching rule components.

This package was developed for the XDAPL Project.

Status

NOT YET READY FOR GENERAL USE!

The current state of this package is EXPERIMENTAL and very unstable. It should NOT be used in mission-critical or production environments, and is prone to breaking changes at any time. There are some interesting long-term plans for this package, so it should continue to evolve and grow.

Much research remains before this package can be relied upon implicitly. Some functionality is present only to serve as a placeholder, and does not exhibit fully standards-compliant behavior at this time.

Contributions are most welcome.

License

The go-dirsyn package is released under the terms of the MIT license. See the repository root for applicable license files.

Content developed or appropriated from external sources, such as that found within the dn.go file, will also contain the relevant license text within the file comment header.

Help Wanted!

As indicated by the above badge, I am actively looking for experienced open source volunteers who have a keen grasp of directory syntaxes, matching rules and other abstract components. Past or present contributors of any third-party X.500/LDAP DSA (server!) products are especially welcome.

Scope

The scope of this package is intended to, ultimately, cover all of the syntactical components and logic of ITU-T Rec. X.500. Though exclusive to directory services, it is not exclusive to LDAP.

Intended Audience

As mentioned earlier, this (very specialized) package is low-level in nature. It is not designed for end users (i.e.: directory users or professionals), but rather for anyone creating a low level directory service implementation using Go.

Dependencies

This package relies upon the following packages from the standard library:

  • bufio
  • bytes
  • embed
  • encoding/asn1
  • encoding/binary
  • encoding/base64
  • encoding/hex
  • errors
  • fmt
  • io/fs
  • math/big
  • os
  • path/filepath
  • reflect††
  • regexp†††
  • sort
  • strconv
  • strings
  • sync
  • testing
  • time
  • unicode
  • unicode/utf8
  • unicode/utf16
- used ONLY for testing/examples
†† - very limited use
††† - used ONLY for custom syntaxes implemented through the X-PATTERN eXtension

This package relies upon the following third-party packages:

Supported Matching Rules

The following matching rules are supported by this package at this time. More will be added in the future:

Supported Syntaxes

The following syntaxes are supported by this package at this time. More will be added in the future:

Documentation

Index

Examples

Constants

View Source
const (
	UBTelephoneNumber   int = 32   // X.520: ub-telephone-number INTEGER ::= 32
	UBTeletexTerminalID int = 1024 // X.520: ub-teletex-terminal-id INTEGER ::= 1024
	UBTeletexPrivateUse int = 128  // X.411: ub-teletex-private-use-length INTEGER ::= 128
)
View Source
const ACIv3AttributeTypeDescription = `` /* 214-byte string literal not displayed */

ACIv3AttributeTypeDescription contains the string representation of the Netscape ACIv3 "aci" attribute type schema definition, formatted in the standard RFC 4512 Attribute Type Description syntax.

Directory systems which implement and honor the Netscape ACIv3 syntax for access control purposes SHOULD register and advertise this type in the directory schema.

Facts

  • OID: 2.16.840.1.113730.3.1.55 ("aci")
  • Directory String SYNTAX
  • NO matching rules of any kind
  • directoryOperation USAGE
View Source
const GreaterOrEqual byte = 0x0

GreaterOrEqual (>=), when input to an OrderingRuleAssertion function, results in a greater or equal (GE) comparison.

View Source
const LessOrEqual byte = 0x1

LessOrEqual (<=), when input to an OrderingRuleAssertion function, results in a less or equal (LE) comparison.

Variables

View Source
var ACIv3AuthenticationMethodLowerCase bool

ACIv3AuthenticationMethodLowerCase allows control over the case folding of ACIv3AuthenticationMethod string representation.

A value of true shall force lowercase normalization, while a value of false (default) forces uppercase normalization.

View Source
var ClassNames = map[int]string{
	// contains filtered or unexported fields
}
View Source
var CompoundNames = map[bool]string{
	// contains filtered or unexported fields
}
View Source
var TagNames = map[int]string{
	// contains filtered or unexported fields
}

Functions

This section is empty.

Types

type ACIv3Attribute

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

ACIv3Attribute facilitates the storage of one (1) or more attribute OIDs, typically used in the context of ACIv3TargetRuleItem attributes.

func (ACIv3Attribute) Eq

Eq initializes and returns a new ACIv3TargetRuleItem instance configured to express the evaluation of the receiver value as Equal-To a ACIv3TargetAttr ACIv3TargetKeyword context.

func (ACIv3Attribute) Index

func (r ACIv3Attribute) Index(idx int) string

func (ACIv3Attribute) IsZero

func (r ACIv3Attribute) IsZero() bool

func (ACIv3Attribute) Keyword

func (r ACIv3Attribute) Keyword() ACIv3Keyword

Keyword performs no useful task, as the receiver instance has no concept of a keyword. This method exists solely to satisfy Go's interface signature requirements and will return nil if executed.

func (ACIv3Attribute) Kind

func (r ACIv3Attribute) Kind() string

Kind performs no useful task, as the receiver instance has no concept of a keyword, which is the typical value source for Kind calls. This method exists solely to satisfy Go's interface signature requirements and will return a zero string if executed.

func (ACIv3Attribute) Len

func (r ACIv3Attribute) Len() int

func (ACIv3Attribute) Ne

Ne initializes and returns a new ACIv3TargetRuleItem instance configured to express the evaluation of the receiver value as Not-Equal-To a ACIv3TargetAttr ACIv3TargetKeyword context.

Negated equality ACIv3TargetRuleItem instances should be used with caution.

func (ACIv3Attribute) Push

func (r ACIv3Attribute) Push(x ...any) ACIv3Attribute

Push appends zero (0) or more attributes to the receiver instance.

func (ACIv3Attribute) String

func (r ACIv3Attribute) String() string

String returns the string representation of the receiver instance.

func (ACIv3Attribute) TRM

TRM returns an instance of ACIv3TargetRuleMethods.

Each of the return instance's key values represent a single instance of the ACIv3Operator type that is allowed for use in the creation of ACIv3TargetRuleItem instances which bear the receiver instance as an expression value. The value for each key is the actual ACIv3TargetRuleMethod instance for OPTIONAL use in the creation of a ACIv3TargetRuleItem instance.

This is merely a convenient alternative to maintaining knowledge of which ACIv3Operator instances apply to which types. Instances of this type are also used to streamline package unit tests.

Please note that if the receiver is in an aberrant state, or if it has not yet been initialized, the execution of ANY of the return instance's value methods will return bogus ACIv3TargetRuleItem instances. While this is useful in unit testing, the end user must only execute this method IF and WHEN the receiver has been properly initialized, populated and prepared for such activity.

func (ACIv3Attribute) Valid

func (r ACIv3Attribute) Valid() (err error)

Valid returns an error following an analysis of the receiver instance.

type ACIv3AttributeBindTypeOrValue

type ACIv3AttributeBindTypeOrValue struct {
	ACIv3BindKeyword // Constraint: ACIv3BindUAT or ACIv3BindGAT keywords only!
	// contains filtered or unexported fields
}

ACIv3AttributeBindTypeOrValue contains a statement of the following syntax:

<AttributeName>#<BindType -OR- AttributeValue>

Instances of this type are used in certain ACIv3BindRule instances, particularly those that involve user-attribute or group-attribute ACIv3BindKeyword instances.

func (ACIv3AttributeBindTypeOrValue) BRM

BRM returns an instance of ACIv3BindRuleMethods.

Each of the return instance's key values represent a single instance of the ACIv3Operator type that is allowed for use in the creation of ACIv3BindRule instances which bear the receiver instance as an expression value. The value for each key is the actual ACIv3BindRuleMethod instance for OPTIONAL use in the creation of a ACIv3BindRule instance.

This is merely a convenient alternative to maintaining knowledge of which ACIv3Operator instances apply to which types. Instances of this type are also used to streamline package unit tests.

Please note that if the receiver is in an aberrant state, or if it has not yet been initialized, the execution of ANY of the return instance's value methods will return bogus ACIv3BindRule instances. While this is useful in unit testing, the end user must only execute this method IF and WHEN the receiver has been properly populated and prepared for such activity.

func (ACIv3AttributeBindTypeOrValue) Eq

Eq initializes and returns a new ACIv3BindRule instance configured to express the evaluation of the receiver value as Equal-To a ACIv3BindUAT or ACIv3BindGAT ACIv3BindKeyword context.

func (ACIv3AttributeBindTypeOrValue) IsZero

IsZero returns a Boolean value indicative of whether the receiver is nil, or unset.

func (ACIv3AttributeBindTypeOrValue) Keyword

Keyword returns the ACIv3BindKeyword associated with the receiver instance, enveloped as a ACIv3Keyword. In the context of this type instance, the ACIv3BindKeyword returned will always be one (1) of ACIv3BindUAT or ACIv3BindGAT.

func (ACIv3AttributeBindTypeOrValue) Ne

Ne initializes and returns a new ACIv3BindRule instance configured to express the evaluation of the receiver value as Not-Equal-To a ACIv3BindUAT or ACIv3BindGAT ACIv3BindKeyword context.

Negated equality ACIv3BindRule instances should be used with caution.

func (ACIv3AttributeBindTypeOrValue) Set

Set assigns value(s) x to the receiver. The value(s) must be ACIv3Attribute and/or AttributeValue instances, created via the package-level [AT] and [AV] functions respectively.

func (ACIv3AttributeBindTypeOrValue) String

String returns the string representation of the receiver instance.

func (ACIv3AttributeBindTypeOrValue) Valid

func (r ACIv3AttributeBindTypeOrValue) Valid() (err error)

Valid returns an error indicative of whether the receiver is in an aberrant state.

type ACIv3AttributeFilter

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

AttributeFilter is a struct type that embeds an ACIv3Attribute and filter-style ACIv3TargetRule.

func (ACIv3AttributeFilter) Attribute

func (r ACIv3AttributeFilter) Attribute() ACIv3Attribute

AttributeType returns the underlying instance of ACIv3Attribute, or a bogus ACIv3Attribute if unset.

func (ACIv3AttributeFilter) Filter

func (r ACIv3AttributeFilter) Filter() Filter

Filter returns the underlying instance of Filter, or a bogus Filter if unset.

func (ACIv3AttributeFilter) IsZero

func (r ACIv3AttributeFilter) IsZero() bool

IsZero returns a Boolean value indicative of whether the receiver is nil, or unset.

func (ACIv3AttributeFilter) Keyword

func (r ACIv3AttributeFilter) Keyword() ACIv3Keyword

Keyword returns the ACIv3TargetKeyword associated with the receiver instance enveloped as a ACIv3Keyword. In the context of this type instance, the ACIv3TargetKeyword returned is always ACIv3TargetFilter.

func (*ACIv3AttributeFilter) Set

Set assigns the provided address component to the receiver and returns the receiver instance in fluent-form.

Multiple values can be provided in variadic form, or piecemeal.

func (ACIv3AttributeFilter) String

func (r ACIv3AttributeFilter) String() string

String returns the string representation of the receiver instance.

func (ACIv3AttributeFilter) Valid

func (r ACIv3AttributeFilter) Valid() (err error)

Valid returns an error indicative of whether the receiver is in an aberrant state.

type ACIv3AttributeFilterOperation

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

ACIv3AttributeFilterOperation is the high-level composite type for use in creating ACIv3TargetRule instances which bear the ACIv3TargetAttrFilters [ACIKeyword].

Instances of this type require one (1) ACIv3AddOp-based ACIv3AttributeFilterOperationItem instance and/or one (1) ACIv3DelOp-based ACIv3AttributeFilterOperationItem instance.

func (ACIv3AttributeFilterOperation) Eq

Eq initializes and returns a new ACIv3TargetRule instance configured to express the evaluation of the receiver value as Equal-To a ACIv3TargetAttrFilters ACIv3TargetKeyword context.

func (ACIv3AttributeFilterOperation) IsZero

IsZero wraps the [stackage.Stack.IsZero] method.

func (ACIv3AttributeFilterOperation) Keyword

Keyword returns the ACIv3TargetKeyword associated with the receiver instance. In the context of this type instance, the ACIv3TargetKeyword returned is always ACIv3TargetAttrFilters.

func (ACIv3AttributeFilterOperation) Kind

Kind returns the categorical label assigned to the receiver.

func (ACIv3AttributeFilterOperation) Len

Len returns the integer length of the receiver instance. The maximum length for instances of this kind is two (2).

func (ACIv3AttributeFilterOperation) Ne

Ne performs no useful task, as negated equality comparison does not apply to ACIv3TargetRule instances that bear the ACIv3TargetAttrFilters ACIv3TargetKeyword context.

This method exists solely to convey this message and conform to Go's interface qualifying signature. When executed, this method will return a bogus ACIv3TargetRule.

Negated equality ACIv3TargetRule instances should be used with caution.

func (ACIv3AttributeFilterOperation) SetDelimiter

SetDelimiter controls the delimitation scheme employed by the receiver. A value of one (1) overrides the default comma (",") delimiter with a semicolon (";").

func (ACIv3AttributeFilterOperation) String

String returns the string representation of the receiver instance.

func (ACIv3AttributeFilterOperation) TRM

TRM returns an instance of ACIv3TargetRuleMethods.

Each of the return instance's key values represent a single instance of the ACIv3Operator type that is allowed for use in the creation of ACIv3TargetRule instances which bear the receiver instance as an expression value. The value for each key is the actual ACIv3TargetRuleMethod instance for OPTIONAL use in the creation of a ACIv3TargetRule instance.

This is merely a convenient alternative to maintaining knowledge of which ACIv3Operator instances apply to which types. Instances of this type are also used to streamline package unit tests.

Please note that if the receiver is in an aberrant state, or if it has not yet been initialized, the execution of ANY of the return instance's value methods will return bogus ACIv3TargetRule instances. While this is useful in unit testing, the end user must only execute this method IF and WHEN the receiver has been properly populated and prepared for such activity.

func (ACIv3AttributeFilterOperation) Valid

Valid wraps the [stackage.Stack.Valid] method.

type ACIv3AttributeFilterOperationItem

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

func (ACIv3AttributeFilterOperationItem) Contains

Contains returns a Boolean value indicative of whether the type and its value were located within the receiver.

Valid input types are ACIv3AttributeFilter or a valid string equivalent.

Case is significant in the matching process.

func (ACIv3AttributeFilterOperationItem) Eq

Eq initializes and returns a new [TargetRule] instance configured to express the evaluation of the receiver value as Equal-To a [TargetAttrFilters] [TargetKeyword] context.

func (ACIv3AttributeFilterOperationItem) Index

Index returns the Nth instance of ACIv3AttributeFilter present within the receiver instance.

func (ACIv3AttributeFilterOperationItem) IsZero

IsZero returns a Boolean value indicative of a nil receiver state.

func (ACIv3AttributeFilterOperationItem) Keyword

Keyword returns the [TargetKeyword] associated with the receiver instance enveloped as a [Keyword]. In the context of this type instance, the [TargetAttrFilters] [TargetKeyword] context is always returned.

func (ACIv3AttributeFilterOperationItem) Kind

Kind returns the kind of receiver instance.

func (ACIv3AttributeFilterOperationItem) Len

Len returns the integer length of the receiver instance.

func (ACIv3AttributeFilterOperationItem) Ne

Ne performs no useful task, as negated equality comparison does not apply to ACIv3TargetRule instances that bear the ACIv3TargetAttrFilters ACIv3TargetKeyword context.

This method exists solely to convey this message and conform to Go's interface qualifying signature. When executed, this method will return a bogus ACIv3TargetRule.

Negated equality ACIv3TargetRule instances should be used with caution.

func (ACIv3AttributeFilterOperationItem) Operation

Operation returns ACIv3AddOp, ACIv3DelOp or an invalid operation if unspecified.

func (ACIv3AttributeFilterOperationItem) Push

func (ACIv3AttributeFilterOperationItem) String

String returns the string representation of the receiver instance.

func (ACIv3AttributeFilterOperationItem) TRM

TRM returns an instance of ACIv3TargetRuleMethods.

Each of the return instance's key values represent a single instance of the ACIv3Operator type that is allowed for use in the creation of ACIv3TargetRule instances which bear the receiver instance as an expression value. The value for each key is the actual ACIv3TargetRuleMethod instance for OPTIONAL use in the creation of a ACIv3TargetRule instance.

This is merely a convenient alternative to maintaining knowledge of which ACIv3Operator instances apply to which types. Instances of this type are also used to streamline package unit tests.

Please note that if the receiver is in an aberrant state, or if it has not yet been initialized, the execution of ANY of the return instance's value methods will return bogus ACIv3TargetRule instances. While this is useful in unit testing, the end user must only execute this method IF and WHEN the receiver has been properly populated and prepared for such activity.

func (ACIv3AttributeFilterOperationItem) Valid

Valid returns an error following an analysis of the receiver instance.

type ACIv3AttributeOperation

type ACIv3AttributeOperation uint8

AttributeOperation defines either an Add Operation or a Delete Operation.

Constants of this type are used in ACIv3AttributeFilterOperation instances.

const (
	ACIv3AddOp ACIv3AttributeOperation // add=
	ACIv3DelOp                         // delete=
)

[AttributeOperation] constants are used to initialize and return ACIv3AttributeFilter instances based on one (1) of the possible two (2) constants defined below.

func (ACIv3AttributeOperation) String

func (r ACIv3AttributeOperation) String() string

String returns the string representation of the receiver instance.

type ACIv3AuthenticationMethod

type ACIv3AuthenticationMethod uint8

ACIv3AuthenticationMethod is a uint8 type that manifests through predefined package constants, each describing a supported means of LDAP authentication.

const (
	ACIv3Anonymous ACIv3AuthenticationMethod // 0
	ACIv3Simple                              // 1
	ACIv3SSL                                 // 2
	ACIv3SASL                                // 3
	ACIv3EXTERNAL                            // 4
	ACIv3DIGESTMD5                           // 5
	ACIv3GSSAPI                              // 6
)

ACIv3AuthenticationMethod constants define all of the available LDAP authentication mechanisms recognized within the ACIv3 syntax honored by the package.

Please note that supported SASL mechanisms vary per implementation.

func (ACIv3AuthenticationMethod) BRM

BRM returns an instance of ACIv3BindRuleMethods.

Each of the return instance's key values represent a single instance of the ACIv3Operator type that is allowed for use in the creation of ACIv3BindRule instances which bear the receiver instance as an expression value. The value for each key is the actual ACIv3BindRuleMethod instance for OPTIONAL use in the creation of a ACIv3BindRule instance.

This is merely a convenient alternative to maintaining knowledge of which ACIv3Operator instances apply to which types. Instances of this type are also used to streamline package unit tests.

Please note that if the receiver is in an aberrant state, or if it has not yet been initialized, the execution of ANY of the return instance's value methods will return bogus ACIv3BindRule instances. While this is useful in unit testing, the end user must only execute this method IF and WHEN the receiver has been properly populated and prepared for such activity.

Example
meths := ACIv3Anonymous.BRM()
fmt.Printf("%d available aci.BindRuleMethod instances", meths.Len())
Output:

2 available aci.BindRuleMethod instances

func (ACIv3AuthenticationMethod) Eq

Eq initializes and returns a new ACIv3BindRule instance configured to express the evaluation of the receiver value as Equal-To the ACIv3BindAM ACIv3BindKeyword context.

Example
fmt.Printf("%s", ACIv3SASL.Eq())
Output:

authmethod="SASL"

func (ACIv3AuthenticationMethod) Ne

Ne initializes and returns a new ACIv3BindRule instance configured to express the evaluation of the receiver value as Not-Equal-To the ACIv3BindAM ACIv3BindKeyword context.

Negated equality ACIv3BindRule instances should be used with caution.

Example
fmt.Printf("%s", ACIv3Anonymous.Ne())
Output:

authmethod!="NONE"

func (ACIv3AuthenticationMethod) String

func (r ACIv3AuthenticationMethod) String() (am string)

String returns the string representation of the receiver instance.

Example
fmt.Printf("%s", ACIv3EXTERNAL)
Output:

SASL EXTERNAL

func (ACIv3AuthenticationMethod) Valid

func (r ACIv3AuthenticationMethod) Valid() (err error)

type ACIv3BindDistinguishedName

type ACIv3BindDistinguishedName struct {
	ACIv3BindKeyword
	// contains filtered or unexported fields
}

func (ACIv3BindDistinguishedName) Contains

func (r ACIv3BindDistinguishedName) Contains(x any) bool

Contains returns a Boolean value indicative of a match between x and a slice value in the receiver instance.

x MUST be a proper DistinguishedName instance, or its string equivalent.

func (ACIv3BindDistinguishedName) Eq

Eq returns an instance of ACIv3BindRuleItem, enveloped as an ACIv3BindRule, bearing the associated ACIv3BindKeyword in equality form.

func (ACIv3BindDistinguishedName) Index

func (r ACIv3BindDistinguishedName) Index(idx int) string

Index returns the Nth string present within the receiver instance.

func (ACIv3BindDistinguishedName) IsZero

func (r ACIv3BindDistinguishedName) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (ACIv3BindDistinguishedName) Len

Len returns the integer length of the receiver instance.

func (ACIv3BindDistinguishedName) Ne

Ne returns an instance of ACIv3BindRuleItem, enveloped as an ACIv3BindRule, bearing the associated ACIv3BindKeyword in negated equality form.

Negated equalient ACIv3BindRule instances should be used with caution.

func (ACIv3BindDistinguishedName) Push

Push appends zero (0) or more values to the receiver. Each value MUST be a DistinguishedName, or its string equivalent.

type ACIv3BindKeyword

type ACIv3BindKeyword uint8

ACIv3BindKeyword contains the value describing a particular ACIv3Keyword to be used within an ACIv3BindRule.

Example

This example demonstrates the interrogation of BindKeyword const definitions. This type qualifies for the Keyword interface type.

There are a total of eleven (11) such BindKeyword definitions.

for idx, bk := range []ACIv3BindKeyword{
	ACIv3BindUDN,
	ACIv3BindRDN,
	ACIv3BindGDN,
	ACIv3BindUAT,
	ACIv3BindGAT,
	ACIv3BindIP,
	ACIv3BindDNS,
	ACIv3BindDoW,
	ACIv3BindToD,
	ACIv3BindAM,
	ACIv3BindSSF,
} {
	fmt.Printf("[%s] %02d/%d: %s\n",
		bk.Kind(), idx+1, 11, bk)
}
Output:

[bindRule] 01/11: userdn
[bindRule] 02/11: roledn
[bindRule] 03/11: groupdn
[bindRule] 04/11: userattr
[bindRule] 05/11: groupattr
[bindRule] 06/11: ip
[bindRule] 07/11: dns
[bindRule] 08/11: dayofweek
[bindRule] 09/11: timeofday
[bindRule] 10/11: authmethod
[bindRule] 11/11: ssf
const (
	ACIv3BindUDN ACIv3BindKeyword // `userdn`
	ACIv3BindRDN                  // `roledn`
	ACIv3BindGDN                  // `groupdn`
	ACIv3BindUAT                  // `userattr`
	ACIv3BindGAT                  // `groupattr`
	ACIv3BindIP                   // `ip`
	ACIv3BindDNS                  // `dns`
	ACIv3BindDoW                  // `dayofweek`
	ACIv3BindToD                  // `timeofday`
	ACIv3BindAM                   // `authmethod`
	ACIv3BindSSF                  // `ssf`
)

ACIv3BindKeyword constants are intended for singular use within an ACIv3BindRule instance.

func (ACIv3BindKeyword) Kind

func (r ACIv3BindKeyword) Kind() string

Kind returns the static string literal `bindRule` identifying the instance as a ACIv3BindKeyword.

Example
fmt.Printf("%s", ACIv3BindUDN.Kind())
Output:

bindRule

func (ACIv3BindKeyword) String

func (r ACIv3BindKeyword) String() (k string)

String returns the string representation of the receiver instance of ACIv3BindKeyword.

Example
fmt.Printf("%s", ACIv3BindUDN)
Output:

userdn

type ACIv3BindRule

type ACIv3BindRule interface {
	// Kind returns the string literal "bindRuleItem",
	// "bindRuleAnd", "bindRuleOr" or "bindRuleNot"
	// depending on the underlying qualifier type.
	Kind() string

	// String returns the string representation
	// of the receiver instance.
	String() string

	// Note that if the underlying qualifier type is an
	// instance of [ACIv3BindRuleItem], an value or zero (0)
	// or one (1) shall always be returned, depending on
	// whether or not the instance is nil.
	Len() int

	// IsZero returns a Boolean value indicative of a
	// nil underlying qualifier type instance.
	IsZero() bool

	// Push appends one (1) or more qualifier type
	// instances of [ACIv3BindRule] to the receiver instance.
	//
	// Note this only has any meaningful effect if the
	// underlying qualifier type is an instance of
	// [ACIv3BindRuleAnd] or [ACIv3BindRuleOr].
	Push(...any) ACIv3BindRule

	// Index returns the Nth underlying slice value found
	// within the underlying qualifier type instance.
	//
	// Note this only has any meaningful effect if the
	// underlying qualifier type is an instance of
	// [ACIv3BindRuleAnd] or [ACIv3BindRuleOr].
	Index(int) ACIv3BindRule

	// SetParen assigns the input Boolean value to the
	// receiver instance.  A value of true shall serve
	// to encapsulate subsequent string representations
	// in parenthesis characters, namely "(" and ")".
	// A value of false performs no such encapsulation
	// and is the default value.
	SetParen(bool) ACIv3BindRule

	// SetQuotationStyle controls whether multivalued
	// values of specific types will be individually
	// quoted during string representation. A value of
	// zero (0) results in individually quoted values,
	// while any other value encapsulates all values
	// in a single pair of quotes. Note that this shall
	// only have an effect if there are two (2) or more
	// values present.
	SetQuotationStyle(int) ACIv3BindRule

	// SetPaddingStyle controls whether whitespace
	// padding is used during string representation. A
	// value of zero (0) disables padding, while any
	// other positive value enables padding.
	SetPaddingStyle(int) ACIv3BindRule

	// IsParen returns a Boolean value indicative of
	// whether the underlying qualifier type instance
	// is configured to encapsulate subsequent string
	// representations within parenthetical characters.
	IsParen() bool

	// Valid returns an error instance which, when non-nil,
	// will indicate a logical flaw, such as a nil or zero
	// length [ACIv3BindRule] instance, a missing component of
	// a [ACIv3BindRuleItem] qualifier, or some other issue.
	Valid() error
	// contains filtered or unexported methods
}

ACIv3BindRule implements an interface qualifier type for instances of any of the following types:

type ACIv3BindRuleAnd

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

ACIv3BindRuleAnd qualifies the ACIv3BindRule interface type and implements a "BOOLEAN AND" multi-valued slice type in which ALL conditions must evaluate as true to be considered a match.

func (ACIv3BindRuleAnd) Index

func (r ACIv3BindRuleAnd) Index(idx int) ACIv3BindRule

Index returns the Nth underlying ACIv3BindRule slice index, if present.

func (ACIv3BindRuleAnd) IsParen

func (r ACIv3BindRuleAnd) IsParen() (is bool)

IsParen returns a Boolean value indicative of the receiver instance being in a parenthetical state.

func (ACIv3BindRuleAnd) IsZero

func (r ACIv3BindRuleAnd) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (ACIv3BindRuleAnd) Kind

func (r ACIv3BindRuleAnd) Kind() string

Kind returns the string literal "bindRuleAnd".

func (ACIv3BindRuleAnd) Len

func (r ACIv3BindRuleAnd) Len() int

Len returns the integer length of the receiver instance.

func (ACIv3BindRuleAnd) Push

func (r ACIv3BindRuleAnd) Push(x ...any) ACIv3BindRule

Push appends the input instance(s) of ACIv3BindRule to the receiver instance.

func (ACIv3BindRuleAnd) SetPaddingStyle

func (r ACIv3BindRuleAnd) SetPaddingStyle(style int) ACIv3BindRule

SetPaddingStyle controls whitespace padding during the string representation process.

A value of 0 disables padding, while any other positive value enables padding.

func (ACIv3BindRuleAnd) SetParen

func (r ACIv3BindRuleAnd) SetParen(p bool) ACIv3BindRule

SetParen declares whether the receiver instance is parenthetical.

A value of true engages parenthetical encapsulation during the string representation process.

func (ACIv3BindRuleAnd) SetQuotationStyle

func (r ACIv3BindRuleAnd) SetQuotationStyle(_ int) ACIv3BindRule

SetQuotationStyle performs no useful task, as the concept of setting a quotation style applies only to instances of *ACIv3BindRuleItem. This method exists solely to satisfy Go's interface signature requirements.

func (ACIv3BindRuleAnd) String

func (r ACIv3BindRuleAnd) String() string

String returns the string representation of the receiver instance.

func (ACIv3BindRuleAnd) Valid

func (r ACIv3BindRuleAnd) Valid() (err error)

Valid returns an error instance which, when non-nil, will indicate a flaw in an instance residing at a particular slice index.

type ACIv3BindRuleItem

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

BindRuleItem is a qualifier of the ACIv3BindRule interface type, and represents the core "atom" of any Bind Rule statement.

An instance of this type contains three (3) user-assigned components, all of which are required:

func (ACIv3BindRuleItem) Expression

func (r ACIv3BindRuleItem) Expression() any

Expression returns the underlying expression value currently set within the receiver instance.

func (ACIv3BindRuleItem) Index

func (r ACIv3BindRuleItem) Index(_ int) ACIv3BindRule

Index returns the Nth underlying slice index, if present.

This type exports this method solely to satisfy Go's interface signature requirements and is not necessary to use upon instances of this type. If executed, this method returns the receiver instance.

func (ACIv3BindRuleItem) IsParen

func (r ACIv3BindRuleItem) IsParen() (is bool)

IsParen returns a Boolean value indicative of the receiver instance being in a parenthetical state.

func (ACIv3BindRuleItem) IsZero

func (r ACIv3BindRuleItem) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (ACIv3BindRuleItem) Keyword

func (r ACIv3BindRuleItem) Keyword() ACIv3BindKeyword

Keyword returns the ACIv3BindKeyword value currently set within the receiver instance.

func (ACIv3BindRuleItem) Kind

func (r ACIv3BindRuleItem) Kind() string

Kind returns the string literal "bindRuleItem".

func (ACIv3BindRuleItem) Len

func (r ACIv3BindRuleItem) Len() int

Len returns an integer length of one (1) if the instance has been initialized, and an integer length of zero (0) if not initialized.

This method exists solely to satisfy Go's interface signature requirements and is not necessary to use upon instances of this type.

func (ACIv3BindRuleItem) Operator

func (r ACIv3BindRuleItem) Operator() ACIv3Operator

Operator returns the ACIv3Operator value currently set within the receiver instance.

func (ACIv3BindRuleItem) Push

func (r ACIv3BindRuleItem) Push(_ ...any) ACIv3BindRule

Push performs no useful action, as this method exists solely to satisfy Go's interface signature requirements.

func (ACIv3BindRuleItem) SetExpression

func (r ACIv3BindRuleItem) SetExpression(expr ...any) ACIv3BindRule

SetExpression assigns value expr to the receiver instance.

func (ACIv3BindRuleItem) SetKeyword

func (r ACIv3BindRuleItem) SetKeyword(kw any) ACIv3BindRule

SetKeyword assigns ACIv3Keyword kw to the receiver instance.

func (ACIv3BindRuleItem) SetOperator

func (r ACIv3BindRuleItem) SetOperator(op any) ACIv3BindRule

SetOperator assigns ACIv3Operator op to the receiver instance.

func (ACIv3BindRuleItem) SetPaddingStyle

func (r ACIv3BindRuleItem) SetPaddingStyle(style int) ACIv3BindRule

SetPaddingStyle controls whitespace padding during the string representation process.

A value of 0 disables padding, while any other positive value enables padding.

func (ACIv3BindRuleItem) SetParen

func (r ACIv3BindRuleItem) SetParen(p bool) ACIv3BindRule

SetParen declares whether the receiver instance is parenthetical.

A value of true engages parenthetical encapsulation during the string representation process.

func (ACIv3BindRuleItem) SetQuotationStyle

func (r ACIv3BindRuleItem) SetQuotationStyle(style int) ACIv3BindRule

SetQuotationStyle allows the election of a particular multivalued quotation style offered by the various adopters of the ACIv3 syntax. In the context of a ACIv3BindRule, this will only have a meaningful impact if the keyword for the receiver is one (1) of the following:

Additionally, the underlying type set as the expression value within the receiver MUST be a [ACIv3BindDistinguishedNames] instance with two (2) or more distinguished names within.

See the const definitions for [MultivalOuterQuotes] (default) and [MultivalSliceQuotes] for details.

func (ACIv3BindRuleItem) String

func (r ACIv3BindRuleItem) String() (s string)

String returns the string representation of the receiver instance.

func (ACIv3BindRuleItem) Valid

func (r ACIv3BindRuleItem) Valid() (err error)

Valid returns an error instance which, when non-nil, will indicate a logical flaw, such a missing component of a ACIv3BindRuleItem qualifier, or some other issue.

type ACIv3BindRuleMethod

type ACIv3BindRuleMethod func() ACIv3BindRule

BindRuleMethod is the closure signature for methods used to build new instances of ACIv3BindRule.

The signature is qualified by methods extended through all eligible types defined in this package.

Note that certain types only support a subset of the above list. Very few types support all of the above.

type ACIv3BindRuleMethods

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

ACIv3BindRuleMethods contains one (1) or more instances of ACIv3BindRuleMethod, representing a particular ACIv3BindRule "builder" method for execution by the caller.

See the Operators method extended through all eligible types for further details.

func (ACIv3BindRuleMethods) Contains

func (r ACIv3BindRuleMethods) Contains(cop any) bool

Contains returns a Boolean value indicative of whether the specified ACIv3Operator, which may be expressed as a string, int or native ACIv3Operator, is allowed for use by the type instance that created the receiver instance. This method offers a convenient alternative to the use of the Index method combined with an assertion value (such as ACIv3Eq, ACIv3Ne, "=", "Greater Than", et al).

In other words, if one uses the [FQDN]'s BRM method to create an instance of ACIv3BindRuleMethods, feeding Gt (Greater Than) to this method shall return false, as mathematical comparison does not apply to instances of the [FQDN] type.

func (ACIv3BindRuleMethods) Index

Index calls the input index (idx) within the internal structure of the receiver instance. If found, an instance of ACIv3Operator and its accompanying ACIv3BindRuleMethod instance are returned.

Valid input index types are integer (int), ACIv3Operator constant or string identifier. In the case of a string identifier, valid values are as follows:

  • For ACIv3Eq (1): `=`, `ACIv3Eq`, `Equal To`
  • For ACIv3Ne (2): `!=`, `ACIv3Ne`, `Not Equal To`
  • For ACIv3Lt (3): `>`, `ACIv3Lt`, `Less Than`
  • For ACIv3Le (4): `>=`, `ACIv3Le`, `Less Than Or Equal`
  • For ACIv3Gt (5): `<`, `ACIv3Gt`, `Greater Than`
  • For ACIv3Ge (6): `<=`, `ACIv3Ge`, `Greater Than Or Equal`

Case is not significant in the string matching process.

Please note that use of this method by way of integer or ACIv3Operator values utilizes fewer resources than a string lookup.

See the ACIv3Operator.Context, ACIv3Operator.String and ACIv3Operator.Description methods for accessing the above string values easily.

If the index was not matched, an invalid ACIv3Operator is returned alongside a nil ACIv3BindRuleMethod. This will also apply to situations in which the type instance which crafted the receiver is uninitialized, or is in an otherwise aberrant state.

func (ACIv3BindRuleMethods) IsZero

func (r ACIv3BindRuleMethods) IsZero() bool

IsZero returns a Boolean value indicative of whether the receiver is nil, or unset.

func (ACIv3BindRuleMethods) Len

func (r ACIv3BindRuleMethods) Len() int

Len returns the integer length of the receiver. Note that the return value will NEVER be less than zero (0) nor greater than six (6).

func (ACIv3BindRuleMethods) Valid

func (r ACIv3BindRuleMethods) Valid() (err error)

Valid returns the first encountered error returned as a result of execution of the first available ACIv3BindRuleMethod instance. This is useful in cases where a user wants to see if the desired instance(s) of ACIv3BindRuleMethod will produce a usable result.

type ACIv3BindRuleNot

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

ACIv3BindRuleNot qualifies the ACIv3BindRule interface type and implements a "BOOLEAN NOT" (negated) type in which NONE of the conditions must evaluate as true to be considered a match.

func (ACIv3BindRuleNot) Index

func (r ACIv3BindRuleNot) Index(idx int) ACIv3BindRule

Index returns the Nth underlying ACIv3BindRule slice index, if present.

Note that, in the case of instances of this type, this method is only meaningful if the underlying ACIv3BindRule qualifier type is an instance of ACIv3BindRuleAnd or ACIv3BindRuleOr.

func (ACIv3BindRuleNot) IsParen

func (r ACIv3BindRuleNot) IsParen() (is bool)

IsParen returns a Boolean value indicative of the receiver instance being in a parenthetical state.

func (ACIv3BindRuleNot) IsZero

func (r ACIv3BindRuleNot) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (ACIv3BindRuleNot) Kind

func (r ACIv3BindRuleNot) Kind() string

Kind returns the string literal "bindRuleNot".

func (ACIv3BindRuleNot) Len

func (r ACIv3BindRuleNot) Len() int

Len returns the integer length of the receiver instance.

func (ACIv3BindRuleNot) Push

func (r ACIv3BindRuleNot) Push(x ...any) ACIv3BindRule

Push assigns the input instance of ACIv3BindRule to the receiver instance. Unlike other Push methods, this does not append.

func (ACIv3BindRuleNot) SetPaddingStyle

func (r ACIv3BindRuleNot) SetPaddingStyle(style int) ACIv3BindRule

SetPaddingStyle controls whitespace padding during the string representation process.

A value of 0 disables padding, while any other positive value enables padding.

func (ACIv3BindRuleNot) SetParen

func (r ACIv3BindRuleNot) SetParen(p bool) ACIv3BindRule

SetParen declares whether the receiver instance is parenthetical.

A value of true engages parenthetical encapsulation during the string representation process.

func (ACIv3BindRuleNot) SetQuotationStyle

func (r ACIv3BindRuleNot) SetQuotationStyle(_ int) ACIv3BindRule

SetQuotationStyle performs no useful task, as the concept of setting a quotation style applies only to instances of *ACIv3BindRuleItem. This method exists solely to satisfy Go's interface signature requirements.

func (ACIv3BindRuleNot) String

func (r ACIv3BindRuleNot) String() (s string)

String returns the string representation of the receiver instance.

func (ACIv3BindRuleNot) Valid

func (r ACIv3BindRuleNot) Valid() (err error)

Valid returns an error instance which, when non-nil, will indicate a logical flaw, such as a nil or zero length ACIv3BindRule instance, a missing component of a ACIv3BindRuleItem qualifier, or some other issue.

type ACIv3BindRuleOr

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

ACIv3BindRuleOr qualifies the ACIv3BindRule interface type and implements a "BOOLEAN OR" multi-valued slice type in which ONE (1) OR MORE conditions must evaluate as true to be considered a match.

func (ACIv3BindRuleOr) Index

func (r ACIv3BindRuleOr) Index(idx int) ACIv3BindRule

Index returns the Nth underlying ACIv3BindRule slice index, if present.

func (ACIv3BindRuleOr) IsParen

func (r ACIv3BindRuleOr) IsParen() (is bool)

IsParen returns a Boolean value indicative of the receiver instance being in a parenthetical state.

func (ACIv3BindRuleOr) IsZero

func (r ACIv3BindRuleOr) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (ACIv3BindRuleOr) Kind

func (r ACIv3BindRuleOr) Kind() string

Kind returns the string literal "bindRuleOr".

func (ACIv3BindRuleOr) Len

func (r ACIv3BindRuleOr) Len() int

Len returns the integer length of the receiver instance.

func (ACIv3BindRuleOr) Push

func (r ACIv3BindRuleOr) Push(x ...any) ACIv3BindRule

Push appends the input instance(s) of ACIv3BindRule to the receiver instance.

func (ACIv3BindRuleOr) SetPaddingStyle

func (r ACIv3BindRuleOr) SetPaddingStyle(style int) ACIv3BindRule

SetPaddingStyle controls whitespace padding during the string representation process.

A value of 0 disables padding, while any other positive value enables padding.

func (ACIv3BindRuleOr) SetParen

func (r ACIv3BindRuleOr) SetParen(p bool) ACIv3BindRule

SetParen declares whether the receiver instance is parenthetical.

A value of true engages parenthetical encapsulation during the string representation process.

func (ACIv3BindRuleOr) SetQuotationStyle

func (r ACIv3BindRuleOr) SetQuotationStyle(_ int) ACIv3BindRule

SetQuotationStyle performs no useful task, as the concept of setting a quotation style applies only to instances of *ACIv3BindRuleItem. This method exists solely to satisfy Go's interface signature requirements.

func (ACIv3BindRuleOr) String

func (r ACIv3BindRuleOr) String() string

String returns the string representation of the receiver instance.

func (ACIv3BindRuleOr) Valid

func (r ACIv3BindRuleOr) Valid() (err error)

Valid returns an error instance which, when non-nil, will indicate a flaw in an instance residing at a particular slice index.

type ACIv3BindType

type ACIv3BindType uint8

ACIv3BindType describes one (1) of five (5) possible contexts used in certain ACIv3BindRule instances:

Example

Let's print out each BindType constant defined in this package.

for idx, bt := range []ACIv3BindType{
	ACIv3BindTypeUSERDN,
	ACIv3BindTypeGROUPDN,
	ACIv3BindTypeROLEDN,
	ACIv3BindTypeSELFDN,
	ACIv3BindTypeLDAPURL,
} {
	fmt.Printf("%T %d/%d: %s\n",
		bt, idx+1, 5, bt)
}
Output:

dirsyn.ACIv3BindType 1/5: USERDN
dirsyn.ACIv3BindType 2/5: GROUPDN
dirsyn.ACIv3BindType 3/5: ROLEDN
dirsyn.ACIv3BindType 4/5: SELFDN
dirsyn.ACIv3BindType 5/5: LDAPURL
const (
	ACIv3BindTypeUSERDN ACIv3BindType
	ACIv3BindTypeGROUPDN
	ACIv3BindTypeROLEDN
	ACIv3BindTypeSELFDN
	ACIv3BindTypeLDAPURL
)

ACIv3BindType keyword constants are used in value matching definitions that utilizes either the ACIv3BindUAT (userattr) or ACIv3BindGAT (groupattr) ACIv3BindKeyword constant within an ACIv3BindRule instance.

func (ACIv3BindType) String

func (r ACIv3BindType) String() (b string)

String returns the string representation of the receiver instance of ACIv3BindType.

type ACIv3Day

type ACIv3Day uint8

ACIv3Day represents the numerical abstraction of a single day of the week, such as Sunday (1).

const (
	ACIv3Sunday    ACIv3Day = 1 << iota // 1
	ACIv3Monday                         // 2
	ACIv3Tuesday                        // 4
	ACIv3Wednesday                      // 8
	ACIv3Thursday                       // 16
	ACIv3Friday                         // 32
	ACIv3Saturday                       // 64
)

Day constants can be shifted into an instance of ACIv3DayOfWeek, allowing effective expressions such as ACIv3Sunday,ACIv3Tuesday. See the ACIv3DayOfWeek.Shift and ACIv3DayOfWeek.Unshift methods.

func (ACIv3Day) String

func (r ACIv3Day) String() (day string)

String returns a single string name value for receiver instance of ACIv3Day.

type ACIv3DayOfWeek

type ACIv3DayOfWeek shifty.BitValue // 8-bit

ACIv3DayOfWeek is a type alias of shifty.BitValue, and is used to construct a dayofweek ACIv3BindRule.

func (ACIv3DayOfWeek) BRM

BRM returns an instance of ACIv3BindRuleMethods.

Each of the return instance's key values represent a single instance of the ACIv3Operator type that is allowed for use in the creation of ACIv3BindRule instances which bear the receiver instance as an expression value. The value for each key is the actual ACIv3BindRuleMethod instance for OPTIONAL use in the creation of a ACIv3BindRule instance.

This is merely a convenient alternative to maintaining knowledge of which ACIv3Operator instances apply to which types. Instances of this type are also used to streamline package unit tests.

Please note that if the receiver is in an aberrant state, or if it has not yet been initialized, the execution of ANY of the return instance's value methods will return bogus ACIv3BindRule instances. While this is useful in unit testing, the end user must only execute this method IF and WHEN the receiver has been properly populated and prepared for such activity.

func (ACIv3DayOfWeek) Eq

func (r ACIv3DayOfWeek) Eq() (b ACIv3BindRule)

Eq initializes and returns a new ACIv3BindRule instance configured to express the evaluation of the receiver value as Equal-To the ACIv3BindDoW ACIv3BindKeyword context.

func (ACIv3DayOfWeek) IsZero

func (r ACIv3DayOfWeek) IsZero() bool

IsZero returns a Boolean value indicative of whether the receiver is nil, or unset.

func (ACIv3DayOfWeek) Keyword

func (r ACIv3DayOfWeek) Keyword() ACIv3Keyword

Keyword returns the ACIv3BindToD [BindKeyword].

func (ACIv3DayOfWeek) Len

func (r ACIv3DayOfWeek) Len() int

Len returns the abstract integer length of the receiver, quantifying the number of ACIv3Day instances currently being expressed.

For example, if the receiver instance has its ACIv3Monday and ACIv3Friday ACIv3Day bits enabled, this would represent an abstract length of two (2).

func (ACIv3DayOfWeek) Ne

func (r ACIv3DayOfWeek) Ne() (b ACIv3BindRule)

Ne initializes and returns a new ACIv3BindRule instance configured to express the evaluation of the receiver value as Not-Equal-To the ACIv3BindDoW ACIv3BindKeyword context.

Negated equality ACIv3BindRule instances should be used with caution.

func (ACIv3DayOfWeek) Positive

func (r ACIv3DayOfWeek) Positive(x ACIv3Day) (posi bool)

Positive wraps the shifty.BitValue.Positive method.

func (ACIv3DayOfWeek) Shift

func (r ACIv3DayOfWeek) Shift(x ...any) ACIv3DayOfWeek

Shift wraps shifty.BitValue.Shift method to allow for bit-shifting of the receiver (r) instance using various representations of any number of days (string, int or ACIv3Day).

func (ACIv3DayOfWeek) String

func (r ACIv3DayOfWeek) String() (s string)

String returns the string representation of the receiver instance. At least one ACIv3Day should register as positive in order for a valid string return to ensue.

func (ACIv3DayOfWeek) Unshift

func (r ACIv3DayOfWeek) Unshift(x ...any) ACIv3DayOfWeek

Unshift wraps shifty.BitValue.Unshift method to allow for bit-unshifting of the receiver (r) instance using various representations of any number of days (string, int or ACIv3Day).

func (ACIv3DayOfWeek) Valid

func (r ACIv3DayOfWeek) Valid() (err error)

Valid returns a Boolean value indicative of whether the receiver contains one or more valid bits representing known ACIv3Day values.

At least one ACIv3Day must be positive within the receiver.

type ACIv3FQDN

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

FQDN contains ordered domain labels that form a fully-qualified domain name.

func (ACIv3FQDN) BRM

BRM returns an instance of ACIv3BindRuleMethods.

Each of the return instance's key values represent a single instance of the ACIv3Operator type that is allowed for use in the creation of ACIv3BindRule instances which bear the receiver instance as an expression value. The value for each key is the actual ACIv3BindRuleMethod instance for OPTIONAL use in the creation of a ACIv3BindRule instance.

This is merely a convenient alternative to maintaining knowledge of which ACIv3Operator instances apply to which types. Instances of this type are also used to streamline package unit tests.

Please note that if the receiver is in an aberrant state, or if it has not yet been initialized, the execution of ANY of the return instance's value methods will return bogus ACIv3BindRule instances. While this is useful in unit testing, the end user must only execute this method IF and WHEN the receiver has been properly populated and prepared for such activity.

Example
var r NetscapeACIv3
f, err := r.FQDN("www.example.com")
if err != nil {
	fmt.Println(err)
	return
}
cops := f.BRM()
fmt.Printf("%T allows Eq: %t", f, cops.Contains(`=`))
Output:

dirsyn.ACIv3FQDN allows Eq: true

func (ACIv3FQDN) Eq

func (r ACIv3FQDN) Eq() ACIv3BindRule

Eq initializes and returns a new ACIv3BindRule instance configured to express the evaluation of the receiver value as Equal-To the ACIv3BindDNS ACIv3BindKeyword context.

Example
var r NetscapeACIv3

f, _ := r.FQDN() // no need to check error w/o arguments.

// Let's set the host labels incrementally ...
f.Set(`www`)
f.Set(`example`)
f.Set(`com`)

fmt.Printf("%s", f.Eq())
Output:

dns="www.example.com"
Example (OneShot)
var r NetscapeACIv3
f, err := r.FQDN("www.example.com")
if err != nil {
	fmt.Println(err)
	return
}
fmt.Printf("%s", f.Eq())
Output:

dns="www.example.com"

func (ACIv3FQDN) IsZero

func (r ACIv3FQDN) IsZero() bool

IsZero returns a Boolean value indicative of whether the receiver is nil, or unset.

Example

This example demonstrates a check of the receiver for "nilness".

var r NetscapeACIv3
f, err := r.FQDN("www.example.com")
if err != nil {
	fmt.Println(err)
	return
}
fmt.Printf("%t", f.IsZero())
Output:

false

func (ACIv3FQDN) Keyword

func (r ACIv3FQDN) Keyword() ACIv3Keyword

Keyword returns the ACIv3BindKeyword instance assigned to the receiver instance as a ACIv3Keyword. This shall be the ACIv3BindKeyword that appears in a ACIv3BindRule containing the receiver instance as the expression value.

Example
var f ACIv3FQDN
fmt.Printf("%v", f.Keyword())
Output:

dns

func (ACIv3FQDN) Len

func (r ACIv3FQDN) Len() int

Len returns the abstract integer length of the receiver. The value returned represents the number of valid DNS labels within a given instance of ACIv3FQDN. For example, `www.example.com` has three (3) such labels.

Example
var r NetscapeACIv3
f, err := r.FQDN("www.example.com")
if err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("%T contains %d DNS labels", f, f.Len())
Output:

dirsyn.ACIv3FQDN contains 3 DNS labels

func (ACIv3FQDN) Ne

func (r ACIv3FQDN) Ne() ACIv3BindRule

Ne initializes and returns a new ACIv3BindRule instance configured to express the evaluation of the receiver value as Not-Equal-To the ACIv3BindDNS ACIv3BindKeyword context.

Negated equality ACIv3BindRule instances should be used with caution.

Example
var r NetscapeACIv3

f, err := r.FQDN(`www.example.com`)
if err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("%s", f.Ne().SetPaddingStyle(1))
Output:

dns != "www.example.com"

func (*ACIv3FQDN) Set

func (r *ACIv3FQDN) Set(x ...any) *ACIv3FQDN

Set appends one or more domain labels to the receiver. The total character length of a single label CANNOT exceed sixty-three (63) characters. When added up, all domain label instances present within the receiver SHALL NOT collectively exceed two hundred fifty-three (253) characters.

Valid characters within labels:

  • a-z
  • A-Z
  • 0-9
  • Hyphen ('-', limited to [1:length-1] slice range)
  • Asterisk ('*', use with care for wildcard DNS-based ACI ACIv3BindRule expressions)
  • Full Stop ('.', see below for remarks on this character)

Users need not enter full stops (.) manually, given this method supports the use of variadic expressions, i.e.:

Set(`www`,`example`,`com`)

However, should full stops (.) be used within input values:

Set(`www.example.com`)

... the parser shall split the input into label components and add them to the receiver piecemeal in the intended order.

Please note that it is not necessary to include a NULL terminating full stop character (.) at the end (TLD?) of the intended ACIv3FQDN.

Example
var r NetscapeACIv3
f, err := r.FQDN("*.example.com")
if err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("%s", f)
Output:

*.example.com

func (ACIv3FQDN) String

func (r ACIv3FQDN) String() string

String returns the string representation of a fully-qualified domain name.

Example

This example demonstrates the string representation of the receiver instance.

var r NetscapeACIv3
f, err := r.FQDN("example.com")
if err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("%s", f)
Output:

example.com

func (ACIv3FQDN) Valid

func (r ACIv3FQDN) Valid() (err error)

Valid returns a Boolean value indicative of whether the receiver contents represent a legal fully-qualified domain name value.

Example

This example demonstrates a check of the receiver for an aberrant state.

var f ACIv3FQDN
fmt.Printf("Valid: %t", f.Valid() == nil)
Output:

Valid: false

type ACIv3IPAddress

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

ACIv3IPAddress embeds slices of address values, allowing simple composition of flexible IP-based ACIv3BindRule instances.

func (ACIv3IPAddress) BRM

BRM returns an instance of ACIv3BindRuleMethods.

Each of the return instance's key values represent a single instance of the ACIv3Operator type that is allowed for use in the creation of ACIv3BindRule instances which bear the receiver instance as an expression value. The value for each key is the actual ACIv3BindRuleMethod instance for OPTIONAL use in the creation of a ACIv3BindRule instance.

This is merely a convenient alternative to maintaining knowledge of which ACIv3Operator instances apply to which types. Instances of this type are also used to streamline package unit tests.

Please note that if the receiver is in an aberrant state, or if it has not yet been initialized, the execution of ANY of the return instance's value methods will return bogus BindRule instances. While this is useful in unit testing, the end user must only execute this method IF and WHEN the receiver has been properly populated and prepared for such activity.

Example
var r NetscapeACIv3
ip, err := r.IPAddress("www.example.com")
if err != nil {
	fmt.Println(err)
	return
}
cops := ip.BRM()
fmt.Printf("%T allows Eq: %t", ip, cops.Contains(`=`))
Output:

dirsyn.ACIv3IPAddress allows Eq: true

func (ACIv3IPAddress) Eq

Eq initializes and returns a new ACIv3BindRule instance configured to express the evaluation of the receiver value as Equal-To the ACIv3BindIP ACIv3BindKeyword context.

Example
var r NetscapeACIv3

i, err := r.IPAddress("192.8.", "10.7.0")
if err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("%s", i.Eq())
Output:

ip="192.8.,10.7.0"
Example (OneShot)
var r NetscapeACIv3

i, _ := r.IPAddress()
fmt.Printf("%s", i.Set(`192.168.0`, `12.3.45.*`, `10.0.0.0/8`).Eq())
Output:

ip="192.168.0,12.3.45.*,10.0.0.0/8"

func (ACIv3IPAddress) IsZero

func (r ACIv3IPAddress) IsZero() bool

IsZero returns a Boolean value indicative of whether the receiver is considered nil, or unset.

Example

This example demonstrates a check of the receiver for "nilness".

var r NetscapeACIv3
ip, err := r.IPAddress(`10.8.`, `192.`)
if err != nil {
	fmt.Println(err)
	return
}
fmt.Printf("%t", ip.IsZero())
Output:

false

func (ACIv3IPAddress) Keyword

func (r ACIv3IPAddress) Keyword() ACIv3Keyword

Keyword returns the ACIv3BindKeyword assigned to the receiver instance. This shall be the keyword that appears in a ACIv3BindRule containing the receiver instance as the expression value.

Example
var ip ACIv3IPAddress
fmt.Printf("%v", ip.Keyword())
Output:

ip

func (ACIv3IPAddress) Kind

func (r ACIv3IPAddress) Kind() string

Kind returns the string representation of the receiver's kind.

Example
var ip ACIv3IPAddress
fmt.Printf("%v", ip.Kind())
Output:

ip

func (ACIv3IPAddress) Len

func (r ACIv3IPAddress) Len() int

Len returns the integer length of the receiver instance.

Example
var r NetscapeACIv3
ip, err := r.IPAddress(`10.8.`)
if err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("%d", ip.Len())
Output:

1

func (ACIv3IPAddress) Ne

Ne initializes and returns a new ACIv3BindRule instance configured to express the evaluation of the receiver value as Not-Equal-To the ACIv3BindIP ACIv3BindKeyword context.

Negated equality ACIv3BindRule instances should be used with caution.

Example
var r NetscapeACIv3

i, err := r.IPAddress("10.8.")
if err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("%s", i.Ne())
Output:

ip!="10.8."

func (*ACIv3IPAddress) Set

func (r *ACIv3IPAddress) Set(addr ...string) *ACIv3IPAddress

Set assigns the provided address component to the receiver and returns the receiver instance in fluent-form.

Multiple values can be provided in variadic form, or piecemeal.

Example
var r NetscapeACIv3

i, _ := r.IPAddress() // no need to check error w/o arguments.

i.Set(`192.168.0`).Set(`12.3.45.*`).Set(`10.0.0.0/8`)
neg := i.Ne().SetParen(true).SetPaddingStyle(1)
fmt.Printf("%s", neg)
Output:

( ip != "192.168.0,12.3.45.*,10.0.0.0/8" )

func (ACIv3IPAddress) String

func (r ACIv3IPAddress) String() string

String returns the string representation of an IP address.

Example

This example demonstrates the string representation of the receiver instance.

var r NetscapeACIv3
ip, err := r.IPAddress(`192.168.56.7`)
if err != nil {
	fmt.Println(err)
	return
}
fmt.Printf("%s", ip)
Output:

192.168.56.7

func (ACIv3IPAddress) Valid

func (r ACIv3IPAddress) Valid() error

Valid returns an error indicative of whether the receiver is in an aberrant state.

Example

This example demonstrates a check of the receiver for an aberrant state.

var ip ACIv3IPAddress
fmt.Printf("Valid: %t", ip.Valid() == nil)
Output:

Valid: false

type ACIv3Inheritance

type ACIv3Inheritance struct {
	ACIv3AttributeBindTypeOrValue
	// contains filtered or unexported fields
}

ACIv3Inheritance describes an inherited ACIv3BindRule syntax, allowing access control over child entry enumeration below the specified parent.

Example (GroupAttr)
var r NetscapeACIv3

attr, err := r.Attribute(`owner`)
if err != nil {
	fmt.Println(err)
	return
}

var gat ACIv3AttributeBindTypeOrValue
gat, err = r.AttributeBindTypeOrValue("groupattr", attr, ACIv3BindTypeUSERDN)
if err != nil {
	fmt.Println(err)
	return
}

var inh ACIv3Inheritance
if inh, err = r.Inheritance(gat, 3, 4); err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("%s", inh.Eq())
Output:

groupattr="parent[3,4].owner#USERDN"
Example (UAT)
var r NetscapeACIv3

attr, err := r.Attribute(`manager`)
if err != nil {
	fmt.Println(err)
	return
}

value := `uid=frank,ou=People,dc=example,dc=com`

var uat ACIv3AttributeBindTypeOrValue
uat, err = r.AttributeBindTypeOrValue("userattr", attr, value)
if err != nil {
	fmt.Println(err)
	return
}

var inh ACIv3Inheritance
if inh, err = r.Inheritance(uat, 3, 4); err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("%s", inh.Eq())
Output:

userattr="parent[3,4].manager#uid=frank,ou=People,dc=example,dc=com"
Example (USERDN)
var r NetscapeACIv3

attr, err := r.Attribute(`manager`)
if err != nil {
	fmt.Println(err)
	return
}

var uat ACIv3AttributeBindTypeOrValue
uat, err = r.AttributeBindTypeOrValue(ACIv3BindUAT, attr, ACIv3BindTypeUSERDN)
if err != nil {
	fmt.Println(err)
	return
}

var inh ACIv3Inheritance
if inh, err = r.Inheritance(uat, 0, 1, 2, 8); err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("%s", inh.Eq())
Output:

userattr="parent[0,1,2,8].manager#USERDN"

func (ACIv3Inheritance) BRM

BRM returns an instance of ACIv3BindRuleMethods.

Each of the return instance's key values represent a single instance of the ACIv3Operator type that is allowed for use in the creation of ACIv3BindRule instances which bear the receiver instance as an expression value. The value for each key is the actual ACIv3BindRuleMethod instance for OPTIONAL use in the creation of a ACIv3BindRule instance.

This is merely a convenient alternative to maintaining knowledge of which ACIv3Operator instances apply to which types. Instances of this type are also used to streamline package unit tests.

Please note that if the receiver is in an aberrant state, or if it has not yet been initialized, the execution of ANY of the return instance's value methods will return bogus ACIv3BindRule instances. While this is useful in unit testing, the end user must only execute this method IF and WHEN the receiver has been properly populated and prepared for such activity.

Example
var r NetscapeACIv3

attr, err := r.Attribute(`manager`)
if err != nil {
	fmt.Println(err)
	return
}

abtv, err := r.AttributeBindTypeOrValue("userattr", attr, "uid=frank,ou=People,dc=example,dc=com")
if err != nil {
	fmt.Println(err)
	return
}

var inh ACIv3Inheritance
inh, err = r.Inheritance(abtv, 1, 3)
if err != nil {
	fmt.Println(err)
	return
}

brm := inh.BRM()
fmt.Printf("%d available comparison operator methods", brm.Len())
Output:

2 available comparison operator methods

func (ACIv3Inheritance) Eq

func (r ACIv3Inheritance) Eq() (b ACIv3BindRule)

Eq initializes and returns a new ACIv3BindRule instance configured to express the evaluation of the receiver value as Equal-To the ACIv3BindUAT or ACIv3BindGAT ACIv3BindKeyword contexts.

Example
var r NetscapeACIv3

attr, err := r.Attribute(`manager`)
if err != nil {
	fmt.Println(err)
	return
}

var uat ACIv3AttributeBindTypeOrValue
uat, err = r.AttributeBindTypeOrValue("userattr", attr, `uid=frank,ou=People,dc=example,dc=com`)
if err != nil {
	fmt.Println(err)
	return
}

var inh ACIv3Inheritance
if inh, err = r.Inheritance(uat, ACIv3Level6, ACIv3Level7); err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("%s", inh.Eq())
Output:

userattr="parent[6,7].manager#uid=frank,ou=People,dc=example,dc=com"

func (ACIv3Inheritance) IsZero

func (r ACIv3Inheritance) IsZero() bool

IsZero returns a Boolean value indicative of whether the receiver instance is nil, or unset.

Example
var inh ACIv3Inheritance
fmt.Printf("%t", inh.IsZero())
Output:

true

func (ACIv3Inheritance) Keyword

func (r ACIv3Inheritance) Keyword() (kw ACIv3Keyword)

Keyword returns the ACIv3BindKeyword associated with the receiver instance enveloped as a ACIv3Keyword. In the context of this type instance, the ACIv3BindKeyword returned will be either ACIv3BindUAT or ACIv3BindGAT.

Example
var r NetscapeACIv3

attr, err := r.Attribute(`manager`)
if err != nil {
	fmt.Println(err)
	return
}

var uat ACIv3AttributeBindTypeOrValue
uat, err = r.AttributeBindTypeOrValue("userattr", attr, ACIv3BindTypeUSERDN)
if err != nil {
	fmt.Println(err)
	return
}

var inh ACIv3Inheritance
if inh, err = r.Inheritance(uat, ACIv3Level6, ACIv3Level7); err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("Keyword: %s", inh.Keyword())
Output:

Keyword: userattr

func (ACIv3Inheritance) Len

func (r ACIv3Inheritance) Len() int

Len returns the abstract integer length of the receiver, quantifying the number of ACIv3InheritanceLevel instances currently being expressed.

For example, if the receiver instance has its ACIv3Level1 and ACIv3Level5 bits enabled, this would represent an abstract length of two (2).

Example
var r NetscapeACIv3

attr, err := r.Attribute(`manager`)
if err != nil {
	fmt.Println(err)
	return
}

var uat ACIv3AttributeBindTypeOrValue
uat, err = r.AttributeBindTypeOrValue("userattr", attr, ACIv3BindTypeUSERDN)
if err != nil {
	fmt.Println(err)
	return
}

var inh ACIv3Inheritance
if inh, err = r.Inheritance(uat, ACIv3Level6, ACIv3Level7); err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("Number of levels: %d", inh.Len())
Output:

Number of levels: 2

func (ACIv3Inheritance) Ne

func (r ACIv3Inheritance) Ne() (b ACIv3BindRule)

Ne initializes and returns a new ACIv3BindRule instance configured to express the evaluation of the receiver value as Not-Equal-To the ACIv3BindUAT or ACIv3BindGAT ACIv3BindKeyword contexts.

Negated equality ACIv3BindRule instances should be used with caution.

Example
var r NetscapeACIv3

attr, err := r.Attribute(`manager`)
if err != nil {
	fmt.Println(err)
	return
}

var uat ACIv3AttributeBindTypeOrValue
uat, err = r.AttributeBindTypeOrValue(ACIv3BindUAT, attr, `uid=frank,ou=People,dc=example,dc=com`)
if err != nil {
	fmt.Println(err)
	return
}

var inh ACIv3Inheritance
if inh, err = r.Inheritance(uat, ACIv3Level1, ACIv3Level3); err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("%s", inh.Ne())
Output:

userattr!="parent[1,3].manager#uid=frank,ou=People,dc=example,dc=com"

func (ACIv3Inheritance) Positive

func (r ACIv3Inheritance) Positive(x any) (posi bool)

Positive wraps the shifty.BitValue.Positive method.

Example
var r NetscapeACIv3

attr, err := r.Attribute(`manager`)
if err != nil {
	fmt.Println(err)
	return
}

var uat ACIv3AttributeBindTypeOrValue
uat, err = r.AttributeBindTypeOrValue(ACIv3BindUAT, attr, ACIv3BindTypeUSERDN)
if err != nil {
	fmt.Println(err)
	return
}

var inh ACIv3Inheritance
if inh, err = r.Inheritance(uat, ACIv3Level6, ACIv3Level7); err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("Level 5 positive? %t", inh.Positive(5))
Output:

Level 5 positive? false
Example (ByString)
var r NetscapeACIv3

attr, err := r.Attribute(`manager`)
if err != nil {
	fmt.Println(err)
	return
}

var gat ACIv3AttributeBindTypeOrValue
gat, err = r.AttributeBindTypeOrValue("userattr", attr, ACIv3BindTypeGROUPDN)
if err != nil {
	fmt.Println(err)
	return
}

var inh ACIv3Inheritance
if inh, err = r.Inheritance(gat, ACIv3Level6, ACIv3Level7); err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("Level 6 positive? %t", inh.Positive(`6`))
Output:

Level 6 positive? true

func (ACIv3Inheritance) Shift

func (r ACIv3Inheritance) Shift(x ...any) ACIv3Inheritance

Shift wraps the shifty.BitValue.Shift method.

Example
var r NetscapeACIv3

attr, err := r.Attribute(`manager`)
if err != nil {
	fmt.Println(err)
	return
}

value := `uid=frank,ou=People,dc=example,dc=com`

var abtv ACIv3AttributeBindTypeOrValue
abtv, err = r.AttributeBindTypeOrValue("groupattr", attr, value)
if err != nil {
	fmt.Println(err)
	return
}

var inh ACIv3Inheritance
if inh, err = r.Inheritance(abtv, 1, 3); err != nil {
	fmt.Println(err)
	return
}

inh.Unshift(1)           // we changed our mind; remove level "1"
inh.Unshift(`1`)         // (or, alternatively ...)
inh.Unshift(ACIv3Level1) // (or, alternatively ...)
inh.Shift(8)             // add the one we forgot

fmt.Printf("Number of levels: %d", inh.Len())
Output:

Number of levels: 2

func (ACIv3Inheritance) String

func (r ACIv3Inheritance) String() (s string)

String returns the string name value for receiver instance.

The return value(s) are enclosed within square-brackets, followed by comma delimitation and are prefixed with "parent" before being returned.

Example
var r NetscapeACIv3

attr, err := r.Attribute(`manager`)
if err != nil {
	fmt.Println(err)
	return
}

var uat ACIv3AttributeBindTypeOrValue
uat, err = r.AttributeBindTypeOrValue("userattr", attr, `uid=frank,ou=People,dc=example,dc=com`)
if err != nil {
	fmt.Println(err)
	return
}

var inh ACIv3Inheritance
if inh, err = r.Inheritance(uat, ACIv3Level6, ACIv3Level7); err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("%s", inh)
Output:

parent[6,7].manager#uid=frank,ou=People,dc=example,dc=com

func (ACIv3Inheritance) Unshift

func (r ACIv3Inheritance) Unshift(x ...any) ACIv3Inheritance

Unshift wraps the shifty.BitValue.Unshift method.

Example
var r NetscapeACIv3

attr, err := r.Attribute(`manager`)
if err != nil {
	fmt.Println(err)
	return
}

value := `uid=frank,ou=People,dc=example,dc=com`

var abtv ACIv3AttributeBindTypeOrValue
abtv, err = r.AttributeBindTypeOrValue("groupattr", attr, value)
if err != nil {
	fmt.Println(err)
	return
}

var inh ACIv3Inheritance
if inh, err = r.Inheritance(abtv, 1, 3, 8); err != nil {
	fmt.Println(err)
	return
}

inh.Unshift(1)           // we changed our mind; remove level "1"
inh.Unshift(`1`)         // (or, alternatively ...)
inh.Unshift(ACIv3Level1) // (or, alternatively ...)

fmt.Printf("Number of levels: %d", inh.Len())
Output:

Number of levels: 2

func (ACIv3Inheritance) Valid

func (r ACIv3Inheritance) Valid() (err error)

Valid returns an error indicative of whether the receiver is in an aberrant state.

Example
var inh ACIv3Inheritance
fmt.Printf("%T.Valid: %t", inh, inh.Valid() == nil)
Output:

dirsyn.ACIv3Inheritance.Valid: false

type ACIv3InheritanceLevel

type ACIv3InheritanceLevel uint16

ACIv3InheritanceLevel describes a discrete numerical abstract of a single subordinate level. ACIv3InheritanceLevel describes any single ACIv3InheritanceLevel definition. ACIv3InheritanceLevel constants are intended for "storage" within an instance of ACIv3Inheritance.

Valid ACIv3InheritanceLevel constants are level zero (0) through level nine (9), though the supported range will vary across directory implementations.

const (
	ACIv3Level0 ACIv3InheritanceLevel = 1 << iota //   1 - base  (0) (current Object)
	ACIv3Level1                                   //   2 - one   (1) level below baseObject
	ACIv3Level2                                   //   4 - two   (2) levels below baseObject
	ACIv3Level3                                   //   8 - three (3) levels below baseObject
	ACIv3Level4                                   //  16 - four  (4) levels below baseObject
	ACIv3Level5                                   //  32 - five  (5) levels below baseObject
	ACIv3Level6                                   //  64 - six   (6) levels below baseObject
	ACIv3Level7                                   // 128 - seven (7) levels below baseObject
	ACIv3Level8                                   // 256 - eight (8) levels below baseObject
	ACIv3Level9                                   // 512 - nine  (9) levels below baseObject

	AllLevels ACIv3InheritanceLevel = ACIv3InheritanceLevel(2046) // ALL levels; one (1) through nine (9)
)

ACIv3Level uint16 constants are left-shifted to define a range of vertical (depth) ACIv3BindRule statements.

func (ACIv3InheritanceLevel) String

func (r ACIv3InheritanceLevel) String() (lvl string)

String returns a single string name value for receiver instance of [ACIv3Level].

Example
fmt.Printf("%s", ACIv3Level8)
Output:

8

type ACIv3Instruction

type ACIv3Instruction struct {
	T  ACIv3TargetRule         // *0 ACIv3TargetRuleItem
	A  string                  //  1 ACL
	PB ACIv3PermissionBindRule // *1 ACIv3PermissionBindRuleItem
}

ACIv3Instruction is the high-level composite type for Netscape's ACIv3 instruction construct.

Field T contains an ACIv3TargetRule, which is always optional.

Field A contains a string intended for a helpful "label" which differentiates the statement from other instructions -- a requirement of most directory implementations which honor the ACIv3 syntax. This is known as the "ACL", or "Access Control Label".

Field PB contains an instance of ACIv3PermissionBindRule, which MUST contain at least one (1) ACIv3PermissionBindRuleItem.

func (ACIv3Instruction) OID

func (r ACIv3Instruction) OID() string

OID returns the official Netscape ACIv3 object identifier string literal "2.16.840.1.113730.3.1.55".

func (ACIv3Instruction) String

func (r ACIv3Instruction) String() string

String returns the string representation of the receiver instance.

type ACIv3Keyword

type ACIv3Keyword interface {
	String() string
	Kind() string
	// contains filtered or unexported methods
}

ACIv3Keyword describes the effective "type" within the context of a given ACIv3BindRule or ACIv3TargetRuleItem.

The available ACIv3Keyword instances vary based on the rule type in which a given ACIv3Keyword resides.

See the ACIv3Keyword constants defined in this package for a complete list.

Example

This example demonstrates the interrogation of qualifiers of the Keyword interface type (BindKeyword and TargetKeyword const definitions).

There are a total of twenty (20) qualifying instances (spanning two (2) distinct types) of this interface.

for idx, k := range []ACIv3Keyword{
	ACIv3BindUDN,
	ACIv3BindRDN,
	ACIv3BindGDN,
	ACIv3BindUAT,
	ACIv3BindGAT,
	ACIv3BindIP,
	ACIv3BindDNS,
	ACIv3BindDoW,
	ACIv3BindToD,
	ACIv3BindAM,
	ACIv3BindSSF,
	ACIv3Target,
	ACIv3TargetTo,
	ACIv3TargetAttr,
	ACIv3TargetCtrl,
	ACIv3TargetFrom,
	ACIv3TargetScope,
	ACIv3TargetFilter,
	ACIv3TargetAttrFilters,
	ACIv3TargetExtOp,
} {
	fmt.Printf("[%s] %02d/%d: %s\n",
		k.Kind(), idx+1, 20, k)
}
Output:

[bindRule] 01/20: userdn
[bindRule] 02/20: roledn
[bindRule] 03/20: groupdn
[bindRule] 04/20: userattr
[bindRule] 05/20: groupattr
[bindRule] 06/20: ip
[bindRule] 07/20: dns
[bindRule] 08/20: dayofweek
[bindRule] 09/20: timeofday
[bindRule] 10/20: authmethod
[bindRule] 11/20: ssf
[targetRule] 12/20: target
[targetRule] 13/20: target_to
[targetRule] 14/20: targetattr
[targetRule] 15/20: targetcontrol
[targetRule] 16/20: target_from
[targetRule] 17/20: targetscope
[targetRule] 18/20: targetfilter
[targetRule] 19/20: targattrfilters
[targetRule] 20/20: extop

type ACIv3ObjectIdentifier

type ACIv3ObjectIdentifier struct {
	ACIv3TargetKeyword
	// contains filtered or unexported fields
}

ACIv3ObjectIdentifier implements a storage type for slices of NumericOID instances.

Instances of this type are only used in ACIv3TargetRuleItem instances which bear either the ACIv3TargetCtrl or ACIv3TargetExtOp keywords.

func (ACIv3ObjectIdentifier) Contains

func (r ACIv3ObjectIdentifier) Contains(x any) bool

Contains returns a Boolean value indicative of whether value x, if a string or NumericOID instance, already resides within the receiver instance.

Case is not significant in the matching process.

func (ACIv3ObjectIdentifier) Eq

Eq returns an instance of ACIv3TargetRuleItem which represents a keyword-based equality rule containing one (1) or more NumericOID instances.

Example
var r NetscapeACIv3

oid, err := r.LDAPControlOIDs(
	`1.3.6.1.4.1.56521.999.5`,
	`1.3.6.1.4.1.56521.999.6`,
	`1.3.6.1.4.1.56521.999.7`,
)

if err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("Target rule: %s", oid.Eq())
Output:

Target rule: (targetcontrol="1.3.6.1.4.1.56521.999.5||1.3.6.1.4.1.56521.999.6||1.3.6.1.4.1.56521.999.7")

func (ACIv3ObjectIdentifier) Index

func (r ACIv3ObjectIdentifier) Index(idx int) NumericOID

Index returns the Nth instance of NumericOID present within the receiver instance.

Example

This example demonstrates the use of the Index method to obtain a single slice OID.

var r NetscapeACIv3

oid, err := r.LDAPControlOIDs(
	`1.3.6.1.4.1.56521.999.5`,
	`1.3.6.1.4.1.56521.999.6`,
	`1.3.6.1.4.1.56521.999.7`,
)

if err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("Slice keyword: %s", oid.Index(1))
Output:

Slice keyword: 1.3.6.1.4.1.56521.999.6

func (ACIv3ObjectIdentifier) IsZero

func (r ACIv3ObjectIdentifier) IsZero() bool

IsZero wraps the [stackage.Stack.IsZero] method.

Example
var oid ACIv3ObjectIdentifier
fmt.Printf("%T is zero: %t\n", oid, oid.IsZero())
Output:

dirsyn.ACIv3ObjectIdentifier is zero: true

func (ACIv3ObjectIdentifier) Keyword

Keyword returns the ACIv3TargetKeyword associated with the receiver instance enveloped as a ACIv3TargetKeyword. In the context of this type instance, the ACIv3TargetKeyword returned is always ACIv3TargetExtOp or ACIv3TargetCtrl.

Example

This example demonstrates use of the ACIv3ObjectIdentifier.Keyword method to obtain the current ACIv3TargetKeyword context from the receiver.

var r NetscapeACIv3

oid, err := r.LDAPExtendedOperationOIDs(
	`1.3.6.1.4.1.56521.999.5`,
	`1.3.6.1.4.1.56521.999.6`,
	`1.3.6.1.4.1.56521.999.7`,
)

if err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("%s", oid.Keyword())
Output:

extop

func (ACIv3ObjectIdentifier) Len

func (r ACIv3ObjectIdentifier) Len() int

Len wraps the [stackage.Stack.Len] method.

Example

This example demonstrates use of the ACIv3ObjectIdentifier.Len method to return the number of slices present within the receiver as an integer.

var r NetscapeACIv3

oid, err := r.LDAPExtendedOperationOIDs(
	`1.3.6.1.4.1.56521.999.5`,
	`1.3.6.1.4.1.56521.999.6`,
	`1.3.6.1.4.1.56521.999.7`,
)

if err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("%d", oid.Len())
Output:

3

func (ACIv3ObjectIdentifier) Ne

Ne returns an instance of ACIv3TargetRuleItem which represents a keyword-based negated equality rule containing one (1) or more NumericOID instances.

Negated equality ACIv3TargetRuleItem instances should be used with caution.

Example
var r NetscapeACIv3

oid, err := r.LDAPExtendedOperationOIDs(
	`1.3.6.1.4.1.56521.999.5`,
	`1.3.6.1.4.1.56521.999.6`,
	`1.3.6.1.4.1.56521.999.7`,
)

if err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("Target rule: %s", oid.Ne())
Output:

Target rule: (extop!="1.3.6.1.4.1.56521.999.5||1.3.6.1.4.1.56521.999.6||1.3.6.1.4.1.56521.999.7")

func (ACIv3ObjectIdentifier) Push

Push appends one (1) or more unique numeric OID values -- as string or NumericOID instances -- to the receiver instance.

Example
var r NetscapeACIv3

oid, err := r.LDAPExtendedOperationOIDs(
	`1.3.6.1.4.1.56521.999.5`,
	`1.3.6.1.4.1.56521.999.6`,
)

if err != nil {
	fmt.Println(err)
	return
}

// Add a third OID we forgot:
oid.Push(`1.3.6.1.4.1.56521.999.7`)

fmt.Printf("%d", oid.Len())
Output:

3

func (ACIv3ObjectIdentifier) TRM

TRM returns an instance of ACIv3TargetRuleMethods.

Each of the return instance's key values represent a single ACIv3Operator that is allowed for use in the creation of ACIv3TargetRuleItem instances which bear the receiver instance as an expression value. The value for each key is the actual instance method to -- optionally -- use for the creation of the ACIv3TargetRuleItem.

This is merely a convenient alternative to maintaining knowledge of which ACIv3Operator instances apply to which types. Instances of this type are also used to streamline package unit tests.

Please note that if the receiver is in an aberrant state, or if it has not yet been initialized, the execution of ANY of the return instance's value methods will return bogus ACIv3TargetRuleItem instances. While this is useful in unit testing, the end user must only execute this method IF and WHEN the receiver has been properly populated and prepared for such activity.

Example

This example demonstrates the use of the ACIv3ObjectIdentifier.TRM method to obtain a list of available ACIv3Operator identifiers and methods.

var oid ACIv3ObjectIdentifier
fmt.Printf("Allows greater-than: %t", oid.TRM().Contains(ACIv3Gt))
Output:

Allows greater-than: false

func (ACIv3ObjectIdentifier) Valid

func (r ACIv3ObjectIdentifier) Valid() error

Valid returns a Boolean value indicative of a valid receiver instance.

Example

This example demonstrates the use of the ACIv3ObjectIdentifier.Valid method upon a nil receiver.

var oid ACIv3ObjectIdentifier
fmt.Printf("Valid: %t", oid.Valid() == nil)
Output:

Valid: false

type ACIv3Operator

type ACIv3Operator uint8

ACIv3Operator implements a simple comparison operator for ACIv3BindRule and ACIv3TargetRuleItem statements.

Example (Stringers)
for _, cop := range []ACIv3Operator{
	ACIv3Eq, ACIv3Ne, ACIv3Lt, ACIv3Gt, ACIv3Le, ACIv3Ge,
} {
	fmt.Printf("[%d] %s (%s)[%s]\n",
		int(cop),
		cop.Description(),
		cop.Context(),
		cop)
}
Output:

[1] Equal To (Eq)[=]
[2] Not Equal To (Ne)[!=]
[3] Less Than (Lt)[<]
[4] Greater Than (Gt)[>]
[5] Less Than Or Equal (Le)[<=]
[6] Greater Than Or Equal (Ge)[>=]
const (
	ACIv3Eq ACIv3Operator = 0x1 // "Equal To"
	ACIv3Ne ACIv3Operator = 0x2 // "Not Equal To"     !! USE WITH CAUTION !!
	ACIv3Lt ACIv3Operator = 0x3 // "Less Than"
	ACIv3Gt ACIv3Operator = 0x4 // "Greater Than"
	ACIv3Le ACIv3Operator = 0x5 // "Less Than Or Equal"
	ACIv3Ge ACIv3Operator = 0x6 // "Greater Than Or Equal"
)

func (ACIv3Operator) Compare

func (r ACIv3Operator) Compare(cop any) bool

Compare shall resolve the input ACIv3Operator candidate (cop) and, if successful, shall perform an equality assertion between it and the receiver instance. The assertion result is returned as a bool instance.

In the case of the string representation of a given candidate input value, case-folding is not a significant factor.

func (ACIv3Operator) Context

func (r ACIv3Operator) Context() (ctx string)

Context returns the contextual string name of the receiver instance:

  • "Eq"
  • "Ne"
  • "Lt"
  • "Gt"
  • "Le"
  • "Ge"
Example

This example demonstrates the use of the Context method to show all the context name for all ACIv3Operator constants.

for _, cop := range []ACIv3Operator{
	ACIv3Eq, ACIv3Ne, ACIv3Lt, ACIv3Gt, ACIv3Le, ACIv3Ge,
} {
	fmt.Printf("%s\n", cop.Context())
}
Output:

Eq
Ne
Lt
Gt
Le
Ge

func (ACIv3Operator) Description

func (r ACIv3Operator) Description() (desc string)

Description returns the string description for the receiver instance:

  • "Equal To"
  • "Not Equal To"
  • "Less Than"
  • "Greater Than"
  • "Less Than Or Equal"
  • "Greater Than Or Equal"

This method is largely for convenience, and many individuals may feel it only has any practical applications in the areas of documentation, diagram creation or some other similar activity.

However, a prudent cybersecurity expert may argue that this method can be used to aid in the (critical) area of proofreading newly-devised or modified access control statements. A person could very easily mistake >= and <=, certainly if they're overworked or not paying attention. One such mistake could spell disaster.

Additionally, use of this method as a means to auto-generate [Instruction] comments (for LDIF configurations, or similar) can greatly help an admin more easily READ and UNDERSTAND the statements in question.

See the ACIv3Operator const definitions for details.

Example

This example demonstrates the use of the Description method to show all descriptive text for all ACIv3Operator constants.

for _, cop := range []ACIv3Operator{
	ACIv3Eq, ACIv3Ne, ACIv3Lt, ACIv3Gt, ACIv3Le, ACIv3Ge,
} {
	fmt.Printf("%s\n", cop.Description())
}
Output:

Equal To
Not Equal To
Less Than
Greater Than
Less Than Or Equal
Greater Than Or Equal

func (ACIv3Operator) String

func (r ACIv3Operator) String() (cop string)

String returns the string representation of the receiver instance.

Example

This example demonstrates the string representation for all known ACIv3Operator constants.

for _, cop := range []ACIv3Operator{
	ACIv3Eq, ACIv3Ne, ACIv3Lt, ACIv3Gt, ACIv3Le, ACIv3Ge,
} {
	fmt.Printf("%s\n", cop)
}
Output:

=
!=
<
>
<=
>=

func (ACIv3Operator) Valid

func (r ACIv3Operator) Valid() (err error)

Valid returns an error instance following the process of verifying the receiver to be a known ACIv3Operator instance. This does NOT, however, imply feasibility of use with any particular type in the creation of ACIv3BindRule or ACIv3TargetRuleItem instances.

Example
var unknown ACIv3Operator = ACIv3Operator(12)
fmt.Printf("Is a known %T: %t", unknown, unknown.Valid() == nil)
Output:

Is a known dirsyn.ACIv3Operator: false

type ACIv3Permission

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

ACIv3Permission defines a level of access bestowed (or withheld) by a ACIv3PermissionBindRule.

Example (Granting)

This example demonstrates the withholding (denial) of all privileges except proxy.

var r NetscapeACIv3

// grant read/write
p, err := r.Permission(true, ACIv3ReadAccess, ACIv3WriteAccess)
if err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("%s", p)
Output:

allow(read,write)
Example (Shifting)
var r NetscapeACIv3
// Shift or Unshift values may be ACIv3Right constants, or their
// string or uint16 equivalents:
p, err := r.Permission(false, ACIv3ReadAccess, "write", 32, ACIv3SearchAccess, "PROXY")
if err != nil {
	fmt.Println(err)
	return
}

p.Unshift("compare") // remove the negated compare (bit 32) privilege
fmt.Printf("Forbids compare: %t", p.Positive(`compare`))
Output:

Forbids compare: false
Example (Witholding)

This example demonstrates the withholding (denial) of all privileges except proxy.

var r NetscapeACIv3

// deny everything (this does not include proxy privilege)
p, err := r.Permission(false, ACIv3AllAccess)
if err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("%s", p)
Output:

deny(all)

func (ACIv3Permission) Disposition

func (r ACIv3Permission) Disposition() string

Disposition returns the string disposition `allow` or 'deny', depending on the state of the receiver.

Example
var r NetscapeACIv3
p, err := r.Permission(true, "read", "write", "compare", "selfwrite")
if err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("%s", p.Disposition())
Output:

allow

func (ACIv3Permission) IsZero

func (r ACIv3Permission) IsZero() bool

IsZero returns a Boolean value indicative of whether the receiver is nil, or unset.

Example
var p ACIv3Permission
fmt.Printf("Privileges are undefined: %t", p.IsZero())
Output:

Privileges are undefined: true

func (ACIv3Permission) Len

func (r ACIv3Permission) Len() (l int)

Len returns the abstract integer length of the receiver, quantifying the number of ACIv3Right instances currently being expressed. For example, if the receiver instance has its ACIv3ReadAccess and ACIv3DeleteAccess ACIv3Right bits enabled, this would represent an abstract length of two (2).

Example
var r NetscapeACIv3
p, err := r.Permission(false, "read", "write", "compare", "search", "proxy")
if err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("Number of privileges denied: %d", p.Len())
Output:

Number of privileges denied: 5

func (ACIv3Permission) Positive

func (r ACIv3Permission) Positive(x any) (posi bool)

Positive returns a Boolean value indicative of whether a particular bit is positive (is set). Negation implies negative, or unset.

func (ACIv3Permission) Shift

func (r ACIv3Permission) Shift(x ...any) ACIv3Permission

Shift left-shifts the receiver instance to include ACIv3Right x, if not already present.

func (ACIv3Permission) String

func (r ACIv3Permission) String() string

String returns the string representation of the receiver instance.

Example
var r NetscapeACIv3
p, err := r.Permission(true, "read", "write", "compare", "selfwrite")
if err != nil {
	fmt.Println(err)
	return
}
fmt.Printf("%s", p)
Output:

allow(read,write,compare,selfwrite)

func (ACIv3Permission) Unshift

func (r ACIv3Permission) Unshift(x ...any) ACIv3Permission

Unshift right-shifts the receiver instance to remove ACIv3Right x, if present.

func (ACIv3Permission) Valid

func (r ACIv3Permission) Valid() (err error)

Valid returns a non-error instance if the receiver fails to pass basic validity checks.

Example
var p ACIv3Permission
fmt.Printf("%T is ready for use: %t", p, p.Valid() == nil)
Output:

dirsyn.ACIv3Permission is ready for use: false

type ACIv3PermissionBindRule

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

ACIv3PermissionBindRule contains one (1) or more ACIv3PermissionBindRuleItem instances.

func (ACIv3PermissionBindRule) Index

Index returns the Nth ACIv3PermissionBindRuleItem slice within the receiver instance.

func (ACIv3PermissionBindRule) IsZero

func (r ACIv3PermissionBindRule) IsZero() bool

IsZero returns a Boolean value indicative of whether the receiver instance is nil, or unset.

func (ACIv3PermissionBindRule) Kind

Kind returns the string literal `permissionBindRule`.

func (ACIv3PermissionBindRule) Len

func (r ACIv3PermissionBindRule) Len() int

func (ACIv3PermissionBindRule) Push

Push appends zero (0) or more valid instances of ACIv3PermissionBindRuleItem, or the string equivalents.

func (ACIv3PermissionBindRule) String

func (r ACIv3PermissionBindRule) String() string

String returns the string representation of the receiver.

func (ACIv3PermissionBindRule) Valid

func (r ACIv3PermissionBindRule) Valid() (err error)

Valid returns an error instance should any of the following conditions evaluate as true:

  • Valid returns an error for P
  • Valid returns an error for B
  • Len returns zero (0) for B

type ACIv3PermissionBindRuleItem

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

ACIv3PermissionBindRuleItem contains one (1) ACIv3Permission instance and one (1) ACIv3BindRule instance. Instances of this type are used within an ACIv3PermissionBindRule instance.

func (ACIv3PermissionBindRuleItem) BindRule

BindRule returns the underlying ACIv3BindRule instance present within the receiver instance.

func (ACIv3PermissionBindRuleItem) IsZero

func (r ACIv3PermissionBindRuleItem) IsZero() bool

IsZero returns a Boolean value indicative of whether the receiver instance is nil, or unset.

func (ACIv3PermissionBindRuleItem) Kind

Kind returns the string literal `permissionBindRuleItem`.

func (ACIv3PermissionBindRuleItem) Permission

Permission returns the underlying ACIv3Permission instance present within the receiver instance.

func (ACIv3PermissionBindRuleItem) String

String returns the string representation of the receiver.

func (ACIv3PermissionBindRuleItem) Valid

func (r ACIv3PermissionBindRuleItem) Valid() (err error)

Valid returns an error following a validity scan of the receiver instance.

type ACIv3Right

type ACIv3Right uint16

ACIv3Right contains the specific bit value of a single user privilege. Constants of this type are intended for submission to the ACIv3Permission.Shift, ACIv3Permission.Unshift and ACIv3Permission.Positive methods.

const (
	ACIv3ReadAccess      ACIv3Right = 1 << iota // 1
	ACIv3WriteAccess                            // 2
	ACIv3AddAccess                              // 4
	ACIv3DeleteAccess                           // 8
	ACIv3SearchAccess                           // 16
	ACIv3CompareAccess                          // 32
	ACIv3SelfWriteAccess                        // 64
	ACIv3ProxyAccess                            // 128
	ACIv3ImportAccess                           // 256
	ACIv3ExportAccess                           // 512

	ACIv3NoAccess  ACIv3Right = 0
	ACIv3AllAccess ACIv3Right = 895 // DOES NOT INCLUDE "proxy"
)

ACIv3Right constants are discrete left-shifted privilege aggregates that can be used in an additive (or subtractive) manner to form a complete ACIv3Permission statement.

func (ACIv3Right) String

func (r ACIv3Right) String() (p string)

String returns a single string name value for receiver instance.

Example
// iterate all of the known Right definitions
// defined as constants in this package.
for idx, privilege := range []ACIv3Right{
	ACIv3NoAccess,
	ACIv3ReadAccess,
	ACIv3WriteAccess,
	ACIv3AddAccess,
	ACIv3DeleteAccess,
	ACIv3SearchAccess,
	ACIv3CompareAccess,
	ACIv3SelfWriteAccess,
	ACIv3ProxyAccess,
	ACIv3ImportAccess,
	ACIv3ExportAccess,
	ACIv3AllAccess, // does NOT include proxy access !
} {
	fmt.Printf("Privilege %02d/%d: %s (bit:%d)\n", idx+1, 12, privilege, int(privilege))
}
Output:

Privilege 01/12: none (bit:0)
Privilege 02/12: read (bit:1)
Privilege 03/12: write (bit:2)
Privilege 04/12: add (bit:4)
Privilege 05/12: delete (bit:8)
Privilege 06/12: search (bit:16)
Privilege 07/12: compare (bit:32)
Privilege 08/12: selfwrite (bit:64)
Privilege 09/12: proxy (bit:128)
Privilege 10/12: import (bit:256)
Privilege 11/12: export (bit:512)
Privilege 12/12: all (bit:895)

type ACIv3Scope

type ACIv3Scope SearchScope

ACIv3Scope extends the standard RFC4511 SearchScope type to accommodate an additional scope, "subordinate", for use in ACIv3-specific [URL]s, as well as for ACIv3TargetRuleItem composition where the ACIv3TargetScope keyword is in use.

const ACIv3ScopeSubordinate ACIv3Scope = 4

ACIv3ScopeSubordinate represents a non-standard ACIv3Scope value, `subordinate`, which is used in ACIv3 types only

func (ACIv3Scope) Eq

Eq initializes and returns a new ACIv3TargetRuleItem instance configured to express the evaluation of the receiver value as Equal-To an ACIv3TargetScope ACIv3TargetKeyword context.

func (ACIv3Scope) Keyword

func (r ACIv3Scope) Keyword() ACIv3Keyword

Keyword returns the ACIv3Keyword associated with the receiver instance enveloped as a ACIv3Keyword. In the context of this type instance, the ACIv3TargetKeyword returned is always ACIv3TargetScope.

func (ACIv3Scope) Ne

Ne performs no useful task, as negated equality comparison does not apply to ACIv3TargetRuleItem instances that bear the ACIv3TargetScope ACIv3TargetKeyword.

This method exists solely to satisfy Go's interface signature requirements.

This method SHALL NOT appear within instances of ACIv3TargetRuleMethods that were crafted through execution of the ACIv3Scope.TRM method.

func (ACIv3Scope) String

func (r ACIv3Scope) String() string

String returns the string representation of the receiver instance.

func (ACIv3Scope) TRM

TRM returns an instance of ACIv3TargetRuleMethods.

Each of the return instance's key values represent a single ACIv3Operator that is allowed for use in the creation of ACIv3TargetRuleItem instances which bear the receiver instance as an expression value. The value for each key is the actual instance method to -- optionally -- use for the creation of the ACIv3TargetRuleItem.

This is merely a convenient alternative to maintaining knowledge of which ACIv3Operator instances apply to which types. Instances of this type are also used to streamline package unit tests.

Please note that if the receiver is in an aberrant state, or if it has not yet been initialized, the execution of ANY of the return instance's value methods will return bogus ACIv3TargetRuleItem instances. While this is useful in unit testing, the end user must only execute this method IF and WHEN the receiver has been properly populated and prepared for such activity.

type ACIv3SecurityStrengthFactor

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

ACIv3SecurityStrengthFactor embeds a pointer to uint8. A nil uint8 value indicates an effective security strength factor of zero (0). A non-nil uint8 value expresses uint8 + 1, thereby allowing a range of 0-256 "within" a uint8 instance.

func (ACIv3SecurityStrengthFactor) BRM

BRM returns an instance of ACIv3BindRuleMethods.

Each of the return instance's key values represent a single instance of the ACIv3Operator type that is allowed for use in the creation of ACIv3BindRule instances which bear the receiver instance as an expression value. The value for each key is the actual ACIv3BindRuleMethod instance for OPTIONAL use in the creation of a ACIv3BindRule instance.

This is merely a convenient alternative to maintaining knowledge of which ACIv3Operator instances apply to which types. Instances of this type are also used to streamline package unit tests.

Please note that if the receiver is in an aberrant state, or if it has not yet been initialized, the execution of ANY of the return instance's value methods will return bogus ACIv3BindRule instances. While this is useful in unit testing, the end user must only execute this method IF and WHEN the receiver has been properly populated and prepared for such activity.

Example
var r NetscapeACIv3

ssf, err := r.SecurityStrengthFactor(128)
if err != nil {
	fmt.Println(err)
	return
}
meths := ssf.BRM()

fmt.Printf("%d available aci.BindRuleMethod instances", meths.Len())
Output:

6 available aci.BindRuleMethod instances

func (ACIv3SecurityStrengthFactor) Eq

Eq initializes and returns a new ACIv3BindRule instance configured to express the evaluation of the receiver value as Equal-To the ACIv3BindSSF ACIv3BindKeyword context.

Example
var r NetscapeACIv3
ssf, err := r.SecurityStrengthFactor(128)
if err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("%s", ssf.Set(128).Ne().SetParen(true))
Output:

(ssf!="128")

func (ACIv3SecurityStrengthFactor) Ge

Ge initializes and returns a new ACIv3BindRule instance configured to express the evaluation of the receiver value as Greater-Than-Or-Equal to the ACIv3BindSSF ACIv3BindKeyword context.

Example
var r NetscapeACIv3
ssf, err := r.SecurityStrengthFactor(128)
if err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("%s", ssf.Set(128).Ge().SetParen(true))
Output:

(ssf>="128")

func (ACIv3SecurityStrengthFactor) Gt

Gt initializes and returns a new ACIv3BindRule instance configured to express the evaluation of the receiver value as Greater-Than the ACIv3BindSSF ACIv3BindKeyword context.

Example
var r NetscapeACIv3
ssf, err := r.SecurityStrengthFactor(128)
if err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("%s", ssf.Set(128).Gt().SetParen(true))
Output:

(ssf>"128")

func (ACIv3SecurityStrengthFactor) IsZero

func (r ACIv3SecurityStrengthFactor) IsZero() bool

IsZero returns a Boolean value indicative of whether the receiver is nil, or unset.

Example
var s ACIv3SecurityStrengthFactor
fmt.Printf("Zero: %t", s.IsZero())
Output:

Zero: true

func (ACIv3SecurityStrengthFactor) Keyword

Keyword returns the BindKeyword assigned to the receiver instance enveloped as a ACIv3Keyword. This shall be the keyword that appears in a ACIv3BindRule containing the receiver instance as the expression value.

Example
var s ACIv3SecurityStrengthFactor
fmt.Printf("Keyword: %s", s.Keyword())
Output:

Keyword: ssf

func (ACIv3SecurityStrengthFactor) Le

Le initializes and returns a new ACIv3BindRule instance configured to express the evaluation of the receiver value as Less-Than-Or-Equal to the ACIv3BindSSF ACIv3BindKeyword context.

Example
var r NetscapeACIv3
ssf, err := r.SecurityStrengthFactor(128)
if err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("%s", ssf.Set(128).Le().SetParen(true))
Output:

(ssf<="128")

func (ACIv3SecurityStrengthFactor) Lt

Lt initializes and returns a new ACIv3BindRule instance configured to express the evaluation of the receiver value as Less-Than the ACIv3BindSSF ACIv3BindKeyword context.

Example
var r NetscapeACIv3
ssf, err := r.SecurityStrengthFactor(128)
if err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("%s", ssf.Set(128).Lt())
Output:

ssf<"128"

func (ACIv3SecurityStrengthFactor) Ne

Ne initializes and returns a new ACIv3BindRule instance configured to express the evaluation of the receiver value as Not-Equal-To the ACIv3BindSSF ACIv3BindKeyword context.

Negated equality ACIv3BindRule instances should be used with caution.

Example
var r NetscapeACIv3
ssf, err := r.SecurityStrengthFactor(128)
if err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("%s", ssf.Set(128).Ne().SetParen(true))
Output:

(ssf!="128")

func (*ACIv3SecurityStrengthFactor) Set

Set modifies the receiver to reflect the desired security strength factor (SSF), which can represent any numerical value between 0 (off) and 256 (max).

Valid input types are int, string and nil.

A value of nil wipes out any previous value, making the SSF effectively zero (0).

A string value of `full` or `max` sets the SSF to its maximum value. A value of `none` or `off` has the same effect as when providing a nil value. A numerical string value is cast as int and (if valid) will be resubmitted silently. Case is not significant during the string matching process.

An int value less than or equal to zero (0) has the same effect as when providing a nil value. A value between 1 and 256 is acceptable and will be used. A value greater than 256 will be silently reduced back to the maximum.

func (ACIv3SecurityStrengthFactor) String

String returns the string representation of the receiver instance.

Example
var r NetscapeACIv3
ssf, err := r.SecurityStrengthFactor(128)
if err != nil {
	fmt.Println(err)
	return
}
fmt.Printf("%s", ssf)
Output:

128

func (ACIv3SecurityStrengthFactor) Valid

Valid returns nil and, at present, does nothing else. Based on the efficient design of the receiver type, there is no possible state that is technically invalid at ALL times. A nil instance may, in fact, be correct in particular situations.

Thus as there is no room for unforeseen errors with regards to this type specifically, this method has been gutted but remains present merely for the purpose of signature consistency throughout the package.

Example
var s ACIv3SecurityStrengthFactor
fmt.Printf("Valid: %t", s.Valid() == nil) // zero IS valid, technically speaking!
Output:

Valid: true

type ACIv3TargetDistinguishedName

type ACIv3TargetDistinguishedName struct {
	ACIv3TargetKeyword
	// contains filtered or unexported fields
}

func (ACIv3TargetDistinguishedName) Contains

func (r ACIv3TargetDistinguishedName) Contains(x any) bool

Contains returns a Boolean value indicative of a match between x and a slice value in the receiver instance.

x MUST be a proper DistinguishedName instance, or its string equivalent.

func (ACIv3TargetDistinguishedName) Eq

Eq returns an instance of ACIv3TargetRuleItem bearing the associated ACIv3TargetKeyword in equality form.

func (ACIv3TargetDistinguishedName) Index

Index returns the Nth string present within the receiver instance.

func (ACIv3TargetDistinguishedName) IsZero

IsZero returns a Boolean value indicative of a nil receiver state.

func (ACIv3TargetDistinguishedName) Len

Len returns the integer length of the receiver instance.

func (ACIv3TargetDistinguishedName) Ne

Ne returns an instance of ACIv3BindRuleItem, enveloped as an ACIv3BindRule, bearing the associated ACIv3BindKeyword in equality form.

Negated equalient ACIv3TargetRuleItem instances should be used with caution.

func (ACIv3TargetDistinguishedName) Push

Push appends zero (0) or more values to the receiver. Each value MUST be a DistinguishedName, or its string equivalent.

type ACIv3TargetKeyword

type ACIv3TargetKeyword uint8

ACIv3TargetKeyword contains the value describing a particular ACIv3Keyword to be used within an ACIv3TargetRuleItem.

Example

This example demonstrates the interrogation of TargetKeyword const definitions. This type qualifies for the Keyword interface type.

There are a total of nine (9) such TargetKeyword definitions.

for idx, tk := range []ACIv3TargetKeyword{
	ACIv3Target,
	ACIv3TargetTo,
	ACIv3TargetAttr,
	ACIv3TargetCtrl,
	ACIv3TargetFrom,
	ACIv3TargetScope,
	ACIv3TargetFilter,
	ACIv3TargetAttrFilters,
	ACIv3TargetExtOp,
} {
	fmt.Printf("[%s] %d/%d: %s\n",
		tk.Kind(), idx+1, 9, tk)
}
Output:

[targetRule] 1/9: target
[targetRule] 2/9: target_to
[targetRule] 3/9: targetattr
[targetRule] 4/9: targetcontrol
[targetRule] 5/9: target_from
[targetRule] 6/9: targetscope
[targetRule] 7/9: targetfilter
[targetRule] 8/9: targattrfilters
[targetRule] 9/9: extop
const (
	ACIv3Target            ACIv3TargetKeyword // 0x1, target
	ACIv3TargetTo                             // 0x2, target_to
	ACIv3TargetAttr                           // 0x3, targetattr
	ACIv3TargetCtrl                           // 0x4, targetcontrol
	ACIv3TargetFrom                           // 0x5, target_from
	ACIv3TargetScope                          // 0x6, targetscope
	ACIv3TargetFilter                         // 0x7, targetfilter
	ACIv3TargetAttrFilters                    // 0x8, targattrfilters (yes, "targ". As in "wild Klingon boars").
	ACIv3TargetExtOp                          // 0x9, extop
)

ACIv3TargetKeyword constants are intended for singular use within an ACIv3TargetRuleItem instance.

func (ACIv3TargetKeyword) Kind

func (r ACIv3TargetKeyword) Kind() string

Kind returns the static string literal `targetRule` identifying the instance as a ACIv3TargetKeyword.

Example
fmt.Printf("%s", ACIv3TargetAttrFilters.Kind())
Output:

targetRule

func (ACIv3TargetKeyword) String

func (r ACIv3TargetKeyword) String() (k string)

String returns the string representation of the receiver instance of ACIv3TargetKeyword.

Example
fmt.Printf("%s", ACIv3TargetScope)
Output:

targetscope

type ACIv3TargetRule

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

ACIv3TargetRuleItem implements the base slice type for instances of ACIv3TargetRuleItem.

Instances of this type shall contain a minimum of zero (0) and a maximum of nine (9) valid ACIv3TargetRuleItem instances.

During the ACIv3TargetRule.Push (append) process, individual slices are checked for uniqueness based on ACIv3TargetKeyword use. As such, no single ACIv3TargetKeyword shall ever appear in more than one ACIv3TargetRuleItem instance found within instances of this type.

func (ACIv3TargetRule) Contains

func (r ACIv3TargetRule) Contains(kw any) bool

Contains returns a Boolean value indicative of the presence an instance of ACIv3TargetRuleItem bearing the specified ACIv3TargetKeyword within the receiver instance.

func (ACIv3TargetRule) Index

Index returns the Nth instance of ACIv3TargetRuleItem present within the receiver instance.

func (ACIv3TargetRule) IsZero

func (r ACIv3TargetRule) IsZero() bool

func (ACIv3TargetRule) Len

func (r ACIv3TargetRule) Len() int

Len returns the integer length of the receiver instance.

func (ACIv3TargetRule) Push

func (r ACIv3TargetRule) Push(x ...any) ACIv3TargetRule

Push appends zero (0) or more valid ACIv3TargetRuleItem instances to the receiver instance.

If the specified ACIv3TargetRuleItem input instances bear [ACIv3TargetKeyword]s already in use within the receiver instance, they are silently ignored.

Up to nine (9) possible ACIv3TargetRuleItem instances shall appear within any instance of this type.

func (ACIv3TargetRule) SetQuotationStyle

func (r ACIv3TargetRule) SetQuotationStyle(style int) ACIv3TargetRule

SetQuotationStyle performs the iterative equivalent to the ACIv3TargetRuleItem.SetQuotationStyle method, activating the specified quotation style upon all such instances present within the receiver instance.

func (ACIv3TargetRule) String

func (r ACIv3TargetRule) String() string

String returns the string representation of the receiver instance.

func (ACIv3TargetRule) Valid

func (r ACIv3TargetRule) Valid() (err error)

Valid returns an error following an analysis of the receiver instance.

type ACIv3TargetRuleItem

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

ACIv3TargetRuleItem implements the (optional) ACIv3 Target Rule slice value type. Instances of this type are intended for storage within an instance of ACIv3TargetRule.

func (ACIv3TargetRuleItem) Expression

func (r ACIv3TargetRuleItem) Expression() any

Expression returns the underlying expression value currently set within the receiver instance.

func (ACIv3TargetRuleItem) IsZero

func (r ACIv3TargetRuleItem) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (ACIv3TargetRuleItem) Keyword

Keyword returns the ACIv3TargetKeyword value currently set within the receiver instance.

func (ACIv3TargetRuleItem) Kind

func (r ACIv3TargetRuleItem) Kind() string

Kind returns the string literal `targetRule`.

func (ACIv3TargetRuleItem) Operator

func (r ACIv3TargetRuleItem) Operator() ACIv3Operator

Operator returns the ACIv3Operator value currently set within the receiver instance.

func (ACIv3TargetRuleItem) SetExpression

func (r ACIv3TargetRuleItem) SetExpression(expr any) ACIv3TargetRuleItem

SetExpression assigns value expr to the receiver instance.

func (ACIv3TargetRuleItem) SetKeyword

func (r ACIv3TargetRuleItem) SetKeyword(kw any) ACIv3TargetRuleItem

SetKeyword assigns ACIv3Keyword kw to the receiver instance.

func (ACIv3TargetRuleItem) SetOperator

func (r ACIv3TargetRuleItem) SetOperator(op any) ACIv3TargetRuleItem

SetOperator assigns ACIv3Operator op to the receiver instance.

func (ACIv3TargetRuleItem) SetQuotationStyle

func (r ACIv3TargetRuleItem) SetQuotationStyle(style int) ACIv3TargetRuleItem

SetQuotationStyle allows the election of a particular multivalued quotation style offered by the various adopters of the ACIv3 syntax. In the context of a ACIv3TargetRuleItem, this will only have a meaningful impact if the keyword for the receiver is one (1) of the following:

Additionally, the underlying type set as the expression value within the receiver MUST be a ACIv3TargetDistinguishedName, ACIv3Attribute or ACIv3ObjectIdentifier instance with two (2) or more values present.

func (ACIv3TargetRuleItem) String

func (r ACIv3TargetRuleItem) String() (s string)

String returns the string representation of the receiver instance.

func (ACIv3TargetRuleItem) Valid

func (r ACIv3TargetRuleItem) Valid() (err error)

Valid returns an error instance which, when non-nil, will indicate a logical flaw, such a missing component of a ACIv3TargetRuleItem qualifier, or some other issue.

type ACIv3TargetRuleMethod

type ACIv3TargetRuleMethod func() ACIv3TargetRuleItem

ACIv3TargetRuleMethod is the closure signature for methods used to build new instances of ACIv3TargetRuleItem.

The signature is qualified by the following methods extended through all eligible types defined in this package:

Note that ACIv3TargetRuleItem instances only support a very limited subset of these methods when compared to ACIv3BindRule instances. In fact, some ACIv3TargetRuleItem instances only support ONE such method: ACIv3Eq.

type ACIv3TargetRuleMethods

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

ACIv3TargetRuleMethods contains one (1) or more instances of ACIv3TargetRuleMethod, representing a particular ACIv3TargetRuleItem "builder" method for execution by the caller.

See the Operators method extended through all eligible types for further details.

func (ACIv3TargetRuleMethods) Contains

func (r ACIv3TargetRuleMethods) Contains(cop any) bool

Contains returns a Boolean value indicative of whether the specified ACIv3Operator, which may be expressed as a string, int or native ACIv3Operator, is allowed for use by the type instance that created the receiver instance. This method offers a convenient alternative to the use of the Index method combined with an assertion value (such as ACIv3Eq, ACIv3Ne, "=", "Greater Than", et al).

In other words, if one uses the ACIv3TargetDistinguishedName's TRM method to create an instance of ACIv3TargetRuleMethods, feeding ACIv3Gt (Greater Than) to this method shall return false, as no ACIv3TargetRuleItem context allows mathematical comparison.

func (ACIv3TargetRuleMethods) Index

Index calls the input index (idx) within the internal structure of the receiver instance. If found, an instance of ACIv3Operator and its accompanying ACIv3TargetRuleMethod instance are returned.

Valid input index types are integer (int), ACIv3Operator constant or string identifier. In the case of a string identifier, valid values are as follows:

  • For ACIv3Eq (1): `=`, `Eq`, `Equal To`
  • For ACIv3Ne (2): `=`, `Ne`, `Not Equal To`
  • For ACIv3Lt (3): `=`, `Lt`, `Less Than`
  • For ACIv3Le (4): `=`, `Le`, `Less Than Or Equal`
  • For ACIv3Gt (5): `=`, `Gt`, `Greater Than`
  • For ACIv3Ge (6): `=`, `Ge`, `Greater Than Or Equal`

Case is not significant in the string matching process.

Please note that use of this method by way of integer or ACIv3Operator values utilizes fewer resources than a string lookup.

See the ACIv3Operator.Context, ACIv3Operator.String and ACIv3Operator.Description methods for accessing the above string values easily.

If the index was not matched, an invalid ACIv3Operator is returned alongside a nil ACIv3TargetRuleMethod. This will also apply to situations in which the type instance which crafted the receiver is uninitialized, or is in an otherwise aberrant state.

func (ACIv3TargetRuleMethods) IsZero

func (r ACIv3TargetRuleMethods) IsZero() bool

IsZero returns a Boolean value indicative of whether the receiver is nil, or unset.

func (ACIv3TargetRuleMethods) Len

func (r ACIv3TargetRuleMethods) Len() int

Len returns the integer length of the receiver. Note that the return value will NEVER be less than zero (0) nor greater than six (6).

func (ACIv3TargetRuleMethods) Valid

func (r ACIv3TargetRuleMethods) Valid() (err error)

Valid returns the first encountered error returned as a result of execution of the first available ACIv3TargetRuleMethod instance. This is useful in cases where a user wants to see if the desired instance(s) of ACIv3TargetRuleMethod will produce a usable result.

type ACIv3TimeOfDay

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

ACIv3TimeOfDay is a [2]byte type used to represent a specific point in 24-hour time using hours and minutes (such as 1215 for 12:15 PM, or 1945 for 7:45 PM). Instances of this type contain a big endian unsigned 16-bit integer value, one that utilizes the first and second slices. The value is used within ACIv3BindToD-based ACIv3BindRule statements.

func (ACIv3TimeOfDay) BRM

BRM returns an instance of ACIv3BindRuleMethods.

Each of the return instance's key values represent a single instance of the ACIv3Operator type that is allowed for use in the creation of ACIv3BindRule instances which bear the receiver instance as an expression value. The value for each key is the actual ACIv3BindRuleMethod instance for OPTIONAL use in the creation of a ACIv3BindRule instance.

This is merely a convenient alternative to maintaining knowledge of which ACIv3Operator instances apply to which types. Instances of this type are also used to streamline package unit tests.

Please note that if the receiver is in an aberrant state, or if it has not yet been initialized, the execution of ANY of the return instance's value methods will return bogus ACIv3BindRule instances. While this is useful in unit testing, the end user must only execute this method IF and WHEN the receiver has been properly populated and prepared for such activity.

func (ACIv3TimeOfDay) Eq

Eq initializes and returns a new ACIv3BindRule instance configured to express the evaluation of the receiver value as Equal-To the ACIv3BindToD [BindKeyword] context.

func (ACIv3TimeOfDay) Ge

Ge initializes and returns a new ACIv3BindRule instance configured to express the evaluation of the receiver value as Greater-Than-Or-Equal to the ACIv3BindToD [BindKeyword] context.

func (ACIv3TimeOfDay) Gt

Gt initializes and returns a new ACIv3BindRule instance configured to express the evaluation of the receiver value as Greater-Than the ACIv3BindToD [BindKeyword] context.

func (ACIv3TimeOfDay) IsZero

func (r ACIv3TimeOfDay) IsZero() bool

IsZero returns a Boolean value indicative of whether the receiver is nil, or unset.

func (ACIv3TimeOfDay) Keyword

func (r ACIv3TimeOfDay) Keyword() ACIv3Keyword

Keyword wraps the [stackage.Condition.Keyword] method and resolves the raw value into a [BindKeyword]. Failure to do so will return a bogus [Keyword].

func (ACIv3TimeOfDay) Le

Le initializes and returns a new ACIv3BindRule instance configured to express the evaluation of the receiver value as Less-Than-Or-Equal to the ACIv3BindToD [BindKeyword] context.

func (ACIv3TimeOfDay) Lt

Lt initializes and returns a new ACIv3BindRule instance configured to express the evaluation of the receiver value as Less-Than the ACIv3BindToD [BindKeyword] context.

func (ACIv3TimeOfDay) Ne

Ne initializes and returns a new ACIv3BindRule instance configured to express the evaluation of the receiver value as Not-Equal-To the ACIv3BindToD [BindKeyword] context.

Negated equality ACIv3BindRule instances should be used with caution.

func (ACIv3TimeOfDay) Set

Set encodes the specified 24-hour (a.k.a.: military) time value into the receiver instance.

Valid input types are string and time.Time. The effective hour and minute values, when combined, should ALWAYS fall within the valid clock range of 0000 up to and including 2400. Bogus values within said range, such as 0477, will return an error.

func (ACIv3TimeOfDay) String

func (r ACIv3TimeOfDay) String() string

String returns the string representation of the receiver instance.

func (ACIv3TimeOfDay) Valid

func (r ACIv3TimeOfDay) Valid() (err error)

Valid returns a Boolean value indicative of whether the receiver is believed to be in a valid state.

type AndTerm

type AndTerm struct {
	Set   []Term
	Paren bool
}

func (AndTerm) Index

func (r AndTerm) Index(idx int) (t Term)

Index returns the Nth slice instance of Term found within the receiver instance.

func (AndTerm) IsZero

func (r AndTerm) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (AndTerm) Len

func (r AndTerm) Len() int

Len returns the integer length of the receiver instance.

func (AndTerm) String

func (a AndTerm) String() string

String returns the string representation of the receiver instance.

func (AndTerm) Valid

func (r AndTerm) Valid() (err error)

Valid returns an error following an analysis of the receiver instance.

type AssertionValue

type AssertionValue []uint8

AssertionValue implements the OCTET STRING value component of an instance of AttributeValueAssertion.

func (AssertionValue) Escaped

func (r AssertionValue) Escaped() (esc string)

func (*AssertionValue) Set

func (r *AssertionValue) Set(x any)

Set assigns x to the receiver instance.

Example

This example demonstrates the means for properly assigning a value to an instance of AssertionValue.

var av AssertionValue
av.Set(`Lučić`)
fmt.Printf("%s / %s\n",
	av.Escaped(),
	av.Unescaped())
Output:

Lu\c4\8di\c4\87 / Lučić

func (AssertionValue) Size

func (r AssertionValue) Size() int

Size returns the integer summation of the ASN.1 OCTET STRING tag (4) and the byte size of the receiver instance

func (AssertionValue) String

func (r AssertionValue) String() string

String returns the string representation of the receiver instance. Note that this method is an alias of AssertionValue.Escaped.

func (AssertionValue) Unescaped

func (r AssertionValue) Unescaped() string

Unescaped returns the unescaped receiver value. For example, "ジェシー" is returned instead of "\e3\82\b8\e3\82\a7\e3\82\b7\e3\83\bc".

type AttributeDescription

type AttributeDescription LDAPString

AttributeDescription implements Section 2.5 of RFC4512.

func (AttributeDescription) Options

func (r AttributeDescription) Options() (options []AttributeOption)

Options returns slices of AttributeOption qualifier types based upon the contents of the receiver instance. For example attribute tags such as ";lang-sl", ";binary", et al, are among the possible returns.

func (AttributeDescription) Size

func (r AttributeDescription) Size() int

Size returns the integer summation of the ASN.1 OCTET STRING tag (4) and the byte size of the receiver instance

func (AttributeDescription) String

func (r AttributeDescription) String() string

String returns the string representation of the receiver instance.

func (AttributeDescription) Type

func (r AttributeDescription) Type() (oid string)

Type returns only the "descr" component of the receiver instance.

Specifically, this will ensure that elements such as AttributeOption instances -- such as language tags -- are not included in the return string value.

type AttributeMatchTerm

type AttributeMatchTerm struct {
	AttributeType string
	MatchType     string
}

TODO - correct this.

   CriteriaItem ::= CHOICE {
	equality         [0] AttributeType,
	substrings       [1] AttributeType,
	greaterOrEqual   [2] AttributeType,
	lessOrEqual      [3] AttributeType,
	approximateMatch [4] AttributeType,
        ... }

func (AttributeMatchTerm) IsZero

func (r AttributeMatchTerm) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (AttributeMatchTerm) String

func (r AttributeMatchTerm) String() string

String returns the string representation of the receiver instance.

func (AttributeMatchTerm) Valid

func (r AttributeMatchTerm) Valid() (err error)

Valid returns an error following an analysis of the receiver instance.

type AttributeOption

type AttributeOption interface {
	Kind() string
	String() string
	// contains filtered or unexported methods
}

AttributeOption implements Section 2.5 of RFC4512.

type AttributeTag

type AttributeTag string

AttributeTag implements Section 2.5.2 of RFC4512.

func (AttributeTag) Kind

func (r AttributeTag) Kind() string

Kind returns the string literal "tag" to describe the kind of AttributeOption represented by the receiver instance.

func (AttributeTag) String

func (r AttributeTag) String() string

String returns the string representation of the receiver instance.

type AttributeType

type AttributeType struct {
	NumericOID         string            // "id"
	Name               []string          // "ldapName"
	Description        string            // "ldapDesc"
	SuperType          string            // "derivation"
	Obsolete           bool              // "obsolete"
	Single             bool              // "single-valued"
	Collective         bool              // "collective"
	NoUserModification bool              // "no-user-modification"
	MinUpperBounds     uint              // --
	Syntax             string            // "ldapSyntax"
	Equality           string            // "equality-match"
	Ordering           string            // "ordering-match"
	Substring          string            // "substrings-match"
	Usage              string            // "usage"
	Extensions         map[int]Extension // --
	// contains filtered or unexported fields
}

AttributeType implements § 4.1.2 of RFC 4512 and § 13.4.8 of ITU-T Rec. X.501 (AttributeType).

func (AttributeType) EffectiveEquality

func (r AttributeType) EffectiveEquality() (rule *MatchingRule)

EffectiveEquality returns an instance of (EQUALITY) *MatchingRule which reflects the effective matchingRule honored by the receiver instance, whether direct or by way of a super type in the super chain.

If the receiver instance both possesses its own MatchingRule AND is a subtype of another (valid) AttributeType definition, the local MatchingRule has precedence and is returned.

Example
title, idx := exampleSchema.AttributeTypes.Get(`title`)
if idx == -1 {
	fmt.Println("Attribute not found!")
	return
}

// NOTE: The "title" attributeType definition
// is a subtype of the "name" attributeType.

equality := title.EffectiveEquality()
fmt.Println(equality.Identifier())
Output:

caseIgnoreMatch

func (AttributeType) EffectiveOrdering

func (r AttributeType) EffectiveOrdering() (rule *MatchingRule)

EffectiveOrdering returns an instance of (ORDERING) *MatchingRule which reflects the effective matchingRule honored by the receiver instance, whether direct or by way of a super type in the super chain.

If the receiver instance both possesses its own MatchingRule AND is a subtype of another (valid) AttributeType definition, the local MatchingRule has precedence and is returned.

Example
dnq, idx := exampleSchema.AttributeTypes.Get(`dnQualifier`)
if idx == -1 {
	fmt.Println("Attribute not found!")
	return
}

ordering := dnq.EffectiveOrdering()
fmt.Println(ordering.Identifier())
Output:

caseIgnoreOrderingMatch

func (AttributeType) EffectiveSubstring

func (r AttributeType) EffectiveSubstring() (rule *MatchingRule)

EffectiveSubstring returns an instance of (SUBSTR) *MatchingRule which reflects the effective matchingRule honored by the receiver instance, whether direct or by way of a super type in the super chain.

If the receiver instance both possesses its own MatchingRule AND is a subtype of another (valid) AttributeType definition, the local MatchingRule has precedence and is returned.

Example
title, idx := exampleSchema.AttributeTypes.Get(`title`)
if idx == -1 {
	fmt.Println("Attribute not found!")
	return
}

// NOTE: The "title" attributeType definition
// is a subtype of the "name" attributeType.

substr := title.EffectiveSubstring()
fmt.Println(substr.Identifier())
Output:

caseIgnoreSubstringsMatch

func (AttributeType) EffectiveSyntax

func (r AttributeType) EffectiveSyntax() (syntax *LDAPSyntax)

EffectiveSyntax returns an instance of *LDAPSyntax which reflects the effective syntax honored by receiver instance, whether direct or by way of a super type in the super chain.

The return instance of *LDAPSyntax should NEVER be zero, as all AttributeType instances are expected to honor a syntax in some way.

If the receiver instance both possesses its own LDAPSyntax AND is a subtype of another (valid) *AttributeType definition, the local LDAPSyntax has precedence and is returned.

Example
title, idx := exampleSchema.AttributeTypes.Get(`title`)
if idx == -1 {
	fmt.Println("Attribute not found!")
	return
}

// NOTE: The "title" attributeType definition
// is a subtype of the "name" attributeType.

syntax := title.EffectiveSyntax()
fmt.Println(syntax.Identifier())
Output:

1.3.6.1.4.1.1466.115.121.1.15

func (AttributeType) Identifier

func (r AttributeType) Identifier() (id string)

Identifier returns the principal string value by which the receiver is known. If the receiver is not assigned a name (descriptor), the numeric OID is returned instead.

func (*AttributeType) IsZero

func (r *AttributeType) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (AttributeType) Match

func (r AttributeType) Match(term string) bool

Match returns a Boolean value indicative of a match between the input string term value and the receiver's NumericOID or Name value.

Case is not significant in the matching process.

func (AttributeType) OID

func (r AttributeType) OID() string

OID returns the numeric OID literal "1.3.6.1.4.1.1466.115.121.1.3" per § 3.3.1 of RFC 4517.

func (AttributeType) String

func (r AttributeType) String() (def string)

String returns the string representation of the receiver instance.

func (AttributeType) SubordinateTypes

func (r AttributeType) SubordinateTypes() (sub *AttributeTypes)

SubordinateTypes returns slices of AttributeType, each of which are direct subordinate types of the input string id.

The input string id must be the numeric OID or name of the supposed superior type.

Note that if a name is used, case-folding is not significant in the matching process.

If zero slices are returned, this can mean either the superior type was not found, or that it has no subordinate types of its own.

func (AttributeType) SuperChain

func (r AttributeType) SuperChain() (supers *AttributeTypes)

SuperChain returns an instance of AttributeTypes, which will contain zero (0) or more slices of AttributeType, each of which representing an ascending superior type of the receiver instance.

The input classes instance should represent the AttributeTypes instance obtained through a SubschemaSubentry instance.

Example
types := exampleSchema.AttributeTypes
child, _ := types.Get(`cn`)
supers := child.SuperChain()
fmt.Println(supers)
Output:

attributeTypes: ( 2.5.4.41 NAME 'name' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )

func (AttributeType) SuperiorType

func (r AttributeType) SuperiorType() (sup *AttributeType)

SuperiorType resolves the super type of id to a proper instance of AttributeType.

The input string id must be the numeric OID or name of the subordinate attribute type.

Note that if a name is used, case-folding is not significant in the matching process.

If zero slices are returned, this can mean either the attribute type was not found, or that it has no super type of its own.

func (AttributeType) Type

func (r AttributeType) Type() string

func (AttributeType) Valid

func (r AttributeType) Valid() bool

Valid returns a Boolean value indicative of a syntactically valid receiver instance. Note this does not verify the presence of dependency schema elements.

func (AttributeType) XOrigin

func (r AttributeType) XOrigin() (origins []string)

XOrigin returns slices of standards citations, each being the name of an RFC, Internet-Draft or ITU-T Recommendation from which the receiver definition originates.

This method is merely a convenient alternative to manually checking the underlying Extensions field instance for the presence of an Extension instance bearing the `X-ORIGIN` XString and at least one (1) value.

type AttributeTypeAndValue

type AttributeTypeAndValue struct {
	// Type is the attribute type
	Type string
	// Value is the attribute value
	Value string
}

AttributeTypeAndValue implements the attributeTypeAndValue defined in Section 3 of RFC4514.

func (*AttributeTypeAndValue) Equal

Equal returns true if the AttributeTypeAndValue is equivalent to the specified AttributeTypeAndValue. Case of the attribute type is not significant

func (*AttributeTypeAndValue) EqualFold

func (r *AttributeTypeAndValue) EqualFold(other *AttributeTypeAndValue) bool

EqualFold returns true if the AttributeTypeAndValue is equivalent to the specified AttributeTypeAndValue. Case of the attribute type and value is not significant

func (*AttributeTypeAndValue) String

func (r *AttributeTypeAndValue) String() string

String returns a normalized string representation of this attribute type and value pair which is the lowercase join of the Type and Value with a "=".

type AttributeTypes

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

AttributeTypes implements § 4.2.2 of RFC 4512 and contains slices of AttributeType.

func (AttributeTypes) Contains

func (r AttributeTypes) Contains(id string) (idx int)

Contains returns an integer index value indicative of a SchemaDefinition residing within the receiver instance which bears an identical value to id. If not found, -1 is returned.

func (AttributeTypes) Get

func (r AttributeTypes) Get(term string) (def *AttributeType, idx int)

Get returns an instance of *AttributeType and a slice index following a descriptor or numeric OID match attempt. A zero instance of *AttributeType alongside an index of -1 is returned if no match is found.

Case is not significant in the matching process.

func (*AttributeTypes) Index

func (r *AttributeTypes) Index(idx int) (def *AttributeType)

Index returns the Nth AttributeType instances found within the receiver instance.

func (*AttributeTypes) IsZero

func (r *AttributeTypes) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

Example
var defs AttributeTypes
fmt.Println(defs.IsZero())
Output:

true

func (AttributeTypes) Len

func (r AttributeTypes) Len() int

func (AttributeTypes) OID

func (r AttributeTypes) OID() string

OID returns the numeric OID literal "2.5.21.5" per § 4.2.2 of RFC 4512.

func (*AttributeTypes) Push

func (r *AttributeTypes) Push(defs ...*AttributeType)

Push appends def to the receiver instance if ALL of the following evaluate as true:

func (AttributeTypes) String

func (r AttributeTypes) String() (s string)

String returns the string representation of the receiver instance.

func (AttributeTypes) Table

func (r AttributeTypes) Table() (table SchemaDefinitionTable)

Inventory returns an instance of SchemaDefinitionTable which represents the current inventory of AttributeType instances within the receiver.

Example
table := exampleSchema.AttributeTypes.Table()
fmt.Printf("Table contains %d indices", len(table))
Output:

Table contains 98 indices

func (AttributeTypes) Type

func (r AttributeTypes) Type() string

type AttributeValue

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

AttributeValue embeds a pointer value that reflects an attribute value.

func (AttributeValue) String

func (r AttributeValue) String() (s string)

String returns the string representation of the underlying value within the receiver. The return value should be either an attributeType assertion value, or one (1) of the five (5) possible ACIv3BindType identifiers (e.g.: ACIv3BindTypeUSERDN).

type AttributeValueAssertion

type AttributeValueAssertion struct {
	Desc  AttributeDescription
	Value AssertionValue
}

AttributeValueAssertion implements the basis for FilterApproximateMatch, FilterGreaterOrEqual, FilterLessOrEqual and FilterEqualityMatch instances.

AttributeValueAssertion ::= SEQUENCE {
    attributeDesc   AttributeDescription,
    assertionValue  AssertionValue }

func (AttributeValueAssertion) Size

func (r AttributeValueAssertion) Size() int

Size returns the integer summation of the underlying value sizes and the ASN.1 SEQUENCE tag (16).

type BMPString

type BMPString []uint8

BMPString implements the Basic Multilingual Plane per ITU-T Rec. X.680.

The structure for instances of this type is as follows:

T (30, Ox1E) N (NUM. BYTES) P{byte,byte,byte}

Tag T represents ASN.1 BMPString tag integer 30 (0x1E). Number N is an int-cast byte value that cannot exceed 255. The remaining bytes, which may be zero (0) or more in number, define payload P. N must equal size of payload P.

func (BMPString) Choice

func (r BMPString) Choice() string

func (BMPString) IsZero

func (r BMPString) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

Example
var bmp BMPString
fmt.Println(bmp.IsZero())
Output:

true

func (BMPString) String

func (r BMPString) String() string

String returns the string representation of the receiver instance.

This involves unmarshaling the receiver into a string return value.

type BaseDistance

type BaseDistance int

BaseDistance implements the integer value of a minimum and/or maximum SubtreeSpecification depth refinement parameter. An instance of this type for either use case indicates the subordinate entry depth "range" whose contents are subject to the influence of the SubtreeSpecification bearing a non-zero value.

A zero instance of this type, unsurprisingly, is zero (0) and indicates no depth refinement is in force for the respective administrative area.

type BitString

type BitString asn1.BitString

BitString is a type alias of asn1.BitString, which can conform to § 3.3.2 of RFC 4517:

BitString    = SQUOTE *binary-digit SQUOTE "B"
binary-digit = "0" / "1"

From § 1.4 of RFC 4512:

SQUOTE  = %x27 ; single quote ("'")

func (BitString) IsZero

func (r BitString) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (BitString) String

func (r BitString) String() (bs string)

String returns the string representation of the receiver instance.

type BoolTerm

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

BoolTerm implements a Boolean Term qualifier.

func (BoolTerm) IsZero

func (r BoolTerm) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (BoolTerm) String

func (b BoolTerm) String() (t string)

String returns the string representation of the receiver instance.

func (BoolTerm) Valid

func (r BoolTerm) Valid() (err error)

Valid returns an error following an analysis of the receiver instance.

type Boolean

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

Boolean wraps a pointer to bool to implement the ASN.1 BOOLEAN type.

From § 3.3.3 of RFC 4517

Boolean = "TRUE" / "FALSE"

A zero instance of this type is equivalent to "UNDEFINED" (neither TRUE nor FALSE).

func (Boolean) Bytes

func (r Boolean) Bytes() []byte

Bytes returns []byte{0xFF} for TRUE and []byte{0x0} for any other state.

func (Boolean) DER

func (r Boolean) DER() (der []byte, err error)

DER returns the ASN.1 DER encoding of the receiver instance alongside an error.

func (Boolean) False

func (r Boolean) False() (v bool)

False returns a Boolean value indicative of a false receiver state.

func (Boolean) IsZero

func (r Boolean) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (*Boolean) Set

func (r *Boolean) Set(b any)

Set assigns the indicated truthy input value to the receiver instance.

Valid input types are string, *bool, bool, byte, []byte or nil. Case is not significant in the matching process involving strings.

An instance of a single byte (or []byte of same size) with of 0xFF results in a state of TRUE, while a value of 0x0 results in a state of FALSE. There is no byte value to invoke a state of UNDEFINED (use nil).

func (*Boolean) SetBytes

func (r *Boolean) SetBytes(b byte)

SetBytes sets the receiver state to reflect the bytes provided.

An instance of []byte containing a single value of 0xFF results in a state of TRUE, while a value of 0x0 results in a state of FALSE.

Example
var b Boolean
b.SetBytes(0xFF) // TRUE
fmt.Println(b)
Output:

TRUE

func (Boolean) Size

func (r Boolean) Size() int

Size returns the summation of the ASN.1 BOOLEAN tag value and 1. instance of this type.

If the receiver is uninitialized, an integer of zero (0) is returned.

func (Boolean) String

func (r Boolean) String() (s string)

func (Boolean) True

func (r Boolean) True() (v bool)

True returns a Boolean value indicative of a true receiver state.

func (Boolean) Undefined

func (r Boolean) Undefined() bool

Undefined wraps Boolean.IsZero and indicates a state that is neither true nor false.

type BootParameter

type BootParameter struct {
	Key    IA5String
	Server IA5String
	Path   IA5String
}

BootParameter implements the NIS BootParameter type. Instances of this type are produced following a successful execution of the RFC2307.BootParameter function.

From § 2.4 of RFC 2307:

bootparameter     = key "=" server ":" path
key               = keystring
server            = keystring
path              = keystring

ASN.1 definition:

bootParameterSyntax ::= SEQUENCE {
	key     IA5String,
	server  IA5String,
	path    IA5String
}

From § 1.4 of RFC 4512:

keystring = leadkeychar *keychar
leadkeychar = ALPHA
keychar = ALPHA / DIGIT / HYPHEN

ALPHA   = %x41-5A / %x61-7A   ; "A"-"Z" / "a"-"z"
DIGIT   = %x30 / LDIGIT       ; "0"-"9"
LDIGIT  = %x31-39             ; "1"-"9"
HYPHEN  = %x2D ; hyphen ("-")

From § 3.2 of RFC 4517:

IA5String          = *(%x00-7F)

func (BootParameter) String

func (r BootParameter) String() (bp string)

String returns the string representation of the receiver instance.

type Choice

type Choice interface {
	// AcceptsTag returns true if the alternative can decode an ASN.1
	// value with the given tag.  This is used for particular Choice
	// qualifiers which are known to be encoded using one of multiple
	// possible ASN.1 tags.
	AcceptsTag(int) bool

	// DecodeChoice decodes the ASN.1 data from the provided RawValue
	// into the concrete Choice type implementing the interface.
	DecodeChoice(asn1.RawValue) error
}

Choice implements an interface-based ASN.1 CHOICE type.

Example
// Get the ASN.1 DER encoding of integer 123456.
encodedValue, err := asn1.Marshal(123456)
if err != nil {
	fmt.Println(err)
	return
}

// Create our choice registry for this
// ASN.1 CHOICE scenario.
reg := make(Choices, 0)

// These are private test types, assume they
// are used-defined Choice qualifiers.
reg.Register(new(stringChoice))
reg.Register(new(intChoice))
//reg.Register(new(...)) // other Choice qualifiers
//reg.Register(new(...)) // defined by the user.

var ch Choice
if ch, err = reg.Unmarshal(encodedValue); err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("%T: %d", ch, (*ch.(*intChoice)))
Output:

*dirsyn.intChoice: 123456

type Choices

type Choices []Choice

Choices implements a Choice registry. Instances of this type are used as the platform upon which a specific ASN.1 CHOICE may be chosen based on an input ASN.1 DER byte value.

See also Choices.Register, Choices.Len and Choices.Unmarshal.

func (Choices) Len

func (r Choices) Len() int

Len returns the integer length of the receiver instance.

func (*Choices) Register

func (r *Choices) Register(choice Choice)

Register registers a Choice in the receiver registry instance.

func (Choices) Unmarshal

func (r Choices) Unmarshal(data []byte) (choice Choice, err error)

Unmarshal returns an instance of Choice alongside an error following an attempt to unmarshal data as an ASN.1 CHOICE.

The receiver instance contains all possible Choice qualifiers, which are used to select an appropriate tag-matched instance.

type ChopSpecification

type ChopSpecification struct {
	Exclusions SpecificExclusions `asn1:"tag:1,optional"`
	Minimum    BaseDistance       `asn1:"tag:2,default:0"`
	Maximum    BaseDistance       `asn1:"tag:3,optional"`
}

ChopSpecification implements the chopSpecification component of an instance of SubtreeSpecification.

func (ChopSpecification) BER

func (r ChopSpecification) BER() (*ber.Packet, error)

func (ChopSpecification) IsZero

func (r ChopSpecification) IsZero() bool

type CountryString

type CountryString string

CountryString implements § 3.3.4 of RFC 4517:

CountryString  = 2(PrintableCharacter)

From § 1.4 of RFC 4512:

PrintableCharacter = ALPHA / DIGIT / SQUOTE / LPAREN / RPAREN /
                     PLUS / COMMA / HYPHEN / DOT / EQUALS /
                     SLASH / COLON / QUESTION / SPACE
PrintableString    = 1*PrintableCharacter

func (CountryString) IsZero

func (r CountryString) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (CountryString) String

func (r CountryString) String() string

String returns the string representation of the receiver instance.

type Criteria

type Criteria struct {
	Set   []AndTerm
	Paren bool
}

Criteria implements the Criteria syntax per ITU-T Rec. X.520, clause 6.5.2.

Criteria ::= CHOICE {
        type [0] CriteriaItem
        and  [1] SET OF Criteria,
        or   [2] SET OF Criteria,
        not  [3] Criteria,
... }

func (Criteria) Index

func (r Criteria) Index(idx int) (a AndTerm)

Index returns the Nth slice instance of AndTerm found within the receiver instance.

func (Criteria) IsZero

func (r Criteria) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (Criteria) Len

func (r Criteria) Len() int

Len returns the integer length of the receiver instance.

func (Criteria) String

func (c Criteria) String() string

String returns the string representation of the receiver instance.

func (Criteria) Valid

func (r Criteria) Valid() (err error)

Valid returns an error following an analysis of the receiver instance.

type DERPacket

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

DERPacket encapsulates an ITU-T Rec. X.690 DER-encoded byte slice and an offset.

Example (Read)
var der *DERPacket
var srcs Sources
var err error

if der, err = srcs.X690().DER("applicationProcess"); err != nil {
	fmt.Println(err)
	return
}

var ls LDAPString
if err = der.Read(&ls); err != nil {
	fmt.Println(err)
	return
}

fmt.Println(ls)
Output:

applicationProcess
Example (ReadWrite)
var der *DERPacket
var srcs Sources
var err error

if der, err = srcs.X690().DER("applicationProcess"); err != nil {
	fmt.Println(err)
	return
}

// Read DERPacket into OctetString
var oct OctetString
if err = der.Read(&oct); err != nil {
	fmt.Println(err)
	return
}

// Make a new DERPacket into which we
// will write our OctetString. This is
// merely to prove the exchange worked.
der2, _ := srcs.X690().DER() // initialize empty packet
if _, err = der2.Write(oct); err != nil {
	fmt.Println(err)
	return
}
// DERPacket "%#x": 0x04126170706c69636174696f6e50726f63657373

// Read new DERPacket into new OctetString
var oct2 OctetString
if err = der2.Read(&oct2); err != nil {
	fmt.Println(err)
	return
}

fmt.Println(oct2)
Output:

applicationProcess

func (DERPacket) Data

func (r DERPacket) Data() []byte

Data returns the underlying byte slice.

func (DERPacket) Dump

func (r DERPacket) Dump() string

Dump returns a quick hexadecimal dump of the current byte and its neighbors. Use of this method is mainly intended for debugging.

func (*DERPacket) Free

func (r *DERPacket) Free()

Free frees the receiver instance.

func (DERPacket) HasMoreData

func (r DERPacket) HasMoreData() bool

HasMoreData returns a Boolean value indicative of whether there are more bytes to process.

func (DERPacket) Offset

func (r DERPacket) Offset() int

Offset returns the current offset position index of the underlying value within the receiver instance.

func (*DERPacket) Read

func (r *DERPacket) Read(x any, z ...any) (err error)

Read returns an error following an attempt to read into primitive x. x must be a pointer.

z provides variadic input. Currently, this is only used for map[Enumerated]string instances and only when x is *Enumerated.

func (*DERPacket) ReadConstructed

func (r *DERPacket) ReadConstructed(expectedClass int, expectedTag int, callback func(sub *DERPacket) error) (err error)

ReadConstructed returns an error following an attempt to read a constructed (compound) element from the callback-revealed *DERPacket into the receiver *DERPacket.

It verifies that the element has the expected class and tag, then creates a temporary *DERPacket for the sub-bytes and calls the provided callback to process them.

func (*DERPacket) SetOffset

func (r *DERPacket) SetOffset(offset ...int)

SetOffset replaces the current offset position index of the underlying value within the receiver instance with a user-supplied value.

This method is intended for use in special cases where a particular packet may need to be re-read for some reason.

If no variadic input is provided, the offset position index is set to zero (0).

func (*DERPacket) TagAndLength

func (r *DERPacket) TagAndLength() (TagAndLength, error)

TagAndLength returns an instance of TagAndLength alongside an error following an attempt to read the next DER tag/length header.

func (*DERPacket) Write

func (r *DERPacket) Write(val any) (b int, err error)

Write returns an int alongside an error following an attempt to write val into the receiver instance.

val may be int, int32, int64, *big.Int, Integer, bool, Boolean or OctetString.

b indicates the number of bytes written.

func (*DERPacket) WriteConstructed

func (r *DERPacket) WriteConstructed(expectedClass int, expectedTag int, callback func(sub *DERPacket) error) (n int, err error)

WriteConstructed writes a constructed (compound) DER element. expectedClass and expectedTag define the header for the constructed element. The callback is used to write the sub-elements (content) into a temporary DERPacket.

func (*DERPacket) WriteTagAndLength

func (r *DERPacket) WriteTagAndLength(class int, isCompound bool, tag, length int) int

WriteTagAndLength returns an int following an attempt to write a DER tag/length header to the receiver buffer.

type DITContentRule

type DITContentRule struct {
	NumericOID  string
	Name        []string
	Description string
	Obsolete    bool
	Aux         []string
	Must        []string
	May         []string
	Not         []string
	Extensions  map[int]Extension
	// contains filtered or unexported fields
}

DITContentRule implements § 4.1.6 of RFC 4512.

func (DITContentRule) Identifier

func (r DITContentRule) Identifier() (id string)

Identifier returns the principal string value by which the receiver is known. If the receiver is not assigned a name (descriptor), the numeric OID is returned instead.

func (*DITContentRule) IsZero

func (r *DITContentRule) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (DITContentRule) Match

func (r DITContentRule) Match(term string) bool

Match returns a Boolean value indicative of a match between the input string term value and the receiver's NumericOID or Name value.

Case is not significant in the matching process.

func (DITContentRule) OID

func (r DITContentRule) OID() string

OID returns the numeric OID literal "1.3.6.1.4.1.1466.115.121.1.16" per § 3.3.7 of RFC 4517.

func (DITContentRule) String

func (r DITContentRule) String() (def string)

String returns the string representation of the receiver instance.

func (DITContentRule) Type

func (r DITContentRule) Type() string

func (DITContentRule) Valid

func (r DITContentRule) Valid() bool

Valid returns a Boolean value indicative of a syntactically valid receiver instance. Note this does not verify the presence of dependency schema elements.

func (DITContentRule) XOrigin

func (r DITContentRule) XOrigin() (origins []string)

XOrigin returns slices of standards citations, each being the name of an RFC, Internet-Draft or ITU-T Recommendation from which the receiver definition originates.

This method is merely a convenient alternative to manually checking the underlying Extensions field instance for the presence of an Extension instance bearing the `X-ORIGIN` XString and at least one (1) value.

type DITContentRules

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

DITContentRules implements § 4.2.6 of RFC 4512 and contains slices of DITContentRule.

func (DITContentRules) Contains

func (r DITContentRules) Contains(id string) (idx int)

Contains returns an integer index value indicative of a SchemaDefinition residing within the receiver instance which bears an identical value to id. If not found, -1 is returned.

func (DITContentRules) Get

func (r DITContentRules) Get(term string) (def *DITContentRule, idx int)

Get returns an instance of *DITContentRule and a slice index following a descriptor or numeric OID match attempt. A zero instance of *DITContentRule alongside an index of -1 is returned if no match is found.

Case is not significant in the matching process.

func (*DITContentRules) Index

func (r *DITContentRules) Index(idx int) (def *DITContentRule)

Index returns the Nth DITContentRule instances found within the receiver instance.

func (*DITContentRules) IsZero

func (r *DITContentRules) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

Example
var defs DITContentRules
fmt.Println(defs.IsZero())
Output:

true

func (DITContentRules) Len

func (r DITContentRules) Len() int

func (DITContentRules) OID

func (r DITContentRules) OID() string

OID returns the numeric OID literal "2.5.21.2" per § 4.2.6 of RFC 4512.

func (*DITContentRules) Push

func (r *DITContentRules) Push(defs ...*DITContentRule)

Push appends def to the receiver instance if ALL of the following evaluate as true:

func (DITContentRules) String

func (r DITContentRules) String() (s string)

String returns the string representation of the receiver instance.

func (DITContentRules) Table

func (r DITContentRules) Table() (table SchemaDefinitionTable)

Inventory returns an instance of SchemaDefinitionTable which represents the current inventory of DITContentRule instances within the receiver.

func (DITContentRules) Type

func (r DITContentRules) Type() string

type DITStructureRule

type DITStructureRule struct {
	RuleID      string
	Name        []string
	Description string
	Obsolete    bool
	Form        string
	SuperRules  []string
	Extensions  map[int]Extension
	// contains filtered or unexported fields
}

DITStructureRule implements § 4.1.7.1 of RFC 4512.

func (*DITStructureRule) Identifier

func (r *DITStructureRule) Identifier() (id string)

Identifier returns the principal string value by which the receiver is known. If the receiver is not assigned a name (descriptor), the integer identifier (rule ID) is returned instead.

func (*DITStructureRule) IsZero

func (r *DITStructureRule) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (DITStructureRule) Match

func (r DITStructureRule) Match(term string) bool

Match returns a Boolean value indicative of a match between the input string term value and the receiver's integer rule identifier (rule ID) or Name value.

Case is not significant in the matching process.

func (DITStructureRule) NamedObjectClass

func (r DITStructureRule) NamedObjectClass() (noc *ObjectClass)

NamedObjectClass returns an instance of ObjectClass which represents the objectClass in use within the name form associated with the receiver instance.

The ObjectClass, if found, is guaranteed to be of the STRUCTURAL kind.

Example
dsr, idx := exampleSchema.DITStructureRules.Get(`1`)
if idx == -1 {
	fmt.Println("Structure Rule #1 not found")
	return
}

fmt.Println(dsr.NamedObjectClass().Identifier())
Output:

applicationProcess

func (DITStructureRule) OID

func (r DITStructureRule) OID() string

OID returns the numeric OID literal "1.3.6.1.4.1.1466.115.121.1.17" per § 3.3.8 of RFC 4517.

func (DITStructureRule) String

func (r DITStructureRule) String() (def string)

String returns the string representation of the receiver instance.

func (DITStructureRule) SubordinateStructureRules

func (r DITStructureRule) SubordinateStructureRules() (sub *DITStructureRules)

SubordinateStructureRules returns slices of DITStructureRule, each of which are direct subordinate structure rules of the receiver instance.

Example
dsr, idx := exampleSchema.DITStructureRules.Get(`1`)
if idx == -1 {
	fmt.Println("Structure Rule #1 not found")
	return
}

subs := dsr.SubordinateStructureRules()
fmt.Printf("Number of subordinate rules: %d", subs.Len())
Output:

Number of subordinate rules: 2

func (DITStructureRule) SuperiorStructureRules

func (r DITStructureRule) SuperiorStructureRules() (sup *DITStructureRules)

SuperiorStructureRules returns slices of DITStructureRule, each of which are direct superior structure rules of the receiver instance.

Example
dsr, idx := exampleSchema.DITStructureRules.Get(`1`)
if idx == -1 {
	fmt.Println("Structure Rule #1 not found")
	return
}

sups := dsr.SuperiorStructureRules()
fmt.Printf("Rule is a root: %t", sups.Len() == 0)
Output:

Rule is a root: true

func (DITStructureRule) Type

func (r DITStructureRule) Type() string

func (DITStructureRule) Valid

func (r DITStructureRule) Valid() bool

Valid returns a Boolean value indicative of a syntactically valid receiver instance. Note this does not verify the presence of dependency schema elements.

func (DITStructureRule) XOrigin

func (r DITStructureRule) XOrigin() (origins []string)

XOrigin returns slices of standards citations, each being the name of an RFC, Internet-Draft or ITU-T Recommendation from which the receiver definition originates.

This method is merely a convenient alternative to manually checking the underlying Extensions field instance for the presence of an Extension instance bearing the `X-ORIGIN` XString and at least one (1) value.

type DITStructureRules

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

DITStructureRules implements § 4.2.7 of RFC 4512 and contains slices of DITStructureRule.

func (DITStructureRules) Contains

func (r DITStructureRules) Contains(id string) (idx int)

Contains returns an integer index value indicative of a SchemaDefinition residing within the receiver instance which bears an identical value to id. If not found, -1 is returned.

func (DITStructureRules) Get

func (r DITStructureRules) Get(term string) (def *DITStructureRule, idx int)

Get returns an instance of *DITStructureRule and a slice index following a descriptor or integer identifier match attempt. A zero instance of *DITStructureRule alongside an index of -1 is returned if no match is found.

Case is not significant in the matching process.

func (*DITStructureRules) Index

func (r *DITStructureRules) Index(idx int) (def *DITStructureRule)

Index returns the Nth DITStructureRule instances found within the receiver instance.

func (*DITStructureRules) IsZero

func (r *DITStructureRules) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

Example
var defs DITStructureRules
fmt.Println(defs.IsZero())
Output:

true

func (DITStructureRules) Len

func (r DITStructureRules) Len() int

func (DITStructureRules) OID

func (r DITStructureRules) OID() string

OID returns the numeric OID literal "2.5.21.1" per § 4.2.7 of RFC 4512.

func (*DITStructureRules) Push

func (r *DITStructureRules) Push(defs ...*DITStructureRule)

Push appends def to the receiver instance if ALL of the following evaluate as true:

func (DITStructureRules) String

func (r DITStructureRules) String() (s string)

String returns the string representation of the receiver instance.

func (DITStructureRules) Table

func (r DITStructureRules) Table() (table SchemaDefinitionTable)

Inventory returns an instance of SchemaDefinitionTable which represents the current inventory of DITStructureRule instances within the receiver.

func (DITStructureRules) Type

func (r DITStructureRules) Type() string

type DeliveryMethod

type DeliveryMethod []string

DeliveryMethod implements § 3.3.5 of RFC 4517:

DeliveryMethod = pdm *( WSP DOLLAR WSP pdm )
pdm = "any" / "mhs" / "physical" / "telex" / "teletex" /
      "g3fax" / "g4fax" / "ia5" / "videotex" / "telephone"

From § 1.4 of RFC 4512:

DOLLAR  = %x24	  ; dollar sign ("$")
WSP     = 0*SPACE ; zero or more " "

func (DeliveryMethod) String

func (r DeliveryMethod) String() string

String returns the string representation of the receiver instance.

type Descriptor

type Descriptor string

Descriptor implements "descr" per § 1.4 of RFC 4512:

descr = keystring
keystring = leadkeychar *keychar
leadkeychar = ALPHA
keychar = ALPHA / DIGIT / HYPHEN

ALPHA   = %x41-5A / %x61-7A   ; "A"-"Z" / "a"-"z"
DIGIT   = %x30 / LDIGIT       ; "0"-"9"
LDIGIT  = %x31-39             ; "1"-"9"
HYPHEN  = %x2D                ; hyphen ("-")

type DirectoryString

type DirectoryString interface {
	String() string
	Choice() string
	IsZero() bool
	// contains filtered or unexported methods
}

DirectoryString implements the Directory String syntax.

From § 3.3.6 of RFC 4517:

DirectoryString = 1*UTF8

From § 1.4 of RFC 4512:

UTF8 = UTF1 / UTFMB
UTFMB = UTF2 / UTF3 / UTF4
UTF0  = %x80-BF
UTF1  = %x00-7F
UTF2  = %xC2-DF UTF0
UTF3  = %xE0 %xA0-BF UTF0 / %xE1-EC 2(UTF0) /
        %xED %x80-9F UTF0 / %xEE-EF 2(UTF0)
UTF4  = %xF0 %x90-BF 2(UTF0) / %xF1-F3 3(UTF0) /
        %xF4 %x80-8F 2(UTF0)

From ITU-T Rec. X.520 clause 2.6:

UnboundedDirectoryString ::= CHOICE {
	teletexString TeletexString(SIZE (1..MAX)),
	printableString PrintableString(SIZE (1..MAX)),
	bmpString BMPString(SIZE (1..MAX)),
	universalString UniversalString(SIZE (1..MAX)),
	uTF8String UTF8String(SIZE (1..MAX)) }

DirectoryString{INTEGER:maxSize} ::= CHOICE {
	teletexString TeletexString(SIZE (1..maxSize,...)),
	printableString PrintableString(SIZE (1..maxSize,...)),
	bmpString BMPString(SIZE (1..maxSize,...)),
	universalString UniversalString(SIZE (1..maxSize,...)),
	uTF8String UTF8String(SIZE (1..maxSize,...)) }

type DistinguishedName

type DistinguishedName struct {
	RDNs []*RelativeDistinguishedName
}

DistinguishedName implements the distinguished name from RFC4514 and RFC4517.

func (DistinguishedName) AncestorOf

func (r DistinguishedName) AncestorOf(other DistinguishedName) bool

AncestorOf returns true if the other DistinguishedName consists of at least one RDN followed by all the RDNs of the current DistinguishedName.

  • "ou=widgets,o=acme.com" is an ancestor of "ou=sprockets,ou=widgets,o=acme.com"
  • "ou=widgets,o=acme.com" is not an ancestor of "ou=sprockets,ou=widgets,o=foo.com"
  • "ou=widgets,o=acme.com" is not an ancestor of "ou=widgets,o=acme.com"

func (DistinguishedName) AncestorOfFold

func (r DistinguishedName) AncestorOfFold(other DistinguishedName) bool

AncestorOfFold returns true if the other DN consists of at least one RDN followed by all the RDNs of the current DN. Case of the attribute type and value is not significant

func (DistinguishedName) Equal

func (r DistinguishedName) Equal(other DistinguishedName) bool

Equal returns true if the DistinguishedName is equal as defined in Section 4.2.15 of RFC4517 (distinguishedNameMatch).

Returns true if they have the same number of relative distinguished names and corresponding relative distinguished names (by position) are the same.

func (DistinguishedName) EqualFold

func (r DistinguishedName) EqualFold(other DistinguishedName) bool

EqualFold returns true if the distinguishedNames are equal as defined in Section 4.2.15 of RFC4517 (distinguishedNameMatch).

Returns true if they have the same number of relative distinguished names and corresponding relative distinguished names (by position) are the same.

Case of the attribute type and value is not significant.

func (DistinguishedName) String

func (r DistinguishedName) String() string

String returns a normalized string representation of this distinguishedName which is the join of all relative distinguishedNames with a ",".

type EnhancedGuide

type EnhancedGuide struct {
	ObjectClass string   `asn1:"tag:0"`
	Criteria    Criteria `asn1:"tag:1"`
	Subset      int      `asn1:"tag:2,default:1"`
}

EnhancedGuide implements the Enhanced Guide type.

From § 3.3.10 of RFC 4517:

EnhancedGuide = object-class SHARP WSP criteria WSP
                   SHARP WSP subset
object-class  = WSP oid WSP
subset        = "baseObject" / "oneLevel" / "wholeSubtree"

criteria   = and-term *( BAR and-term )
and-term   = term *( AMPERSAND term )
term       = EXCLAIM term /
             attributetype DOLLAR match-type /
             LPAREN criteria RPAREN /
             true /
             false
match-type = "EQ" / "SUBSTR" / "GE" / "LE" / "APPROX"
true       = "?true"
false      = "?false"
BAR        = %x7C  ; vertical bar ("|")
AMPERSAND  = %x26  ; ampersand ("&")
EXCLAIM    = %x21  ; exclamation mark ("!")

From ITU-T Rec. X.520, clause 9.2.11:

EnhancedGuide ::= SEQUENCE {
	objectClass	[0] OBJECT-CLASS.&id,
	criteria	[1] Criteria,
	subset		[2] INTEGER {
		baseObject      (0),
		oneLevel        (1),
		wholeSubtree    (2)} DEFAULT oneLevel,
... }

func (EnhancedGuide) String

func (r EnhancedGuide) String() (s string)

String returns the string representation of the receiver instance.

type Enumerated

type Enumerated int

Enumerated implements the ASN.1 ENUMERATED type per ITU-T Rec. X.680.

Example
var names map[Enumerated]string = map[Enumerated]string{
	Enumerated(0): "baseObject",
	Enumerated(1): "singleLevel",
	Enumerated(2): "wholeSubtree",
}

var srcs Sources
e, err := srcs.X680().Enumerated(0, names)
if err != nil {
	fmt.Println(err)
	return
}

fmt.Println(names[e])
Output:

baseObject

func (Enumerated) Int

func (e Enumerated) Int() int

Int returns the integer representation of the receiver instance.

type EqualityRuleAssertion

type EqualityRuleAssertion func(any, any) (Boolean, error)

EqualityRuleAssertion defines a closure signature held by qualifying function instances intended to implement an Equality MatchingRuleAssertion.

The semantics of the MatchingRuleAssertion are discussed in § 4.1 of RFC 4517.

type Extension

type Extension struct {
	XString string
	Values  []string
}

Extension implements § 4.2 of RFC 4512 and describes a single extension using an "xstring" and one or more quoted string values.

func (Extension) String

func (r Extension) String() (ext string)

String returns the string representation of the receiver instance.

type FacsimileTelephoneNumber

type FacsimileTelephoneNumber struct {
	TelephoneNumber               PrintableString `asn1:"printable"`
	G3FacsimileNonBasicParameters asn1.BitString  `asn1:"optional"`
}

FacsimileTelephoneNumber implements § 3.3.11 of RFC 4517 and ITU-T Rec. X.520 clause 6.7.4.

From § 3.3.11 of RFC 4517:

fax-number       = telephone-number *( DOLLAR fax-parameter )
telephone-number = PrintableString
fax-parameter    = "twoDimensional" /
                   "fineResolution" /
                   "unlimitedLength" /
                   "b4Length" /
                   "a3Width" /
                   "b4Width" /
                   "uncompressed"

ASN.1 definitions:

FacsimileTelephoneNumber ::= SEQUENCE {
	telephoneNumber     PrintableString (SIZE(1.. ub-telephone-number)),
	parameters          G3FacsimileNonBasicParameters  OPTIONAL}

G3FacsimileNonBasicParameters ::= BIT STRING {
	two-dimensional	     (8),
	fine-resolution	     (9),
	unlimited-length     (20),
	b4-length            (21),
	a3-width             (22),
	b4-width             (23),
	uncompressed         (30) }

func (*FacsimileTelephoneNumber) IsZero

func (r *FacsimileTelephoneNumber) IsZero() bool

func (FacsimileTelephoneNumber) String

func (r FacsimileTelephoneNumber) String() (ftn string)

type Fax

type Fax struct {
	G3Facsimile G3FacsimileBodyPart
}

Fax implements an ASN.1 CHOICE of G3FacsimileBodyPart.

type Filter

type Filter interface {
	// BER returns the BER encoding of the receiver
	// instance alongside an error. The *ber.Packet
	// instance can be decoded back to an instance
	// of Filter via the RFC4515.Filter method.
	BER() (*ber.Packet, error)

	// Index returns the Nth slice index found within
	// the receiver instance. This is only useful if
	// the receiver is an FilterAnd or FilterOr Filter
	// qualifier type instance.
	Index(int) Filter

	// IsZero returns a Boolean value indicative of
	// a nil receiver state.
	IsZero() bool

	// String returns the string representation of
	// the receiver instance.
	String() string

	// Choice returns the string CHOICE "name" of the
	// receiver instance. Use of this method is merely
	// intended as a convenient alternative to type
	// assertion checks.
	Choice() string

	// Len returns the integer length of the receiver
	// instance. This is only useful if the receiver is
	// an FilterAnd or FilterOr Filter qualifier type
	// instance.
	Len() int

	// Size returns the integer summation of the tag value
	// and the underlying byte value size(s).
	Size() int
	// contains filtered or unexported methods
}

Filter implements Section 2 and Section 3 of RFC4515.

Example (Size)
var r RFC4515
f, _ := r.Filter(`(&(sn=Lučić)(objectClass=person))`)
fmt.Println(f.Size())
Output:

52

type FilterAnd

type FilterAnd []Filter

FilterAnd implements the "and" CHOICE of an instance of Filter.

func (FilterAnd) BER

func (r FilterAnd) BER() (packet *ber.Packet, err error)

BER returns the BER encoding of the receiver instance alongside an error.

To decode the return *ber.Packet, pass it to RFC4515.Filter as the input value.

func (FilterAnd) Choice

func (r FilterAnd) Choice() string

Choice returns the string literal CHOICE "and".

func (FilterAnd) Index

func (r FilterAnd) Index(idx int) (filter Filter)

Index returns the Nth Filter slice instance from within the receiver.

Example

This example demonstrates the means for accessing a specific slice index within the return instance of Filter.

var r RFC4515
f, _ := r.Filter(`(&(|(sn;lang-sl=Lučić)(employeeID=123456789))(objectClass=person))`)

slice := f.Index(0).Index(1)
fmt.Printf("%s\n", slice)
Output:

(employeeID=123456789)

func (FilterAnd) IsZero

func (r FilterAnd) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (FilterAnd) Len

func (r FilterAnd) Len() int

Len returns the integer length of the receiver instance.

func (FilterAnd) Size

func (r FilterAnd) Size() int

Size returns the integer summation of all underlying slice value sizes.

func (FilterAnd) String

func (r FilterAnd) String() (s string)

String returns the string representation of the receiver instance.

type FilterApproximateMatch

type FilterApproximateMatch AttributeValueAssertion

FilterApproximateMatch aliases the AttributeValueAssertion type to implement the "approxMatch" CHOICE of an instance of Filter.

func (FilterApproximateMatch) BER

func (r FilterApproximateMatch) BER() (packet *ber.Packet, err error)

BER returns the BER encoding of the receiver instance alongside an error.

To decode the return *ber.Packet, pass it to RFC4515.Filter as the input value.

func (FilterApproximateMatch) Choice

func (r FilterApproximateMatch) Choice() string

Choice returns the string literal CHOICE "approxMatch".

func (FilterApproximateMatch) Index

func (r FilterApproximateMatch) Index(_ int) (filter Filter)

Index returns the receiver instance of Filter. This method only exists to satisfy Go's interface signature requirement.

func (FilterApproximateMatch) IsZero

func (r FilterApproximateMatch) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (FilterApproximateMatch) Len

func (r FilterApproximateMatch) Len() int

Len always returns one (1), as instances of this kind only contain a single value.

func (FilterApproximateMatch) Size

func (r FilterApproximateMatch) Size() int

Size returns the integer summation of the underlying AttributeDescription and AttributeValue byte sizes and the FilterApproximateMatch tag (9).

func (FilterApproximateMatch) String

func (r FilterApproximateMatch) String() (s string)

String returns the string representation of the receiver instance.

type FilterEqualityMatch

type FilterEqualityMatch AttributeValueAssertion

FilterEqualityMatch aliases the AttributeValueAssertion type to implement the "equalityMatch" CHOICE of an instance of Filter.

func (FilterEqualityMatch) BER

func (r FilterEqualityMatch) BER() (packet *ber.Packet, err error)

BER returns the BER encoding of the receiver instance alongside an error.

To decode the return *ber.Packet, pass it to RFC4515.Filter as the input value.

func (FilterEqualityMatch) Choice

func (r FilterEqualityMatch) Choice() string

Choice returns the string literal CHOICE "equalityMatch".

func (FilterEqualityMatch) Index

func (r FilterEqualityMatch) Index(_ int) (filter Filter)

Index returns the receiver instance of Filter. This method only exists to satisfy Go's interface signature requirement.

func (FilterEqualityMatch) IsZero

func (r FilterEqualityMatch) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (FilterEqualityMatch) Len

func (r FilterEqualityMatch) Len() int

Len always returns one (1), as instances of this kind only contain a single value.

func (FilterEqualityMatch) Size

func (r FilterEqualityMatch) Size() int

Size returns the integer summation of the underlying AttributeDescription and AttributeValue byte sizes and the FilterEqualityMatch tag (4).

func (FilterEqualityMatch) String

func (r FilterEqualityMatch) String() (s string)

String returns the string representation of the receiver instance.

type FilterExtensibleMatch

type FilterExtensibleMatch MatchingRuleAssertion

FilterExtensibleMatch aliases the MatchingRuleAssertion to implement the "extensibleMatch" CHOICE of an instance of Filter.

func (FilterExtensibleMatch) BER

func (r FilterExtensibleMatch) BER() (*ber.Packet, error)

BER returns the BER encoding of the receiver instance alongside an error.

To decode the return *ber.Packet, pass it to RFC4515.Filter as the input value.

func (FilterExtensibleMatch) Choice

func (r FilterExtensibleMatch) Choice() string

Choice returns the string literal CHOICE "extensibleMatch".

func (FilterExtensibleMatch) Index

func (r FilterExtensibleMatch) Index(_ int) (filter Filter)

Index returns the receiver instance of Filter. This method only exists to satisfy Go's interface signature requirement.

func (FilterExtensibleMatch) IsZero

func (r FilterExtensibleMatch) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (FilterExtensibleMatch) Len

func (r FilterExtensibleMatch) Len() int

Len always returns one (1), as instances of this kind only contain a single value.

func (FilterExtensibleMatch) Size

func (r FilterExtensibleMatch) Size() int

Size returns the integer summation of the underlying AttributeDescription and AttributeValue byte sizes and the FilterExtensibleMatch tag (10).

func (FilterExtensibleMatch) String

func (r FilterExtensibleMatch) String() (s string)

String returns the string representation of the receiver instance.

type FilterGreaterOrEqual

type FilterGreaterOrEqual AttributeValueAssertion

FilterGreaterOrEqual aliases the AttributeValueAssertion type to implement the "greaterOrEqual" CHOICE of an instance of Filter.

func (FilterGreaterOrEqual) BER

func (r FilterGreaterOrEqual) BER() (packet *ber.Packet, err error)

BER returns the BER encoding of the receiver instance alongside an error.

To decode the return *ber.Packet, pass it to RFC4515.Filter as the input value.

func (FilterGreaterOrEqual) Choice

func (r FilterGreaterOrEqual) Choice() string

Choice returns the string literal CHOICE "greaterOrEqual".

func (FilterGreaterOrEqual) Index

func (r FilterGreaterOrEqual) Index(_ int) (filter Filter)

Index returns the receiver instance of Filter. This method only exists to satisfy Go's interface signature requirement.

func (FilterGreaterOrEqual) IsZero

func (r FilterGreaterOrEqual) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (FilterGreaterOrEqual) Len

func (r FilterGreaterOrEqual) Len() int

Len always returns one (1), as instances of this kind only contain a single value.

func (FilterGreaterOrEqual) Size

func (r FilterGreaterOrEqual) Size() int

Size returns the integer summation of the underlying AttributeDescription and AttributeValue byte sizes and the FilterGreaterOrEqual tag (6).

func (FilterGreaterOrEqual) String

func (r FilterGreaterOrEqual) String() (s string)

String returns the string representation of the receiver instance.

type FilterLessOrEqual

type FilterLessOrEqual AttributeValueAssertion

FilterLessOrEqual aliases the AttributeValueAssertion type to implement the "lessOrEqual" CHOICE of an instance of Filter.

func (FilterLessOrEqual) BER

func (r FilterLessOrEqual) BER() (packet *ber.Packet, err error)

BER returns the BER encoding of the receiver instance alongside an error.

To decode the return *ber.Packet, pass it to RFC4515.Filter as the input value.

func (FilterLessOrEqual) Choice

func (r FilterLessOrEqual) Choice() string

Choice returns the string literal CHOICE "lessOrEqual".

func (FilterLessOrEqual) Index

func (r FilterLessOrEqual) Index(_ int) (filter Filter)

Index returns the receiver instance of Filter. This method only exists to satisfy Go's interface signature requirement.

func (FilterLessOrEqual) IsZero

func (r FilterLessOrEqual) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (FilterLessOrEqual) Len

func (r FilterLessOrEqual) Len() int

Len always returns one (1), as instances of this kind only contain a single value.

func (FilterLessOrEqual) Size

func (r FilterLessOrEqual) Size() int

Size returns the integer summation of the underlying AttributeDescription and AttributeValue byte sizes and the FilterLessOrEqual tag (7).

func (FilterLessOrEqual) String

func (r FilterLessOrEqual) String() (s string)

String returns the string representation of the receiver instance.

type FilterNot

type FilterNot struct {
	Filter
}

FilterNot implements the "not" CHOICE of an instance of Filter.

func (FilterNot) BER

func (r FilterNot) BER() (packet *ber.Packet, err error)

BER returns the BER encoding of the receiver instance alongside an error.

To decode the return *ber.Packet, pass it to RFC4515.Filter as the input value.

func (FilterNot) Choice

func (r FilterNot) Choice() string

Choice returns the string literal CHOICE "not".

func (FilterNot) Index

func (r FilterNot) Index(idx int) (filter Filter)

Index returns the Nth Filter slice instance from within the receiver.

Example

This example demonstrates the means for accessing a specific slice index within the return instance of Filter.

var r RFC4515
f, _ := r.Filter(`(!(&(objectClass=employee)(terminated=TRUE)))`)

slice := f.Index(0)
fmt.Printf("%s\n", slice.Choice())
Output:

equalityMatch

func (FilterNot) IsZero

func (r FilterNot) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (FilterNot) Len

func (r FilterNot) Len() (l int)

Len always returns one (1), as instances of this kind only contain a single value.

func (FilterNot) Size

func (r FilterNot) Size() int

Size returns the underlying Filter size value.

func (FilterNot) String

func (r FilterNot) String() (s string)

String returns the string representation of the receiver instance.

type FilterOr

type FilterOr []Filter

FilterOr implements the "or" CHOICE of an instance of Filter.

func (FilterOr) BER

func (r FilterOr) BER() (packet *ber.Packet, err error)

BER returns the BER encoding of the receiver instance alongside an error.

To decode the return *ber.Packet, pass it to RFC4515.Filter as the input value.

func (FilterOr) Choice

func (r FilterOr) Choice() string

Choice returns the string literal CHOICE "or".

func (FilterOr) Index

func (r FilterOr) Index(idx int) (filter Filter)

Index returns the Nth Filter slice instance from within the receiver.

Example

This example demonstrates the means for accessing a specific slice index within the return instance of Filter.

var r RFC4515
f, _ := r.Filter(`(&(|(sn=Lučić)(employeeID=123456789))(objectClass=person))`)

slice := f.Index(0)
fmt.Printf("%s [%d]\n", slice.Choice(), slice.Len())
Output:

or [2]

func (FilterOr) IsZero

func (r FilterOr) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (FilterOr) Len

func (r FilterOr) Len() int

Len returns the integer length of the receiver instance.

func (FilterOr) Size

func (r FilterOr) Size() int

Size returns the integer summation of all underlying slice value sizes.

func (FilterOr) String

func (r FilterOr) String() (s string)

String returns the string representation of the receiver instance.

type FilterPresent

type FilterPresent struct {
	Desc AttributeDescription
}

FilterPresent implements the "present" CHOICE of an instance of Filter.

func (FilterPresent) BER

func (r FilterPresent) BER() (packet *ber.Packet, err error)

BER returns the BER encoding of the receiver instance alongside an error.

To decode the return *ber.Packet, pass it to RFC4515.Filter as the input value.

func (FilterPresent) Choice

func (r FilterPresent) Choice() string

Choice returns the string literal CHOICE "present".

func (FilterPresent) Index

func (r FilterPresent) Index(_ int) (filter Filter)

Index returns the receiver instance of Filter. This method only exists to satisfy Go's interface signature requirement.

func (FilterPresent) IsZero

func (r FilterPresent) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (FilterPresent) Len

func (r FilterPresent) Len() int

Len always returns one (1), as instances of this kind only contain a single value.

func (FilterPresent) Size

func (r FilterPresent) Size() int

Size returns the integer summation of the underlying AttributeDescription byte size and the FilterPresent tag (8).

func (FilterPresent) String

func (r FilterPresent) String() (s string)

String returns the string representation of the receiver instance.

type FilterSubstrings

type FilterSubstrings struct {
	Type       AttributeDescription
	Substrings SubstringAssertion
}

FilterSubstrings implements the "substrings" CHOICE of an instance of Filter.

func (FilterSubstrings) BER

func (r FilterSubstrings) BER() (packet *ber.Packet, err error)

BER returns the BER encoding of the receiver instance alongside an error.

To decode the return *ber.Packet, pass it to RFC4515.Filter as the input value.

func (FilterSubstrings) Choice

func (r FilterSubstrings) Choice() string

Choice returns the string literal CHOICE "substrings".

func (FilterSubstrings) Index

func (r FilterSubstrings) Index(_ int) (filter Filter)

Index returns the receiver instance of Filter. This method only exists to satisfy Go's interface signature requirement.

func (FilterSubstrings) IsZero

func (r FilterSubstrings) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (FilterSubstrings) Len

func (r FilterSubstrings) Len() int

Len always returns one (1), as instances of this kind only contain a single value.

func (FilterSubstrings) Size

func (r FilterSubstrings) Size() (size int)

Size returns the integer summation of the underlying value byte sizes and their associated tags.

func (FilterSubstrings) String

func (r FilterSubstrings) String() (s string)

String returns the string representation of the receiver instance.

type G3FacsimileBodyPart

type G3FacsimileBodyPart struct {
	Parameters G3FacsimileParameters `asn1:"set"`

	// Data implements G3FacsimileData defined in ITU Rec. X.420.
	// G3FacsimileData ::= SEQUENCE OF BIT STRING
	Data []asn1.BitString `asn1:"tag:3,sequence"`
}

G3FacsimileBodyPart implements clause 7.4.2 of ITU-T Rec. X.420:

G3FacsimileBodyPart ::= SEQUENCE {
    parameters G3FacsimileParameters,
    data       G3FacsimileData
}

type G3FacsimileData

type G3FacsimileData []asn1.BitString

G3FacsimileData implements G3FacsimileData as defined in ITU-T Rec. X.420.

G3FacsimileData ::= SEQUENCE OF BIT STRING

type G3FacsimileNonBasicParameters

type G3FacsimileNonBasicParameters asn1.BitString

G3FacsimileNonBasicParameters implements Figure 2, Part 28 of 29 of ITU-T Rec. X.411:

G3FacsimileNonBasicParameters ::= BIT STRING {
     two-dimensional           (8),  -- As defined in ITU-T Recommendation T.30
     fine-resolution           (9),  -- unlimited-length (20) -- These bit values are chosen such that when
     b4-length                 (21), -- encoded using ASN.1 Basic Encoding Rules
     a3-width                  (22), -- the resulting octets have the same values
     b4-width                  (23), -- as for T.30 encoding
     t6-coding                 (25), -- uncompressed (30), -- Trailing zero bits are not significant.
     width-middle-864-of-1728  (37), -- It is recommended that implementations
     width-middle-1216-of-1728 (38), -- should not encode more than 32 bits unless
     resolution-type           (44), -- higher numbered bits are non-zero.
     resolution-400x400        (45),
     resolution-300x300        (46),
     resolution-8x15           (47),
     edi                       (49),
     dtm                       (50),
     bft                       (51),
     mixed-mode                (58),
     character-mode            (60),
     twelve-bits               (65),
     preferred-huffmann        (66),
     full-colour               (67),
     jpeg                      (68),
     processable-mode-26       (71) }

func (*G3FacsimileNonBasicParameters) Shift

func (r *G3FacsimileNonBasicParameters) Shift(bitPos int)

Shift bit-shifts the input value bitPos into the receiver instance.

type G3FacsimileParameters

type G3FacsimileParameters struct {
	NumberOfPages      int            `asn1:"tag:0,optional"`
	NonBasicParameters asn1.BitString `asn1:"tag:1,optional"`
}

type GeneralizedTime

type GeneralizedTime time.Time

GeneralizedTime aliases an instance of time.Time to implement § 3.3.13 of RFC 4517:

GeneralizedTime = century year month day hour
        [ minute [ second / leap-second ] ]
        [ fraction ]
        g-time-zone

century = 2(%x30-39) ; "00" to "99"
year    = 2(%x30-39) ; "00" to "99"
month   =   ( %x30 %x31-39 ) ; "01" (January) to "09"
          / ( %x31 %x30-32 ) ; "10" to "12"
day     =   ( %x30 %x31-39 )    ; "01" to "09"
          / ( %x31-32 %x30-39 ) ; "10" to "29"
          / ( %x33 %x30-31 )    ; "30" to "31"
hour    = ( %x30-31 %x30-39 ) / ( %x32 %x30-33 ) ; "00" to "23"
minute  = %x30-35 %x30-39                        ; "00" to "59"

second      = ( %x30-35 %x30-39 ) ; "00" to "59"
leap-second = ( %x36 %x30 )       ; "60"

fraction        = ( DOT / COMMA ) 1*(%x30-39)
g-time-zone     = %x5A  ; "Z"
                  / g-differential
g-differential  = ( MINUS / PLUS ) hour [ minute ]
MINUS           = %x2D  ; minus sign ("-")

func (GeneralizedTime) Cast

func (r GeneralizedTime) Cast() time.Time

Cast unwraps and returns the underlying instance of time.Time.

func (GeneralizedTime) String

func (r GeneralizedTime) String() string

String returns the string representation of the receiver instance.

type Guide deprecated

type Guide struct {
	ObjectClass string   `asn1:"tag:0,optional"`
	Criteria    Criteria `asn1:"tag:1"`
}

Deprecated: Guide is OBSOLETE and is provided for historical support only; use EnhancedGuide instead.

From § 3.3.14 of RFC 4517:

Guide = [ object-class SHARP ] criteria

object-class  = WSP oid WSP
criteria   = and-term *( BAR and-term )
and-term   = term *( AMPERSAND term )
term       = EXCLAIM term /
             attributetype DOLLAR match-type /
             LPAREN criteria RPAREN /
             true /
             false
match-type = "EQ" / "SUBSTR" / "GE" / "LE" / "APPROX"
true       = "?true"
false      = "?false"
BAR        = %x7C  ; vertical bar ("|")
AMPERSAND  = %x26  ; ampersand ("&")
EXCLAIM    = %x21  ; exclamation mark ("!")

func (Guide) String

func (r Guide) String() (s string)

String returns the string representation of the receiver instance.

type IA5String

type IA5String string

IA5String implements § 3.2 of RFC 4517:

IA5 = 0x0000 through 0x00FF

func (IA5String) IsZero

func (r IA5String) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (IA5String) String

func (r IA5String) String() string

String returns the string representation of the receiver instance.

type Integer

type Integer big.Int

Integer aliases big.Int to implement an unbounded ASN.1 INTEGER syntax and matching rule capabilities.

From § 3.3.16 of RFC 4517:

Integer = ( HYPHEN LDIGIT *DIGIT ) / number

func (Integer) Bytes

func (r Integer) Bytes() (bts []byte)

Bytes wraps big.Int.Bytes.

Note that the return value is a big endian byte sequence.

Also note that the return value will bear a leading 0x0 if the number is zero (0) or more, or a leading 0x1 if the number is negative.

func (Integer) Cast

func (r Integer) Cast() *big.Int

Cast unwraps and returns the underlying instance of *big.Int.

func (Integer) DER

func (r Integer) DER() (der []byte, err error)

DER returns the ASN.1 DER encoding of the receiver instance alongside an error.

func (Integer) IsZero

func (r Integer) IsZero() bool

IsZero returns a Boolean value indicative of a nil, or unset, receiver.

func (*Integer) SetBytes

func (r *Integer) SetBytes(bts []byte)

SetBytes wraps big.Int.SetBytes.

Note that input value "bts" must be a a big endian byte sequence.

Also note that if encoding bytes manually for submission to this method, a leading 0x1 signifies the number is negative. A leading 0x0 indicates the number is unsigned (zero (0) or more) and is optional.

func (Integer) Size

func (r Integer) Size() int

Size returns the summation of the receiver byte size and the ASN.1 INTEGER tag value (2).

func (Integer) String

func (r Integer) String() (s string)

String returns the string representation of the receiver instance. If the receiver is unset, `0` is returned.

func (Integer) UUID

func (r Integer) UUID() (u UUID)

UUID returns the UUID representation of the receiver instance.

Example

This example demonstrates the means for converting an Integer instance to a UUID instance.

var r RFC4517
i, err := r.Integer(`987895962269883002155146617097157934`)
if err != nil {
	fmt.Println(err)
	return
}

fmt.Println(i.UUID())
Output:

00be4308-0c89-1085-8ea0-0002a5d5fd2e

type LDAPDN

type LDAPDN LDAPString

LDAPDN implements the string form of a distinguished name.

type LDAPString

type LDAPString OctetString

LDAPString aliases OctetString to implement § 4.1.2 of RFC 4511.

func (LDAPString) Size

func (r LDAPString) Size() int

func (LDAPString) String

func (r LDAPString) String() string

String returns the string representation of the receiver instance.

type LDAPSyntax

type LDAPSyntax struct {
	NumericOID  string // IDENTIFIER
	Description string
	Extensions  map[int]Extension
	// contains filtered or unexported fields
}

LDAPSyntax implements § 4.1.5 of RFC 4512.

func (LDAPSyntax) HR

func (r LDAPSyntax) HR() (hr bool)

HR returns a Boolean value indicative of whether the receiver instance represents a human readable syntax.

This method is merely a convenient alternative to manually checking the underlying Extensions field instance for the presence of an Extension instance bearing the `X-NOT-HUMAN-READABLE` XString and a BOOLEAN ASN.1 value of `TRUE`.

Example
def, idx := exampleSchema.LDAPSyntax(`1.3.6.1.1.15.5`) // X.509 Cert List Exact Assertion
if idx == -1 {
	fmt.Println("No such definition found")
	return
}

fmt.Println(def.HR())
Output:

false

func (LDAPSyntax) Identifier

func (r LDAPSyntax) Identifier() string

Identifier returns the numeric OID by which the receiver is known.

func (*LDAPSyntax) IsZero

func (r *LDAPSyntax) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (LDAPSyntax) Match

func (r LDAPSyntax) Match(term string) bool

Match returns a Boolean value indicative of a match between the input string term value and the receiver's NumericOID or Description value.

Case is not significant in the matching process, and whitespace is disregarded where a Description value is concerned.

func (LDAPSyntax) OID

func (r LDAPSyntax) OID() string

OID returns the numeric OID literal "1.3.6.1.4.1.1466.115.121.1.54" per § 3.3.1 of RFC 4517.

func (LDAPSyntax) String

func (r LDAPSyntax) String() (def string)

String returns the string representation of the receiver instance.

func (LDAPSyntax) Type

func (r LDAPSyntax) Type() string

func (LDAPSyntax) Valid

func (r LDAPSyntax) Valid() bool

Valid returns a Boolean value indicative of a valid receiver instance.

func (LDAPSyntax) Verify

func (r LDAPSyntax) Verify(x any) (result Boolean)

Verify returns an instance of Boolean following an analysis of input value x against the underlying syntax.

Not to be confused with LDAPSyntax.Valid which only checks the validity of a syntax definition itself -- not an assertion value.

Example
def, idx := exampleSchema.LDAPSyntax(`INTEGER`)
if idx == -1 {
	fmt.Println("No such definition found")
	return
}

result := def.Verify(`362`) // verify "362" as an INTEGER ASN.1 type
fmt.Println(result)
Output:

TRUE

func (LDAPSyntax) XOrigin

func (r LDAPSyntax) XOrigin() (origins []string)

XOrigin returns slices of standards citations, each being the name of an RFC, Internet-Draft or ITU-T Recommendation from which the receiver definition originates.

This method is merely a convenient alternative to manually checking the underlying Extensions field instance for the presence of an Extension instance bearing the `X-ORIGIN` XString and at least one (1) value.

Example
def, idx := exampleSchema.LDAPSyntaxes.Get(`nisNetgroupTripleSyntax`)
if idx == -1 {
	fmt.Println("Syntax not found")
	return
}

fmt.Println(def.XOrigin())
Output:

[RFC2307]

type LDAPSyntaxes

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

LDAPSyntaxes implements § 4.2.5 of RFC 4512 and contains slices of LDAPSyntax.

func (LDAPSyntaxes) Contains

func (r LDAPSyntaxes) Contains(id string) (idx int)

Contains returns an integer index value indicative of a SchemaDefinition residing within the receiver instance which bears an identical value to id. If not found, -1 is returned.

func (LDAPSyntaxes) Get

func (r LDAPSyntaxes) Get(term string) (def *LDAPSyntax, idx int)

Get returns an instance of *LDAPSyntax and a slice index following a description or numeric OID match attempt. A zero instance of *LDAPSyntax alongside an index of -1 is returned if no match is found.

Neither whitespace nor case is significant in the matching process when a description is used.

func (*LDAPSyntaxes) Index

func (r *LDAPSyntaxes) Index(idx int) (def *LDAPSyntax)

Index returns the Nth LDAPSyntaxes instances found within the receiver instance.

func (*LDAPSyntaxes) IsZero

func (r *LDAPSyntaxes) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

Example
var defs LDAPSyntaxes
fmt.Println(defs.IsZero())
Output:

true

func (LDAPSyntaxes) Len

func (r LDAPSyntaxes) Len() int

func (LDAPSyntaxes) OID

func (r LDAPSyntaxes) OID() string

OID returns the numeric OID literal "1.3.6.1.4.1.1466.101.120.16" per § 4.2.5 of RFC 4512.

func (*LDAPSyntaxes) Push

func (r *LDAPSyntaxes) Push(defs ...*LDAPSyntax)

Push appends def to the receiver instance if ALL of the following evaluate as true:

  • def is an LDAPSyntax instance
  • NumericOID of def does not already exist as a slice
  • Execution of LDAPSyntax.Valid encounters no issues

func (LDAPSyntaxes) String

func (r LDAPSyntaxes) String() (s string)

String returns the string representation of the receiver instance.

func (LDAPSyntaxes) Table

func (r LDAPSyntaxes) Table() (table SchemaDefinitionTable)

Inventory returns an instance of SchemaDefinitionTable which represents the current inventory of LDAPSyntax instances within the receiver.

func (LDAPSyntaxes) Type

func (r LDAPSyntaxes) Type() string

type LocalName

type LocalName string

LocalName implements an "RDNSequence" per § 6 of RFC 3642.

Instances of this type may be found within the "base" of a SubtreeSpecification instance, as well as the "name" of a SpecificExclusion, and are used to describe an indicated entry set present at, or within, a given administrative area.

A zero instance of this type is equivalent to a null DN, which normally indicates that the given administrative area is defined by the current subentry.

func (LocalName) IsZero

func (r LocalName) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (LocalName) String

func (r LocalName) String() string

String returns the string representation of the receiver instance.

type MatchingRule

type MatchingRule struct {
	NumericOID  string
	Name        []string
	Description string
	Obsolete    bool
	Syntax      string
	Extensions  map[int]Extension
	// contains filtered or unexported fields
}

MatchingRule implements § 4.1.3 of RFC 4512.

func (MatchingRule) EqualityMatch

func (r MatchingRule) EqualityMatch(actual, assertion any) (result Boolean, err error)

EqualityMatch returns a Boolean instance alongside an error following an attempt to perform an equality match between the actual and assertion input values.

The actual value represents the value that would ostensibly be derived from an LDAP DIT entry, while the assertion value represents the test value that would be input by a requesting user.

Example (CaseExactMatch)
// obtain caseExactMatch matchingRule instance
mr, idx := exampleSchema.MatchingRule(`caseExactMatch`)
if idx == -1 {
	fmt.Println("No such definition found")
	return
}

matched, err := mr.EqualityMatch(`thisIsText`, `ThisIsText`)
if err != nil {
	fmt.Println(err)
	return
}

fmt.Println(matched)
Output:

FALSE
Example (IntegerMatch)
// obtain integerMatch matchingRule instance
mr, idx := exampleSchema.MatchingRule(`integerMatch`)
if idx == -1 {
	fmt.Println("No such definition found")
	return
}

matched, err := mr.EqualityMatch(2, 22)
if err != nil {
	fmt.Println(err)
	return
}

fmt.Println(matched)
Output:

FALSE

func (MatchingRule) Identifier

func (r MatchingRule) Identifier() (id string)

Identifier returns the principal string value by which the receiver is known. If the receiver is not assigned a name (descriptor), the numeric OID is returned instead.

func (*MatchingRule) IsZero

func (r *MatchingRule) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (MatchingRule) Match

func (r MatchingRule) Match(term string) bool

Match returns a Boolean value indicative of a match between the input string term value and the receiver's NumericOID or Name value.

Case is not significant in the matching process.

Example
def, idx := exampleSchema.MatchingRule(`2.5.13.2`)
if idx == -1 {
	fmt.Println("No such definition found")
	return
}
fmt.Println(def.Match(`caseIgnoreMatch`)) // or by numeric OID (2.5.13.2)
Output:

true

func (MatchingRule) OID

func (r MatchingRule) OID() string

OID returns the numeric OID literal "1.3.6.1.4.1.1466.115.121.1.30" per § 3.3.19 of RFC 4517.

func (MatchingRule) OrderingMatch

func (r MatchingRule) OrderingMatch(actual, assertion any, operator byte) (result Boolean, err error)

OrderingMatch returns a Boolean instance alongside an error following an attempt to compare the actual and assertion input values in terms of ordering.

Comparison behavior is dictated through use the operator input byte value. See the GreaterOrEqual and LessOrEqual constants for details.

The actual value represents the value that would ostensibly be derived from an LDAP DIT entry, while the assertion value represents the test value that would be input by a requesting user.

Example (CaseExactOrderingMatchGreaterOrEqual)
// obtain caseExactOrderingMatch matchingRule instance
mr, idx := exampleSchema.MatchingRule(`caseExactOrderingMatch`)
if idx == -1 {
	fmt.Println("No such definition found")
	return
}

// Greater or equal (actual>=assertion)
matched, err := mr.OrderingMatch(`ThisIsText`, `thisIsText`, GreaterOrEqual)
if err != nil {
	fmt.Println(err)
	return
}

fmt.Println(matched)
Output:

FALSE
Example (CaseExactOrderingMatchLessOrEqual)
// obtain caseExactOrderingMatch matchingRule instance
mr, idx := exampleSchema.MatchingRule(`caseExactOrderingMatch`)
if idx == -1 {
	fmt.Println("No such definition found")
	return
}

// Less or equal (actual<=assertion)
matched, err := mr.OrderingMatch(`thisIsText`, `ThisIsText`, LessOrEqual)
if err != nil {
	fmt.Println(err)
	return
}

fmt.Println(matched)
Output:

TRUE
Example (IntegerOrderingMatchGreaterOrEqual)
// obtain integerOrderingMatch matchingRule instance
mr, idx := exampleSchema.MatchingRule(`integerOrderingMatch`)
if idx == -1 {
	fmt.Println("No such definition found")
	return
}

// Greater or equal (1>=2)
matched, err := mr.OrderingMatch(1, 2, GreaterOrEqual)
if err != nil {
	fmt.Println(err)
	return
}

fmt.Println(matched)
Output:

TRUE
Example (IntegerOrderingMatchLessOrEqual)
// obtain integerOrderingMatch matchingRule instance
mr, idx := exampleSchema.MatchingRule(`integerOrderingMatch`)
if idx == -1 {
	fmt.Println("No such definition found")
	return
}

// Less or equal (1<=2)
matched, err := mr.OrderingMatch(1, 2, LessOrEqual)
if err != nil {
	fmt.Println(err)
	return
}

fmt.Println(matched)
Output:

TRUE

func (MatchingRule) String

func (r MatchingRule) String() (def string)

String returns the string representation of the receiver instance.

func (MatchingRule) SubstringsMatch

func (r MatchingRule) SubstringsMatch(actual, assertion any) (result Boolean, err error)

SubstringsMatch returns a Boolean instance alongside an error following an attempt to perform a substrings match between the actual and assertion input values.

The actual value represents the value that would ostensibly be derived from an LDAP DIT entry, while the assertion value represents the test value that would be input by a requesting user.

Example (CaseExactSubstringsMatch)
// obtain caseExactSubstringsMatch matchingRule instance
mr, idx := exampleSchema.MatchingRule(`caseExactSubstringsMatch`)
if idx == -1 {
	fmt.Println("No such definition found")
	return
}

matched, err := mr.SubstringsMatch(`thisIsText`, `*HisIsT*xt`)
if err != nil {
	fmt.Println(err)
	return
}

fmt.Println(matched)
Output:

FALSE

func (MatchingRule) Type

func (r MatchingRule) Type() string

func (MatchingRule) Valid

func (r MatchingRule) Valid() bool

Valid returns a Boolean value indicative of a syntactically valid receiver instance. Note this does not verify the presence of dependency schema elements.

func (MatchingRule) XOrigin

func (r MatchingRule) XOrigin() (origins []string)

XOrigin returns slices of standards citations, each being the name of an RFC, Internet-Draft or ITU-T Recommendation from which the receiver definition originates.

This method is merely a convenient alternative to manually checking the underlying Extensions field instance for the presence of an Extension instance bearing the `X-ORIGIN` XString and at least one (1) value.

Example
def, idx := exampleSchema.MatchingRules.Get(`objectIdentifierMatch`)
if idx == -1 {
	fmt.Println("Matching rule not found")
	return
}

fmt.Println(def.XOrigin())
Output:

[RFC4517]

type MatchingRuleAssertion

type MatchingRuleAssertion struct {
	MatchingRule MatchingRuleID       `asn1:"tag:1,optional"`
	Type         AttributeDescription `asn1:"tag:2,optional"`
	MatchValue   AssertionValue       `asn1:"tag:3"`
	DNAttributes bool                 `asn1:"tag:4,default:false"`
}

MatchingRuleAssertion implements the basis of FilterExtensibleMatch.

MatchingRuleAssertion ::= SEQUENCE {
    matchingRule    [1] MatchingRuleId OPTIONAL,
    type            [2] AttributeDescription OPTIONAL,
    matchValue      [3] AssertionValue,
    dnAttributes    [4] BOOLEAN DEFAULT FALSE }

func (MatchingRuleAssertion) IsZero

func (r MatchingRuleAssertion) IsZero() bool

func (MatchingRuleAssertion) Size

func (r MatchingRuleAssertion) Size() int

Size returns the integer summation of the underlying value byte sizes and their associated tags.

type MatchingRuleID

type MatchingRuleID LDAPString

func (MatchingRuleID) Size

func (r MatchingRuleID) Size() int

Size returns the integer summation of the MatchingRuleAssertionMatchingRule tag (1) and the byte size of the receiver instance

func (MatchingRuleID) String

func (r MatchingRuleID) String() string

String returns the string representation of the receiver instance.

type MatchingRuleUse

type MatchingRuleUse struct {
	NumericOID  string
	Name        []string
	Description string
	Obsolete    bool
	Applies     []string
	Extensions  map[int]Extension
	// contains filtered or unexported fields
}

MatchingRuleUse implements § 4.1.4 of RFC 4512.

func (MatchingRuleUse) Identifier

func (r MatchingRuleUse) Identifier() (id string)

Identifier returns the principal string value by which the receiver is known. If the receiver is not assigned a name (descriptor), the numeric OID is returned instead.

func (*MatchingRuleUse) IsZero

func (r *MatchingRuleUse) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (MatchingRuleUse) Match

func (r MatchingRuleUse) Match(term string) bool

Match returns a Boolean value indicative of a match between the input string term value and the receiver's NumericOID or Name value.

Case is not significant in the matching process.

func (MatchingRuleUse) OID

func (r MatchingRuleUse) OID() string

OID returns the numeric OID literal "1.3.6.1.4.1.1466.115.121.1.31" per § 3.3.20 of RFC 4517.

func (MatchingRuleUse) String

func (r MatchingRuleUse) String() (def string)

String returns the string representation of the receiver instance.

func (MatchingRuleUse) Type

func (r MatchingRuleUse) Type() string

func (MatchingRuleUse) Valid

func (r MatchingRuleUse) Valid() bool

Valid returns a Boolean value indicative of a syntactically valid receiver instance. Note this does not verify the presence of dependency schema elements.

func (MatchingRuleUse) XOrigin

func (r MatchingRuleUse) XOrigin() (origins []string)

XOrigin returns slices of standards citations, each being the name of an RFC, Internet-Draft or ITU-T Recommendation from which the receiver definition originates.

This method is merely a convenient alternative to manually checking the underlying Extensions field instance for the presence of an Extension instance bearing the `X-ORIGIN` XString and at least one (1) value.

type MatchingRuleUses

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

MatchingRuleUses implements § 4.2.4 of RFC 4512 and contains slices of MatchingRuleUse.

func (MatchingRuleUses) Contains

func (r MatchingRuleUses) Contains(id string) (idx int)

Contains returns an integer index value indicative of a SchemaDefinition residing within the receiver instance which bears an identical value to id. If not found, -1 is returned.

func (MatchingRuleUses) Get

func (r MatchingRuleUses) Get(term string) (def *MatchingRuleUse, idx int)

Get returns an instance of *MatchingRuleUse and a slice index following a descriptor or numeric OID match attempt. A zero instance of *MatchingRuleUse alongside an index of -1 is returned if no match is found.

Case is not significant in the matching process.

func (*MatchingRuleUses) Index

func (r *MatchingRuleUses) Index(idx int) (def *MatchingRuleUse)

Index returns the Nth MatchingRuleUse instances found within the receiver instance.

func (*MatchingRuleUses) IsZero

func (r *MatchingRuleUses) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

Example
var defs MatchingRuleUses
fmt.Println(defs.IsZero())
Output:

true

func (MatchingRuleUses) Len

func (r MatchingRuleUses) Len() int

func (MatchingRuleUses) OID

func (r MatchingRuleUses) OID() string

OID returns the numeric OID literal "2.5.21.8" per § 4.2.4 of RFC 4512.

func (MatchingRuleUses) String

func (r MatchingRuleUses) String() (s string)

String returns the string representation of the receiver instance.

func (MatchingRuleUses) Table

func (r MatchingRuleUses) Table() (table SchemaDefinitionTable)

Inventory returns an instance of SchemaDefinitionTable which represents the current inventory of MatchingRuleUse instances within the receiver.

func (MatchingRuleUses) Type

func (r MatchingRuleUses) Type() string

type MatchingRules

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

MatchingRules implements § 4.2.3 of RFC 4512 and contains slices of MatchingRule.

func (MatchingRules) Contains

func (r MatchingRules) Contains(id string) (idx int)

Contains returns an integer index value indicative of a SchemaDefinition residing within the receiver instance which bears an identical value to id. If not found, -1 is returned.

func (MatchingRules) Get

func (r MatchingRules) Get(term string) (def *MatchingRule, idx int)

Get returns an instance of *MatchingRule and a slice index following a descriptor or numeric OID match attempt. A zero instance of *MatchingRule alongside an index of -1 is returned if no match is found.

Case is not significant in the matching process.

func (*MatchingRules) Index

func (r *MatchingRules) Index(idx int) (def *MatchingRule)

Index returns the Nth MatchingRule instances found within the receiver instance.

func (*MatchingRules) IsZero

func (r *MatchingRules) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

Example
var defs MatchingRules
fmt.Println(defs.IsZero())
Output:

true

func (MatchingRules) Len

func (r MatchingRules) Len() int

func (MatchingRules) OID

func (r MatchingRules) OID() string

OID returns the numeric OID literal "2.5.21.4" per § 4.2.3 of RFC 4512.

func (*MatchingRules) Push

func (r *MatchingRules) Push(defs ...*MatchingRule)

Push appends def to the receiver instance if ALL of the following evaluate as true:

func (MatchingRules) String

func (r MatchingRules) String() (s string)

String returns the string representation of the receiver instance.

func (MatchingRules) Table

func (r MatchingRules) Table() (table SchemaDefinitionTable)

Inventory returns an instance of SchemaDefinitionTable which represents the current inventory of MatchingRule instances within the receiver.

func (MatchingRules) Type

func (r MatchingRules) Type() string

type NameAndOptionalUID

type NameAndOptionalUID struct {
	DN  DistinguishedName
	UID BitString `asn1:"optional"`
}

NameAndOptionalUID returns an error following an analysis of x in the context of a Name and Optional UID.

From § 3.3.21 of RFC 4517:

NameAndOptionalUID = distinguishedName [ SHARP BitString ]

From § 3.3.2 of RFC 4517:

BitString    = SQUOTE *binary-digit SQUOTE "B"
binary-digit = "0" / "1"

From § 1.4 of RFC 4512:

SHARP  = %x23	; octothorpe (or sharp sign) ("#")
SQUOTE = %x27	; single quote ("'")

type NameForm

type NameForm struct {
	NumericOID  string
	Name        []string
	Description string
	Obsolete    bool
	OC          string
	Must        []string
	May         []string
	Extensions  map[int]Extension
	// contains filtered or unexported fields
}

NameForm implements § 4.1.7.2 of RFC 4512.

func (NameForm) Identifier

func (r NameForm) Identifier() (id string)

Identifier returns the principal string value by which the receiver is known. If the receiver is not assigned a name (descriptor), the numeric OID is returned instead.

func (*NameForm) IsZero

func (r *NameForm) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (NameForm) Match

func (r NameForm) Match(term string) bool

Match returns a Boolean value indicative of a match between the input string term value and the receiver's NumericOID or Name value.

Case is not significant in the matching process.

func (NameForm) OID

func (r NameForm) OID() string

OID returns the numeric OID literal "1.3.6.1.4.1.1466.115.121.1.35" per § 3.3.22 of RFC 4517.

func (NameForm) String

func (r NameForm) String() (def string)

String returns the string representation of the receiver instance.

func (NameForm) Type

func (r NameForm) Type() string

func (NameForm) Valid

func (r NameForm) Valid() bool

Valid returns a Boolean value indicative of a syntactically valid receiver instance. Note this does not verify the presence of dependency schema elements.

func (NameForm) XOrigin

func (r NameForm) XOrigin() (origins []string)

XOrigin returns slices of standards citations, each being the name of an RFC, Internet-Draft or ITU-T Recommendation from which the receiver definition originates.

This method is merely a convenient alternative to manually checking the underlying Extensions field instance for the presence of an Extension instance bearing the `X-ORIGIN` XString and at least one (1) value.

type NameForms

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

NameForms implements § 4.2.8 of RFC 4512 and contains slices of NameForm.

func (NameForms) Contains

func (r NameForms) Contains(id string) (idx int)

Contains returns an integer index value indicative of a SchemaDefinition residing within the receiver instance which bears an identical value to id. If not found, -1 is returned.

func (NameForms) Get

func (r NameForms) Get(term string) (def *NameForm, idx int)

Get returns an instance of *NameForm and a slice index following a descriptor or numeric OID match attempt. A zero instance of *NameForm alongside an index of -1 is returned if no match is found.

Case is not significant in the matching process.

func (*NameForms) Index

func (r *NameForms) Index(idx int) (def *NameForm)

Index returns the Nth NameForm instances found within the receiver instance.

func (*NameForms) IsZero

func (r *NameForms) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

Example
var defs NameForms
fmt.Println(defs.IsZero())
Output:

true

func (NameForms) Len

func (r NameForms) Len() int

func (NameForms) OID

func (r NameForms) OID() string

OID returns the numeric OID literal "2.5.21.7" per § 4.2.8 of RFC 4512.

func (*NameForms) Push

func (r *NameForms) Push(defs ...*NameForm)

Push appends def to the receiver instance if ALL of the following evaluate as true:

  • def is a NameForm instance
  • NumericOID of def does not already exist as a slice
  • Execution of NameForm.Valid encounters no issues

func (NameForms) String

func (r NameForms) String() (s string)

String returns the string representation of the receiver instance.

func (NameForms) Table

func (r NameForms) Table() (table SchemaDefinitionTable)

Inventory returns an instance of SchemaDefinitionTable which represents the current inventory of NameForm instances within the receiver.

func (NameForms) Type

func (r NameForms) Type() string

type NetgroupTriple

type NetgroupTriple struct {
	Hostname IA5String `asn1:"tag:0,optional"`
	Username IA5String `asn1:"tag:1,optional"`
	Domain   IA5String `asn1:"tag:2,optional"`
}

NetgroupTriple implements the NIS Netgroup Triple type. Instances of this type are produced following a successful execution of the RFC2307.NetgroupTriple function.

A zero instance of this type is equal to:

("-","-","-")

From § 2.4 of RFC 2307:

nisnetgrouptriple = "(" hostname "," username "," domainname ")"
hostname          = "" / "-" / keystring
username          = "" / "-" / keystring
domainname        = "" / "-" / keystring

ASN.1 definition:

nisNetgroupTripleSyntax ::= SEQUENCE {
        hostname   [0] IA5String OPTIONAL,
        username   [1] IA5String OPTIONAL,
        domainname [2] IA5String OPTIONAL
}

From § 1.4 of RFC 4512:

keystring = leadkeychar *keychar
leadkeychar = ALPHA
keychar = ALPHA / DIGIT / HYPHEN

ALPHA   = %x41-5A / %x61-7A     ; "A"-"Z" / "a"-"z"
DIGIT   = %x30 / LDIGIT         ; "0"-"9"
LDIGIT  = %x31-39               ; "1"-"9"
HYPHEN  = %x2D                  ; hyphen ("-")

From § 3.2 of RFC 4517:

IA5String          = *(%x00-7F)

func (NetgroupTriple) String

func (r NetgroupTriple) String() string

String returns the string representation of the receiver instance.

type NetscapeACIv3

type NetscapeACIv3 struct{ *SubschemaSubentry }

func (NetscapeACIv3) Attribute

func (r NetscapeACIv3) Attribute(x ...any) (ACIv3Attribute, error)

Attribute returns an instance of ACIv3Attribute alongside an error following an attempt to parse x into one (1) or more attribute type OIDs, whether as numeric or descriptor values.

func (NetscapeACIv3) AttributeBindTypeOrValue

func (r NetscapeACIv3) AttributeBindTypeOrValue(x ...any) (ACIv3AttributeBindTypeOrValue, error)

AttributeBindTypeOrValue will return a new instance of ACIv3AttributeBindTypeOrValue. The required ACIv3BindKeyword must be either ACIv3BindUAT or ACIv3BindGAT. The optional input values (x), if provided, will be used to set the instance.

func (NetscapeACIv3) AttributeFilter

func (r NetscapeACIv3) AttributeFilter(x ...any) (ACIv3AttributeFilter, error)

AF initializes, optionally sets and returns a new instance of ACIv3AttributeFilter, which is a critical component of the ACIv3TargetAttrFilters Target Rule.

Input values must be either a Filter or an ACIv3Attribute.

func (NetscapeACIv3) AttributeFilterOperation

func (r NetscapeACIv3) AttributeFilterOperation(x ...any) (ACIv3AttributeFilterOperation, error)

func (NetscapeACIv3) AttributeFilterOperationItem

func (r NetscapeACIv3) AttributeFilterOperationItem(x ...any) (ACIv3AttributeFilterOperationItem, error)

func (NetscapeACIv3) AuthenticationMethod

func (r NetscapeACIv3) AuthenticationMethod(x ...any) (ACIv3AuthenticationMethod, error)

func (NetscapeACIv3) BindDistinguishedName

func (r NetscapeACIv3) BindDistinguishedName(x ...any) (ACIv3BindDistinguishedName, error)

BindDistinguishedName returns an instance of ACIv3BindDistinguishedName alongside an error following an attempt to marshal the input arguments.

If no arguments are provided, a bogus instance is returned.

The first argument must be a single ACIv3BindKeyword, which MUST be one of ACIv3BindUDN, ACIv3BindGDN or ACIv3BindRDN.

All subsequent arguments must be any of the following:

  • String-based DNs, which may or may not include wildcard or substring patterns, or ...
  • Proper instances of DistinguishedName

In the case of a string-based DN with or without matching patterns, the ACIv3-required prefix of "ldap:///" need not be specified.

func (NetscapeACIv3) BindRule

func (r NetscapeACIv3) BindRule(x ...any) (ACIv3BindRule, error)

BindRule returns an instance of ACIv3BindRule alongside an error following an attempt to parse string x as a qualifying instance of ACIv3BindRuleItem, ACIv3BindRuleAnd, ACIv3BindRuleOr or ACIv3BindRuleNot.

func (NetscapeACIv3) BindRuleAnd

func (r NetscapeACIv3) BindRuleAnd(x ...any) (ACIv3BindRule, error)

BindRuleAnd returns an instance of ACIv3BindRule, qualified via an underlying ACIv3BindRuleAnd instance.

Zero (0) or more ACIv3BindRule qualifier type instances may be input for immediate addition to the return value.

func (NetscapeACIv3) BindRuleItem

func (r NetscapeACIv3) BindRuleItem(x ...any) (ACIv3BindRule, error)

BindRuleItem initialized, populates and returns an instance of ACIv3BindRule, qualified by an underlying *ACIv3BindRuleItem instance.

func (NetscapeACIv3) BindRuleNot

func (r NetscapeACIv3) BindRuleNot(x ...any) (ACIv3BindRule, error)

BindRuleNot returns a negated instance of ACIv3BindRule, qualified via an underlying ACIv3BindRuleNot instance.

Note that up to one (1) ACIv3BindRule qualifier type instance may be set within instances of this type. An instance of ACIv3BindRuleNot is ineligible for assignment.

func (NetscapeACIv3) BindRuleOr

func (r NetscapeACIv3) BindRuleOr(x ...any) (ACIv3BindRule, error)

BindRuleOr returns an instance of ACIv3BindRule, qualified via an underlying ACIv3BindRuleOr instance.

Zero (0) or more ACIv3BindRule qualifier type instances may be input for immediate addition to the return value.

func (NetscapeACIv3) DayOfWeek

func (r NetscapeACIv3) DayOfWeek(x ...any) (ACIv3DayOfWeek, error)

DoW initializes, shifts and returns a new instance of ACIv3DayOfWeek in one shot.

func (NetscapeACIv3) FQDN

func (r NetscapeACIv3) FQDN(x ...any) (ACIv3FQDN, error)

DNS initializes, sets and returns a new instance of ACIv3FQDN in one shot.

func (NetscapeACIv3) IPAddress

func (r NetscapeACIv3) IPAddress(addr ...any) (ACIv3IPAddress, error)

IPAddress initializes, sets and returns a new instance of [ACIv3IPAddr] in one shot.

Example

This example demonstrates the creation of an instance of ACIv3IPAddress, which is used in a variety of contexts.

In this example, a string name is fed to the package level IP function to form a complete ACIv3IPAddress instance, which is then shown in string representation.

var r NetscapeACIv3
ip, err := r.IPAddress(`10.0.0.1`)
if err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("%s", ip)
Output:

10.0.0.1

func (NetscapeACIv3) Inheritance

func (r NetscapeACIv3) Inheritance(x ...any) (ACIv3Inheritance, error)

Inheritance creates a new instance of [Inheritance] bearing the provided ACIv3AttributeBindTypeOrValue instance, as well as zero (0) or more [ACIv3Level] instances for shifting.

func (NetscapeACIv3) Instruction

func (r NetscapeACIv3) Instruction(x ...any) (ACIv3Instruction, error)

Instruction returns an instance of ACIv3Instruction alongside an error following an attempt to parse or marshal x.

func (NetscapeACIv3) LDAPControlOIDs

func (r NetscapeACIv3) LDAPControlOIDs(x ...any) (ACIv3ObjectIdentifier, error)

LDAPControlOIDs initializes a new instance of ACIv3ObjectIdentifier.

Instances of this design are used in the creation of ACIv3TargetRuleItem instances that bear the ACIv3TargetCtrl ACIv3TargetKeyword context.

OIDs produced as a result of this function are expected to be LDAP Control Object Identifiers. Input instances must be string or NumericOID.

func (NetscapeACIv3) LDAPExtendedOperationOIDs

func (r NetscapeACIv3) LDAPExtendedOperationOIDs(x ...any) (ACIv3ObjectIdentifier, error)

LDAPExtendedOperationOIDs initializes a new instance of ACIv3ObjectIdentifier.

Instances of this design are used in the creation of ACIv3TargetRuleItem instances that bear the ACIv3TargetExtOp ACIv3TargetKeyword context.

OIDs produced as a result of this function are expected to be LDAP Extended Operation Object Identifiers. Input instances must be string or NumericOID.

func (NetscapeACIv3) Permission

func (r NetscapeACIv3) Permission(x ...any) (ACIv3Permission, error)

Permission returns an instance of ACIv3Permission alongside an error following an attempt to marshal x.

If only a single value is provided, it is assumed to be the string representation of an ACIv3Permission, e.g.:

allow(read,search,compare)

If more than one values are provided, it is assumed the first argument is a disposition Boolean. A value of true results in a granting ACIv3Permission ("allow"), while false results in a withholding ACIv3Permission ("deny"). All subsequent arguments are assumed to be individual ACIv3Right instances or their equivalent forms as integers or strings.

func (NetscapeACIv3) PermissionBindRule

func (r NetscapeACIv3) PermissionBindRule(x ...any) (ACIv3PermissionBindRule, error)

PermissionBindRule returns an instance of ACIv3PermissionBindRule alongside an error following an attempt to marshal x, which must be zero (0) or more instances of ACIv3PermissionBindRuleItem or equivalent string values.

func (NetscapeACIv3) PermissionBindRuleItem

func (r NetscapeACIv3) PermissionBindRuleItem(x ...any) (ACIv3PermissionBindRuleItem, error)

PermissionBindRuleItem returns an instance of ACIv3PermissionBindRuleItem, bearing the ACIv3Permission P and the ACIv3BindRule B. The values P and B shall undergo validity checks per the conditions of the ACIv3PermissionBindRuleItem Valid method automatically. A bogus ACIv3PermissionBindRuleItem is returned if such checks fail.

Instances of this kind are intended for append via the ACIv3PermissionBindRule.Push method

func (NetscapeACIv3) SearchScope

func (r NetscapeACIv3) SearchScope(x ...any) (s ACIv3Scope, err error)

Scope initializes, sets and returns an instance of ACIv3Scope in one shot. Valid input types are as follows:

  • Standard scope names as string values (e.g.: `base`, `onelevel`, `subtree` and `subordinate`)
  • Integer representations of scopes (see the predefined ACIv3Scope constants for details)

This function may only be needed in certain situations where a scope needs to be parsed from values with different representations. Usually the predefined ACIv3Scope constants are sufficient.

Example
var r NetscapeACIv3
scope, err := r.SearchScope("one")
if err != nil {
	fmt.Println(err)
	return
}

fmt.Println(scope)
Output:

onelevel

func (NetscapeACIv3) SecurityStrengthFactor

func (r NetscapeACIv3) SecurityStrengthFactor(x ...any) (ACIv3SecurityStrengthFactor, error)

SecurityStrengthFactor initializes, sets and returns a new instance of ACIv3SecurityStrengthFactor in one shot.

Example
// convenient alternative to "var X ACIv3SecurityStrengthFactor, X.Set(...) ..."
var r NetscapeACIv3
ssf, err := r.SecurityStrengthFactor(128)
if err != nil {
	fmt.Println(err)
	return
}
fmt.Printf("%s", ssf)
Output:

128

func (NetscapeACIv3) TargetDistinguishedName

func (r NetscapeACIv3) TargetDistinguishedName(x ...any) (ACIv3TargetDistinguishedName, error)

TargetDistinguishedName returns an instance of ACIv3TargetDistinguishedName alongside an error following an attempt to marshal the input arguments.

If no arguments are provided, a bogus instance is returned.

The first argument must be a single ACIv3TargetKeyword or its string equivalent, which MUST be one of ACIv3Target, ACIv3TargetTo or ACIv3TargetFrom.

All subsequent arguments must be any of the following:

  • String-based DNs, which may or may not include wildcard or substring patterns, or ...
  • Proper instances of DistinguishedName

In the case of a string-based DN with or without matching patterns, the ACIv3-required prefix of "ldap:///" need not be specified.

func (NetscapeACIv3) TargetRule

func (r NetscapeACIv3) TargetRule(x ...any) (ACIv3TargetRule, error)

TargetRule returns an instance of ACIv3TargetRule alongside an error following an attempt to parse raw as one (1) or more instance of ACIv3TargetRuleItem.

func (NetscapeACIv3) TargetRuleItem

func (r NetscapeACIv3) TargetRuleItem(x ...any) (ACIv3TargetRuleItem, error)

TargetRuleItem initializes, populates and returns a new instance of ACIv3TargetRuleItem.

func (NetscapeACIv3) TimeOfDay

func (r NetscapeACIv3) TimeOfDay(x ...any) (ACIv3TimeOfDay, error)

ToD initializes, sets and returns a new instance of [TimeOfDay] in one shot.

func (NetscapeACIv3) TimeframeBindRule

func (r NetscapeACIv3) TimeframeBindRule(notBefore, notAfter ACIv3TimeOfDay) ACIv3BindRule

TimeframeBindRule is a convenience function that returns a ACIv3BindRule instance for the purpose of expressing a timeframe during which access may (or may not) be granted. This is achieved by combining the two (2) ACIv3TimeOfDay input values in a Boolean "AND stack".

The notBefore input value defines the so-called "start" of the timeframe. It should be chronologically earlier than notAfter. This value will be used to craft a Greater-Than-Or-Equal (Ge) ACIv3BindRule expressive statement.

The notAfter input value defines the so-called "end" of the timeframe. It should be chronologically later than notBefore. This value will be used to craft a Less-Than (Lt) ACIv3BindRule expressive statement.

func (NetscapeACIv3) WeekdaysBindRule

func (r NetscapeACIv3) WeekdaysBindRule(cop any) (b ACIv3BindRule)

Weekdays is a convenient prefabricator function that returns an instance of ACIv3BindRule automatically assembled to express a sequence of weekdays. The sequence "ACIv3Monday through ACIv3Friday" can also be expressed via the bit-shifted value of sixty-two (62). See the ACIv3Day constants for the specific numerals used for summation in this manner.

Supplying an invalid or nonapplicable ACIv3Operator to this method shall return a bogus ACIv3BindRule instance.

func (NetscapeACIv3) WeekendBindRule

func (r NetscapeACIv3) WeekendBindRule(cop any) (b ACIv3BindRule)

Weekend is a convenient prefabricator function that returns an instance of ACIv3BindRule automatically assembled to express a sequence of ACIv3Sunday and ACIv3Saturday ACIv3Day instances. This sequence can also be expressed via the bit-shifted value of sixty-five (65). See the ACIv3Day constants for the specific numerals used for summation in this manner.

Supplying an invalid or nonapplicable ACIv3Operator to this method shall return a bogus ACIv3BindRule instance.

type NotTerm

type NotTerm struct {
	Term
}

NotTerm negates an instance of Term.

func (NotTerm) IsZero

func (r NotTerm) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (NotTerm) String

func (r NotTerm) String() (s string)

String returns the string representation of the receiver instance.

func (NotTerm) Valid

func (r NotTerm) Valid() (err error)

Valid returns an error following an analysis of the receiver instance.

type NumericOID

type NumericOID struct {
	*objectid.DotNotation
}

NumericOID embeds *objectid.DotNotation to implement "numericoid" per § 1.4 of RFC 4512:

numericoid = number 1*( DOT number )
number  = DIGIT / ( LDIGIT 1*DIGIT )

DIGIT   = %x30 / LDIGIT   ; "0"-"9"
LDIGIT  = %x31-39         ; "1"-"9"
DOT     = %x2E            ; period (".")

type NumericString

type NumericString string

NumericString implements § 3.3.23 of RFC 4517:

NumericString = 1*(DIGIT / SPACE)

func (NumericString) IsZero

func (r NumericString) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (NumericString) String

func (r NumericString) String() string

String returns the string representation of the receiver instance.

type ObjectClass

type ObjectClass struct {
	NumericOID   string
	Name         []string
	Description  string
	Obsolete     bool
	Kind         uint8 // 0=STRUCTURAL/1=AUXILIARY/2=ABSTRACT; DEFAULT=0
	SuperClasses []string
	Must         []string
	May          []string
	Extensions   map[int]Extension
	// contains filtered or unexported fields
}

ObjectClass implements § 4.1.1 of RFC 4512.

func (ObjectClass) AllMay

func (r ObjectClass) AllMay() (may *AttributeTypes)

AllMay returns an *AttributeTypes instance containing zero (0) or more OPTIONAL *AttributeType instances for use with this the receiver instance, as well as those specified by any and all applicable super classes.

The input types instance must contain all registered *AttributeType slice instances known to be registered within the relevant *SubschemaSubentry instance. Similarly, the input classes instance must contain all registered *ObjectClass instances known to be registered within that same *SubschemaSubentry instance.

Duplicate references are silently discarded.

Example
child, _ := exampleSchema.ObjectClass(`applicationProcess`)
fmt.Println(child.AllMay())
Output:

attributeTypes: ( 2.5.4.34 NAME 'seeAlso' SUP distinguishedName )
attributeTypes: ( 2.5.4.11 NAME ( 'ou' 'organizationalUnitName' ) SUP name )
attributeTypes: ( 2.5.4.7 NAME ( 'l' 'localityName' ) SUP name )
attributeTypes: ( 2.5.4.13 NAME 'description' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )

func (ObjectClass) AllMust

func (r ObjectClass) AllMust() (must *AttributeTypes)

AllMust returns an *AttributeTypes instance containing zero (0) or more MANDATORY *AttributeType instances for use with this the receiver instance, as well as those specified by any and all applicable super classes.

The input types instance must contain all registered *AttributeType slice instances known to be registered within the relevant *SubschemaSubentry instance. Similarly, the input classes instance must contain all registered *ObjectClass instances known to be registered within that same *SubschemaSubentry instance.

Duplicate references are silently discarded.

Example
child, _ := exampleSchema.ObjectClass(`subentry`)
fmt.Println(child.AllMust())
Output:

attributeTypes: ( 2.5.4.0 NAME 'objectClass' EQUALITY objectIdentifierMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )
attributeTypes: ( 2.5.4.3 NAME ( 'cn' 'commonName' ) DESC 'RFC4519: common name(s) for which the entity is known by' SUP name )
attributeTypes: ( 2.5.18.6 NAME 'subtreeSpecification' SYNTAX 1.3.6.1.4.1.1466.115.121.1.45 SINGLE-VALUE USAGE directoryOperation )

func (ObjectClass) Identifier

func (r ObjectClass) Identifier() (id string)

Identifier returns the principal string value by which the receiver is known. If the receiver is not assigned a name (descriptor), the numeric OID is returned instead.

func (*ObjectClass) IsZero

func (r *ObjectClass) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (ObjectClass) Match

func (r ObjectClass) Match(term string) bool

Match returns a Boolean value indicative of a match between the input string term value and the receiver's NumericOID or Name value.

Case is not significant in the matching process.

func (ObjectClass) OID

func (r ObjectClass) OID() string

OID returns the numeric OID literal "1.3.6.1.4.1.1466.115.121.1.37" per § 3.3.24 of RFC 4517.

func (ObjectClass) String

func (r ObjectClass) String() (def string)

String returns the string representation of the receiver instance.

func (ObjectClass) SubordinateClasses

func (r ObjectClass) SubordinateClasses() (sub *ObjectClasses)

SubordinateClasses returns slices of ObjectClass, each of which are direct subordinate classes of the input string id.

The input string id must be the numeric OID or name of the supposed superior class.

Note that if a name is used, case-folding is not significant in the matching process.

If zero slices are returned, this can mean either the superior class was not found, or that it has no subordinate classes of its own.

func (ObjectClass) SuperChain

func (r ObjectClass) SuperChain() (supers *ObjectClasses)

SuperChain returns an instance of ObjectClasses, which will contain zero (0) or more slices of ObjectClass, each of which representing a direct superior class of the receiver instance.

The input classes instance should represent the ObjectClasses instance obtained through a SubschemaSubentry instance.

Example
child, _ := exampleSchema.ObjectClass(`subentry`)
fmt.Println(child.SuperChain())
Output:

objectClasses: ( 2.5.6.0 NAME 'top' ABSTRACT MUST objectClass )
objectClasses: ( 2.5.17.0 NAME 'subentry' SUP top STRUCTURAL MUST ( cn $ subtreeSpecification ) X-ORIGIN 'RFC3672' )

func (ObjectClass) SuperClassOf

func (r ObjectClass) SuperClassOf(sub any) (sup bool)

SuperClassOf returns a Boolean value indicative of r being a superior ("SUP") ObjectClass of sub, which may be a string or bonafide instance of ObjectClass.

Note: this will trace all super class chains indefinitely and, thus, will recognize any superior association without regard for "depth".

Example
classes := exampleSchema.ObjectClasses
top, idx := classes.Get(`top`) // 2.5.6.0
if idx == -1 {
	// not found
	return
}

fmt.Println(top.SuperClassOf(`subentry`))
Output:

true

func (ObjectClass) SuperiorClasses

func (r ObjectClass) SuperiorClasses() (sup *ObjectClasses)

SuperiorClasses returns slices of *ObjectClass, each of which are direct superior object classes of the input string id.

The input string id must be the numeric OID or name of the subordinate object class.

Note that if a name is used, case-folding is not significant in the matching process.

If zero slices are returned, this can mean either the object class was not found, or that it has no superior classes of its own.

func (ObjectClass) Type

func (r ObjectClass) Type() string

func (ObjectClass) Valid

func (r ObjectClass) Valid() bool

Valid returns a Boolean value indicative of a syntactically valid receiver instance. Note this does not verify the presence of dependency schema elements.

func (ObjectClass) XOrigin

func (r ObjectClass) XOrigin() (origins []string)

XOrigin returns slices of standards citations, each being the name of an RFC, Internet-Draft or ITU-T Recommendation from which the receiver definition originates.

This method is merely a convenient alternative to manually checking the underlying Extensions field instance for the presence of an Extension instance bearing the `X-ORIGIN` XString and at least one (1) value.

type ObjectClasses

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

ObjectClasses implements § 4.2.1 of RFC 4512 and contains slices of ObjectClass.

func (ObjectClasses) Contains

func (r ObjectClasses) Contains(id string) (idx int)

Contains returns an integer index value indicative of a SchemaDefinition residing within the receiver instance which bears an identical value to id. If not found, -1 is returned.

func (ObjectClasses) Get

func (r ObjectClasses) Get(term string) (def *ObjectClass, idx int)

Get returns an instance of *ObjectClass and a slice index following a descriptor or numeric OID match attempt. A zero instance of *ObjectClass alongside an index of -1 is returned if no match is found.

Case is not significant in the matching process.

func (*ObjectClasses) Index

func (r *ObjectClasses) Index(idx int) (def *ObjectClass)

Index returns the Nth ObjectClass instances found within the receiver instance.

func (*ObjectClasses) IsZero

func (r *ObjectClasses) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

Example
var defs ObjectClasses
fmt.Println(defs.IsZero())
Output:

true

func (ObjectClasses) Len

func (r ObjectClasses) Len() int

func (ObjectClasses) OID

func (r ObjectClasses) OID() string

OID returns the numeric OID literal "2.5.21.6" per § 4.2.1 of RFC 4512.

func (*ObjectClasses) Push

func (r *ObjectClasses) Push(defs ...*ObjectClass)

Push appends def to the receiver instance if ALL of the following evaluate as true:

func (ObjectClasses) String

func (r ObjectClasses) String() (s string)

String returns the string representation of the receiver instance.

func (ObjectClasses) Table

func (r ObjectClasses) Table() (table SchemaDefinitionTable)

Inventory returns an instance of SchemaDefinitionTable which represents the current inventory of ObjectClass instances within the receiver.

func (ObjectClasses) Type

func (r ObjectClasses) Type() string

type OctetString

type OctetString []byte

OctetString implements § 3.3.25 of RFC 4517:

OctetString = *OCTET

func (OctetString) DER

func (r OctetString) DER() (der []byte, err error)

DER returns the ASN.1 DER encoding of the receiver instance alongside an error.

func (OctetString) IsZero

func (r OctetString) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

Example
var oct OctetString
fmt.Println(oct.IsZero())
Output:

true

func (OctetString) Len

func (r OctetString) Len() int

Len returns the integer length of the receiver instance.

func (OctetString) Size

func (r OctetString) Size() int

Size returns the summation of the ASN.1 OCTET STRING tag (4) and the byte size of the receiver instance

func (OctetString) String

func (r OctetString) String() string

String returns the string representation of the receiver instance.

type OrderingRuleAssertion

type OrderingRuleAssertion func(any, any, byte) (Boolean, error)

OrderingRuleAssertion defines a closure signature held by qualifying function instances intended to implement an Ordering MatchingRuleAssertion.

The semantics of the MatchingRuleAssertion are discussed in § 4.1 of RFC 4517.

type OtherMailbox

type OtherMailbox [2]string

OtherMailbox implements § 3.3.27 of RFC 4517:

OtherMailbox = mailbox-type DOLLAR mailbox
mailbox-type = PrintableString
mailbox      = IA5String
IA5String    = *(%x00-7F)

From § 1.4 of RFC 4512:

PrintableCharacter = ALPHA / DIGIT / SQUOTE / LPAREN / RPAREN /
                     PLUS / COMMA / HYPHEN / DOT / EQUALS /
                     SLASH / COLON / QUESTION / SPACE
PrintableString    = 1*PrintableCharacter

ALPHA   = %x41-5A / %x61-7A    ; "A"-"Z" / "a"-"z"
DIGIT   = %x30 / LDIGIT        ; "0"-"9"
SQUOTE  = %x27                 ; single quote ("'")
SPACE   = %x20                 ; space (" ")
LPAREN  = %x28                 ; left paren ("(")
RPAREN  = %x29                 ; right paren (")")
PLUS    = %x2B                 ; plus sign ("+")
COMMA   = %x2C                 ; comma (",")
HYPHEN  = %x2D                 ; hyphen ("-")
DOT     = %x2E                 ; period (".")
EQUALS  = %x3D                 ; equals sign ("=")
DOLLAR  = %x24	               ; dollar sign ("$")

From § 3.2 of RFC 4517:

IA5String          = *(%x00-7F)

type PostalAddress

type PostalAddress []string

PostalAddress implements the PostalAddress definition per § 3.3.28 of RFC 4517:

PostalAddress = line *( DOLLAR line )
line          = 1*line-char
line-char     = %x00-23
                / (%x5C "24")  ; escaped "$"
                / %x25-5B
                / (%x5C "5C")  ; escaped "\"
                / %x5D-7F
                / UTFMB

From § 1.4 of RFC 4512:

DOLLAR  = %x24	  ; dollar sign ("$")
UTFMB   = UTF2 / UTF3 / UTF4
UTF0    = %x80-BF
UTF1    = %x00-7F
UTF2    = %xC2-DF UTF0
UTF3    = %xE0 %xA0-BF UTF0 / %xE1-EC 2(UTF0) /
          %xED %x80-9F UTF0 / %xEE-EF 2(UTF0)
UTF4    = %xF0 %x90-BF 2(UTF0) / %xF1-F3 3(UTF0) /
          %xF4 %x80-8F 2(UTF0)

func (PostalAddress) String

func (r PostalAddress) String() string

String returns the string representation of the receiver instance.

type PrintableString

type PrintableString string

PrintableString implements § 3.3.29 of RFC 4517:

PrintableCharacter = ALPHA / DIGIT / SQUOTE / LPAREN / RPAREN /
                     PLUS / COMMA / HYPHEN / DOT / EQUALS /
                     SLASH / COLON / QUESTION / SPACE
PrintableString    = 1*PrintableCharacter

From § 1.4 of RFC 4512:

ALPHA   = %x41-5A / %x61-7A    ; "A"-"Z" / "a"-"z"
DIGIT   = %x30 / LDIGIT        ; "0"-"9"
SQUOTE  = %x27                 ; single quote ("'")
SPACE   = %x20                 ; space (" ")
LPAREN  = %x28                 ; left paren ("(")
RPAREN  = %x29                 ; right paren (")")
PLUS    = %x2B                 ; plus sign ("+")
COMMA   = %x2C                 ; comma (",")
HYPHEN  = %x2D                 ; hyphen ("-")
DOT     = %x2E                 ; period (".")
EQUALS  = %x3D                 ; equals sign ("=")

From § 3.2 of RFC 4517:

SLASH     = %x2F               ; forward slash ("/")
COLON     = %x3A               ; colon (":")
QUESTION  = %x3F               ; question mark ("?")

func (PrintableString) Choice

func (r PrintableString) Choice() string

func (PrintableString) IsZero

func (r PrintableString) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (PrintableString) String

func (r PrintableString) String() string

String returns the string representation of the receiver instance.

type RFC2307

type RFC2307 struct {
	// contains filtered or unexported fields

} // RFC 2307

func (RFC2307) BootParameter

func (r RFC2307) BootParameter(x any) (bp BootParameter, err error)

BootParameter returns an error following an analysis of x in the context of a NIS Boot Parameter.

func (RFC2307) Document

func (r RFC2307) Document() string

Document returns the string representation of the RFC 2307 document URL.

func (RFC2307) NetgroupTriple

func (r RFC2307) NetgroupTriple(x any) (trip NetgroupTriple, err error)

NISNetgroupTriple returns an instance of NetgroupTriple alongside an error.

The input value type must be a string, such as `("laptop","jesse","example.com")` or `("-","-","-")`.

type RFC3672

type RFC3672 struct {
	// contains filtered or unexported fields

} // RFC 3672

func (RFC3672) Document

func (r RFC3672) Document() string

Document returns the string representation of the RFC 3672 document URL.

func (RFC3672) SubtreeSpecification

func (r RFC3672) SubtreeSpecification(x any) (ss SubtreeSpecification, err error)

SubtreeSpecification returns an instance of SubtreeSpecification alongside an error.

If the input is nil, the default SubtreeSpecification (e.g.: "{}") is returned.

If the input is a string, an attempt to marshal the value is made. If the string is zero, this is equivalent to providing nil.

If the input is a *ber.Packet instance, it is unmarshaled into the return instance of SubtreeSpecification.

Any errors found will result in the return of an invalid Filter instance.

type RFC4511

type RFC4511 struct {
	// contains filtered or unexported fields

} // RFC 4511

func (RFC4511) Document

func (r RFC4511) Document() string

Document returns the string representation of the RFC 4511 document URL.

func (RFC4511) LDAPString

func (r RFC4511) LDAPString(x ...any) (LDAPString, error)

LDAPString returns an instance of LDAPString alongside an error.

func (RFC4511) SearchScope

func (r RFC4511) SearchScope(x any) (s SearchScope, err error)

Scope initializes, sets and returns an instance of SearchScope in one shot. Valid input types are as follows:

  • Standard scope names as string values (e.g.: `base`, `one`, `subtree`)
  • Integer representations of scopes (see the predefined SearchScope constants for details)

This function may only be needed in certain situations where a scope needs to be parsed from values with different representations. Usually the predefined SearchScope constants are sufficient.

type RFC4512

type RFC4512 struct {
	// contains filtered or unexported fields

} // RFC 4512

func (RFC4512) Descriptor

func (r RFC4512) Descriptor(x any) (Descriptor, error)

Descriptor returns an instance of Descriptor alongside an error. See also RFC4512.OID.

func (RFC4512) Document

func (r RFC4512) Document() string

Document returns the string representation of the RFC 4512 document URL.

func (RFC4512) NumericOID

func (r RFC4512) NumericOID(x any) (NumericOID, error)

NumericOID returns a instance of NumericOID alongside an error. See also RFC4512.OID.

func (RFC4512) OID

func (r RFC4512) OID(x any) (err error)

OID returns an error following an analysis of x in the context of either a numeric OID (numericoid) or descriptor (descr) value.

From § 1.4 of RFC 4512:

oid = descr / numericoid

See also NumericOID and Descriptor for ABNF productions.

func (RFC4512) SubschemaSubentry

func (r RFC4512) SubschemaSubentry(prime ...bool) (sch *SubschemaSubentry, err error)

SubschemaSubentry returns a freshly initialized instance of *SubschemaSubentry. Instances of this type serve as a platform upon which individual text definitions may be parsed into usable instances of SchemaDefinition.

The prime variadic argument controls whether to prime, or "pre-load", standard LDAPSyntax and MatchingRule definitions sourced from RFC 4512, RFC 4523 and RFC 2307 into the receiver instance. The default is false, which results in no such definitions being pre-loaded.

Generally speaking, it is RECOMMENDED that users pre-load these definitions UNLESS they are constructing a very stringent schema structure which only contains select syntaxes and matching rules -- a most unusual circumstance. In such a case, users will be required to register those select syntaxes and matching rules MANUALLY.

func (RFC4512) UTF8String

func (r RFC4512) UTF8String(x any) (UTF8String, error)

UTF8String returns an instance of UTF8String alongside an error following an analysis of x in the context of a UTF8-compliant string.

type RFC4514

type RFC4514 struct {
	// contains filtered or unexported fields

} // RFC 4514

func (RFC4514) DistinguishedName

func (r RFC4514) DistinguishedName(x any) (DistinguishedName, error)

DistinguishedName returns an error following an analysis of x in the context of a distinguished name.

Note: DN, RDN and ATV parsing capabilities derived from go-ldap/ldap/v3/dn.go

From § 3 of RFC 4514:

distinguishedName = [ relativeDistinguishedName *( COMMA relativeDistinguishedName ) ]
relativeDistinguishedName = attributeTypeAndValue *( PLUS attributeTypeAndValue )
attributeTypeAndValue = attributeType EQUALS attributeValue
attributeType = descr / numericoid
attributeValue = string / hexstring
string = [ ( leadchar / pair ) [ *( stringchar / pair ) ( trailchar / pair ) ] ]

leadchar = LUTF1 / UTFMB
LUTF1 = %x01-1F / %x21 / %x24-2A / %x2D-3A / %x3D / %x3F-5B / %x5D-7F

trailchar  = TUTF1 / UTFMB
TUTF1 = %x01-1F / %x21 / %x23-2A / %x2D-3A / %x3D / %x3F-5B / %x5D-7F

stringchar = SUTF1 / UTFMB
SUTF1 = %x01-21 / %x23-2A / %x2D-3A / %x3D / %x3F-5B / %x5D-7F

pair = ESC ( ESC / special / hexpair )
special = escaped / SPACE / SHARP / EQUALS
escaped = DQUOTE / PLUS / COMMA / SEMI / LANGLE / RANGLE
hexstring = SHARP 1*hexpair
hexpair = HEX HEX

func (RFC4514) Document

func (r RFC4514) Document() string

Document returns the string representation of the RFC 4514 document URL.

type RFC4515

type RFC4515 struct {
	// contains filtered or unexported fields

} // RFC 4515

func (RFC4515) Document

func (r RFC4515) Document() string

Document returns the string representation of the RFC 4515 document URL.

func (RFC4515) Filter

func (r RFC4515) Filter(x any) (Filter, error)

Filter returns a Filter qualifier instance alongside an error.

If the input is nil, the default FilterPresent (e.g.: "(objectClass=*)") is returned.

If the input is a string, an attempt to marshal the value is made. If the string is zero, this is equivalent to providing nil.

If the input is a *ber.Packet instance describing a previously parsed Filter, it is unmarshaled into the return instance of Filter.

Any errors found will result in the return of an invalid Filter instance.

type RFC4516

type RFC4516 struct {
	// contains filtered or unexported fields

} // RFC 4516

func (RFC4516) Document

func (r RFC4516) Document() string

Document returns the string representation of the RFC 4516 document URL.

func (RFC4516) URL

func (r RFC4516) URL(input string) (URL, error)

URL returns an instance of URL alongside an error following an attempt to parse input.

type RFC4517

type RFC4517 struct {
	// contains filtered or unexported fields

} // RFC 4517

func (RFC4517) BitString

func (r RFC4517) BitString(x any) (bs BitString, err error)

BitString returns an error following an analysis of x in the context of an ASN.1 BIT STRING.

func (RFC4517) Boolean

func (r RFC4517) Boolean(x any) (b Boolean, err error)

Boolean returns an instance of Boolean alongside an error.

Valid input types are native Go Booleans, string representations of Booleans and nil.

If the input is a Go Boolean, true is equal to "TRUE" in the context of directory values, while false is equal to "FALSE". The return error instance shall always be nil.

If the input is a string, case is not significant in the matching process. A value of "TRUE" returns a Go Boolean of true, while "FALSE" returns false. Any other string value results in an error.

If the input is nil, the return is a zero instance of Boolean.

All other input types return an error.

From § 3.3.3 of RFC 4517:

Boolean = "TRUE" / "FALSE"

func (RFC4517) CountryString

func (r RFC4517) CountryString(x any) (CountryString, error)

CountryString returns an error following an analysis of x in the context of an ISO 3166 country code. Note that specific codes -- though syntactically valid -- should be verified periodically in lieu of significant world events.

func (RFC4517) DeliveryMethod

func (r RFC4517) DeliveryMethod(x any) (DeliveryMethod, error)

DeliveryMethod returns an error following an analysis of x in the context of a DeliveryMethod.

func (RFC4517) Descriptor

func (r RFC4517) Descriptor(x any) (Descriptor, error)

Descriptor is a wrapping alias of RFC4512.Descriptor.

func (RFC4517) DirectoryString

func (r RFC4517) DirectoryString(x any) (DirectoryString, error)

DirectoryString returns an instance of DirectoryString alongside an error.

The following input types are accepted:

func (RFC4517) DistinguishedName

func (r RFC4517) DistinguishedName(x any) (dn DistinguishedName, err error)

DistinguishedName is a wrapping alias for [RFC4514.DN].

func (RFC4517) Document

func (r RFC4517) Document() string

Document returns the string representation of the RFC 4517 document URL.

func (RFC4517) EnhancedGuide

func (r RFC4517) EnhancedGuide(x any) (EnhancedGuide, error)

EnhancedGuide returns an instance of EnhancedGuide alongside an error.

func (RFC4517) FacsimileTelephoneNumber

func (r RFC4517) FacsimileTelephoneNumber(x any) (FacsimileTelephoneNumber, error)

FacsimileTelephoneNumber returns an instance of FacsimileTelephoneNumber alongside an error.

From § 3.3.11 of RFC 4517:

fax-number       = telephone-number *( DOLLAR fax-parameter )
telephone-number = PrintableString
fax-parameter    = "twoDimensional" /
                   "fineResolution" /
                   "unlimitedLength" /
                   "b4Length" /
                   "a3Width" /
                   "b4Width" /
                   "uncompressed"

From § 1.4 of RFC 4512:

DOLLAR  = %x24 ; dollar sign ("$")

func (RFC4517) Fax

func (r RFC4517) Fax(x any) (Fax, error)

Fax returns an instance of Fax alongside an error following an attempt to unmarshal x.

Input x should be the ASN.1 encoded bytes of the receiver instance in string or []byte form.

func (RFC4517) GeneralizedTime

func (r RFC4517) GeneralizedTime(x any) (gt GeneralizedTime, err error)

GeneralizedTime returns an instance of GeneralizedTime alongside an error.

func (RFC4517) Guide

func (r RFC4517) Guide(x any) (Guide, error)

Guide returns an instance of Guide alongside an error.

func (RFC4517) IA5String

func (r RFC4517) IA5String(x any) (ia5 IA5String, err error)

IA5String returns an instance of IA5String alongside an error following an analysis of x in the context of an IA5 String.

func (RFC4517) Integer

func (r RFC4517) Integer(x any) (Integer, error)

Integer returns an instance of Integer alongside an error following an analysis of x in the context of an ASN.1 Integer.

x may be any Go primitive number, *big.Int, string or []byte. If x is a []byte instance, it is assumed to be ASN.1 DER encoded bytes.

func (RFC4517) JPEG

func (r RFC4517) JPEG(x any) error

JPEG returns an error following an analysis of x in the context of a JFIF enveloped payload, which resembles the following:

                      +- NULL (CTRL+@)
                     /  +- DATA LINK ESCAPE (CTRL+P)
                    /  /  +- ENVELOPE LITERAL
                   +  +   |
       ÿ  Ø  ÿ  à  |  |   |                         ÿ  Ù
      -- -- -- -- -- -- ----                       -- --
<SOF> FF D8 FF 0E 00 10 JFIF <variable image data> FF D9 <EOF>

Note that only the envelope elements -- specifically the header and footer -- are read. Actual image data is skipped for performance reasons.

Valid input values are string and []byte.

If the input value is a string, it is assumed the value leads to a path and filename of a JPEG image file.

If the input value is a []byte instance, it may be raw JPEG data, or Base64 encoded JPEG data. If Base64 encoded, it is decoded and processed.

All other input types result in an error.

Aside from the error instance, there is no return type for parsed JPEG content, as this would not serve any useful purpose to end users in any of the intended use cases for this package.

See also § 3.3.17 of RFC 4517.

func (RFC4517) NameAndOptionalUID

func (r RFC4517) NameAndOptionalUID(x any) (NameAndOptionalUID, error)

NameAndOptionalUID returns an instance of NameAndOptionalUID alongside an error.

func (RFC4517) NumericOID

func (r RFC4517) NumericOID(x any) (NumericOID, error)

NumericOID is a wrapping alias of RFC4512.NumericOID.

func (RFC4517) NumericString

func (r RFC4517) NumericString(x any) (NumericString, error)

NumericString returns an instance of NumericString alongside an error following an analysis of x in the context of a Numeric String.

func (RFC4517) OID

func (r RFC4517) OID(x any) (err error)

OID is a wrapping alias of RFC4512.OID.

func (RFC4517) OctetString

func (r RFC4517) OctetString(x any) (OctetString, error)

OctetString returns an instance of OctetString alongside an error following an analysis of x in the context of an Octet String.

func (RFC4517) OtherMailbox

func (r RFC4517) OtherMailbox(x any) (OtherMailbox, error)

OtherMailbox returns an error following an analysis of x in the context of an OtherMailbox.

func (RFC4517) PostalAddress

func (r RFC4517) PostalAddress(x any) (PostalAddress, error)

PostalAddress returns an error following an analysis of x in the context of a PostalAddress.

func (RFC4517) PrintableString

func (r RFC4517) PrintableString(x any) (PrintableString, error)

PrintableString returns an error following an analysis of x in the context of a PrintableString.

func (RFC4517) SubstringAssertion

func (r RFC4517) SubstringAssertion(x any) (SubstringAssertion, error)

SubstringAssertion returns an error following an analysis of x in the context of a Substring Assertion.

func (RFC4517) TelephoneNumber

func (r RFC4517) TelephoneNumber(x any) (TelephoneNumber, error)

TelephoneNumber returns an instance of TelephoneNumber alongside an error following an analysis of x in the context of a Telephone Number.

func (RFC4517) TeletexString deprecated

func (r RFC4517) TeletexString(x any) (TeletexString, error)

Deprecated: TeletexString returns an instance of TeletexString alongside an error following an analysis of x in the context of a Teletex String, per ITU-T Rec. T.61.

func (RFC4517) TeletexTerminalIdentifier

func (r RFC4517) TeletexTerminalIdentifier(x any) (TeletexTerminalIdentifier, error)

TeletexTerminalIdentifier returns an error following an analysis of x in the context of a Teletex Terminal Identifier.

func (RFC4517) TelexNumber

func (r RFC4517) TelexNumber(x any) (TelexNumber, error)

TelexNumber returns an error following an analysis of x in the context of a Telex Number.

func (RFC4517) UTCTime deprecated

func (r RFC4517) UTCTime(x any) (utc UTCTime, err error)

Deprecated: UTCTime is intended for historical support only; use GeneralizedTime instead.

UTCTime returns an error following an analysis of x in the context of a (deprecated) UTC Time value.

func (RFC4517) UniversalString

func (r RFC4517) UniversalString(x any) (UniversalString, error)

UniversalString returns an instance of UniversalString alongside an error following an analysis of x in the context of a UniversalString.

type RFC4523

type RFC4523 struct {
	// contains filtered or unexported fields

} // RFC 4523

func (RFC4523) Document

func (r RFC4523) Document() string

Document returns the string representation of the RFC 4523 document URL.

type RFC4530

type RFC4530 struct {
	// contains filtered or unexported fields

} // RFC 4530

func (RFC4530) Document

func (r RFC4530) Document() string

Document returns the string representation of the RFC 4530 document URL.

func (RFC4530) UUID

func (r RFC4530) UUID(x any) (UUID, error)

UUID returns an instance of UUID alongside an error.

type Refinement

type Refinement interface {
	// BER returns the BER encoding of the receiver
	// instance alongside an error.
	BER() (*ber.Packet, error)

	// Index returns the Nth slice index found within
	// the receiver instance. This is only useful if
	// the receiver is an RefinementAnd or RefinementOr
	// Refinement qualifier type instance.
	Index(int) Refinement

	// IsZero returns a Boolean value indicative of
	// a nil receiver state.
	IsZero() bool

	// String returns the string representation of
	// the receiver instance.
	String() string

	// Choice returns the string CHOICE "name" of the
	// receiver instance. Use of this method is merely
	// intended as a convenient alternative to type
	// assertion checks.
	Choice() string

	// Len returns the integer length of the receiver
	// instance. This is only useful if the receiver is
	// an RefinementAnd or RefinementOr Refinement
	// qualifier type instance.
	Len() int
	// contains filtered or unexported methods
}

Refinement implements Appendix A of RFC 3672, and serves as the "SpecificationFilter" optionally found within a Subtree Specification. It is qualified through instances of:

From Appendix A of RFC 3672:

Refinement  = item / and / or / not
item        = id-item ":" OBJECT-IDENTIFIER
and         = id-and  ":" Refinements
or          = id-or   ":" Refinements
not         = id-not  ":" Refinement

Refinements = "{" [ sp Refinement *( "," sp Refinement ) ] sp "}"
id-item     = %x69.74.65.6D ; "item"
id-and      = %x61.6E.64    ; "and"
id-or       = %x6F.72       ; "or"
id-not      = %x6E.6F.74    ; "not"

From ITU-T Rec. X.501 clause 12.3.5:

Refinement ::= CHOICE {
	item [0] OBJECT-CLASS.&id,
	and  [1] SET SIZE (1..MAX) OF Refinement,
	or   [2] SET SIZE (1..MAX) OF Refinement,
	not  [3] Refinement,
	... }

type RefinementAnd

type RefinementAnd []Refinement

RefinementAnd implements slices of Refinement, all of which are expected to evaluate as true during processing.

Instances of this type qualify the Refinement interface type.

func (RefinementAnd) BER

func (r RefinementAnd) BER() (packet *ber.Packet, err error)

BER returns the BER encoding of the receiver instance.

func (RefinementAnd) Choice

func (r RefinementAnd) Choice() string

Type returns the string literal "and" as the ASN.1 CHOICE.

func (RefinementAnd) Index

func (r RefinementAnd) Index(idx int) (x Refinement)

Index returns the Nth slice index found within the receiver instance.

func (RefinementAnd) IsZero

func (r RefinementAnd) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (RefinementAnd) Len

func (r RefinementAnd) Len() int

Len returns the integer length of the receiver instance.

func (*RefinementAnd) Push

func (r *RefinementAnd) Push(x ...any)

Push appends zero (0) or more instances of string or Refinement to the receiver instance.

func (RefinementAnd) String

func (r RefinementAnd) String() (s string)

String returns the string representation of the receiver instance.

type RefinementItem

type RefinementItem string

RefinementItem implements the core ("atom") value type to be used in Refinement statements, and appears in RefinementAnd, RefinementOr and RefinementNot Refinement qualifier type instances.

This is the only "tangible" type in the "specificationFilter" formula, as all other types simply act as contextual "envelopes" meant to, ultimately, store instances of this type.

Instances of this type qualify the Refinement interface type.

func (RefinementItem) BER

func (r RefinementItem) BER() (packet *ber.Packet, err error)

BER returns the BER encoding of the receiver instance.

func (RefinementItem) Choice

func (r RefinementItem) Choice() string

Type returns the string literal "item" as the ASN.1 CHOICE.

func (RefinementItem) Index

func (r RefinementItem) Index(_ int) Refinement

Index returns the receiver instance of Refinement. This method only exists to satisfy Go's interface signature requirement.

func (RefinementItem) IsZero

func (r RefinementItem) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (RefinementItem) Len

func (r RefinementItem) Len() int

Len always returns the integer 1 (one). This method only exists to satisfy Go's interface signature requirements.

func (RefinementItem) String

func (r RefinementItem) String() (s string)

String returns the string representation of the receiver instance.

type RefinementNot

type RefinementNot struct {
	Refinement
}

RefinementNot implements a negated, recursive instance of Refinement. Normally during processing, instances of this type are processed first when present among other qualifiers as siblings (slices), such as with RefinementAnd and RefinementOr instances.

Instances of this type qualify the Refinement interface type.

func (RefinementNot) BER

func (r RefinementNot) BER() (packet *ber.Packet, err error)

BER returns the BER encoding of the receiver instance.

func (RefinementNot) Choice

func (r RefinementNot) Choice() string

Type returns the string literal "not" as the ASN.1 CHOICE.

func (RefinementNot) Index

func (r RefinementNot) Index(idx int) (x Refinement)

Index returns the Nth slice index found within the receiver instance.

func (RefinementNot) IsZero

func (r RefinementNot) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (RefinementNot) Len

func (r RefinementNot) Len() (l int)

Len returns the integer length of the receiver instance.

func (RefinementNot) String

func (r RefinementNot) String() string

String returns the string representation of the receiver instance.

type RefinementOr

type RefinementOr []Refinement

RefinementOr implements slices of Refinement, at least one of which is expected to evaluate as true during processing.

Instances of this type qualify the Refinement interface type.

func (RefinementOr) BER

func (r RefinementOr) BER() (packet *ber.Packet, err error)

BER returns the BER encoding of the receiver instance.

func (RefinementOr) Choice

func (r RefinementOr) Choice() string

Type returns the string literal "or" as the ASN.1 CHOICE.

func (RefinementOr) Index

func (r RefinementOr) Index(idx int) (x Refinement)

Index returns the Nth slice index found within the receiver instance.

func (RefinementOr) IsZero

func (r RefinementOr) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (RefinementOr) Len

func (r RefinementOr) Len() int

Len returns the integer length of the receiver instance.

func (*RefinementOr) Push

func (r *RefinementOr) Push(x ...any)

Push appends zero (0) or more instances of string or Refinement to the receiver instance.

func (RefinementOr) String

func (r RefinementOr) String() (s string)

String returns the string representation of the receiver instance.

type RelativeDistinguishedName

type RelativeDistinguishedName struct {
	Attributes []*AttributeTypeAndValue
}

RelativeDistinguishedName implements the relativeDistinguishedName defined in Section 3 of RFC4514.

func (*RelativeDistinguishedName) Equal

Equal returns true if the RelativeDistinguishedName is equal as defined in Section 4.2.15 of RFC4517 (distinguishedNameMatch).

Relative distinguished names are the same if and only if they have the same number of AttributeTypeAndValues and each attribute of the first RDN is the same as the attribute of the second RDN with the same attribute type.

The order of attributes is not significant. Case of attribute types is not significant.

func (*RelativeDistinguishedName) EqualFold

EqualFold returns true if the relativeDistinguishedNames are equal as defined in Section 4.2.15 of RFC4517 (distinguishedNameMatch).

Case of the attribute type is not significant.

func (*RelativeDistinguishedName) String

func (r *RelativeDistinguishedName) String() string

String returns a normalized string representation of this relative distinguishedName which is the join of all attributes (sorted in increasing order) with a "+".

type RelativeLDAPDN

type RelativeLDAPDN LDAPString

RelativeLDAPDN implements the string form of a relative distinguished name.

type SchemaDefinition

type SchemaDefinition interface {
	// OID returns the official ASN.1 OBJECT IDENTIFIER
	// (numeric OID) belonging to the underlying TYPE --
	// NOT the individual definition's assigned OID (see
	// the NumericOID struct field).
	OID() string

	// IsZero returns a Boolean value indicative of a nil
	// receiver state.
	IsZero() bool

	// Identifier returns the receiver's descriptor OR
	// (if one was not set) its numeric OID.
	Identifier() string

	// Type returns the string type name of the receiver
	// instance (e.g.: "attributeType").
	Type() string

	// Valid returns a Boolean value indicative of a valid
	// receiver state.
	Valid() bool

	// String returns the string representation of the
	// receiver instance.
	String() string

	// XOrigin returns slices of standard names, which may
	// be RFCs, Internet-Drafts or ITU-T Recommendations,
	// from which the receiver originates.
	XOrigin() []string
	// contains filtered or unexported methods
}

SchemaDefinition is an interface type qualified through instances of the following types:

type SchemaDefinitionTable

type SchemaDefinitionTable map[string][]string

SchemaDefinitionTable implements a basic map[string][]string lookup table for a particular SchemaDefinitions instance.

With the exception of DITStructureRules, which uses integer identifiers (e.g.: "1"), the keys are numeric OIDs (e.g.: "2.5.4.3").

With the exception of LDAPSyntaxes, which uses a description string, the values are zero (0) or more string slices, each representing a descriptor (name) by which the definition is known (e.g.: []string{"cn","commonName"})

Instances of this type may be created using any of the following methods:

type SchemaDefinitions

type SchemaDefinitions interface {
	// Len returns the integer length of the receiver instance.
	Len() int

	// OID returns the official ASN.1 OBJECT IDENTIFIER
	// (numeric OID) belonging to the underlying TYPE.
	OID() string

	// Type returns the string type name of the receiver
	// instance (e.g.: "attributeTypes").
	Type() string

	// IsZero returns a Boolean value indicative of a nil
	// receiver state.
	IsZero() bool

	// String returns the string representation of the
	// receiver instance.
	String() string

	// Contains returns an integer index value indicative
	// of whether the specified SchemaDefinition -- identified
	// by descriptor or numeric OID -- resides within
	// the receiver instance and what what numerical index.
	//
	// In the event of an instance of LDAPSyntaxes,
	// the description is used in place of a descriptor,
	// and can be matched regardless of whitespace or
	// case folding.
	//
	// In the event of an instance of DITStructureRule,
	// an integer identifier (rule ID) may be used in
	// place of a numeric OID.
	//
	// If a particular search term is not found, -1 is
	// subsequently returned.
	Contains(string) int

	// Push appends a SchemaDefinition instance into the
	// receiver instance. Uniqueness checks are conducted
	// automatically using the numeric OID (or rule ID in
	// the case of a DITStructureRule).
	Push(...SchemaDefinition)

	// Table returns an instance of [SchemaDefinitionTable].
	Table() SchemaDefinitionTable
	// contains filtered or unexported methods
}

SchemaDefinitions is an interface type qualified through instances of the following types:

It is generally discouraged to modify instances of the above types directly due to thread safety concerns; instead, perform modifications via the appropriate instance of the SubschemaSubentry type.

type SearchScope

type SearchScope uint8

SearchScope is a type definition used to represent one of the four (4) possible LDAP Search Scope types that are eligible for use within the ACIv3 syntax specification honored by this package.

SearchScope constants are generally used for crafting TargetRule instances that bear the [TargetScope] [TargetKeyword], as well as for crafting fully-qualified LDAP Search URIs.

See the SearchScope constants defined in this package for specific scopes available.

const (
	ScopeBaseObject  SearchScope // 0x1, `base`
	ScopeSingleLevel             // 0x2, `one` or `onelevel`
	ScopeSubtree                 // 0x3, `sub` or `subtree`

)

SearchScope constants define four (4) known LDAP Search Scopes permitted for use per the ACIv3 syntax specification honored by this package.

func (SearchScope) String

func (r SearchScope) String() (s string)

standard returns the more common naming variations for a given search scope. Generally, these are used in fully-qualified LDAP Search URL statements.

type Sources

type Sources struct{}

Sources extends a method for each constructor type.

This is merely a portable alternative to manual allocation of individual constructor type variables, e.g.:

  var (
	r X690
	s RFC4517
	n NetscapeACIv3
  )

  der, err := r.DER(args)
  ...
  tim, err := s.GeneralizedTime(args)
  ...
  aci, err := n.ACIv3Instruction(args)

... thus, instead, allowing:

var r Sources
der, err := r.X690().DER(args)
...
tim, err := r.RFC4517().GeneralizedTime(args)
...
aci, err := r.ACIv3().ACIv3Instruction(args)
...

Instances of this type are most useful when several types are being managed together, particularly in one location or process.

func (Sources) ACIv3

func (r Sources) ACIv3() NetscapeACIv3

ACIv3 returns the NetscapeACIv3 constructor type.

func (Sources) RFC2307

func (r Sources) RFC2307() RFC2307

RFC2307 returns the RFC2307 constructor type.

func (Sources) RFC3672

func (r Sources) RFC3672() RFC3672

RFC3672 returns the RFC3672 constructor type.

func (Sources) RFC4511

func (r Sources) RFC4511() RFC4511

RFC4511 returns the RFC4511 constructor type.

func (Sources) RFC4512

func (r Sources) RFC4512() RFC4512

RFC4512 returns the RFC4512 constructor type.

func (Sources) RFC4514

func (r Sources) RFC4514() RFC4514

RFC4514 returns the RFC4514 constructor type.

func (Sources) RFC4515

func (r Sources) RFC4515() RFC4515

RFC4515 returns the RFC4515 constructor type.

func (Sources) RFC4516

func (r Sources) RFC4516() RFC4516

RFC4516 returns the RFC4516 constructor type.

func (Sources) RFC4517

func (r Sources) RFC4517() RFC4517

RFC4517 returns the RFC4517 constructor type.

func (Sources) RFC4523

func (r Sources) RFC4523() RFC4523

RFC4523 returns the RFC4523 constructor type.

func (Sources) RFC4530

func (r Sources) RFC4530() RFC4530

RFC4530 returns the RFC4530 constructor type.

func (Sources) X501

func (r Sources) X501() X501

X501 returns the ITU-T Rec. X501 constructor type.

func (Sources) X520

func (r Sources) X520() X520

X520 returns the ITU-T Rec. X520 constructor type.

func (Sources) X680

func (r Sources) X680() X680

X680 returns the ITU-T Rec. X680 constructor type.

func (Sources) X690

func (r Sources) X690() X690

X690 returns the ITU-T Rec. X690 constructor type.

type SpecificExclusion

type SpecificExclusion struct {
	ChopBefore LocalName `asn1:"tag:0"`
	ChopAfter  LocalName `asn1:"tag:1"`
}

SpecificExclusion implements the chopSpecification specificExclusion component.

From § 2.1 of RFC 3672:

LocalName ::= RDNSequence
SET OF CHOICE {
   chopBefore [0] LocalName,
   chopAfter  [1] LocalName }

From Appendix A of RFC 3672:

SpecificExclusion  = chopBefore / chopAfter
chopBefore         = id-chopBefore ":" LocalName
chopAfter          = id-chopAfter  ":" LocalName
id-chopBefore      = %x63.68.6F.70.42.65.66.6F.72.65 ; "chopBefore"
id-chopAfter       = %x63.68.6F.70.41.66.74.65.72    ; "chopAfter"

func (SpecificExclusion) BER

func (r SpecificExclusion) BER() (*ber.Packet, error)

func (SpecificExclusion) Choice

func (r SpecificExclusion) Choice() (se string)

String returns the string literal "before" or "after" as the selected ASN.1 CHOICE. The determination is made based upon non-zeroness of the respective LocalName value. A zero string is returned if the instance is invalid.

func (SpecificExclusion) IsZero

func (r SpecificExclusion) IsZero() bool

func (SpecificExclusion) String

func (r SpecificExclusion) String() (s string)

String returns the string representation of the receiver instance.

type SpecificExclusions

type SpecificExclusions []SpecificExclusion

SpecificExclusions implements the chopSpecification specificExclusions ASN.1 SET OF CHOICE component.

From Appendix A of RFC 3672:

SpecificExclusions = "{" [ sp SpecificExclusion *( "," sp SpecificExclusion ) ] sp "}"

func (SpecificExclusions) BER

func (r SpecificExclusions) BER() (*ber.Packet, error)

func (SpecificExclusions) IsZero

func (r SpecificExclusions) IsZero() bool

func (SpecificExclusions) Len

func (r SpecificExclusions) Len() int

func (SpecificExclusions) String

func (r SpecificExclusions) String() string

String returns the string representation of the receiver instance.

type SubschemaSubentry

SubschemaSubentry implements § 4.2 of RFC 4512 and contains slice types of various SchemaDefinition types.

Instances of this type are thread safe by way of an internal instance of sync/Mutex. No special actions are required by users to make use of this feature, and its invocation is automatic wherever appropriate.

func (*SubschemaSubentry) AttributeType

func (r *SubschemaSubentry) AttributeType(term string) (*AttributeType, int)

AttributeType returns an instance of *AttributeType alongside the associated integer index. If not found, the index shall be -1 and the schema definition shall be unpopulated.

The input id value (identifier) should be the string representation of the desired AttributeType numeric OID, or name (descriptor).

Note that if a name is used, case-folding is not significant in the matching process.

func (*SubschemaSubentry) AttributeTypeByIndex

func (r *SubschemaSubentry) AttributeTypeByIndex(idx int) (def *AttributeType)

AttributeTypeIndex returns the Nth AttributeType instances found within the receiver instance.

func (*SubschemaSubentry) Counters

func (r *SubschemaSubentry) Counters() (counters [9]uint)

Counters returns an instance of [9]uint, each slice representing the current number of SchemaDefinition instances of a particular collection, while the final slice represents the sum total of the previous eight (8).

Collection indices are as follows:

  • 0 - "LDAPSyntaxes"
  • 1 - "MatchingRules"
  • 2 - "AttributeTypes"
  • 3 - "MatchingRuleUses"
  • 4 - "ObjectClasses"
  • 5 - "DITContentRules"
  • 6 - "NameForms"
  • 7 - "DITStructureRules"
  • 8 - "total"

As the return type is fixed, there is no risk of panic when calling indices 0 through 8 in any circumstance.

Note that locking is engaged by this method for the purposes of thread safe tallying and summation.

Example

This example demonstrates a convenient means of counting each SchemaDefinition by category. The return type (an instance of [9]uint) is of the following structure:

 LDAPSyntaxes
 |  MatchingRules
 |  |  AttributeTypes
 |  |  |  MatchingRuleUses
 |  |  |  |
 |  |  |  |
 |  |  |  |
[67 44 96 44 29 0 1 2 283]
             |  | | | |
             |  | | | Grand Total
             |  | | DITStructureRules
             |  | NameForms
             |  DITContentRules
             ObjectClasses
fmt.Println(exampleSchema.Counters())
Output:

[67 45 97 44 29 2 1 2 287]

func (*SubschemaSubentry) DITContentRule

func (r *SubschemaSubentry) DITContentRule(term string) (*DITContentRule, int)

DITContentRule returns an instance of *DITContentRule alongside the associated integer index. If not found, the index shall be -1 and the schema definition shall be unpopulated.

The input id value (identifier) should be the string representation of the desired DITContentRule numeric OID, or name (descriptor).

Note that if a name is used, case-folding is not significant in the matching process.

func (*SubschemaSubentry) DITContentRuleByIndex

func (r *SubschemaSubentry) DITContentRuleByIndex(idx int) (def *DITContentRule)

DITContentRuleIndex returns the Nth DITContentRule instances found within the receiver instance.

func (*SubschemaSubentry) DITStructureRule

func (r *SubschemaSubentry) DITStructureRule(term string) (*DITStructureRule, int)

DITStructureRule returns an instance of *DITStructureRule alongside the associated integer index. If not found, the index shall be -1 and the schema definition shall be unpopulated.

The input id value (identifier) should be the string representation of the desired DITStructureRule integer identifier (rule ID), or name (descriptor).

Note that if a name is used, case-folding is not significant in the matching process.

func (*SubschemaSubentry) DITStructureRuleByIndex

func (r *SubschemaSubentry) DITStructureRuleByIndex(idx int) (def *DITStructureRule)

DITStructureRuleIndex returns the Nth DITStructureRule instances found within the receiver instance.

func (*SubschemaSubentry) LDAPSyntax

func (r *SubschemaSubentry) LDAPSyntax(term string) (*LDAPSyntax, int)

LDAPSyntax returns an instance of *LDAPSyntax alongside the associated integer index. If not found, the index shall be -1 and the definition shall be unpopulated.

The input id value (identifier) should be the string representation of the desired LDAPSyntax numeric OID, or the description text.

Note that if description text is used, neither whitespace nor case-folding are significant in the matching process.

Example
def, idx := exampleSchema.LDAPSyntax(`INTEGER`)
if idx == -1 {
	fmt.Println("No such definition found")
	return
}

fmt.Println(def.NumericOID)
Output:

1.3.6.1.4.1.1466.115.121.1.27

func (*SubschemaSubentry) LDAPSyntaxByIndex

func (r *SubschemaSubentry) LDAPSyntaxByIndex(idx int) (def *LDAPSyntax)

LDAPSyntaxByIndex returns the Nth LDAPSyntax instances found within the receiver instance.

func (*SubschemaSubentry) MatchingRule

func (r *SubschemaSubentry) MatchingRule(term string) (*MatchingRule, int)

MatchingRule returns an instance of *MatchingRule alongside the associated integer index. If not found, the index shall be -1 and the schema definition shall be unpopulated.

The input id value (identifier) should be the string representation of the desired MatchingRule numeric OID, or name (descriptor).

Note that if a name is used, case-folding is not significant in the matching process.

Example
mr, idx := exampleSchema.MatchingRule(`caseExactMatch`)
if idx == -1 {
	fmt.Println("No such definition found")
	return
}

fmt.Println(mr.NumericOID)
Output:

2.5.13.5

func (*SubschemaSubentry) MatchingRuleByIndex

func (r *SubschemaSubentry) MatchingRuleByIndex(idx int) (def *MatchingRule)

MatchingRuleIndex returns the Nth MatchingRule instances found within the receiver instance.

func (*SubschemaSubentry) MatchingRuleUse

func (r *SubschemaSubentry) MatchingRuleUse(term string) (*MatchingRuleUse, int)

MatchingRuleUse returns an instance of *MatchingRuleUse alongside the associated integer index. If not found, the index shall be -1 and the schema definition shall be unpopulated.

The input id value (identifier) should be the string representation of the desired MatchingRuleUse numeric OID, or name (descriptor).

Note that if a name is used, case-folding is not significant in the matching process.

func (*SubschemaSubentry) MatchingRuleUseByIndex

func (r *SubschemaSubentry) MatchingRuleUseByIndex(idx int) (def *MatchingRuleUse)

MatchingRuleUseIndex returns the Nth MatchingRuleUse instances found within the receiver instance.

func (*SubschemaSubentry) NameForm

func (r *SubschemaSubentry) NameForm(term string) (*NameForm, int)

NameForm returns an instance of *NameForm alongside the associated integer index. If not found, the index shall be -1 and the schema definition shall be unpopulated.

The input id value (identifier) should be the string representation of the desired NameForm numeric OID, or name (descriptor).

Note that if a name is used, case-folding is not significant in the matching process.

func (*SubschemaSubentry) NameFormByIndex

func (r *SubschemaSubentry) NameFormByIndex(idx int) (def *NameForm)

NameFormIndex returns the Nth NameForm instances found within the receiver instance.

func (*SubschemaSubentry) NewAttributeTypes

func (r *SubschemaSubentry) NewAttributeTypes() *AttributeTypes

NewAttributeTypes returns an empty, but initialized and thread-safe, instance of *AttributeTypes intended for general use.

func (*SubschemaSubentry) NewDITContentRules

func (r *SubschemaSubentry) NewDITContentRules() *DITContentRules

NewDITContentRules returns an empty, but initialized and thread-safe, instance of *DITContentRules intended for general use.

func (*SubschemaSubentry) NewDITStructureRules

func (r *SubschemaSubentry) NewDITStructureRules() *DITStructureRules

NewDITStructureRules returns an empty, but initialized and thread-safe, instance of *DITStructureRules intended for general use.

func (*SubschemaSubentry) NewLDAPSyntaxes

func (r *SubschemaSubentry) NewLDAPSyntaxes() *LDAPSyntaxes

NewLDAPSyntaxes returns an empty, but initialized and thread-safe, instance of *LDAPSyntaxes intended for general use.

func (*SubschemaSubentry) NewMatchingRuleUses

func (r *SubschemaSubentry) NewMatchingRuleUses() *MatchingRuleUses

NewMatchingRuleUses returns an empty, but initialized and thread-safe, instance of *MatchingRuleUses intended for general use.

func (*SubschemaSubentry) NewMatchingRules

func (r *SubschemaSubentry) NewMatchingRules() *MatchingRules

NewMatchingRules returns an empty, but initialized and thread-safe, instance of *MatchingRules intended for general use.

func (*SubschemaSubentry) NewNameForms

func (r *SubschemaSubentry) NewNameForms() *NameForms

NewNameForms returns an empty, but initialized and thread-safe, instance of *NameForms intended for general use.

func (*SubschemaSubentry) NewObjectClasses

func (r *SubschemaSubentry) NewObjectClasses() *ObjectClasses

NewObjectClasses returns an empty, but initialized and thread-safe, instance of *ObjectClasses intended for general use.

func (SubschemaSubentry) OID

func (r SubschemaSubentry) OID() string

OID returns the numeric OID literal "2.5.18.10" per § 4.2 of RFC 4512.

func (*SubschemaSubentry) ObjectClass

func (r *SubschemaSubentry) ObjectClass(term string) (*ObjectClass, int)

ObjectClass returns an instance of *ObjectClass alongside the associated integer index. If not found, the index shall be -1 and the schema definition shall be unpopulated.

The input id value (identifier) should be the string representation of the desired *ObjectClass numeric OID, or name (descriptor).

Note that if a name is used, case-folding is not significant in the matching process.

func (*SubschemaSubentry) ObjectClassByIndex

func (r *SubschemaSubentry) ObjectClassByIndex(idx int) (def *ObjectClass)

ObjectClassIndex returns the Nth ObjectClass instances found within the receiver instance.

func (*SubschemaSubentry) Push

func (r *SubschemaSubentry) Push(defs ...SchemaDefinition)
Example (AttributeType)
exampleSchema.Push(&AttributeType{
	NumericOID:  "1.3.6.1.4.1.56521.999.40.11",
	Name:        []string{`fakeType`},
	Description: "Fake type",
	SuperType:   "description",
})

fmt.Printf("Found definition at index #%d\n",
	exampleSchema.AttributeTypes.Contains("1.3.6.1.4.1.56521.999.40.11"))
Output:

Found definition at index #96
Example (DITContentRule)
exampleSchema.Push(&DITContentRule{
	NumericOID:  "1.3.6.1.4.1.56521.999.50.11",
	Name:        []string{`fakeRule`},
	Description: "Fake rule",
	Not:         []string{"audio"},
})

fmt.Printf("Found definition at index #%d\n",
	exampleSchema.DITContentRules.Contains("1.3.6.1.4.1.56521.999.50.11"))
Output:

Found definition at index #1
Example (LDAPSyntax)
exampleSchema.Push(&LDAPSyntax{
	NumericOID:  "1.3.6.1.4.1.56521.999.10.11",
	Description: "Fake syntax",
})

fmt.Printf("Found definition at index #%d\n",
	exampleSchema.LDAPSyntaxes.Contains("1.3.6.1.4.1.56521.999.10.11"))
Output:

Found definition at index #66
Example (MatchingRule)
exampleSchema.Push(&MatchingRule{
	NumericOID:  "1.3.6.1.4.1.56521.999.20.11",
	Name:        []string{`fakeRule`},
	Description: "Fake rule",
	Syntax:      "1.3.6.1.4.1.56521.999.10.11",
})

fmt.Printf("Found definition at index #%d\n",
	exampleSchema.MatchingRules.Contains("1.3.6.1.4.1.56521.999.20.11"))
Output:

Found definition at index #44
Example (ObjectClass)
exampleSchema.Push(&ObjectClass{
	NumericOID:   "1.3.6.1.4.1.56521.999.50.11",
	Name:         []string{`fakeClass`},
	Description:  "Fake class",
	Kind:         0,
	SuperClasses: []string{"top"},
})

fmt.Printf("Found definition at index #%d\n",
	exampleSchema.ObjectClasses.Contains("1.3.6.1.4.1.56521.999.50.11"))
Output:

Found definition at index #28

func (*SubschemaSubentry) ReadBytes

func (r *SubschemaSubentry) ReadBytes(data []byte) error

ReadBytes returns an error following an attempt parse data ([]byte) into the receiver instance. This method exists as a convenient alternative to manual parsing of individual definitions, one at a time.

Definitions which are dependencies of other definitions should be parsed first. For example, the following AttributeTypeDescriptions should be parsed in the order shown:

attributeType ( 2.5.4.41 NAME 'name' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) attributeType ( 2.5.4.3 NAME 'cn' SUP name )

... as "cn" depends upon "name".

Each definition MUST begin with one (1) of the following keywords:

  • "ldapSyntax" or "ldapSyntaxes"
  • "matchingRule" or "matchingRules"
  • "attributeType" or "attributeTypes"
  • "objectClass" or "objectClasses"
  • "dITContentRule" or "dITContentRules"
  • "nameForm" or "nameForms"
  • "dITStructureRule" or "dITStructureRules"

Case is not significant in the keyword matching process.

Example
// Assume raw was read from a file somewhere ...
raw := []byte(`
	attributeTypes: ( 1.3.6.1.4.1.56521.999.9.5
		NAME 'fakeAttribute'
		SUP name )
	attributeTypes: ( 1.3.6.1.4.1.56521.999.9.6
		NAME 'otherAttribute'
		SUP o )
	objectClasses:  ( 1.3.6.1.4.1.56521.999.10.1
		NAME 'testClass'
		DESC 'a fake class'
		MUST cn
		MAY ( fakeAttribute $ otherAttribute ) )
	`)

if err := exampleSchema.ReadBytes(raw); err != nil {
	fmt.Println(err)
	return
}

func (*SubschemaSubentry) ReadDirectory

func (r *SubschemaSubentry) ReadDirectory(dir string) (err error)

ReadDirectory recurses all files and folders specified at 'dir', returning parsed schema bytes (content) alongside an error.

Only files with an extension of ".schema" will be parsed, but all subdirectories will be traversed in search of these files. Files not bearing the ".schema" extension will be silently ignored.

File and directory naming schemes MUST guarantee the appropriate ordering of any and all sub types, sub rules and sub classes which would rely on the presence of dependency definitions (e.g.: 'cn' cannot exist without 'name').

func (*SubschemaSubentry) ReadFile

func (r *SubschemaSubentry) ReadFile(file string) (err error)

ReadFile returns an error following an attempt to read the specified filename into an instance of []byte, which is then fed to the SubschemaSubentry.ReadBytes method automatically.

The filename MUST end in ".schema", else an error shall be raised.

func (*SubschemaSubentry) RegisterAttributeType

func (r *SubschemaSubentry) RegisterAttributeType(input any) (err error)

RegisterAttributeType returns an error following an attempt to add a new AttributeType definition to the receiver instance.

Valid input types may be an instance of AttributeType, or its equivalent string representation (AttributeTypeDescription) as described in § 4.1.2 of RFC 4512.

Example (ByInstance)
instance := AttributeType{
	NumericOID:  `1.3.6.1.4.1.56521.999.11.2.4`,
	Name:        []string{`myAttribute`},
	Description: `A random attribute`,
	Syntax:      `1.3.6.1.4.1.1466.115.121.1.15`,
	Equality:    `caseIgnoreMatch`,
	Extensions: map[int]Extension{
		0: {
			XString: `X-ORIGIN`,
			Values:  []string{`NOWHERE`},
		},
	},
}

if err := exampleSchema.RegisterAttributeType(instance); err != nil {
	fmt.Println(err)
	return
}

if _, idx := exampleSchema.AttributeType("myattribute"); idx != -1 {
	fmt.Println("Type found")
}
Output:

Type found

func (*SubschemaSubentry) RegisterDITContentRule

func (r *SubschemaSubentry) RegisterDITContentRule(input any) (err error)

RegisterDITContentRule returns an error following an attempt to add a new DITContentRule to the receiver instance.

Valid input types may be an instance of DITContentRule, or its equivalent string representation (DITContentRuleDescription) as described in § 4.1.6 of RFC 4512.

Example (ByInstance)
instance := DITContentRule{
	NumericOID:  `2.5.6.11`,
	Name:        []string{`myContentRule`},
	Description: `A dITContentRule`,
	Must:        []string{`cn`, `l`},
	Not:         []string{`seeAlso`},
	Extensions: map[int]Extension{
		0: {
			XString: `X-ORIGIN`,
			Values:  []string{`NOWHERE`},
		},
	},
}

if err := exampleSchema.RegisterDITContentRule(instance); err != nil {
	fmt.Println(err)
	return
}

if _, idx := exampleSchema.DITContentRule("myContentRule"); idx != -1 {
	fmt.Println("Rule found")
}
Output:

Rule found

func (*SubschemaSubentry) RegisterDITStructureRule

func (r *SubschemaSubentry) RegisterDITStructureRule(input any) (err error)

RegisterDITStructureRule returns an error following an attempt to add a new structure rule definition to the receiver instance.

Valid input types may be an instance of DITStructureRule, or its equivalent string representation (DITStructureRuleDescription) as described in § 4.1.7.1 of RFC 4512.

Example (ByInstance)
instance := DITStructureRule{
	RuleID:      `3`,
	Name:        []string{`subentryStructureRule`},
	Description: `Enforces ITU-T X.501 cl. 14.2.2; internal use only`,
	Form:        `subentryNameForm`,
	SuperRules:  []string{`1`, `2`},
	Extensions: map[int]Extension{
		0: {
			XString: `X-ORIGIN`,
			Values:  []string{`NOWHERE`},
		},
	},
}

if err := exampleSchema.RegisterDITStructureRule(instance); err != nil {
	fmt.Println(err)
	return
}

if _, idx := exampleSchema.DITStructureRule("3"); idx != -1 {
	fmt.Println("Rule found")
}
Output:

Rule found

func (*SubschemaSubentry) RegisterLDAPSyntax

func (r *SubschemaSubentry) RegisterLDAPSyntax(input any) (err error)

RegisterLDAPSyntax returns an error following an attempt to add a new syntax definition to the receiver instance.

Valid input types may be an instance of LDAPSyntax, or its equivalent string representation (LDAPSyntaxDescription) as described in § 4.1.5 of RFC 4512.

Example (ByDescription)
// Invent and register a custom (non-standard) syntax
exampleSchema.RegisterLDAPSyntax(`ldapSyntaxes: ( 1.3.6.1.4.1.56521.101.2.1.4
          DESC 'ObjectIdentifierValue'
          X-PATTERN '^\{([a-z](-?[A-Za-z0-9]+)*(\(\d+\))?)(\s([a-z](-?[A-Za-z0-9]+)*(\(\d+\))))*\}$' )`)

// Retrieve new syntax
def, idx := exampleSchema.LDAPSyntax(`object identifier value`)
if idx == -1 {
	fmt.Println("No such definition found")
	return
}

// Verify assertion value against syntax
fmt.Println(def.Verify(`{joint-iso-itu-t(2) uuid(25)}`))
Output:

TRUE
Example (ByInstance)
instance := LDAPSyntax{
	NumericOID:  `1.3.6.1.4.1.56521.999.2.1.4`,
	Description: `Custom Syntax`,
	Extensions: map[int]Extension{
		0: {
			XString: `X-ORIGIN`,
			Values:  []string{`NOWHERE`},
		},
	},
}

if err := exampleSchema.RegisterLDAPSyntax(instance); err != nil {
	fmt.Println(err)
	return
}

if _, idx := exampleSchema.LDAPSyntax("custom syntax"); idx != -1 {
	fmt.Println("Syntax found")
}
Output:

Syntax found

func (*SubschemaSubentry) RegisterMatchingRule

func (r *SubschemaSubentry) RegisterMatchingRule(input any) (err error)

RegisterMatchingRule returns an error following an attempt to add a new matchingRule definition to the receiver instance.

Valid input types may be an instance of MatchingRule, or its equivalent string representation (MatchingRuleDescription) as described in § 4.1.3 of RFC 4512.

Example (ByInstance)
instance := MatchingRule{
	NumericOID:  `1.3.6.1.4.1.56521.999.11.2.4`,
	Name:        []string{`myMatchingRule`},
	Description: `Some matching rule`,
	Syntax:      `1.3.6.1.4.1.1466.115.121.1.15`,
	Extensions: map[int]Extension{
		0: {
			XString: `X-ORIGIN`,
			Values:  []string{`NOWHERE`},
		},
	},
}

if err := exampleSchema.RegisterMatchingRule(instance); err != nil {
	fmt.Println(err)
	return
}

if _, idx := exampleSchema.MatchingRule("mymatchingrule"); idx != -1 {
	fmt.Println("Rule found")
}
Output:

Rule found

func (*SubschemaSubentry) RegisterNameForm

func (r *SubschemaSubentry) RegisterNameForm(input any) (err error)

RegisterNameForm returns an error following an attempt to add a new nameForm definition to the receiver instance.

Valid input types may be an instance of NameForm, or its equivalent string representation (NameFormDescription) as described in § 4.1.7.2 of RFC 4512.

Example (ByInstance)
instance := NameForm{
	NumericOID:  `2.5.15.16`,
	Name:        []string{`subentryNameForm`},
	Description: `X.501, cl. 14.2.2: the subentry name form`,
	OC:          `subentry`,
	Must:        []string{`cn`},
	Extensions: map[int]Extension{
		0: {
			XString: `X-ORIGIN`,
			Values:  []string{`X.501`},
		},
	},
}

if err := exampleSchema.RegisterNameForm(instance); err != nil {
	fmt.Println(err)
	return
}

if _, idx := exampleSchema.NameForm("2.5.15.16"); idx != -1 {
	fmt.Println("Name form found")
}
Output:

Name form found

func (*SubschemaSubentry) RegisterObjectClass

func (r *SubschemaSubentry) RegisterObjectClass(input any) (err error)

RegisterObjectClass returns an error following an attempt to add a new objectClass definition to the receiver instance.

Valid input types may be an instance of ObjectClass, or its equivalent string representation (ObjectClassDescription) as described in § 4.1.1 of RFC 4512.

Example (ByInstance)
instance := ObjectClass{
	NumericOID:  `1.3.6.1.4.1.56521.999.17.1.64`,
	Name:        []string{`myClass`},
	Description: `An auxiliary class`,
	Kind:        uint8(1),
	Must:        []string{`cn`, `l`},
	Extensions: map[int]Extension{
		0: {
			XString: `X-ORIGIN`,
			Values:  []string{`NOWHERE`},
		},
	},
}

if err := exampleSchema.RegisterObjectClass(instance); err != nil {
	fmt.Println(err)
	return
}

if _, idx := exampleSchema.ObjectClass("myclass"); idx != -1 {
	fmt.Println("Class found")
}
Output:

Class found

func (SubschemaSubentry) String

func (r SubschemaSubentry) String() (ssse string)

String returns the string representation of the receiver instance.

func (*SubschemaSubentry) Unregister

func (r *SubschemaSubentry) Unregister(defs ...SchemaDefinition) (err error)

Unregister returns an error following an attempt to unregister one or more SchemaDefinition qualifier instances.

Note that MatchingRuleUse instances cannot be unregistered directly. Instead, one must unregister the associated MatchingRule instance to accomplish this.

Example (AttributeType)
// First lookup the type in question and obtain
// the proper instance.
def, idx := exampleSchema.AttributeType("fakeAttribute")
if idx == -1 {
	fmt.Printf("Not found!")
	return
}

// Now we use the type instance to call Unregister.
err := exampleSchema.Unregister(def)
fmt.Println(err == nil) // should succeed (no dependents)
Output:

true
Example (DITContentRule)
// First lookup the rule in question and obtain
// the proper instance.
_, idx := exampleSchema.DITContentRule("nonexistentRule")
fmt.Println(idx == -1) // should fail due to it not existing.
Output:

true
Example (DITStructureRule)
// First lookup the rule in question and obtain
// the proper instance.
def, idx := exampleSchema.DITStructureRule("1")
if idx == -1 {
	fmt.Printf("Not found!")
	return
}

// Now we use the rule instance to call Unregister.
err := exampleSchema.Unregister(def)
fmt.Println(err == nil) // should fail due to dependencies
Output:

false
Example (LDAPSyntax)
// First lookup the syntax in question and obtain
// the proper instance.
booleanSyntax := "1.3.6.1.4.1.1466.115.121.1.7"
def, idx := exampleSchema.LDAPSyntax(booleanSyntax)
if idx == -1 {
	fmt.Printf("Not found!")
	return
}

// Now we use the syntax instance to call Unregister.
err := exampleSchema.Unregister(def)
fmt.Println(err == nil) // should fail due to dependencies
Output:

false
Example (MatchingRule)
// First lookup the rule in question and obtain
// the proper instance.
def, idx := exampleSchema.MatchingRule("caseIgnoreMatch")
if idx == -1 {
	fmt.Printf("Not found!")
	return
}

// Now we use the rule instance to call Unregister.
err := exampleSchema.Unregister(def)
fmt.Println(err == nil) // should fail due to dependencies
Output:

false
Example (NameForm)
// First lookup the form in question and obtain
// the proper instance.
nf := "applicationProcessNameForm"
def, idx := exampleSchema.NameForm(nf)
if idx == -1 {
	fmt.Printf("Not found!")
	return
}

// Now we use the form instance to call Unregister.
err := exampleSchema.Unregister(def)
fmt.Println(err == nil) // should fail due to dependencies
Output:

false
Example (ObjectClass)
// First lookup the class in question and obtain
// the proper instance.
def, idx := exampleSchema.ObjectClass("top")
if idx == -1 {
	fmt.Printf("Not found!")
	return
}

// Now we use the class instance to call Unregister.
err := exampleSchema.Unregister(def)
fmt.Println(err == nil) // should fail due to dependencies
Output:

false
Example (UnusedLDAPSyntax)
// First lookup the syntax in question and obtain
// the proper instance.
bootParam := "bootParameterSyntax"
def, idx := exampleSchema.LDAPSyntax(bootParam)
if idx == -1 {
	fmt.Printf("Not found!")
	return
}

// Now we use the syntax instance to call Unregister.
err := exampleSchema.Unregister(def)
fmt.Println(err == nil) // should succeed
Output:

true

func (*SubschemaSubentry) UnregisterAttributeType

func (r *SubschemaSubentry) UnregisterAttributeType(input any) (err error)

UnregisterAttributeType returns an error following an attempt to remove the specified definition from the receiver instance. A successful run will also remove the target from any applied MatchingRuleUse instances.

Valid input types may be an instance of AttributeType, or its equivalent string representation (AttributeTypeDescription) as described in § 4.1.2 of RFC 4512.

Note that this process shall fail if the specified definition has dependent definitions such as nameForm, objectClass or dITContentRule instances.

Example
def := `( 1.3.6.1.4.1.56521.999.9.5
                NAME 'fakeAttribute'
                SUP name )`
err := exampleSchema.UnregisterAttributeType(def)
fmt.Println(err == nil) // should fail due to dependencies
Output:

false

func (*SubschemaSubentry) UnregisterDITContentRule

func (r *SubschemaSubentry) UnregisterDITContentRule(input any) (err error)

UnregisterDITContentRule returns an error following an attempt to remove the specified definition from the receiver instance.

Valid input types may be an instance of DITContentRule, or its equivalent string representation (DITContentRuleDescription) as described in § 4.1.6 of RFC 4512.

DITContentRule instances are not subject to any dependency constraints.

func (*SubschemaSubentry) UnregisterDITStructureRule

func (r *SubschemaSubentry) UnregisterDITStructureRule(input any) (err error)

UnregisterDITStructureRule returns an error following an attempt to remove the specified definition from the receiver instance.

Valid input types may be an instance of DITStructureRule, or its equivalent string representation (DITStructureRuleDescription) as described in § 4.1.7.1 of RFC 4512.

Note that this process shall fail if the specified definition has dependent definitions, such as subordinate structure rules.

func (*SubschemaSubentry) UnregisterLDAPSyntax

func (r *SubschemaSubentry) UnregisterLDAPSyntax(input any) (err error)

UnregisterLDAPSyntax returns an error following an attempt to remove the specified definition from the receiver instance. A successful run will also remove the associated MatchingRuleUse instance.

Valid input types may be an instance of *LDAPSyntax, or its equivalent string representation (LDAPSyntaxDescription) as described in § 4.1.5 of RFC 4512.

Note that this process shall fail if the specified definition has dependent matchingRule or attributeType definitions.

func (*SubschemaSubentry) UnregisterMatchingRule

func (r *SubschemaSubentry) UnregisterMatchingRule(input any) (err error)

UnregisterMatchingRule returns an error following an attempt to remove the specified definition from the receiver instance. A successful run will also remove the associated MatchingRuleUse instance.

Valid input types may be an instance of MatchingRule, or its equivalent string representation (MatchingRuleDescription) as described in § 4.1.3 of RFC 4512.

Note that this process shall fail if the specified definition has dependent attributeType definitions, as well as if any matchingRuleUse instances exist with one or more applied types.

func (*SubschemaSubentry) UnregisterNameForm

func (r *SubschemaSubentry) UnregisterNameForm(input any) (err error)

UnregisterNameForm returns an error following an attempt to remove the specified definition from the receiver instance.

Valid input types may be an instance of NameForm, or its equivalent string representation (NameFormDescription) as described in § 4.1.7.2 of RFC 4512.

Note that this process shall fail if the specified definition has dependent definitions, such as instances of DITStructureRule.

func (*SubschemaSubentry) UnregisterObjectClass

func (r *SubschemaSubentry) UnregisterObjectClass(input any) (err error)

UnregisterObjectClass returns an error following an attempt to remove the specified definition from the receiver instance.

Valid input types may be an instance of ObjectClass, or its equivalent string representation (ObjectClassDescription) as described in § 4.1.1 of RFC 4512.

Note that this process shall fail if the specified definition has dependent definitions such as nameForm or dITContentRule instances.

Example
def := `( 1.3.6.1.4.1.56521.999.10.1
                NAME 'testClass'
                DESC 'a fake class'
                MUST cn
                MAY ( fakeAttribute $ otherAttribute ) )`
err := exampleSchema.UnregisterObjectClass(def)
fmt.Println(err == nil) // should succeed (no dependents)
Output:

true

type SubstringAssertion

type SubstringAssertion struct {
	Initial AssertionValue `asn1:"tag:0"`
	Any     AssertionValue `asn1:"tag:1"`
	Final   AssertionValue `asn1:"tag:2"`
}

SubstringAssertion implements the Substring Assertion.

From § 3.3.30 of RFC 4517:

SubstringAssertion = [ initial ] any [ final ]

initial  = substring
any      = ASTERISK *(substring ASTERISK)
final    = substring
ASTERISK = %x2A  ; asterisk ("*")

substring           = 1*substring-character
substring-character = %x00-29
                      / (%x5C "2A")  ; escaped "*"
                      / %x2B-5B
                      / (%x5C "5C")  ; escaped "\"
                      / %x5D-7F
                      / UTFMB

From § 2 of RFC 4515:

SubstringFilter ::= SEQUENCE {
    type    AttributeDescription,
    -- initial and final can occur at most once
    substrings    SEQUENCE SIZE (1..MAX) OF substring CHOICE {
     initial        [0] AssertionValue,
     any            [1] AssertionValue,
     final          [2] AssertionValue } }

From § 3 of RFC 4515:

initial = assertionvalue
any     = ASTERISK *(assertionvalue ASTERISK)
final   = assertionvalue

func (SubstringAssertion) IsZero

func (r SubstringAssertion) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (SubstringAssertion) Size

func (r SubstringAssertion) Size() int

Size returns the summation of the underlying AssertionValue instance sizes.

func (SubstringAssertion) String

func (r SubstringAssertion) String() (s string)

String returns the string representation of the receiver instance.

type SubstringsRuleAssertion

type SubstringsRuleAssertion func(any, any) (Boolean, error)

SubstringsRuleAssertion defines a closure signature held by qualifying function instances intended to implement a Substrings MatchingRuleAssertion.

The semantics of the MatchingRuleAssertion are discussed in § 4.1 of RFC 4517.

type SubtreeSpecification

type SubtreeSpecification struct {
	Base LocalName `asn1:"tag:0,default:"`

	// COMPONENTS OF chopSpecification
	ChopSpecification

	SpecificationFilter Refinement `asn1:"tag:4,optional"`
}

SubtreeSpecification implements the Subtree Specification construct.

At present, instances of this type are not ASN.1 encode-friendly due to the use of an interface type for Refinement instances. This is because Go's encoding/asn1 package does not play nicely with such types.

A zero instance of this type is equal to "{}" when represented as a string value, which is a valid default value when populated for an entry's "subtreeSpecification" attribute type instance within a DIT.

From § 2.1 of RFC 3672:

SubtreeSpecification ::= SEQUENCE {
    base                [0] LocalName DEFAULT { },
                            COMPONENTS OF ChopSpecification,
    specificationFilter [4] Refinement OPTIONAL }

LocalName ::= RDNSequence

ChopSpecification ::= SEQUENCE {
    specificExclusions  [1] SET OF CHOICE {
                            chopBefore [0] LocalName,
                            chopAfter [1] LocalName } OPTIONAL,
    minimum             [2] BaseDistance DEFAULT 0,
    maximum             [3] BaseDistance OPTIONAL }

BaseDistance ::= INTEGER (0 .. MAX)

Refinement ::= CHOICE {
    item                [0] OBJECT-CLASS.&id,
    and                 [1] SET OF Refinement,
    or                  [2] SET OF Refinement,
    not                 [3] Refinement }

From Appendix A of RFC 3672:

SubtreeSpecification = "{" [ sp ss-base ]
                           [ sep sp ss-specificExclusions ]
                           [ sep sp ss-minimum ]
                           [ sep sp ss-maximum ]
                           [ sep sp ss-specificationFilter ]
                                sp "}"

ss-base                = id-base                msp LocalName
ss-specificExclusions  = id-specificExclusions  msp SpecificExclusions
ss-minimum             = id-minimum             msp BaseDistance
ss-maximum             = id-maximum             msp BaseDistance
ss-specificationFilter = id-specificationFilter msp Refinement

BaseDistance = INTEGER-0-MAX

From § 6 of RFC 3642:

LocalName         = RDNSequence
RDNSequence       = dquote *SafeUTF8Character dquote

INTEGER-0-MAX   = "0" / positive-number
positive-number = non-zero-digit *decimal-digit

sp  =  *%x20  ; zero, one or more space characters
msp = 1*%x20  ; one or more space characters
sep = [ "," ]

OBJECT-IDENTIFIER = numeric-oid / descr
numeric-oid       = oid-component 1*( "." oid-component )
oid-component     = "0" / positive-number

func (SubtreeSpecification) BER

func (r SubtreeSpecification) BER() (*ber.Packet, error)

BER returns the BER encoding of the receiver instance alongside an error.

To decode the return *ber.Packet, pass it to RFC3672.SubtreeSpecification as the input value.

func (SubtreeSpecification) IsZero

func (r SubtreeSpecification) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (SubtreeSpecification) String

func (r SubtreeSpecification) String() (s string)

String returns the string representation of the receiver instance.

type SyntaxVerification

type SyntaxVerification func(any) Boolean

SyntaxVerification implements a closure function signature meant to be honored by functions or methods intended to verify the syntax of a value.

type TagAndLength

type TagAndLength struct {
	Class      int
	Tag        int
	IsCompound bool
	Length     int
}

TagAndLength represents a parsed DER tag/length header.

func (TagAndLength) Equal

func (r TagAndLength) Equal(tal TagAndLength, length ...bool) bool

Equal returns a Boolean value indicative of whether the receiver instance is equal to the input TagAndLength instance.

func (TagAndLength) Expect

func (r TagAndLength) Expect(class int, tag int, IsCompound bool) (err error)

Expect returns an error following a comparison of the ASN.1 class, tag and compound state against those of the receiver instance.

func (TagAndLength) ExpectClass

func (r TagAndLength) ExpectClass(class int) (err error)

ExpectClass returns an error following a comparison of the ASN.1 class with the receiver's class.

func (TagAndLength) ExpectCompound

func (r TagAndLength) ExpectCompound(IsCompound bool) (err error)

ExpectCompound returns an error following a comparison of the ASN.1 compound state with the receiver's compound state.

func (TagAndLength) ExpectTag

func (r TagAndLength) ExpectTag(tag int) (err error)

ExpectTag returns an error following a comparison of the ASN.1 tag with the receiver's tag.

type TelephoneNumber

type TelephoneNumber PrintableString

TelephoneNumber implements § 3.3.31 of RFC 4517 and ITU-T Rec. X.520 clause 6.7.1:

PrintableString (SIZE(1..ub-telephone-number))

func (TelephoneNumber) String

func (r TelephoneNumber) String() string

String returns the string representation of the receiver instance.

type TeletexNonBasicParameters

type TeletexNonBasicParameters struct {
	GraphicCharacterSets     TeletexString `asn1:"tag:0,optional"` // TeletexString OPTIONAL
	CtrlCharacterSets        TeletexString `asn1:"tag:1,optional"` // TeletexString OPTIONAL
	PageFormats              OctetString   `asn1:"tag:2,optional"` // OCTET STRING OPTIONAL
	MiscTerminalCapabilities TeletexString `asn1:"tag:3,optional"` // TeletexString OPTIONAL
	PrivateUse               OctetString   `asn1:"tag:4,optional"` // OCTET STRING OPTIONAL
}

TeletexNonBasicParameters is defined in ITU-T Rec. X.420.

type TeletexString deprecated

type TeletexString string

Deprecated: TeletexString implements the Teletex String, per ITU-T Rec. T.61

func (TeletexString) Choice

func (r TeletexString) Choice() string

func (TeletexString) IsZero

func (r TeletexString) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

Example
var tel TeletexString
fmt.Println(tel.IsZero())
Output:

true

func (TeletexString) String

func (r TeletexString) String() string

String returns the string representation of the receiver instance.

type TeletexTerminalIdentifier

type TeletexTerminalIdentifier struct {
	TeletexTerminal string                    `asn1:"printable"` // (SIZE(1..ub-teletex-terminal-id)),
	Parameters      TeletexNonBasicParameters `asn1:"set,optional"`
}

TeletexTerminalIdentifier implements § 3.3.32 of RFC 4517 and

teletex-id = ttx-term *(DOLLAR ttx-param)
ttx-term   = PrintableString          ; terminal identifier
ttx-param  = ttx-key COLON ttx-value  ; parameter
ttx-key    = "graphic" / "control" / "misc" / "page" / "private"
ttx-value  = *ttx-value-octet

ttx-value-octet = %x00-23
                  / (%x5C "24")  ; escaped "$"
                  / %x25-5B
                  / (%x5C "5C")  ; escaped "\"
                  / %x5D-FF

ASN.1 definition, per ITU-T Rec. X.520:

TeletexTerminalIdentifier ::= SEQUENCE {
	teletexTerminal PrintableString (SIZE(1..ub-teletex-terminal-id)),
	parameters	TeletexNonBasicParameters OPTIONAL
}

ub-teletex-terminal-id INTEGER ::= 1024

From § 3.2 of RFC 4517:

PrintableCharacter = ALPHA / DIGIT / SQUOTE / LPAREN / RPAREN /
                     PLUS / COMMA / HYPHEN / DOT / EQUALS /
                     SLASH / COLON / QUESTION / SPACE
PrintableString    = 1*PrintableCharacter
COLON              = %x3A  ; colon (":")

From § 1.4 of RFC 4512:

DOLLAR  = %x24 ; dollar sign ("$")

func (TeletexTerminalIdentifier) String

func (r TeletexTerminalIdentifier) String() (s string)

type TelexNumber

type TelexNumber [3]string

TelexNumber implements TelexNumber per § 3.3.33 of RFC 4517:

telex-number  = actual-number DOLLAR country-code DOLLAR answerback
actual-number = PrintableString
country-code  = PrintableString
answerback    = PrintableString

From § 3.2 of RFC 4517:

PrintableCharacter = ALPHA / DIGIT / SQUOTE / LPAREN / RPAREN /
                     PLUS / COMMA / HYPHEN / DOT / EQUALS /
                     SLASH / COLON / QUESTION / SPACE
PrintableString    = 1*PrintableCharacter

From § 1.4 of RFC 4512:

DOLLAR  = %x24 ; dollar sign ("$")

func (TelexNumber) String

func (r TelexNumber) String() (str string)

String returns the string representation of the receiver instance.

type Term

type Term interface {
	String() string
	IsZero() bool
	Valid() error
}

Term implements the slice component of an instance of AndTerm. Term is qualified through instances of AttributeMatchTerm, BoolTerm, and Criteria.

type URL

type URL struct {
	Scheme     string                        // "ldap", "ldaps", "ldapi"; case is not significant
	Host       string                        // host
	Port       string                        // service port
	DN         DistinguishedName             // distinguished name
	Attributes []string                      // comma-separated attribute selector; mutex of ATBTV
	ATBTV      ACIv3AttributeBindTypeOrValue // attributeBindTypeOrValue; mutex of attributes
	Scope      string                        // RFC4511 Search Scope: "base", "one", or "sub"; case is not significant
	Filter     Filter                        // RFC4515 Search Filter
	Extensions []string                      // LDAP extensions
}

URL implements § 2 of RFC4516:

ldapurl     = scheme COLON SLASH SLASH [host [COLON port]]
                 [SLASH dn [QUESTION [attributes]
                 [QUESTION [scope] [QUESTION [filter]
                 [QUESTION extensions]]]]]
                                ; <host> and <port> are defined
                                ;   in Sections 3.2.2 and 3.2.3
                                ;   of [RFC3986].
                                ; <filter> is from Section 3 of
                                ;   [RFC4515], subject to the
                                ;   provisions of the
                                ;   "Percent-Encoding" section
                                ;   below.
scheme      = "ldap"
dn          = distinguishedName ; From Section 3 of [RFC4514],
                                ; subject to the provisions of
                                ; the "Percent-Encoding"
                                ; section below.
attributes  = attrdesc *(COMMA attrdesc)
attrdesc    = selector *(COMMA selector)
selector    = attributeSelector ; From Section 4.5.1 of
                                ; [RFC4511], subject to the
                                ; provisions of the
                                ; "Percent-Encoding" section
                                ; below.
scope       = "base" / "one" / "sub"
extensions  = extension *(COMMA extension)
extension   = [EXCLAMATION] extype [EQUALS exvalue]
extype      = oid               ; From section 1.4 of [RFC4512].
exvalue     = LDAPString        ; From section 4.1.2 of
                                ; [RFC4511], subject to the
                                ; provisions of the
                                ; "Percent-Encoding" section
                                ; below.
EXCLAMATION = %x21              ; exclamation mark ("!")
SLASH       = %x2F              ; forward slash ("/")
COLON       = %x3A              ; colon (":")
QUESTION    = %x3F              ; question mark ("?")

Notice of non-standard extensions

While the official ABNF above only specifies "ldap" as a valid scheme, this implementation has been expanded to allow "ldaps://" and "ldapi:///" as well.

Additionally, in addition to the use of an attribute selector, an instance of [ACIAttributeBindTypeOrValue] may be used. These choices are mutually exclusive. Note that use of an [ACIAttributeBindTypeOrValue] is only meaningful if the URL is used in the construction of a Netscape ACIv3 [Instruction] instance.

func (*URL) IsZero

func (r *URL) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (URL) String

func (r URL) String() string

String returns the string representation of the receiver instance.

type UTCTime deprecated

type UTCTime time.Time

Deprecated: UTCTime implements § 3.3.34 of RFC 4517.

UTCTime         = year month day hour minute [ second ] [ u-time-zone ]
u-time-zone     = %x5A  ; "Z"
                  / u-differential
u-differential  = ( MINUS / PLUS ) hour minute

Use instances of GeneralizedTime instead.

func (UTCTime) Cast

func (r UTCTime) Cast() time.Time

Cast unwraps and returns the underlying instance of time.Time.

func (UTCTime) String

func (r UTCTime) String() string

String returns the string representation of the receiver instance.

type UTF8String

type UTF8String string

UTF8String implements the UTF8 String syntax and abstraction.

From § 1.4 of RFC 4512:

UTF8    = UTF1 / UTFMB
UTFMB   = UTF2 / UTF3 / UTF4
UTF0    = %x80-BF
UTF1    = %x00-7F
UTF2    = %xC2-DF UTF0
UTF3    = %xE0 %xA0-BF UTF0 / %xE1-EC 2(UTF0) /
          %xED %x80-9F UTF0 / %xEE-EF 2(UTF0)
UTF4    = %xF0 %x90-BF 2(UTF0) / %xF1-F3 3(UTF0) /
          %xF4 %x80-8F 2(UTF0)

func (UTF8String) Choice

func (r UTF8String) Choice() string

func (UTF8String) IsZero

func (r UTF8String) IsZero() bool

func (UTF8String) String

func (r UTF8String) String() string

String returns the string representation of the receiver instance.

type UUID

type UUID uuid.UUID

UUID aliases uuid.UUID to implement RFC 4530.

From § 3 of RFC 4122:

UUID                   = time-low "-" time-mid "-"
                         time-high-and-version "-"
                         clock-seq-and-reserved
                         clock-seq-low "-" node
time-low               = 4hexOctet
time-mid               = 2hexOctet
time-high-and-version  = 2hexOctet
clock-seq-and-reserved = hexOctet
clock-seq-low          = hexOctet
node                   = 6hexOctet
hexOctet               = hexDigit hexDigit
hexDigit =
      "0" / "1" / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9" /
      "a" / "b" / "c" / "d" / "e" / "f" /
      "A" / "B" / "C" / "D" / "E" / "F"

func (UUID) Cast

func (r UUID) Cast() uuid.UUID

Cast unwraps and returns the underlying instance of uuid.UUID.

func (UUID) Integer

func (r UUID) Integer() (i Integer)

Integer returns the Integer representation of the receiver instance.

Example

This example demonstrates the means for converting a UUID instance to an Integer instance.

var r RFC4530
u, err := r.UUID(`00be4308-0c89-1085-8ea0-0002a5d5fd2e`)
if err != nil {
	fmt.Println(err)
	return
}

fmt.Printf("%s\n", u.Integer())
Output:

987895962269883002155146617097157934

func (UUID) IsZero

func (r UUID) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (UUID) String

func (r UUID) String() string

String returns the string representation of the receiver instance.

type UniversalString

type UniversalString string

UniversalString implements the Universal Character Set.

UCS = 0x0000 through 0xFFFF

func (UniversalString) Choice

func (r UniversalString) Choice() string

func (UniversalString) IsZero

func (r UniversalString) IsZero() bool

IsZero returns a Boolean value indicative of a nil receiver state.

func (UniversalString) String

func (r UniversalString) String() string

String returns the string representation of the receiver instance.

type X501

type X501 struct {
	// contains filtered or unexported fields

} // ITU-T Rec. X.501

func (X501) Document

func (r X501) Document() string

Document returns the string representation of the ITU-T Rec. X.501 document URL.

type X520

type X520 struct {
	// contains filtered or unexported fields

} // ITU-T Rec. X.520

func (X520) Document

func (r X520) Document() string

Document returns the string representation of the ITU-T Rec. X.520 document URL.

type X680

type X680 struct {
	// contains filtered or unexported fields

} // ITU-T Rec. X.680

func (X680) BMPString

func (r X680) BMPString(x any) (BMPString, error)

BMPString marshals x into a BMPString (UTF-16) return value, returning an instance of BMPString alongside an error.

func (X680) Document

func (r X680) Document() string

Document returns the string representation of the ITU-T Rec. X.680 document URL.

func (X680) Enumerated

func (r X680) Enumerated(x ...any) (Enumerated, error)

type X690

type X690 struct {
	// contains filtered or unexported fields

} // ITU-T Rec. X.690

func (X690) DER

func (r X690) DER(x ...any) (*DERPacket, error)

DER returns an instance of *DERPacket alongside an error.

func (X690) Document

func (r X690) Document() string

Document returns the string representation of the ITU-T Rec. X.690 document URL.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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