rtns

package module
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: May 30, 2019 License: Apache-2.0 Imports: 22 Imported by: 0

README

RTNS

RTNS (RTrade Name Service) is a stand-alone IPNS record management service, designed to facilitate secure publishing of IPNS records, leveraging an encrypted keystore known as kaas. Internally it facilitates scheduled republishing of all published records.

It is essentially a modified and condensed version of go-ipfs/namesys with minor optimizations

Limitations

  • When used within Temporal, any keys derived from the fail-over KaaS host are not eligible for automated republishing

Future Improvements

  • DNSLink support
  • Act as a gateway implementation to TNS (Temporal Name Server)
  • Enable HA Kaas Backend
    • This will involve repeatedly iterating through all available KaaS hosts attempting to retrieve the private key, until we either find the key or we iterate through all available KaaS hosts without finding one, triggering an error
  • Enable automatic topic subscription for IPNS pubsub
    • This would involve using rtfs to call an IPFS node, establishing a subscription for a given topic

Documentation

Overview

Package rtns provides a secure, stand-alone IPNS publishing service that leverages the KaaS encrypted keystore service

Index

Constants

View Source
const DefaultRecordLifetime = time.Hour * 24

DefaultRecordLifetime is the default lifetime for IPNS records

Variables

View Source
var DefaultRebroadcastInterval = time.Hour * 4

DefaultRebroadcastInterval is the default interval at which we rebroadcast IPNS records

View Source
var FailureRetryInterval = time.Minute * 5

FailureRetryInterval is the interval at which we retry IPNS records broadcasts (when they fail)

Functions

This section is empty.

Types

type Cache

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

Cache is used to cache keyIDs we have published

func NewCache

func NewCache() *Cache

NewCache is used to instantiate a new cache

func (*Cache) List

func (c *Cache) List() []string

List is used to list items in our cache

func (*Cache) Set

func (c *Cache) Set(entry string)

Set is used to set an item in cache

type Config

type Config struct {
	DSPath      string
	PK          ci.PrivKey
	ListenAddrs []multiaddr.Multiaddr
	Secret      []byte
}

Config is used to configure the RTNS service

type RKeystore

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

RKeystore satisfies the keystore.Keystore interface, providing access to a kaas backend for secure key management

func NewRKeystore

func NewRKeystore(ctx context.Context, kb *kaas.Client) *RKeystore

NewRKeystore implements a keystore.Keystore compatible version of the kaas client

func (*RKeystore) Delete

func (rk *RKeystore) Delete(string) error

Delete removes a key from the Keystore

func (*RKeystore) Get

func (rk *RKeystore) Get(name string) (ci.PrivKey, error)

Get retrieves a key from the Keystore if it exists, and returns ErrNoSuchKey otherwise.

func (*RKeystore) Has

func (rk *RKeystore) Has(name string) (bool, error)

Has returns whether or not a key exist in the Keystore

func (*RKeystore) List

func (rk *RKeystore) List() ([]string, error)

List returns a list of key identifier

func (*RKeystore) Put

func (rk *RKeystore) Put(name string, pk ci.PrivKey) error

Put stores a key in the Keystore, if a key with the same name already exists, returns ErrKeyExists

type Service added in v0.0.7

type Service interface {
	// service management
	Close()
	DefaultBootstrap()

	// record publishing
	Publish(ctx context.Context, pk ci.PrivKey, cache bool, keyID, content string) error
	PublishWithEOL(ctx context.Context, pk ci.PrivKey, eol time.Time, cache bool, keyID, content string) error

	// key management
	GetKey(name string) (ci.PrivKey, error)
	HasKey(name string) (bool, error)
}

Service implements the rtns logic as a consumable service or library.

func NewService added in v0.0.7

func NewService(ctx context.Context, kbClient *kaas.Client, cfg Config) (Service, error)

NewService is used to instantiate an RTNS publisher service

Directories

Path Synopsis
internal
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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