terminus

package
v0.60.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2021 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// get info rpc method
	GetInfoMethod = "getinfo"
	// create account rpc method
	CreateAccountMethod = "create"
	// connect rpc method
	ConnectMethod = "connect"
	// listen rpc method
	ListenMethod = "listen"
)
View Source
const NexusName = "TerminusNexus"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client added in v0.54.0

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

func NewClient

func NewClient(config *config.Config) Client

func (Client) Connect added in v0.54.0

func (t Client) Connect(accountName, beacon string) (res string, err error)

func (Client) CreateAccount added in v0.54.0

func (t Client) CreateAccount(msats int) (res string, err error)

create account with a given number of sats

func (Client) ExecCmd added in v0.54.0

func (t Client) ExecCmd(method string, argv []string) (res []byte, err error)

func (Client) GetInfo added in v0.54.0

func (t Client) GetInfo() (res string, err error)

get list of beacons, accounts, etc

func (Client) Listen added in v0.54.0

func (t Client) Listen(accountName string) (res string, err error)

type Directory added in v0.54.0

type Directory struct {
	AccountBySharedSeed   map[string]account.Db
	SharedSeedsByAccount  map[string][]beacon.SharedSeed
	Accounts              map[string]account.Db
	AccountsByPaymentHash map[string]account.Db
	// contains filtered or unexported fields
}

func NewTerminusDirectory

func NewTerminusDirectory(config *config.Config) *Directory

func (*Directory) AddAccount added in v0.54.0

func (t *Directory) AddAccount(acct account.Db)

func (*Directory) GenerateAccountName added in v0.54.0

func (t *Directory) GenerateAccountName() string

generate an account name from an autoincrementing int

func (*Directory) GetAccountList added in v0.54.0

func (t *Directory) GetAccountList() []account.Db

func (*Directory) GetAccountNameSet added in v0.54.0

func (t *Directory) GetAccountNameSet() (accounts []string)

get list of acount names

func (*Directory) GetAccounts added in v0.54.0

func (t *Directory) GetAccounts() (accounts []account.Db)

python version is an iterator

func (*Directory) LookupByName added in v0.54.0

func (t *Directory) LookupByName(name string) *account.Db

func (*Directory) LookupByPaymentHash added in v0.54.0

func (t *Directory) LookupByPaymentHash(hash string)

func (*Directory) LookupBySeed added in v0.54.0

func (t *Directory) LookupBySeed(seed beacon.SharedSeed) account.Db

func (*Directory) ReindexAccount added in v0.54.0

func (t *Directory) ReindexAccount(acct account.Db)

type Layer added in v0.54.0

type Layer struct {
	layer.BaseLayer
	NexusesBySharedSeed map[string][]string
	// contains filtered or unexported fields
}

TODO this needs to be fully implemented

func NewTerminusLayer

func NewTerminusLayer() *Layer

func (*Layer) AnnounceNexus added in v0.54.0

func (o *Layer) AnnounceNexus(belowNexus nexus.Nexus)

AnnounceNexus creates a new TerminusNexus and registers it

func (*Layer) HandleInvoiceRequest added in v0.54.0

func (o *Layer) HandleInvoiceRequest(ss beacon.SharedSeed, msats int)

func (*Layer) HandlePayRequest added in v0.54.0

func (o *Layer) HandlePayRequest(ss beacon.SharedSeed, bolt11 string)

func (*Layer) HandleProviderInfoRequest added in v0.54.0

func (o *Layer) HandleProviderInfoRequest(ss beacon.SharedSeed)

func (*Layer) NotifyPreImage added in v0.54.0

func (o *Layer) NotifyPreImage(sharedSeeds []beacon.SharedSeed, preimage string)

func (*Layer) RegisterAboveLayer added in v0.54.0

func (o *Layer) RegisterAboveLayer(belowLayer layer.Layer)

RegisterAboveLayer registers the current nexuses announce/revoke nexuses to the below layer

func (*Layer) RevokeNexus added in v0.54.0

func (o *Layer) RevokeNexus(belowNexus nexus.Nexus)

func (*Layer) SetupTerminusNexus added in v0.54.0

func (o *Layer) SetupTerminusNexus(belowNexus nexus.Nexus) *Nexus

type Nexus added in v0.54.0

type Nexus struct {
	*base.NexusBase
	// contains filtered or unexported fields
}

func NewTerminusNexus

func NewTerminusNexus(below nexus.Nexus, layer layer.Layer) Nexus

func (Nexus) IsLayerMessage added in v0.54.0

func (o Nexus) IsLayerMessage(message message_base.MoneysocketMessage) bool

