Documentation
¶
Index ¶
- Constants
- type Client
- func (t Client) Connect(accountName, beacon string) (res string, err error)
- func (t Client) CreateAccount(msats int) (res string, err error)
- func (t Client) ExecCmd(method string, argv []string) (res []byte, err error)
- func (t Client) GetInfo() (res string, err error)
- func (t Client) Listen(accountName string) (res string, err error)
- type Directory
- func (t *Directory) AddAccount(acct account.DB)
- func (t *Directory) GenerateAccountName() string
- func (t *Directory) GetAccountList() []account.DB
- func (t *Directory) GetAccountNameSet() (accounts []string)
- func (t *Directory) GetAccounts() (accounts []account.DB)
- func (t *Directory) LookupByName(name string) *account.DB
- func (t *Directory) LookupByPaymentHash(hash string)
- func (t *Directory) LookupBySeed(seed beacon.SharedSeed) account.DB
- func (t *Directory) ReindexAccount(acct account.DB)
- type Layer
- func (o *Layer) AnnounceNexus(belowNexus nexus.Nexus)
- func (o *Layer) HandleInvoiceRequest(ss beacon.SharedSeed, msats int)
- func (o *Layer) HandlePayRequest(ss beacon.SharedSeed, bolt11 string)
- func (o *Layer) HandleProviderInfoRequest(ss beacon.SharedSeed)
- func (o *Layer) NotifyPreImage(sharedSeeds []beacon.SharedSeed, preimage string)
- func (o *Layer) RegisterAboveLayer(belowLayer layer.Base)
- func (o *Layer) RevokeNexus(belowNexus nexus.Nexus)
- func (o *Layer) SetupTerminusNexus(belowNexus nexus.Nexus) *Nexus
- type Nexus
- func (o Nexus) IsLayerMessage(message message_base.MoneysocketMessage) bool
- func (o *Nexus) NotifyPreimage(preimage, requestReferenceUUID string)
- func (o *Nexus) NotifyProviderInfo(ss beacon.SharedSeed)
- func (o *Nexus) OnBinMessage(belowNexus nexus.Nexus, msgBytes []byte)
- func (o *Nexus) OnMessage(belowNexus nexus.Nexus, message message_base.MoneysocketMessage)
- type OnStackEvent
- type RPCMessage
- type Stack
- func (s *Stack) AnnounceNexus(terminusNexus Nexus)
- func (s *Stack) Connect(location location.WebsocketLocation, sharedSeed *beacon.SharedSeed) (*websocket2.OutgoingSocket, error)
- func (s *Stack) GetListenLocation() []location.Location
- func (s *Stack) Listen() error
- func (s *Stack) LocalConnect(sharedSeed beacon.SharedSeed)
- func (s *Stack) SendStackEvent(layerName string, nexus nexus.Nexus, status string)
- func (s *Stack) SetupIncomingStack(config *config.Config, localLayer *local.OutgoingLocalLayer) *stack.IncomingStack
- func (s *Stack) SetupLocalLayer() *local.OutgoingLocalLayer
- func (s *Stack) SetupProviderLayer(belowLayer layer.Base) *provider.Layer
- func (s *Stack) SetupRendezvousLayer(belowLayer1 layer.Base, belowLayer2 layer.Base) *rendezvous.OutgoingRendezvousLayer
- func (s *Stack) SetupTerminusLayer(belowLayer layer.Base) *Layer
- func (s *Stack) SetupWebsocketLayer() *websocket.OutgoingWebsocketLayer
- type Terminus
- func (t *Terminus) Create(msats int) account.DB
- func (t *Terminus) GetInfo() (res string)
- func (t *Terminus) Listen(rawAcct string, rawSharedSeed string) (encodedBeacon string, err error)
- func (t *Terminus) LoadPersisted()
- func (t *Terminus) OnAnnounce(nexus nexus.Nexus)
- func (t *Terminus) OnRevoke(nexus nexus.Nexus)
- func (t *Terminus) RetryConnectionLoop()
- func (t *Terminus) ServeHTTP(w http.ResponseWriter, request *http.Request)
- func (t *Terminus) Start(ctx context.Context) error
- func (t *Terminus) StartServer() error
Constants ¶
const ( // GetInfoMethod is the rpc method for getting info GetInfoMethod = "getinfo" // CreateAccountMethod is the create account rpc method CreateAccountMethod = "create" // ConnectMethod is the connect rpc method ConnectMethod = "connect" // ListenMethod is the listen rpc method ListenMethod = "listen" )
const NexusName = "TerminusNexus"
NexusName is the name of the terminus nexus
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
}
Client is the terminus client
func (Client) CreateAccount ¶ added in v0.54.0
CreateAccount creates account with a given number of sats
type Directory ¶ added in v0.54.0
type Directory struct {
AccountBySharedSeed map[string]account.DB
SharedSeedsByAccount map[string][]beacon.SharedSeed
// Accounts is a list of accounts
Accounts map[string]account.DB
// AccountsByPaymentHash is a list of accounts organized by payment hash
AccountsByPaymentHash map[string]account.DB
// contains filtered or unexported fields
}
Directory is a terminus directory that manages account lists/maps
func NewTerminusDirectory ¶
NewTerminusDirectory gets anew terminus directory
func (*Directory) AddAccount ¶ added in v0.54.0
AddAccount creates an account
func (*Directory) GenerateAccountName ¶ added in v0.54.0
GenerateAccountName generates an account name from an autoincrementing int
func (*Directory) GetAccountList ¶ added in v0.54.0
GetAccountList gets a list of accounts
func (*Directory) GetAccountNameSet ¶ added in v0.54.0
GetAccountNameSet gets a list of acount names
func (*Directory) GetAccounts ¶ added in v0.54.0
GetAccounts python version is an iterator
func (*Directory) LookupByName ¶ added in v0.54.0
LookupByName looks up an account by name
func (*Directory) LookupByPaymentHash ¶ added in v0.54.0
LookupByPaymentHash looks up a payment by hash
func (*Directory) LookupBySeed ¶ added in v0.54.0
func (t *Directory) LookupBySeed(seed beacon.SharedSeed) account.DB
LookupBySeed looks up an item by seed
func (*Directory) ReindexAccount ¶ added in v0.54.0
ReindexAccount reindexes an account
type Layer ¶ added in v0.54.0
Layer is the terminus layer TODO this needs to be fully implemented
func NewTerminusLayer ¶
func NewTerminusLayer() *Layer
NewTerminusLayer creates a new terminus layer
func (*Layer) AnnounceNexus ¶ added in v0.54.0
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)
HandleInvoiceRequest handles an invoice request
func (*Layer) HandlePayRequest ¶ added in v0.54.0
func (o *Layer) HandlePayRequest(ss beacon.SharedSeed, bolt11 string)
HandlePayRequest handles a payment request
func (*Layer) HandleProviderInfoRequest ¶ added in v0.54.0
func (o *Layer) HandleProviderInfoRequest(ss beacon.SharedSeed)
HandleProviderInfoRequest processes a provider info request
func (*Layer) NotifyPreImage ¶ added in v0.54.0
func (o *Layer) NotifyPreImage(sharedSeeds []beacon.SharedSeed, preimage string)
NotifyPreImage notifies a preimage
func (*Layer) RegisterAboveLayer ¶ added in v0.54.0
RegisterAboveLayer registers the current nexuses announce/revoke nexuses to the below layer
func (*Layer) RevokeNexus ¶ added in v0.54.0
RevokeNexus removes a nexus
type Nexus ¶ added in v0.54.0
Nexus is the name of the nexus
func NewTerminusNexus ¶
NewTerminusNexus creates a new terminus nexus
func (Nexus) IsLayerMessage ¶ added in v0.54.0
func (o Nexus) IsLayerMessage(message message_base.MoneysocketMessage) bool
IsLayerMessage determines wether or not the message can be handled by the current layer
func (*Nexus) NotifyPreimage ¶ added in v0.54.0
NotifyPreimage notifies a preimage is ready
func (*Nexus) NotifyProviderInfo ¶ added in v0.54.0
func (o *Nexus) NotifyProviderInfo(ss beacon.SharedSeed)
NotifyProviderInfo sends a provider info notification
func (*Nexus) OnBinMessage ¶ added in v0.54.0
OnBinMessage processes a binary message
func (*Nexus) OnMessage ¶ added in v0.54.0
func (o *Nexus) OnMessage(belowNexus nexus.Nexus, message message_base.MoneysocketMessage)
OnMessage processes a message
type OnStackEvent ¶
OnStackEvent processes stack events
type RPCMessage ¶ added in v0.54.0
type RPCMessage struct {
// Method is the rpc method (e.g. connect, listen, etc)
Method string `json:"method"`
// Params are any parameters passed in RPCMessage
Params [][]string `json:"params"`
}
RPCMessage is used for getting messages from the terminus client
type Stack ¶ added in v0.54.0
Stack is the terminus stack
func NewTerminusStack ¶
NewTerminusStack creates a terminus stack
func (*Stack) AnnounceNexus ¶ added in v0.54.0
AnnounceNexus announces the terminus nexus
func (*Stack) Connect ¶ added in v0.54.0
func (s *Stack) Connect(location location.WebsocketLocation, sharedSeed *beacon.SharedSeed) (*websocket2.OutgoingSocket, error)
Connect connects to a websocket location
func (*Stack) GetListenLocation ¶ added in v0.54.0
GetListenLocation gets ws listen locations from the config
func (*Stack) LocalConnect ¶ added in v0.54.0
func (s *Stack) LocalConnect(sharedSeed beacon.SharedSeed)
LocalConnect connects to a layer by shared seed
func (*Stack) SendStackEvent ¶ added in v0.54.0
SendStackEvent sends a given event up the stack
func (*Stack) SetupIncomingStack ¶ added in v0.54.0
func (s *Stack) SetupIncomingStack(config *config.Config, localLayer *local.OutgoingLocalLayer) *stack.IncomingStack
SetupIncomingStack sets up an incoming stack3
func (*Stack) SetupLocalLayer ¶ added in v0.54.0
func (s *Stack) SetupLocalLayer() *local.OutgoingLocalLayer
SetupLocalLayer sets up the local layer
func (*Stack) SetupProviderLayer ¶ added in v0.54.0
SetupProviderLayer sets up a provider layer
func (*Stack) SetupRendezvousLayer ¶ added in v0.54.0
func (s *Stack) SetupRendezvousLayer(belowLayer1 layer.Base, belowLayer2 layer.Base) *rendezvous.OutgoingRendezvousLayer
SetupRendezvousLayer sets up the rendezvous layer
func (*Stack) SetupTerminusLayer ¶ added in v0.54.0
SetupTerminusLayer sets up the terminus layer
func (*Stack) SetupWebsocketLayer ¶ added in v0.54.0
func (s *Stack) SetupWebsocketLayer() *websocket.OutgoingWebsocketLayer
SetupWebsocketLayer sets up a websocket layer
type Terminus ¶
type Terminus struct {
// contains filtered or unexported fields
}
Terminus is the app
func NewTerminus ¶
NewTerminus creates a Terminus node from a config
func (*Terminus) Create ¶
Create creates an account with a given number of msats and add it to the directory
func (*Terminus) LoadPersisted ¶
func (t *Terminus) LoadPersisted()
LoadPersisted loads persisted accounts from the disk
func (*Terminus) OnAnnounce ¶ added in v0.54.0
OnAnnounce handles nexus announcements
func (*Terminus) OnRevoke ¶ added in v0.54.0
OnRevoke handles a nexus revoke attempt. Does nothing in terminus
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) StartServer ¶
StartServer starts the terminus server