Categorygithub.com/JesseCoretta/go-dirsyn
modulepackage
0.0.0-20250119021436-6885537e027d
Repository: https://github.com/jessecoretta/go-dirsyn.git
Documentation: pkg.go.dev

# README


dirsyn_logo_small

Go Report Card Reference License Issues Experimental Volatility Warning Help Animals

Package dirsyn implements directory syntax parsing and matching rule components.

This package was mainly developed for the XDAPL Project, but may be freely used by anyone needing value abstract syntax checking or matching rule capabilities related to directory technologies.

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.

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.

Dependencies

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

  • encoding/asn1
  • encoding/base64
  • encoding/hex
  • errors
  • fmt
  • math/big
  • os
  • reflect††
  • regexp†††
  • sort
  • strconv
  • strings
  • testing
  • time
  • unicode
  • unicode/utf8
  • unicode/utf16
- used ONLY for testing/examples
†† - very limited use
††† - only used 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:

To parse instances of the Netscape ACIv3 "aci" attribute type, see go-antlraci, or the full-featured go-aci. This functionality may be ported into this package in the future.

# Functions

NewSubschemaSubentry returns a freshly initialized instance of *[SubschemaSubentry].

# Constants

X.520: ub-telephone-number INTEGER ::= 32.
X.411: ub-teletex-private-use-length INTEGER ::= 128.
X.520: ub-teletex-terminal-id INTEGER ::= 1024.

# Structs

