nodebuilder

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2020 License: AGPL-3.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
const MULTIADDR_WSS_CODE = 0x01DE

Variables

This section is empty.

Functions

func BootstrapAddresses

func BootstrapAddresses(bootstrapHost p2p.Node) []string

func NewDefaultBadger

func NewDefaultBadger(path string) (datastore.Batching, error)

NewDefaultBadger is a convenience function to produce our "standard" badger with the optional low memory mode

func NewS3

Types

type Config

type Config struct {
	Namespace string

	Gossip3NotaryGroupConfig *g3types.Config
	NotaryGroupConfig        *types.Config
	PublicIP                 string
	Port                     int

	WebSocketPort         int
	SecureWebSocketDomain string
	CertificateCache      string

	PrivateKeySet  *PrivateKeySet
	BootstrapNodes []string

	TracingSystem TracingSystem // either Jaeger or Elastic
	BootstrapOnly bool

	Blockstore blockstore.Blockstore
	Datastore  datastore.Batching
}

func HumanConfigToConfig

func HumanConfigToConfig(hc HumanConfig) (*Config, error)

func TomlToConfig

func TomlToConfig(path string) (*Config, error)

TomlToConfig will load a config from a path to a toml file

type HumanConfig

type HumanConfig struct {
	Namespace string

	NotaryGroupConfig        string
	Gossip3NotaryGroupConfig string
	PublicIP                 string
	Port                     int

	Storage HumanStorageConfig

	WebSocketPort         int
	SecureWebSocketDomain string // only available on port 443
	CertificateCache      string

	PrivateKeySet *HumanPrivateKeySet

	BootstrapOnly bool
	TracingSystem string
}

HumanConfig is used for parsing an ondisk configuration into the application-used Config struct. At the time of this comment, it also uses the types.HumanConfig for notary groups defined in the tupelo-go-sdk as well.

type HumanPrivateKeySet

type HumanPrivateKeySet struct {
	SignKeyHex string
	DestKeyHex string
}

func (*HumanPrivateKeySet) ToPrivateKeySet

func (hpks *HumanPrivateKeySet) ToPrivateKeySet() (*PrivateKeySet, error)

type HumanStorageConfig

type HumanStorageConfig struct {
	Kind string
	Path string // for badger
	// CacheSize defaults to 100 (when set to 0), use -1 for no cache
	// only used for the blockstore
	CacheSize int

	// remaining are For s3
	RegionEndpoint string
	Bucket         string
	Region         string
	AccessKey      string
	SecretKey      string
	LocalS3        bool
	RootDirectory  string
}

func (*HumanStorageConfig) ToBlockstore

func (hsc *HumanStorageConfig) ToBlockstore() (blockstore.Blockstore, error)

func (*HumanStorageConfig) ToDatastore

func (hsc *HumanStorageConfig) ToDatastore() (datastore.Batching, error)

type LegacyPrivateKeySet

type LegacyPrivateKeySet struct {
	BlsHexPrivateKey   string `json:"blsHexPrivateKey,omitempty"`
	EcdsaHexPrivateKey string `json:"ecdsaHexPrivateKey,omitempty"`
}

func (*LegacyPrivateKeySet) ToPrivateKeySet

func (lpks *LegacyPrivateKeySet) ToPrivateKeySet() (*PrivateKeySet, error)

type LegacyPublicKeySet

type LegacyPublicKeySet struct {
	BlsHexPublicKey   string `json:"blsHexPublicKey,omitempty"`
	EcdsaHexPublicKey string `json:"ecdsaHexPublicKey,omitempty"`
	PeerIDBase58Key   string `json:"peerIDBase58Key,omitempty"`
}

func (*LegacyPublicKeySet) ToPublicKeySet

func (lpks *LegacyPublicKeySet) ToPublicKeySet() (*types.PublicKeySet, error)

type LocalNetwork

type LocalNetwork struct {
	Builders        []*NodeBuilder
	Nodes           []p2p.Node
	ClientNode      p2p.Node
	BootstrapNode   p2p.Node
	BootstrapAddrrs []string
	NotaryGroup     *types.NotaryGroup
}

func NewLocalNetwork

func NewLocalNetwork(ctx context.Context, namespace string, keys []*PrivateKeySet, ngConfig *types.Config) (*LocalNetwork, error)

func (*LocalNetwork) BootstrappedP2PNode

func (ln *LocalNetwork) BootstrappedP2PNode(ctx context.Context, opts ...p2p.Option) (p2p.Node, error)

type NoDialWebSocketTransport

type NoDialWebSocketTransport struct {
	*ws.WebsocketTransport
}

NoDialWebSocketTransport is a thin wrapper around the websocket transport but does not allow actually *dialing* the peer

func NewNoDialWebsocketTransport

func NewNoDialWebsocketTransport(u *tptu.Upgrader) *NoDialWebSocketTransport

NewNoDialWebsocketTransport wraps the standard go-ws-transport New to return the non-dialing version

func (*NoDialWebSocketTransport) CanDial

func (ndwst *NoDialWebSocketTransport) CanDial(a ma.Multiaddr) bool

CanDial always returns false because for this transport we want to allow connections but *never* want to dial out to the websockets

type NodeBuilder

type NodeBuilder struct {
	Config *Config
	// contains filtered or unexported fields
}

func (*NodeBuilder) Actor

func (nb *NodeBuilder) Actor() *actor.PID

func (*NodeBuilder) Host

func (nb *NodeBuilder) Host() p2p.Node

func (*NodeBuilder) NotaryGroup

func (nb *NodeBuilder) NotaryGroup() (*types.NotaryGroup, error)

func (*NodeBuilder) Start

func (nb *NodeBuilder) Start(ctx context.Context) error

func (*NodeBuilder) StartTracing

func (nb *NodeBuilder) StartTracing()

func (*NodeBuilder) Stop

func (nb *NodeBuilder) Stop() error

type PrivateKeySet

type PrivateKeySet struct {
	SignKey *bls.SignKey
	DestKey *ecdsa.PrivateKey
}

type TracingSystem

type TracingSystem int
const (
	NoTracing TracingSystem = iota
	JaegerTracing
	ElasticTracing
)

Jump to

Keyboard shortcuts

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