common

package
Version: v0.2103.1 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2021 License: Apache-2.0 Imports: 15 Imported by: 6

Documentation

Index

Constants

View Source
const (
	// NamespaceSize is the size of a chain namespace identifier in bytes.
	NamespaceSize = 32

	// NamespaceHexSize is the size of the chain namespace identifier in string format.
	NamespaceHexSize = NamespaceSize * 2

	// NamespaceIDSize is the size of the identifier component of a namespace.
	NamespaceIDSize = NamespaceSize - 8

	NamespaceTest       NamespaceFlag = 1 << 63
	NamespaceKeyManager NamespaceFlag = 1 << 62
)

Variables

View Source
var (
	// ErrMalformedNamespace is the error returned when a namespace
	// identifier is malformed.
	ErrMalformedNamespace = errors.New("malformed namespace")
)

Functions

func FindAllAddresses

func FindAllAddresses() ([]net.IP, error)

FindAllAddresses returns all addresses found by examining all up interfaces (skipping loopback).

func GetHostPort

func GetHostPort(rawURL string) (string, error)

GetHostPort makes a normalized "host:port" string from the given raw URL.

func GuessExternalAddress

func GuessExternalAddress() net.IP

GuessExternalAddress returns a best guess of the external address, or nil if the process fails.

func IsAddrPort

func IsAddrPort(s string) error

IsAddrPort validates that the provided string is an address + port.

func IsFQDN

func IsFQDN(s string) error

IsFQDN validates that the provided string is a well-formed FQDN.

func IsProbablyGloballyReachable added in v0.2103.0

func IsProbablyGloballyReachable(ip net.IP) bool

IsProbablyGloballyReachable returns true if the provided IP address is likely to be globally reachable.

func Mkdir

func Mkdir(d string) error

Mkdir creates a directory iff it does not exist, and otherwise ensures that the filesystem permissions are sufficiently restrictive.

func NormalizeFQDN

func NormalizeFQDN(s string) string

NormalizeFQDN normalizes the provided string as a FQDN.

func TrimArgs

func TrimArgs(osArgs []string) []string

TrimArgs removes all arguments in the argument list occurring before the "--" separator. The first argument is treated as the binary name (as in os.Args) and is left unchanged.

If the argument list does not include the separator, a slice containing only the first argument is returned.

It is an error to call this function with an empty slice.

Types

type Namespace

type Namespace [NamespaceSize]byte

Namespace is a chain namespace identifier.

func NewNamespace

func NewNamespace(id [NamespaceIDSize]byte, flags NamespaceFlag) (Namespace, error)

NewNamespace returns a new namespace from it's component ID and flags.

func NewTestNamespaceFromSeed

func NewTestNamespaceFromSeed(seed []byte, flags NamespaceFlag) Namespace

NewTestNamespaceFromSeed returns a test namespace from a seed and flags.

func (Namespace) Base64 added in v0.2103.1

func (n Namespace) Base64() string

Base64 returns the base64 string representation of a namespace identifier.

func (*Namespace) Equal

func (n *Namespace) Equal(cmp *Namespace) bool

Equal compares vs another namespace for equality.

func (Namespace) Hex added in v0.2103.1

func (n Namespace) Hex() string

Hex returns the hexadecimal string representation of a namespace identifier.

func (Namespace) IsKeyManager

func (n Namespace) IsKeyManager() bool

IsKeyManager returns true iff the namespace is for a key manager runtime.

func (Namespace) IsTest

func (n Namespace) IsTest() bool

IsTest returns true iff the namespace is for a test runtime.

func (*Namespace) MarshalBinary

func (n *Namespace) MarshalBinary() (data []byte, err error)

MarshalBinary encodes a namespace identifier into binary form.

func (*Namespace) MarshalHex added in v0.2103.0

func (n *Namespace) MarshalHex() ([]byte, error)

MarshalHex encodes a namespace identifier into a hexadecimal form.

func (Namespace) MarshalText

func (n Namespace) MarshalText() ([]byte, error)

MarshalText encodes a namespace identifier into text form.

func (Namespace) String

func (n Namespace) String() string

String returns the string representation of a namespace identifier.

func (*Namespace) UnmarshalBinary

func (n *Namespace) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes a binary marshaled namespace identifier.

func (*Namespace) UnmarshalHex

func (n *Namespace) UnmarshalHex(text string) error

UnmarshalHex deserializes a hexadecimal text string into the given type.

func (*Namespace) UnmarshalText

func (n *Namespace) UnmarshalText(text []byte) error

UnmarshalText decodes a text marshaled namespace identifier.

type NamespaceFlag

type NamespaceFlag uint64

NamespaceFlag is a namespace flag.

Directories

