rtns

package module
v0.0.5 Latest Latest
Warning

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

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

README

rtns

rtns is a IPNS publishing service for use with RTradeLtd/kaas, with republishing of published records.

limitations

  • When used within Temporal, any keys derived from the fail-over KaaS host are not eligible for automated republishing
  • When using PublishWithEOL, any republishes afterwards will republish using the default values

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 RTNS

type RTNS struct {
	Keys *RKeystore
	// contains filtered or unexported fields
}

RTNS is a standalone IPNS publishing service for use with the kaas keystore enabling secure management of IPNS records

func NewRTNS

func NewRTNS(ctx context.Context, kbClient *kaas.Client, cfg Config) (*RTNS, error)

NewRTNS is used to instantiate our RTNS service NOTE: this DHT isn't bootstrapped

func (*RTNS) Bootstrap

func (r *RTNS) Bootstrap(peers []peerstore.PeerInfo)

Bootstrap is an optional helper to connect to the given peers and bootstrap the Peer DHT (and Bitswap). This is a best-effort function. Errors are only logged and a warning is printed when less than half of the given peers could be contacted. It is fine to pass a list where some peers will not be reachable.

func (*RTNS) Close

func (r *RTNS) Close()

Close is used to close all service needed by our publisher

func (*RTNS) DefaultBootstrap

func (r *RTNS) DefaultBootstrap()

DefaultBootstrap is a wrapper around Bootstrap that handles bootstrapping to the default libp2p bootstrap nodes, as well as the Temporal production nodes

func (*RTNS) Publish

func (r *RTNS) Publish(ctx context.Context, pk ci.PrivKey, cache bool, keyID, content string) error

Publish is used to publish content with a fixed lifetime and ttl

func (*RTNS) PublishWithEOL

func (r *RTNS) PublishWithEOL(ctx context.Context, pk ci.PrivKey, eol time.Time, cache bool, keyID, content string) error

PublishWithEOL is used to publish an IPNS record with non default lifetime values

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