substr

package module
v0.0.0-...-c831009 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 7 Imported by: 0

README

go-ldapsubstr

Package substr implements SubstringAssertion and AssertionValue types and methods.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsSafeUTF8

func IsSafeUTF8(x any) (err error)

UTF8String = StringValue StringValue = dquote *SafeUTF8Character dquote

dquote = %x22 ; " (double quote) SafeUTF8Character = %x00-21 / %x23-7F / ; ASCII minus dquote

dquote dquote /       ; escaped double quote
%xC0-DF %x80-BF /     ; 2 byte UTF-8 character
%xE0-EF 2(%x80-BF) /  ; 3 byte UTF-8 character
%xF0-F7 3(%x80-BF)    ; 4 byte UTF-8 character

func IsUTFMB

func IsUTFMB(x any) bool

IsUTFMB returns a Boolean value indicative of the input value -- which may be a string, rune, rune slice, byte or byte slice -- being a valid UTFMB value.

Types

type AssertionValue

type AssertionValue []uint8

AssertionValue implements an OCTET STRING value.

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.

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 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 New

func New(x any) (SubstringAssertion, error)

New returns an error following an analysis of x in the context of a Substring Assertion.

func (SubstringAssertion) IsZero

func (r SubstringAssertion) IsZero() bool

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

func (SubstringAssertion) String

func (r SubstringAssertion) String() (s 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 NewUTF8String

func NewUTF8String(x any) (UTF8String, error)

NewUTF8String returns an instance of UTF8String alongside an error following an analysis of x in the context of a UTF8-compliant 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.

Jump to

Keyboard shortcuts

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