No description provided by the author
TODO - correct this.
AttributeTypeAndValue implements the attributeTypeAndValue defined in [Section 3 of RFC4514].
AttributeTypeDescription implements [§ 4.1.2 of RFC 4512].
AttributeValueAssertion implements the basis for [ApproximateMatchFilter], [GreaterOrEqualFilter], [LessOrEqualFilter] and [EqualityMatchFilter].
Boolean wraps a pointer to bool to implement the ASN.1 BOOLEAN type.
BoolTerm implements a Boolean [Term] qualifier.
BootParameter implements the NIS BootParameter type.
ChopSpecification implements the chopSpecification component of an instance of [SubtreeSpecification].
Criteria implements the Criteria syntax per [ITU-T Rec.
DistinguishedName implements the distinguished name from RFC4514 and RFC4517.
DITContentRuleDescription implements [§ 4.1.6 of RFC 4512].
DITStructureRuleDescription implements [§ 4.1.7.1 of RFC 4512].
EnhancedGuide implements the Enhanced Guide type.
Extension implements [§ 4.2 of RFC 4512] and describes a single extension using an "xstring" and one or more quoted string values.
FacsimileTelephoneNumber implements [§ 3.3.11 of RFC 4517] and [ITU-T Rec.
Fax implements an ASN.1 CHOICE of [G3FacsimileBodyPart].
G3FacsimileBodyPart implements [clause 7.4.2 of ITU-T Rec.
No description provided by the author
Deprecated: Guide is OBSOLETE and is provided for historical support only; use [EnhancedGuide] instead.
LDAPSyntaxDescription implements [§ 4.1.5 of RFC 4512].
MatchingRuleAssertion implements the basis of [ExtensibleMatchFilter].
MatchingRuleDescription implements [§ 4.1.3 of RFC 4512].
MatchingRuleUseDescription implements [§ 4.1.4 of RFC 4512].
NameAndOptionalUID returns an error following an analysis of x in the context of a Name and Optional UID.
NameFormDescription implements [§ 4.1.7.2 of RFC 4512].
NetgroupTriple implements the NIS Netgroup Triple type.
NotFilter implements the "not" CHOICE of an instance of [Filter].
NotRefinement implements a negated, recursive instance of [Refinement].
NotTerm negates an instance of [Term].
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 (".") [§ 1.4 of RFC 4512]: https://datatracker.ietf.org/doc/html/rfc4512#section-1.4 */.
ObjectClassDescription implements [§ 4.1.1 of RFC 4512].
PresentFilter implements the "present" CHOICE of an instance of [Filter].
RelativeDistinguishedName implements the relativeDistinguishedName defined in [Section 3 of RFC4514].
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
SpecificExclusion implements the chopSpecification specificExclusion component.
SubschemaSubentry implements [§ 4.2 of RFC 4512] and contains slice types of various definition types.
SubstringAssertion implements the Substring Assertion.
SubstringsFilter implements the "substrings" CHOICE of an instance of [Filter].
SubtreeSpecification implements the Subtree Specification construct.
TeletexNonBasicParameters is defined in [ITU-T Rec.
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.
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

AttributeOption implements [Section 2.5 of RFC4512].
Definition is an interface type qualified through instances of the following types: - [LDAPSyntaxDescription] - [MatchingRuleDescription] - [AttributeTypeDescription] - [MatchingRuleUseDescription] - [ObjectClassDescription] - [DITContentRuleDescription] - [NameFormDescription] - [DITStructureRuleDescription] */.
DirectoryString implements the Directory String syntax.
Filter implements [Section 2] and [Section 3] of RFC4515.
Refinement implements [Appendix A of RFC 3672], and serves as the "SpecificationFilter" optionally found within a Subtree Specification.
Term implements the slice component of an instance of [AndTerm].

# Type aliases

AndFilter implements the "and" CHOICE of an instance of [Filter].
AndRefinement implements slices of [Refinement], all of which are expected to evaluate as true during processing.
ApproximateMatchFilter aliases the [AttributeValueAssertion] type to implement the "approxMatch" CHOICE of an instance of [Filter].
AssertionValue implements the OCTET STRING value component of an instance of [AttributeValueAssertion].
AttributeDescription implements [Section 2.5 of RFC4512].
AttributeTag implements [Section 2.5.2 of RFC4512].
BaseDistance implements the integer value of a minimum and/or maximum [SubtreeSpecification] depth refinement parameter.
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 ("'") [§ 1.4 of RFC 4512]: https://datatracker.ietf.org/doc/html/rfc4512#section-1.4 [§ 3.3.2 of RFC 4517]: https://datatracker.ietf.org/doc/html/rfc4517#section-3.3.2 */.
BMPString implements the Basic Multilingual Plane per [ITU-T Rec.
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 [§ 1.4 of RFC 4512]: https://datatracker.ietf.org/doc/html/rfc4512#section-1.4 [§ 3.3.4 of RFC 4517]: https://datatracker.ietf.org/doc/html/rfc4517#section-3.3.4 */.
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 " " [§ 1.4 of RFC 4512]: https://datatracker.ietf.org/doc/html/rfc4512#section-1.4 [§ 3.3.5 of RFC 4517]: https://datatracker.ietf.org/doc/html/rfc4517#section-3.3.5 */.
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 ("-") [§ 1.4 of RFC 4512]: https://datatracker.ietf.org/doc/html/rfc4512#section-1.4 */.
EqualityMatchFilter aliases the [AttributeValueAssertion] type to implement the "equalityMatch" CHOICE of an instance of [Filter].
ExtensibleMatchFilter aliases the [MatchingRuleAssertionFilter] to implement the "extensibleMatch" CHOICE of an instance of [Filter].
G3FacsimileData implements G3FacsimileData as defined in [ITU-T Rec.
G3FacsimileNonBasicParameters implements [Figure 2, Part 28 of 29 of ITU-T Rec.
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 ("-") [§ 3.3.13 of RFC 4517]: https://datatracker.ietf.org/doc/html/rfc4517#section-3.3.13 */.
GreaterOrEqualFilter aliases the [AttributeValueAssertion] type to implement the "greaterOrEqual" CHOICE of an instance of [Filter].
IA5String implements [§ 3.2 of RFC 4517]: IA5 = 0x0000 through 0x00FF [§ 3.2 of RFC 4517]: https://datatracker.ietf.org/doc/html/rfc4517#section-3.2 */.
Integer aliases [big.Int] to implement an unbounded ASN.1 INTEGER syntax and matching rule capabilities.
ItemRefinement implements the core ("atom") value type to be used in [Refinement] statements, and appears in [AndRefinement], [OrRefinement] and [NotRefinement] [Refinement] qualifier type instances.
LessOrEqualFilter aliases the [AttributeValueAssertion] type to implement the "lessOrEqual" CHOICE of an instance of [Filter].
LocalName implements an "RDNSequence" per [§ 6 of RFC 3642].
MatchingRuleAssertion defines a closure signature held by qualifying function instances intended to implement a particular Matching Rule.
NumericString implements [§ 3.3.23 of RFC 4517]: NumericString = 1*(DIGIT / SPACE) [§ 3.3.23 of RFC 4517]: https://datatracker.ietf.org/doc/html/rfc4517#section-3.3.23 */.
OctetString implements [§ 3.3.25 of RFC 4517]: OctetString = *OCTET [§ 3.3.25 of RFC 4517]: https://datatracker.ietf.org/doc/html/rfc4517#section-3.3.25 */.
OrFilter implements the "or" CHOICE of an instance of [Filter].
OrRefinement implements slices of [Refinement], at least one of which is expected to evaluate as true during processing.
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) [§ 3.3.27 of RFC 4517]: https://datatracker.ietf.org/doc/html/rfc4517#section-3.3.27 [§ 3.2 of RFC 4517]: https://datatracker.ietf.org/doc/html/rfc4517#section-3.2 [§ 1.4 of RFC 4512]: https://datatracker.ietf.org/doc/html/rfc4512#section-1.4 */.
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) [§ 1.4 of RFC 4512]: https://datatracker.ietf.org/doc/html/rfc4512#section-1.4 [§ 3.3.28 of RFC 4517]: https://datatracker.ietf.org/doc/html/rfc4517#section-3.3.28 */.
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 ("?") [§ 3.3.29 of RFC 4517]: https://datatracker.ietf.org/doc/html/rfc4517#section-3.3.29 [§ 3.2 of RFC 4517]: https://datatracker.ietf.org/doc/html/rfc4517#section-3.2 [§ 1.4 of RFC 4512]: https://datatracker.ietf.org/doc/html/rfc4512#section-1.4 */.
SpecificExclusions implements the chopSpecification specificExclusions ASN.1 SET OF CHOICE component.
SyntaxVerification implements a closure function signature meant to be honored by functions or methods intended to verify the syntax of a value.
TelephoneNumber implements [§ 3.3.31 of RFC 4517] and [ITU-T Rec.
Deprecated: TeletexString implements the Teletex String, per [ITU-T Rec.
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 ("$") [§ 1.4 of RFC 4512]: https://datatracker.ietf.org/doc/html/rfc4512#section-1.4 [§ 3.2 of RFC 4517]: https://datatracker.ietf.org/doc/html/rfc4517#section-3.2 [§ 3.3.33 of RFC 4517]: https://datatracker.ietf.org/doc/html/rfc4517#section-3.3.33 */.
UniversalString implements the Universal Character Set.
Deprecated: UTCTime implements [§ 3.3.34 of RFC 4517].
UTF8String implements the UTF8 String syntax and abstraction.
UUID aliases [uuid.UUID] to implement RFC4530.