Path Synopsis
Package accessctl implements access control for an Oasis node.
Package accessctl implements access control for an Oasis node.
Package backoff contains helpers for dealing with backoffs.
Package backoff contains helpers for dealing with backoffs.
Package badger contains convenience helpers for integrating BadgerDB.
Package badger contains convenience helpers for integrating BadgerDB.
cache
lru
Package LRU implements an in-memory Least-Recently-Used cache.
Package LRU implements an in-memory Least-Recently-Used cache.
Package cbor provides helpers for encoding and decoding canonical CBOR.
Package cbor provides helpers for encoding and decoding canonical CBOR.
Package crash provides a framework for adding probabilistic crash points.
Package crash provides a framework for adding probabilistic crash points.
crypto
address
Package address implements a generic cryptographic address with versioning and context separation.
Package address implements a generic cryptographic address with versioning and context separation.
drbg
Package drbg implements the HMAC_DRBG construct as per NIST Special Publication 800-90A Revision 1.
Package drbg implements the HMAC_DRBG construct as per NIST Special Publication 800-90A Revision 1.
hash
Package hash implements a cryptographic hash over arbitrary binary data.
Package hash implements a cryptographic hash over arbitrary binary data.
mathrand
Package mathrand implements an adapter from a cryptographically secure entropy source that implements an io.Reader to a math/rand.Source64.
Package mathrand implements an adapter from a cryptographically secure entropy source that implements an io.Reader to a math/rand.Source64.
mrae/api
Package api implements the MRAE API and common helpers.
Package api implements the MRAE API and common helpers.
mrae/deoxysii
Package deoxysii implements the Deoxys-II-256-128 based MRAE boxes.
Package deoxysii implements the Deoxys-II-256-128 based MRAE boxes.
pvss
Package pvss implements a PVSS backed commit-reveal scheme loosely based on the Scalable Randomness Attested by Public Entities protocol by Casudo and David.
Package pvss implements a PVSS backed commit-reveal scheme loosely based on the Scalable Randomness Attested by Public Entities protocol by Casudo and David.
sakg
Package sakg implements ADR 0008: Standard Account Key Generation.
Package sakg implements ADR 0008: Standard Account Key Generation.
signature
Package signature provides wrapper types around public key signatures.
Package signature provides wrapper types around public key signatures.
signature/signers/composite
Package composite provides a composite signer.
Package composite provides a composite signer.
signature/signers/file
Package file provides a PEM file backed signer.
Package file provides a PEM file backed signer.
signature/signers/memory
Package memory provides a memory backed Signer, primarily for use in testing.
Package memory provides a memory backed Signer, primarily for use in testing.
signature/signers/plugin
Package plugin implements the Go plugin signature signer.
Package plugin implements the Go plugin signature signer.
signature/signers/remote
Package remote provides a gRPC backed signer (both client and server).
Package remote provides a gRPC backed signer (both client and server).
slip10
Package slip10 implements the SLIP-0010 private key derivation scheme for Ed25519.
Package slip10 implements the SLIP-0010 private key derivation scheme for Ed25519.
tls
Package tls implements helpful wrappers for dealing with TLS certificates.
Package tls implements helpful wrappers for dealing with TLS certificates.
Package ctxsync contains some synchronization primitvies that are aware of a context becoming done and can bail on waits in that case.
Package ctxsync contains some synchronization primitvies that are aware of a context becoming done and can bail on waits in that case.
Package diff implements helpers for comparing objects.
Package diff implements helpers for comparing objects.
encoding
bech32
Package bech32 provides implementation of Bech32 encoding specified in BIP 173: https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki.
Package bech32 provides implementation of Bech32 encoding specified in BIP 173: https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki.
Package entity implements common entity routines.
Package entity implements common entity routines.
Package errors implements errors that can be easily sent across the wire and reconstructed at the other end.
Package errors implements errors that can be easily sent across the wire and reconstructed at the other end.
Package grpc implements common gRPC related services and utilities.
Package grpc implements common gRPC related services and utilities.
auth
Package auth implements gRPC authentication server interceptors.
Package auth implements gRPC authentication server interceptors.
policy/api
Package api defines the common gRPC policy service and data structures.
Package api defines the common gRPC policy service and data structures.
proxy
Package proxy implements service agnostic gRPC reverse proxy.
Package proxy implements service agnostic gRPC reverse proxy.
testing
Package testing implements common grpc testing helpers.
Package testing implements common grpc testing helpers.
Package identity encapsulates the node identity.
Package identity encapsulates the node identity.
Package logging implements support for structured logging.
Package logging implements support for structured logging.
Package node implements common node identity routines.
Package node implements common node identity routines.
Package pem provides handy wrappers for dealing with PEM files.
Package pem provides handy wrappers for dealing with PEM files.
Package persistent provides a wrapper around a key-value database for use as general node-wide storage.
Package persistent provides a wrapper around a key-value database for use as general node-wide storage.
Package pubsub implements a generic publish-subscribe interface.
Package pubsub implements a generic publish-subscribe interface.
Package random provides a concurrency safe https://golang.org/pkg/math/rand/#Rand object.
Package random provides a concurrency safe https://golang.org/pkg/math/rand/#Rand object.
Package service provides service primitives.
Package service provides service primitives.
sgx
Package SGX provides common Intel SGX datatypes and utilities.
Package SGX provides common Intel SGX datatypes and utilities.
aesm
Package aesm provides a client for AESMD.
Package aesm provides a client for AESMD.
ias
Package ias provides routines for interacting with the Intel Attestation Service.
Package ias provides routines for interacting with the Intel Attestation Service.
Package syscall defines OS-specific syscall parameters.
Package syscall defines OS-specific syscall parameters.
Package version implements Oasis protocol and runtime versioning.
Package version implements Oasis protocol and runtime versioning.
Package workerpool implements a simple goroutine-based workerpool with a configurable number of workers.
Package workerpool implements a simple goroutine-based workerpool with a configurable number of workers.

Jump to

Keyboard shortcuts

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