func (*Nexus) NotifyPreimage added in v0.54.0

func (o *Nexus) NotifyPreimage(preimage, requestReferenceUUID string)

func (*Nexus) NotifyProviderInfo added in v0.54.0

func (o *Nexus) NotifyProviderInfo(ss beacon.SharedSeed)

func (*Nexus) OnBinMessage added in v0.54.0

func (o *Nexus) OnBinMessage(belowNexus nexus.Nexus, msgBytes []byte)

func (*Nexus) OnMessage added in v0.54.0

func (o *Nexus) OnMessage(belowNexus nexus.Nexus, message message_base.MoneysocketMessage)

type OnStackEvent

type OnStackEvent func(layerName string, nexus nexus.Nexus, status string)

type RPCMessage added in v0.54.0

type RPCMessage struct {
	Method string     `json:"method"`
	Params [][]string `json:"params"`
}

type Stack added in v0.54.0

type Stack struct {
	Config *config.Config
	// contains filtered or unexported fields
}

func NewTerminusStack

func NewTerminusStack(config *config.Config) *Stack

func (*Stack) AnnounceNexus added in v0.54.0

func (s *Stack) AnnounceNexus(terminusNexus Nexus)

func (*Stack) Connect added in v0.54.0

func (s *Stack) Connect(location location.WebsocketLocation, sharedSeed *beacon.SharedSeed) (*websocket2.OutgoingSocket, error)

func (*Stack) GetListenLocation added in v0.54.0

func (s *Stack) GetListenLocation() []location.Location

get ws listen locations from the config

func (*Stack) Listen added in v0.54.0

func (s *Stack) Listen() error

func (*Stack) LocalConnect added in v0.54.0

func (s *Stack) LocalConnect(sharedSeed beacon.SharedSeed)

func (*Stack) SendStackEvent added in v0.54.0

func (s *Stack) SendStackEvent(layerName string, nexus nexus.Nexus, status string)

func (*Stack) SetupIncomingStack added in v0.54.0

func (s *Stack) SetupIncomingStack(config *config.Config, localLayer *local.OutgoingLocalLayer) *stack.IncomingStack

func (*Stack) SetupLocalLayer added in v0.54.0

func (s *Stack) SetupLocalLayer() *local.OutgoingLocalLayer

func (*Stack) SetupProviderLayer added in v0.54.0

func (s *Stack) SetupProviderLayer(belowLayer layer.Layer) *provider.Layer

func (*Stack) SetupRendezvousLayer added in v0.54.0

func (s *Stack) SetupRendezvousLayer(belowLayer1 layer.Layer, belowLayer2 layer.Layer) *rendezvous.OutgoingRendezvousLayer

func (*Stack) SetupTerminusLayer added in v0.54.0

func (s *Stack) SetupTerminusLayer(belowLayer layer.Layer) *Layer

func (*Stack) SetupWebsocketLayer added in v0.54.0

func (s *Stack) SetupWebsocketLayer() *websocket.OutgoingWebsocketLayer

type Terminus

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

Terminus is the app

func NewTerminus

func NewTerminus(config *config.Config) (terminus Terminus, err error)

NewTerminus creates a Terminus node from a config

func (*Terminus) Create

func (t *Terminus) Create(msats int) account.Db

Create creates an account with a given number of msats and add it to the directory

func (*Terminus) GetInfo

func (t *Terminus) GetInfo() (res string)

GetInfo gets formatted info (for python parity)

func (*Terminus) Listen

func (t *Terminus) Listen(rawAcct string, rawSharedSeed string) (encodedBeacon string, err error)

Listen listens on a port. Raw shared seed is optional

func (*Terminus) LoadPersisted

func (t *Terminus) LoadPersisted()

LoadPersisted loads persisted accounts from the disk

func (*Terminus) OnAnnounce added in v0.54.0

func (t *Terminus) OnAnnounce(nexus nexus.Nexus)

OnAnnounce handles nexus announcements

func (*Terminus) OnRevoke added in v0.54.0

func (t *Terminus) OnRevoke(nexus nexus.Nexus)

func (*Terminus) RetryConnectionLoop added in v0.17.0

func (t *Terminus) RetryConnectionLoop()

RetryConnectionLoop retries a connection on a loop

func (*Terminus) ServeHTTP

func (t *Terminus) ServeHTTP(w http.ResponseWriter, request *http.Request)

ServeHTTP handles requests through the rpc server todo break this out into separate methods

func (*Terminus) Start

func (t *Terminus) Start(ctx context.Context) error

Start starts the server

func (*Terminus) StartServer

func (t *Terminus) StartServer() error

StartServer starts the terminus server

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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