ns

package
v0.0.0-...-20ab57b Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Overview

Package ns provides functionality of FrostFS name system.

DNS type is designed to resolve FrostFS-related names using Domain Name System:

const containerName = "some-container"

var dns DNS

containerID, err := dns.ResolveContainerName(containerName)
// ...

NNS type is designed to resolve FrostFS-related names using Neo Name Service:

var nns NNS

err := nns.Dial(nnsServerAddress)
// ...

var containerDomain container.Domain
containerDomain.SetName(containerName)

containerID, err := nns.ResolveContainerDomain(containerDomain)
// ...

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DNS

type DNS struct{}

DNS looks up FrostFS names using system DNS.

See also net package.

func (*DNS) ResolveContainerName

func (x *DNS) ResolveContainerName(name string) (id cid.ID, err error)

ResolveContainerName looks up for DNS TXT records for the given domain name and returns the first one which represents valid container ID in a string format. Otherwise, returns an error.

See also net.LookupTXT.

type NNS

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

NNS looks up FrostFS names using Neo Name Service.

Instances are created with a variable declaration. Before work, the connection to the NNS server MUST be established using Dial method.

func (*NNS) Close

func (n *NNS) Close()

Close closes connections of multiSchemeClient.

func (*NNS) Dial

func (n *NNS) Dial(address string) error

Dial connects to the address of the NNS server. If fails, the instance MUST NOT be used.

If URL address scheme is 'ws' or 'wss', then WebSocket protocol is used, otherwise HTTP.

func (*NNS) ResolveContainerDomain

func (n *NNS) ResolveContainerDomain(domain container.Domain) (cid.ID, error)

ResolveContainerDomain looks up for NNS TXT records for the given container domain by calling `resolve` method of NNS contract. Returns the first record which represents valid container ID in a string format. Otherwise, returns an error.

ResolveContainerDomain MUST NOT be called before successful Dial.

See also https://docs.neo.org/docs/en-us/reference/nns.html.

func (*NNS) ResolveContractHash

func (n *NNS) ResolveContractHash(domain container.Domain) (util.Uint160, error)

ResolveContractHash looks up for NNS TXT records for the given container domain by calling `resolve` method of NNS contract. Returns the first record which represents valid contract hash 20 bytes long unsigned integer. Otherwise, returns an error.

ResolveContractHash MUST NOT be called before successful Dial.

See also https://docs.neo.org/docs/en-us/reference/nns.html.

Jump to

Keyboard shortcuts

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