docs(ax): finish naming and path guidance pass
This commit is contained in:
parent
bd66579a86
commit
d8bda28eae
5 changed files with 263 additions and 12 deletions
21
lns.go
21
lns.go
|
|
@ -248,9 +248,10 @@ func lookupCatalogName[T any](
|
|||
// LookupCatalogName resolves a raw or canonical catalog label with service-scoped
|
||||
// dispatch semantics that match the package-level helper.
|
||||
//
|
||||
// The helper first checks the raw label path, then falls back to canonical
|
||||
//
|
||||
// The helper first checks the raw label path, then falls back to canonical
|
||||
// name hashing and hash callback resolution.
|
||||
//
|
||||
// item, ok := svc.LookupCatalogName(name, byLabel, byHash)
|
||||
func (s *Service) LookupCatalogName(
|
||||
name any,
|
||||
byLabel func(string) (any, bool),
|
||||
|
|
@ -2549,7 +2550,10 @@ func GetReserved(name any) (covenant.ReservedName, bool) {
|
|||
return lookupReserved(name)
|
||||
}
|
||||
|
||||
// GetReservedName looks up a reserved name after canonicalisation.
|
||||
// GetReservedName looks up a reserved name using the raw catalog label first.
|
||||
//
|
||||
// The helper accepts the bare label first, then falls back to canonical
|
||||
// `.lthn` resolution so existing callers can pass either form.
|
||||
//
|
||||
// item, ok := lns.GetReservedName("reserved")
|
||||
func GetReservedName(name any) (covenant.ReservedName, bool) {
|
||||
|
|
@ -2634,7 +2638,8 @@ func HasReservedByName(name any) bool {
|
|||
return HasReservedName(name)
|
||||
}
|
||||
|
||||
// HasReservedName reports whether a reserved name exists using the raw catalog label.
|
||||
// HasReservedName reports whether a reserved name exists using the raw catalog
|
||||
// label.
|
||||
//
|
||||
// ok := lns.HasReservedName("reserved")
|
||||
func HasReservedName(name any) bool {
|
||||
|
|
@ -2678,7 +2683,10 @@ func GetLocked(name any) (covenant.LockedName, bool) {
|
|||
return lookupLocked(name)
|
||||
}
|
||||
|
||||
// GetLockedName looks up a locked name after canonicalisation.
|
||||
// GetLockedName looks up a locked name using the raw catalog label first.
|
||||
//
|
||||
// The helper accepts the bare label first, then falls back to canonical
|
||||
// `.lthn` resolution so existing callers can pass either form.
|
||||
//
|
||||
// item, ok := lns.GetLockedName("nec")
|
||||
func GetLockedName(name any) (covenant.LockedName, bool) {
|
||||
|
|
@ -2763,7 +2771,8 @@ func HasLockedByName(name any) bool {
|
|||
return HasLockedName(name)
|
||||
}
|
||||
|
||||
// HasLockedName reports whether a locked name exists using the raw catalog label.
|
||||
// HasLockedName reports whether a locked name exists using the raw catalog
|
||||
// label.
|
||||
//
|
||||
// ok := lns.HasLockedName("nec")
|
||||
func HasLockedName(name any) bool {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
// Package covenant in pkg/covenant/blind.go documents the sealed-bid helper
|
||||
// used by the Lethean Name System covenant rules.
|
||||
// Package covenant documents the sealed-bid helper used by the Lethean Name
|
||||
// System covenant rules. Path as documentation: pkg/covenant/blind.go covers
|
||||
// bid commitments, while covenant.go and the lookup files cover rule metadata
|
||||
// and reference catalogs.
|
||||
//
|
||||
// Create a commitment from a bid value and nonce:
|
||||
//
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
// Package covenant in pkg/covenant/locked_lookup.go documents the locked-name
|
||||
// catalog path for the Lethean Name System.
|
||||
// Package covenant documents the locked-name catalog path for the Lethean Name
|
||||
// System. Path as documentation: pkg/covenant/locked_lookup.go covers the
|
||||
// locked reference table, while reserved_lookup.go covers the reserved table.
|
||||
//
|
||||
// Look up a locked label:
|
||||
//
|
||||
|
|
@ -32,6 +33,8 @@ type LockedName struct {
|
|||
}
|
||||
|
||||
// LockedCatalog exposes the locked-name reference table.
|
||||
//
|
||||
// catalog := covenant.DefaultLockedCatalog()
|
||||
type LockedCatalog struct {
|
||||
byHash map[primitives.Hash]LockedName
|
||||
}
|
||||
|
|
@ -53,21 +56,29 @@ var (
|
|||
//
|
||||
// Lookup is case-insensitive and accepts a canonical `.lthn` suffix in
|
||||
// addition to bare labels.
|
||||
//
|
||||
// ok := covenant.HasLockedName("example")
|
||||
func HasLockedName(name string) bool {
|
||||
return DefaultLockedCatalog().HasByName(name)
|
||||
}
|
||||
|
||||
// HasLockedByName is an alias for HasLockedName.
|
||||
//
|
||||
// ok := covenant.HasLockedByName("example")
|
||||
func HasLockedByName(name string) bool {
|
||||
return HasLockedName(name)
|
||||
}
|
||||
|
||||
// HasLockedString is an alias for HasLockedName.
|
||||
//
|
||||
// ok := covenant.HasLockedString("example")
|
||||
func HasLockedString(name string) bool {
|
||||
return HasLockedName(name)
|
||||
}
|
||||
|
||||
// HasLockedBinary is an alias for HasLockedName.
|
||||
//
|
||||
// ok := covenant.HasLockedBinary([]byte("example"))
|
||||
func HasLockedBinary(name []byte) bool {
|
||||
return HasLockedName(string(name))
|
||||
}
|
||||
|
|
@ -76,81 +87,113 @@ func HasLockedBinary(name []byte) bool {
|
|||
//
|
||||
// The input is lower-cased before hashing, and canonical `.lthn` suffixes are
|
||||
// stripped before lookup.
|
||||
//
|
||||
// item, ok := covenant.GetLockedName("example")
|
||||
func GetLockedName(name string) (LockedName, bool) {
|
||||
return DefaultLockedCatalog().GetByName(name)
|
||||
}
|
||||
|
||||
// GetLockedByName is an alias for GetLockedName.
|
||||
//
|
||||
// item, ok := covenant.GetLockedByName("example")
|
||||
func GetLockedByName(name string) (LockedName, bool) {
|
||||
return GetLockedName(name)
|
||||
}
|
||||
|
||||
// GetLockedString is an alias for GetLockedName.
|
||||
//
|
||||
// item, ok := covenant.GetLockedString("example")
|
||||
func GetLockedString(name string) (LockedName, bool) {
|
||||
return GetLockedName(name)
|
||||
}
|
||||
|
||||
// GetLockedBinary is an alias for GetLockedName.
|
||||
//
|
||||
// item, ok := covenant.GetLockedBinary([]byte("example"))
|
||||
func GetLockedBinary(name []byte) (LockedName, bool) {
|
||||
return GetLockedName(string(name))
|
||||
}
|
||||
|
||||
// HasLockedByString is an alias for HasLockedString.
|
||||
//
|
||||
// ok := covenant.HasLockedByString("example")
|
||||
func HasLockedByString(name string) bool {
|
||||
return HasLockedString(name)
|
||||
}
|
||||
|
||||
// HasLockedByBinary is an alias for HasLockedBinary.
|
||||
//
|
||||
// ok := covenant.HasLockedByBinary([]byte("example"))
|
||||
func HasLockedByBinary(name []byte) bool {
|
||||
return HasLockedBinary(name)
|
||||
}
|
||||
|
||||
// GetLockedByString is an alias for GetLockedString.
|
||||
//
|
||||
// item, ok := covenant.GetLockedByString("example")
|
||||
func GetLockedByString(name string) (LockedName, bool) {
|
||||
return GetLockedString(name)
|
||||
}
|
||||
|
||||
// GetLockedByBinary is an alias for GetLockedBinary.
|
||||
//
|
||||
// item, ok := covenant.GetLockedByBinary([]byte("example"))
|
||||
func GetLockedByBinary(name []byte) (LockedName, bool) {
|
||||
return GetLockedBinary(name)
|
||||
}
|
||||
|
||||
// GetLockedHash returns the locked-name entry for a precomputed hash.
|
||||
//
|
||||
// item, ok := covenant.GetLockedHash(hash)
|
||||
func GetLockedHash(hash primitives.Hash) (LockedName, bool) {
|
||||
return defaultLockedCatalog().Get(hash)
|
||||
}
|
||||
|
||||
// HasLockedHash reports whether a precomputed hash is present in the catalog.
|
||||
//
|
||||
// ok := covenant.HasLockedHash(hash)
|
||||
func HasLockedHash(hash primitives.Hash) bool {
|
||||
return DefaultLockedCatalog().Has(hash)
|
||||
}
|
||||
|
||||
// GetLockedByHash is an alias for GetLockedHash.
|
||||
//
|
||||
// item, ok := covenant.GetLockedByHash(hash)
|
||||
func GetLockedByHash(hash primitives.Hash) (LockedName, bool) {
|
||||
return GetLockedHash(hash)
|
||||
}
|
||||
|
||||
// HasLockedByHash is an alias for HasLockedHash.
|
||||
//
|
||||
// ok := covenant.HasLockedByHash(hash)
|
||||
func HasLockedByHash(hash primitives.Hash) bool {
|
||||
return HasLockedHash(hash)
|
||||
}
|
||||
|
||||
// DefaultLockedCatalog returns the lazily loaded locked-name catalog.
|
||||
//
|
||||
// catalog := covenant.DefaultLockedCatalog()
|
||||
func DefaultLockedCatalog() *LockedCatalog {
|
||||
return defaultLockedCatalog()
|
||||
}
|
||||
|
||||
// GetLockedCatalog is an alias for DefaultLockedCatalog.
|
||||
//
|
||||
// catalog := covenant.GetLockedCatalog()
|
||||
func GetLockedCatalog() *LockedCatalog {
|
||||
return DefaultLockedCatalog()
|
||||
}
|
||||
|
||||
// GetDefaultLockedCatalog is an alias for DefaultLockedCatalog.
|
||||
//
|
||||
// catalog := covenant.GetDefaultLockedCatalog()
|
||||
func GetDefaultLockedCatalog() *LockedCatalog {
|
||||
return DefaultLockedCatalog()
|
||||
}
|
||||
|
||||
// Size reports the number of locked-name entries in the catalog.
|
||||
//
|
||||
// size := catalog.Size()
|
||||
func (c *LockedCatalog) Size() int {
|
||||
if c == nil {
|
||||
return 0
|
||||
|
|
@ -160,21 +203,29 @@ func (c *LockedCatalog) Size() int {
|
|||
}
|
||||
|
||||
// GetSize is an alias for Size.
|
||||
//
|
||||
// size := catalog.GetSize()
|
||||
func (c *LockedCatalog) GetSize() int {
|
||||
return c.Size()
|
||||
}
|
||||
|
||||
// PrefixSize reports the byte offset where the locked-name table entries begin.
|
||||
//
|
||||
// offset := catalog.PrefixSize()
|
||||
func (c *LockedCatalog) PrefixSize() int {
|
||||
return lockedCatalogPrefixSize
|
||||
}
|
||||
|
||||
// GetPrefixSize is an alias for PrefixSize.
|
||||
//
|
||||
// offset := catalog.GetPrefixSize()
|
||||
func (c *LockedCatalog) GetPrefixSize() int {
|
||||
return c.PrefixSize()
|
||||
}
|
||||
|
||||
// Has reports whether the catalog contains the hash.
|
||||
//
|
||||
// ok := catalog.Has(hash)
|
||||
func (c *LockedCatalog) Has(hash primitives.Hash) bool {
|
||||
if c == nil {
|
||||
return false
|
||||
|
|
@ -185,11 +236,15 @@ func (c *LockedCatalog) Has(hash primitives.Hash) bool {
|
|||
}
|
||||
|
||||
// HasByHash is an alias for Has.
|
||||
//
|
||||
// ok := catalog.HasByHash(hash)
|
||||
func (c *LockedCatalog) HasByHash(hash primitives.Hash) bool {
|
||||
return c.Has(hash)
|
||||
}
|
||||
|
||||
// Get returns the locked-name entry for the hash.
|
||||
//
|
||||
// item, ok := catalog.Get(hash)
|
||||
func (c *LockedCatalog) Get(hash primitives.Hash) (LockedName, bool) {
|
||||
if c == nil {
|
||||
return LockedName{}, false
|
||||
|
|
@ -200,11 +255,15 @@ func (c *LockedCatalog) Get(hash primitives.Hash) (LockedName, bool) {
|
|||
}
|
||||
|
||||
// GetByHash is an alias for Get.
|
||||
//
|
||||
// item, ok := catalog.GetByHash(hash)
|
||||
func (c *LockedCatalog) GetByHash(hash primitives.Hash) (LockedName, bool) {
|
||||
return c.Get(hash)
|
||||
}
|
||||
|
||||
// HasByName reports whether the catalog contains the provided label.
|
||||
//
|
||||
// ok := catalog.HasByName("example")
|
||||
func (c *LockedCatalog) HasByName(name string) bool {
|
||||
_, ok := c.GetByName(name)
|
||||
return ok
|
||||
|
|
@ -214,6 +273,8 @@ func (c *LockedCatalog) HasByName(name string) bool {
|
|||
//
|
||||
// The lookup lower-cases ASCII input, strips canonical `.lthn` suffixes, and
|
||||
// hashes the normalized label directly.
|
||||
//
|
||||
// item, ok := catalog.GetByName("example")
|
||||
func (c *LockedCatalog) GetByName(name string) (LockedName, bool) {
|
||||
name, ok := asciiLowerName(name)
|
||||
if !ok {
|
||||
|
|
@ -225,6 +286,8 @@ func (c *LockedCatalog) GetByName(name string) (LockedName, bool) {
|
|||
}
|
||||
|
||||
// Entries returns the catalog contents as hash/item pairs.
|
||||
//
|
||||
// entries := catalog.Entries()
|
||||
func (c *LockedCatalog) Entries() []LockedEntry {
|
||||
if c == nil || len(c.byHash) == 0 {
|
||||
return nil
|
||||
|
|
@ -246,11 +309,15 @@ func (c *LockedCatalog) Entries() []LockedEntry {
|
|||
}
|
||||
|
||||
// GetEntries is an alias for Entries.
|
||||
//
|
||||
// entries := catalog.GetEntries()
|
||||
func (c *LockedCatalog) GetEntries() []LockedEntry {
|
||||
return c.Entries()
|
||||
}
|
||||
|
||||
// Keys returns the locked-name hashes in deterministic order.
|
||||
//
|
||||
// keys := catalog.Keys()
|
||||
func (c *LockedCatalog) Keys() []primitives.Hash {
|
||||
if c == nil || len(c.byHash) == 0 {
|
||||
return nil
|
||||
|
|
@ -263,11 +330,15 @@ func (c *LockedCatalog) Keys() []primitives.Hash {
|
|||
}
|
||||
|
||||
// GetKeys is an alias for Keys.
|
||||
//
|
||||
// keys := catalog.GetKeys()
|
||||
func (c *LockedCatalog) GetKeys() []primitives.Hash {
|
||||
return c.Keys()
|
||||
}
|
||||
|
||||
// Values returns the locked-name entries in deterministic order.
|
||||
//
|
||||
// values := catalog.Values()
|
||||
func (c *LockedCatalog) Values() []LockedName {
|
||||
if c == nil || len(c.byHash) == 0 {
|
||||
return nil
|
||||
|
|
@ -289,6 +360,8 @@ func (c *LockedCatalog) Values() []LockedName {
|
|||
}
|
||||
|
||||
// GetValues is an alias for Values.
|
||||
//
|
||||
// values := catalog.GetValues()
|
||||
func (c *LockedCatalog) GetValues() []LockedName {
|
||||
return c.Values()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
// Package covenant in pkg/covenant/reserved_lookup.go documents the reserved
|
||||
// name catalog path for the Lethean Name System.
|
||||
// Package covenant documents the reserved-name catalog path for the Lethean
|
||||
// Name System. Path as documentation: pkg/covenant/reserved_lookup.go covers
|
||||
// the reserved reference table, while locked_lookup.go covers the locked one.
|
||||
//
|
||||
// Look up a reserved label:
|
||||
//
|
||||
|
|
@ -41,6 +42,8 @@ type ReservedName struct {
|
|||
}
|
||||
|
||||
// ReservedCatalog exposes the reserved-name reference table.
|
||||
//
|
||||
// catalog := covenant.DefaultReservedCatalog()
|
||||
type ReservedCatalog struct {
|
||||
byHash map[primitives.Hash]ReservedName
|
||||
nameValue uint64
|
||||
|
|
@ -69,21 +72,29 @@ var (
|
|||
//
|
||||
// Lookup is case-insensitive and accepts a canonical `.lthn` suffix in
|
||||
// addition to bare labels.
|
||||
//
|
||||
// ok := covenant.HasReservedName("example")
|
||||
func HasReservedName(name string) bool {
|
||||
return DefaultReservedCatalog().HasByName(name)
|
||||
}
|
||||
|
||||
// HasReservedByName is an alias for HasReservedName.
|
||||
//
|
||||
// ok := covenant.HasReservedByName("example")
|
||||
func HasReservedByName(name string) bool {
|
||||
return HasReservedName(name)
|
||||
}
|
||||
|
||||
// HasReservedString is an alias for HasReservedName.
|
||||
//
|
||||
// ok := covenant.HasReservedString("example")
|
||||
func HasReservedString(name string) bool {
|
||||
return HasReservedName(name)
|
||||
}
|
||||
|
||||
// HasReservedBinary is an alias for HasReservedName.
|
||||
//
|
||||
// ok := covenant.HasReservedBinary([]byte("example"))
|
||||
func HasReservedBinary(name []byte) bool {
|
||||
return HasReservedName(string(name))
|
||||
}
|
||||
|
|
@ -92,81 +103,113 @@ func HasReservedBinary(name []byte) bool {
|
|||
//
|
||||
// The input is lower-cased before hashing, and canonical `.lthn` suffixes are
|
||||
// stripped before lookup.
|
||||
//
|
||||
// item, ok := covenant.GetReservedName("example")
|
||||
func GetReservedName(name string) (ReservedName, bool) {
|
||||
return DefaultReservedCatalog().GetByName(name)
|
||||
}
|
||||
|
||||
// GetReservedByName is an alias for GetReservedName.
|
||||
//
|
||||
// item, ok := covenant.GetReservedByName("example")
|
||||
func GetReservedByName(name string) (ReservedName, bool) {
|
||||
return GetReservedName(name)
|
||||
}
|
||||
|
||||
// GetReservedString is an alias for GetReservedName.
|
||||
//
|
||||
// item, ok := covenant.GetReservedString("example")
|
||||
func GetReservedString(name string) (ReservedName, bool) {
|
||||
return GetReservedName(name)
|
||||
}
|
||||
|
||||
// GetReservedBinary is an alias for GetReservedName.
|
||||
//
|
||||
// item, ok := covenant.GetReservedBinary([]byte("example"))
|
||||
func GetReservedBinary(name []byte) (ReservedName, bool) {
|
||||
return GetReservedName(string(name))
|
||||
}
|
||||
|
||||
// HasReservedByString is an alias for HasReservedString.
|
||||
//
|
||||
// ok := covenant.HasReservedByString("example")
|
||||
func HasReservedByString(name string) bool {
|
||||
return HasReservedString(name)
|
||||
}
|
||||
|
||||
// HasReservedByBinary is an alias for HasReservedBinary.
|
||||
//
|
||||
// ok := covenant.HasReservedByBinary([]byte("example"))
|
||||
func HasReservedByBinary(name []byte) bool {
|
||||
return HasReservedBinary(name)
|
||||
}
|
||||
|
||||
// GetReservedByString is an alias for GetReservedString.
|
||||
//
|
||||
// item, ok := covenant.GetReservedByString("example")
|
||||
func GetReservedByString(name string) (ReservedName, bool) {
|
||||
return GetReservedString(name)
|
||||
}
|
||||
|
||||
// GetReservedByBinary is an alias for GetReservedBinary.
|
||||
//
|
||||
// item, ok := covenant.GetReservedByBinary([]byte("example"))
|
||||
func GetReservedByBinary(name []byte) (ReservedName, bool) {
|
||||
return GetReservedBinary(name)
|
||||
}
|
||||
|
||||
// GetReservedHash returns the reserved-name entry for a precomputed hash.
|
||||
//
|
||||
// item, ok := covenant.GetReservedHash(hash)
|
||||
func GetReservedHash(hash primitives.Hash) (ReservedName, bool) {
|
||||
return defaultReservedCatalog().Get(hash)
|
||||
}
|
||||
|
||||
// HasReservedHash reports whether a precomputed hash is present in the catalog.
|
||||
//
|
||||
// ok := covenant.HasReservedHash(hash)
|
||||
func HasReservedHash(hash primitives.Hash) bool {
|
||||
return DefaultReservedCatalog().Has(hash)
|
||||
}
|
||||
|
||||
// GetReservedByHash is an alias for GetReservedHash.
|
||||
//
|
||||
// item, ok := covenant.GetReservedByHash(hash)
|
||||
func GetReservedByHash(hash primitives.Hash) (ReservedName, bool) {
|
||||
return GetReservedHash(hash)
|
||||
}
|
||||
|
||||
// HasReservedByHash is an alias for HasReservedHash.
|
||||
//
|
||||
// ok := covenant.HasReservedByHash(hash)
|
||||
func HasReservedByHash(hash primitives.Hash) bool {
|
||||
return HasReservedHash(hash)
|
||||
}
|
||||
|
||||
// DefaultReservedCatalog returns the lazily loaded reserved-name catalog.
|
||||
//
|
||||
// catalog := covenant.DefaultReservedCatalog()
|
||||
func DefaultReservedCatalog() *ReservedCatalog {
|
||||
return defaultReservedCatalog()
|
||||
}
|
||||
|
||||
// GetReservedCatalog is an alias for DefaultReservedCatalog.
|
||||
//
|
||||
// catalog := covenant.GetReservedCatalog()
|
||||
func GetReservedCatalog() *ReservedCatalog {
|
||||
return DefaultReservedCatalog()
|
||||
}
|
||||
|
||||
// GetDefaultReservedCatalog is an alias for DefaultReservedCatalog.
|
||||
//
|
||||
// catalog := covenant.GetDefaultReservedCatalog()
|
||||
func GetDefaultReservedCatalog() *ReservedCatalog {
|
||||
return DefaultReservedCatalog()
|
||||
}
|
||||
|
||||
// Size reports the number of reserved-name entries in the catalog.
|
||||
//
|
||||
// size := catalog.Size()
|
||||
func (c *ReservedCatalog) Size() int {
|
||||
if c == nil {
|
||||
return 0
|
||||
|
|
@ -176,11 +219,15 @@ func (c *ReservedCatalog) Size() int {
|
|||
}
|
||||
|
||||
// GetSize is an alias for Size.
|
||||
//
|
||||
// size := catalog.GetSize()
|
||||
func (c *ReservedCatalog) GetSize() int {
|
||||
return c.Size()
|
||||
}
|
||||
|
||||
// NameValue reports the base value used for reserved-name lookups.
|
||||
//
|
||||
// base := catalog.NameValue()
|
||||
func (c *ReservedCatalog) NameValue() uint64 {
|
||||
if c == nil {
|
||||
return 0
|
||||
|
|
@ -190,11 +237,15 @@ func (c *ReservedCatalog) NameValue() uint64 {
|
|||
}
|
||||
|
||||
// GetNameValue is an alias for NameValue.
|
||||
//
|
||||
// base := catalog.GetNameValue()
|
||||
func (c *ReservedCatalog) GetNameValue() uint64 {
|
||||
return c.NameValue()
|
||||
}
|
||||
|
||||
// RootValue reports the root-name increment used for reserved-name lookups.
|
||||
//
|
||||
// root := catalog.RootValue()
|
||||
func (c *ReservedCatalog) RootValue() uint64 {
|
||||
if c == nil {
|
||||
return 0
|
||||
|
|
@ -204,11 +255,15 @@ func (c *ReservedCatalog) RootValue() uint64 {
|
|||
}
|
||||
|
||||
// GetRootValue is an alias for RootValue.
|
||||
//
|
||||
// root := catalog.GetRootValue()
|
||||
func (c *ReservedCatalog) GetRootValue() uint64 {
|
||||
return c.RootValue()
|
||||
}
|
||||
|
||||
// TopValue reports the top-100 increment used for reserved-name lookups.
|
||||
//
|
||||
// top := catalog.TopValue()
|
||||
func (c *ReservedCatalog) TopValue() uint64 {
|
||||
if c == nil {
|
||||
return 0
|
||||
|
|
@ -218,21 +273,29 @@ func (c *ReservedCatalog) TopValue() uint64 {
|
|||
}
|
||||
|
||||
// GetTopValue is an alias for TopValue.
|
||||
//
|
||||
// top := catalog.GetTopValue()
|
||||
func (c *ReservedCatalog) GetTopValue() uint64 {
|
||||
return c.TopValue()
|
||||
}
|
||||
|
||||
// PrefixSize reports the byte offset where the reserved-name table entries begin.
|
||||
//
|
||||
// offset := catalog.PrefixSize()
|
||||
func (c *ReservedCatalog) PrefixSize() int {
|
||||
return reservedCatalogPrefixSize
|
||||
}
|
||||
|
||||
// GetPrefixSize is an alias for PrefixSize.
|
||||
//
|
||||
// offset := catalog.GetPrefixSize()
|
||||
func (c *ReservedCatalog) GetPrefixSize() int {
|
||||
return c.PrefixSize()
|
||||
}
|
||||
|
||||
// Has reports whether the catalog contains the hash.
|
||||
//
|
||||
// ok := catalog.Has(hash)
|
||||
func (c *ReservedCatalog) Has(hash primitives.Hash) bool {
|
||||
if c == nil {
|
||||
return false
|
||||
|
|
@ -243,11 +306,15 @@ func (c *ReservedCatalog) Has(hash primitives.Hash) bool {
|
|||
}
|
||||
|
||||
// HasByHash is an alias for Has.
|
||||
//
|
||||
// ok := catalog.HasByHash(hash)
|
||||
func (c *ReservedCatalog) HasByHash(hash primitives.Hash) bool {
|
||||
return c.Has(hash)
|
||||
}
|
||||
|
||||
// Get returns the reserved-name entry for the hash.
|
||||
//
|
||||
// item, ok := catalog.Get(hash)
|
||||
func (c *ReservedCatalog) Get(hash primitives.Hash) (ReservedName, bool) {
|
||||
if c == nil {
|
||||
return ReservedName{}, false
|
||||
|
|
@ -258,11 +325,15 @@ func (c *ReservedCatalog) Get(hash primitives.Hash) (ReservedName, bool) {
|
|||
}
|
||||
|
||||
// GetByHash is an alias for Get.
|
||||
//
|
||||
// item, ok := catalog.GetByHash(hash)
|
||||
func (c *ReservedCatalog) GetByHash(hash primitives.Hash) (ReservedName, bool) {
|
||||
return c.Get(hash)
|
||||
}
|
||||
|
||||
// HasByName reports whether the catalog contains the provided label.
|
||||
//
|
||||
// ok := catalog.HasByName("example")
|
||||
func (c *ReservedCatalog) HasByName(name string) bool {
|
||||
_, ok := c.GetByName(name)
|
||||
return ok
|
||||
|
|
@ -272,6 +343,8 @@ func (c *ReservedCatalog) HasByName(name string) bool {
|
|||
//
|
||||
// The lookup lower-cases ASCII input, strips canonical `.lthn` suffixes, and
|
||||
// hashes the normalized label directly.
|
||||
//
|
||||
// item, ok := catalog.GetByName("example")
|
||||
func (c *ReservedCatalog) GetByName(name string) (ReservedName, bool) {
|
||||
name, ok := asciiLowerName(name)
|
||||
if !ok {
|
||||
|
|
@ -283,6 +356,8 @@ func (c *ReservedCatalog) GetByName(name string) (ReservedName, bool) {
|
|||
}
|
||||
|
||||
// Entries returns the catalog contents as hash/item pairs.
|
||||
//
|
||||
// entries := catalog.Entries()
|
||||
func (c *ReservedCatalog) Entries() []ReservedEntry {
|
||||
if c == nil || len(c.byHash) == 0 {
|
||||
return nil
|
||||
|
|
@ -304,11 +379,15 @@ func (c *ReservedCatalog) Entries() []ReservedEntry {
|
|||
}
|
||||
|
||||
// GetEntries is an alias for Entries.
|
||||
//
|
||||
// entries := catalog.GetEntries()
|
||||
func (c *ReservedCatalog) GetEntries() []ReservedEntry {
|
||||
return c.Entries()
|
||||
}
|
||||
|
||||
// Keys returns the reserved-name hashes in deterministic order.
|
||||
//
|
||||
// keys := catalog.Keys()
|
||||
func (c *ReservedCatalog) Keys() []primitives.Hash {
|
||||
if c == nil || len(c.byHash) == 0 {
|
||||
return nil
|
||||
|
|
@ -321,11 +400,15 @@ func (c *ReservedCatalog) Keys() []primitives.Hash {
|
|||
}
|
||||
|
||||
// GetKeys is an alias for Keys.
|
||||
//
|
||||
// keys := catalog.GetKeys()
|
||||
func (c *ReservedCatalog) GetKeys() []primitives.Hash {
|
||||
return c.Keys()
|
||||
}
|
||||
|
||||
// Values returns the reserved-name entries in deterministic order.
|
||||
//
|
||||
// values := catalog.Values()
|
||||
func (c *ReservedCatalog) Values() []ReservedName {
|
||||
if c == nil || len(c.byHash) == 0 {
|
||||
return nil
|
||||
|
|
@ -347,6 +430,8 @@ func (c *ReservedCatalog) Values() []ReservedName {
|
|||
}
|
||||
|
||||
// GetValues is an alias for Values.
|
||||
//
|
||||
// values := catalog.GetValues()
|
||||
func (c *ReservedCatalog) GetValues() []ReservedName {
|
||||
return c.Values()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,6 +152,8 @@ func GetHashBinary(name []byte) (primitives.Hash, error) {
|
|||
}
|
||||
|
||||
// ResolveName is an alias for Resolve.
|
||||
//
|
||||
// hash, err := dns.ResolveName("example.lthn")
|
||||
func ResolveName(name any) (primitives.Hash, error) {
|
||||
return Resolve(name)
|
||||
}
|
||||
|
|
@ -164,6 +166,8 @@ func GetResolveName(name any) (primitives.Hash, error) {
|
|||
}
|
||||
|
||||
// HashName is an alias for Hash.
|
||||
//
|
||||
// hash, err := dns.HashName("example.lthn")
|
||||
func HashName(name any) (primitives.Hash, error) {
|
||||
return Hash(name)
|
||||
}
|
||||
|
|
@ -176,6 +180,8 @@ func GetHashName(name any) (primitives.Hash, error) {
|
|||
}
|
||||
|
||||
// VerifyName is an alias for Verify.
|
||||
//
|
||||
// ok := dns.VerifyName("example.lthn")
|
||||
func VerifyName(name any) bool {
|
||||
return Verify(name)
|
||||
}
|
||||
|
|
@ -279,6 +285,8 @@ func VerifyByString(name string) bool {
|
|||
}
|
||||
|
||||
// GetVerifyByString is an alias for VerifyByString.
|
||||
//
|
||||
// ok := dns.VerifyByString("example.lthn")
|
||||
func GetVerifyByString(name string) bool {
|
||||
return VerifyByString(name)
|
||||
}
|
||||
|
|
@ -291,6 +299,8 @@ func VerifyByBinary(name []byte) bool {
|
|||
}
|
||||
|
||||
// GetVerifyByBinary is an alias for VerifyByBinary.
|
||||
//
|
||||
// ok := dns.VerifyByBinary([]byte("example.lthn"))
|
||||
func GetVerifyByBinary(name []byte) bool {
|
||||
return VerifyByBinary(name)
|
||||
}
|
||||
|
|
@ -381,16 +391,25 @@ func (s *Service) Resolve(name any) (primitives.Hash, error) {
|
|||
}
|
||||
|
||||
// GetResolve is an alias for Resolve.
|
||||
//
|
||||
// svc := dns.NewService()
|
||||
// hash, err := svc.Resolve("example.lthn")
|
||||
func (s *Service) GetResolve(name any) (primitives.Hash, error) {
|
||||
return s.Resolve(name)
|
||||
}
|
||||
|
||||
// Hash returns the canonical hash for a .lthn name.
|
||||
//
|
||||
// svc := dns.NewService()
|
||||
// hash, err := svc.Hash("example.lthn")
|
||||
func (s *Service) Hash(name any) (primitives.Hash, error) {
|
||||
return resolveCanonicalName("dns.Service.Hash", name)
|
||||
}
|
||||
|
||||
// GetHash is an alias for Hash.
|
||||
//
|
||||
// svc := dns.NewService()
|
||||
// hash, err := svc.Hash("example.lthn")
|
||||
func (s *Service) GetHash(name any) (primitives.Hash, error) {
|
||||
return s.Hash(name)
|
||||
}
|
||||
|
|
@ -407,6 +426,9 @@ func (s *Service) Verify(name any) bool {
|
|||
}
|
||||
|
||||
// GetVerify is an alias for Verify.
|
||||
//
|
||||
// svc := dns.NewService()
|
||||
// ok := svc.Verify("example.lthn")
|
||||
func (s *Service) GetVerify(name any) bool {
|
||||
return s.Verify(name)
|
||||
}
|
||||
|
|
@ -419,6 +441,8 @@ func (s *Service) HashString(name string) (primitives.Hash, error) {
|
|||
}
|
||||
|
||||
// GetHashString is an alias for HashString.
|
||||
//
|
||||
// hash, err := svc.HashString("example.lthn")
|
||||
func (s *Service) GetHashString(name string) (primitives.Hash, error) {
|
||||
return s.HashString(name)
|
||||
}
|
||||
|
|
@ -431,6 +455,8 @@ func (s *Service) HashBinary(name []byte) (primitives.Hash, error) {
|
|||
}
|
||||
|
||||
// GetHashBinary is an alias for HashBinary.
|
||||
//
|
||||
// hash, err := svc.HashBinary([]byte("example.lthn"))
|
||||
func (s *Service) GetHashBinary(name []byte) (primitives.Hash, error) {
|
||||
return s.HashBinary(name)
|
||||
}
|
||||
|
|
@ -444,6 +470,9 @@ func (s *Service) ResolveByString(name string) (primitives.Hash, error) {
|
|||
}
|
||||
|
||||
// GetResolveByString is an alias for ResolveByString.
|
||||
//
|
||||
// svc := dns.NewService()
|
||||
// hash, err := svc.ResolveByString("example.lthn")
|
||||
func (s *Service) GetResolveByString(name string) (primitives.Hash, error) {
|
||||
return s.ResolveByString(name)
|
||||
}
|
||||
|
|
@ -457,6 +486,9 @@ func (s *Service) ResolveByBinary(name []byte) (primitives.Hash, error) {
|
|||
}
|
||||
|
||||
// GetResolveByBinary is an alias for ResolveByBinary.
|
||||
//
|
||||
// svc := dns.NewService()
|
||||
// hash, err := svc.ResolveByBinary([]byte("example.lthn"))
|
||||
func (s *Service) GetResolveByBinary(name []byte) (primitives.Hash, error) {
|
||||
return s.ResolveByBinary(name)
|
||||
}
|
||||
|
|
@ -470,6 +502,9 @@ func (s *Service) HashByString(name string) (primitives.Hash, error) {
|
|||
}
|
||||
|
||||
// GetHashByString is an alias for HashByString.
|
||||
//
|
||||
// svc := dns.NewService()
|
||||
// hash, err := svc.HashByString("example.lthn")
|
||||
func (s *Service) GetHashByString(name string) (primitives.Hash, error) {
|
||||
return s.HashByString(name)
|
||||
}
|
||||
|
|
@ -483,6 +518,9 @@ func (s *Service) HashByBinary(name []byte) (primitives.Hash, error) {
|
|||
}
|
||||
|
||||
// GetHashByBinary is an alias for HashByBinary.
|
||||
//
|
||||
// svc := dns.NewService()
|
||||
// hash, err := svc.HashByBinary([]byte("example.lthn"))
|
||||
func (s *Service) GetHashByBinary(name []byte) (primitives.Hash, error) {
|
||||
return s.HashByBinary(name)
|
||||
}
|
||||
|
|
@ -496,6 +534,9 @@ func (s *Service) ResolveString(name string) (primitives.Hash, error) {
|
|||
}
|
||||
|
||||
// GetResolveString is an alias for ResolveString.
|
||||
//
|
||||
// svc := dns.NewService()
|
||||
// hash, err := svc.ResolveString("example.lthn")
|
||||
func (s *Service) GetResolveString(name string) (primitives.Hash, error) {
|
||||
return s.ResolveString(name)
|
||||
}
|
||||
|
|
@ -509,6 +550,9 @@ func (s *Service) ResolveBinary(name []byte) (primitives.Hash, error) {
|
|||
}
|
||||
|
||||
// GetResolveBinary is an alias for ResolveBinary.
|
||||
//
|
||||
// svc := dns.NewService()
|
||||
// hash, err := svc.ResolveBinary([]byte("example.lthn"))
|
||||
func (s *Service) GetResolveBinary(name []byte) (primitives.Hash, error) {
|
||||
return s.ResolveBinary(name)
|
||||
}
|
||||
|
|
@ -522,6 +566,9 @@ func (s *Service) ResolveName(name any) (primitives.Hash, error) {
|
|||
}
|
||||
|
||||
// GetResolveName is an alias for ResolveName.
|
||||
//
|
||||
// svc := dns.NewService()
|
||||
// hash, err := svc.ResolveName("example.lthn")
|
||||
func (s *Service) GetResolveName(name any) (primitives.Hash, error) {
|
||||
return s.ResolveName(name)
|
||||
}
|
||||
|
|
@ -534,6 +581,8 @@ func (s *Service) HashName(name any) (primitives.Hash, error) {
|
|||
}
|
||||
|
||||
// GetHashName is an alias for HashName.
|
||||
//
|
||||
// hash, err := svc.HashName("example.lthn")
|
||||
func (s *Service) GetHashName(name any) (primitives.Hash, error) {
|
||||
return s.HashName(name)
|
||||
}
|
||||
|
|
@ -547,6 +596,9 @@ func (s *Service) VerifyString(name string) bool {
|
|||
}
|
||||
|
||||
// GetVerifyString is an alias for VerifyString.
|
||||
//
|
||||
// svc := dns.NewService()
|
||||
// ok := svc.VerifyString("example.lthn")
|
||||
func (s *Service) GetVerifyString(name string) bool {
|
||||
return s.VerifyString(name)
|
||||
}
|
||||
|
|
@ -560,6 +612,9 @@ func (s *Service) VerifyBinary(name []byte) bool {
|
|||
}
|
||||
|
||||
// GetVerifyBinary is an alias for VerifyBinary.
|
||||
//
|
||||
// svc := dns.NewService()
|
||||
// ok := svc.VerifyBinary([]byte("example.lthn"))
|
||||
func (s *Service) GetVerifyBinary(name []byte) bool {
|
||||
return s.VerifyBinary(name)
|
||||
}
|
||||
|
|
@ -573,11 +628,16 @@ func (s *Service) VerifyName(name any) bool {
|
|||
}
|
||||
|
||||
// GetVerifyName is an alias for VerifyName.
|
||||
//
|
||||
// svc := dns.NewService()
|
||||
// ok := svc.VerifyName("example.lthn")
|
||||
func (s *Service) GetVerifyName(name any) bool {
|
||||
return s.VerifyName(name)
|
||||
}
|
||||
|
||||
// ResolveByName is an alias for ResolveName.
|
||||
//
|
||||
// hash, err := dns.ResolveByName("example.lthn")
|
||||
func ResolveByName(name any) (primitives.Hash, error) {
|
||||
return ResolveName(name)
|
||||
}
|
||||
|
|
@ -590,6 +650,8 @@ func GetResolveByName(name any) (primitives.Hash, error) {
|
|||
}
|
||||
|
||||
// HashByName is an alias for HashName.
|
||||
//
|
||||
// hash, err := dns.HashByName("example.lthn")
|
||||
func HashByName(name any) (primitives.Hash, error) {
|
||||
return HashName(name)
|
||||
}
|
||||
|
|
@ -602,6 +664,8 @@ func GetHashByName(name any) (primitives.Hash, error) {
|
|||
}
|
||||
|
||||
// VerifyByName is an alias for VerifyName.
|
||||
//
|
||||
// ok := dns.VerifyByName("example.lthn")
|
||||
func VerifyByName(name any) bool {
|
||||
return VerifyName(name)
|
||||
}
|
||||
|
|
@ -622,6 +686,9 @@ func (s *Service) VerifyByString(name string) bool {
|
|||
}
|
||||
|
||||
// GetVerifyByString is an alias for VerifyByString.
|
||||
//
|
||||
// svc := dns.NewService()
|
||||
// ok := svc.VerifyByString("example.lthn")
|
||||
func (s *Service) GetVerifyByString(name string) bool {
|
||||
return s.VerifyByString(name)
|
||||
}
|
||||
|
|
@ -635,6 +702,9 @@ func (s *Service) VerifyByBinary(name []byte) bool {
|
|||
}
|
||||
|
||||
// GetVerifyByBinary is an alias for VerifyByBinary.
|
||||
//
|
||||
// svc := dns.NewService()
|
||||
// ok := svc.VerifyByBinary([]byte("example.lthn"))
|
||||
func (s *Service) GetVerifyByBinary(name []byte) bool {
|
||||
return s.VerifyByBinary(name)
|
||||
}
|
||||
|
|
@ -648,16 +718,25 @@ func (s *Service) ResolveByName(name any) (primitives.Hash, error) {
|
|||
}
|
||||
|
||||
// GetResolveByName is an alias for ResolveByName.
|
||||
//
|
||||
// svc := dns.NewService()
|
||||
// hash, err := svc.ResolveByName("example.lthn")
|
||||
func (s *Service) GetResolveByName(name any) (primitives.Hash, error) {
|
||||
return s.ResolveByName(name)
|
||||
}
|
||||
|
||||
// HashByName is an alias for HashName.
|
||||
//
|
||||
// svc := dns.NewService()
|
||||
// hash, err := svc.HashByName("example.lthn")
|
||||
func (s *Service) HashByName(name any) (primitives.Hash, error) {
|
||||
return s.HashName(name)
|
||||
}
|
||||
|
||||
// GetHashByName is an alias for HashByName.
|
||||
//
|
||||
// svc := dns.NewService()
|
||||
// hash, err := svc.HashByName("example.lthn")
|
||||
func (s *Service) GetHashByName(name any) (primitives.Hash, error) {
|
||||
return s.HashByName(name)
|
||||
}
|
||||
|
|
@ -671,6 +750,9 @@ func (s *Service) VerifyByName(name any) bool {
|
|||
}
|
||||
|
||||
// GetVerifyByName is an alias for VerifyByName.
|
||||
//
|
||||
// svc := dns.NewService()
|
||||
// ok := svc.VerifyByName("example.lthn")
|
||||
func (s *Service) GetVerifyByName(name any) bool {
|
||||
return s.VerifyByName(name)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue