Documentation
¶
Index ¶
- Constants
- type Config
- type LNDCluster
- func (cluster *LNDCluster) AddInvoice(ctx context.Context, req *lnrpc.Invoice, options ...grpc.CallOption) (*lnrpc.AddInvoiceResponse, error)
- func (cluster *LNDCluster) DecodeBolt11(ctx context.Context, bolt11 string, options ...grpc.CallOption) (*lnrpc.PayReq, error)
- func (cluster *LNDCluster) GetInfo(ctx context.Context, req *lnrpc.GetInfoRequest, options ...grpc.CallOption) (*lnrpc.GetInfoResponse, error)
- func (cluster *LNDCluster) GetMainPubkey() (pubkey string)
- func (cluster *LNDCluster) IsIdentityPubkey(pubkey string) (isOurPubkey bool)
- func (cluster *LNDCluster) ListChannels(ctx context.Context, req *lnrpc.ListChannelsRequest, ...) (*lnrpc.ListChannelsResponse, error)
- func (cluster *LNDCluster) SendPaymentSync(ctx context.Context, req *lnrpc.SendRequest, options ...grpc.CallOption) (*lnrpc.SendResponse, error)
- func (cluster *LNDCluster) StartLivenessLoop(ctx context.Context)
- func (cluster *LNDCluster) SubscribeInvoices(ctx context.Context, req *lnrpc.InvoiceSubscription, ...) (SubscribeInvoicesWrapper, error)
- func (cluster *LNDCluster) SubscribePayment(ctx context.Context, req *routerrpc.TrackPaymentRequest, ...) (SubscribePaymentWrapper, error)
- type LNDWrapper
- func (wrapper *LNDWrapper) AddInvoice(ctx context.Context, req *lnrpc.Invoice, options ...grpc.CallOption) (*lnrpc.AddInvoiceResponse, error)
- func (wrapper *LNDWrapper) DecodeBolt11(ctx context.Context, bolt11 string, options ...grpc.CallOption) (*lnrpc.PayReq, error)
- func (wrapper *LNDWrapper) GetInfo(ctx context.Context, req *lnrpc.GetInfoRequest, options ...grpc.CallOption) (*lnrpc.GetInfoResponse, error)
- func (wrapper *LNDWrapper) GetMainPubkey() (pubkey string)
- func (wrapper *LNDWrapper) IsIdentityPubkey(pubkey string) (isOurPubkey bool)
- func (wrapper *LNDWrapper) ListChannels(ctx context.Context, req *lnrpc.ListChannelsRequest, ...) (*lnrpc.ListChannelsResponse, error)
- func (wrapper *LNDWrapper) SendPaymentSync(ctx context.Context, req *lnrpc.SendRequest, options ...grpc.CallOption) (*lnrpc.SendResponse, error)
- func (wrapper *LNDWrapper) SubscribeInvoices(ctx context.Context, req *lnrpc.InvoiceSubscription, ...) (SubscribeInvoicesWrapper, error)
- func (wrapper *LNDWrapper) SubscribePayment(ctx context.Context, req *routerrpc.TrackPaymentRequest, ...) (SubscribePaymentWrapper, error)
- type LNDoptions
- type LNPayReq
- type LightningClientWrapper
- func InitLNClient(c *Config, logger *lecho.Logger, ctx context.Context) (result LightningClientWrapper, err error)
- func InitLNDCluster(c *Config, logger *lecho.Logger, ctx context.Context) (result LightningClientWrapper, err error)
- func InitSingleLNDClient(c *Config, ctx context.Context) (result LightningClientWrapper, err error)
- type SubscribeInvoicesWrapper
- type SubscribePaymentWrapper
Constants ¶
View Source
const ( LND_CLIENT_TYPE = "lnd" LND_CLUSTER_CLIENT_TYPE = "lnd_cluster" ECLAIR_CLIENT_TYPE = "eclair" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
LNClientType string `envconfig:"LN_CLIENT_TYPE" default:"lnd"` //lnd, lnd_cluster, eclair
LNDAddress string `envconfig:"LND_ADDRESS" required:"true"`
LNDMacaroonFile string `envconfig:"LND_MACAROON_FILE"`
LNDCertFile string `envconfig:"LND_CERT_FILE"`
LNDMacaroonHex string `envconfig:"LND_MACAROON_HEX"`
LNDCertHex string `envconfig:"LND_CERT_HEX"`
LNDClusterLivenessPeriod int `envconfig:"LND_CLUSTER_LIVENESS_PERIOD" default:"10"`
LNDClusterActiveChannelRatio float64 `envconfig:"LND_CLUSTER_ACTIVE_CHANNEL_RATIO" default:"0.5"`
LNDClusterPubkeys string `envconfig:"LND_CLUSTER_PUBKEYS"` //comma-seperated list of public keys of the cluster
}
func LoadConfig ¶
type LNDCluster ¶
type LNDCluster struct {
Nodes []LightningClientWrapper
ActiveNode LightningClientWrapper
ActiveChannelRatio float64
Logger *lecho.Logger
LivenessCheckPeriod int
}
func (*LNDCluster) AddInvoice ¶
func (cluster *LNDCluster) AddInvoice(ctx context.Context, req *lnrpc.Invoice, options ...grpc.CallOption) (*lnrpc.AddInvoiceResponse, error)
func (*LNDCluster) DecodeBolt11 ¶
func (cluster *LNDCluster) DecodeBolt11(ctx context.Context, bolt11 string, options ...grpc.CallOption) (*lnrpc.PayReq, error)
func (*LNDCluster) GetInfo ¶
func (cluster *LNDCluster) GetInfo(ctx context.Context, req *lnrpc.GetInfoRequest, options ...grpc.CallOption) (*lnrpc.GetInfoResponse, error)
func (*LNDCluster) GetMainPubkey ¶
func (cluster *LNDCluster) GetMainPubkey() (pubkey string)
func (*LNDCluster) IsIdentityPubkey ¶
func (cluster *LNDCluster) IsIdentityPubkey(pubkey string) (isOurPubkey bool)
func (*LNDCluster) ListChannels ¶
func (cluster *LNDCluster) ListChannels(ctx context.Context, req *lnrpc.ListChannelsRequest, options ...grpc.CallOption) (*lnrpc.ListChannelsResponse, error)
func (*LNDCluster) SendPaymentSync ¶
func (cluster *LNDCluster) SendPaymentSync(ctx context.Context, req *lnrpc.SendRequest, options ...grpc.CallOption) (*lnrpc.SendResponse, error)
func (*LNDCluster) StartLivenessLoop ¶
func (cluster *LNDCluster) StartLivenessLoop(ctx context.Context)
func (*LNDCluster) SubscribeInvoices ¶
func (cluster *LNDCluster) SubscribeInvoices(ctx context.Context, req *lnrpc.InvoiceSubscription, options ...grpc.CallOption) (SubscribeInvoicesWrapper, error)
func (*LNDCluster) SubscribePayment ¶
func (cluster *LNDCluster) SubscribePayment(ctx context.Context, req *routerrpc.TrackPaymentRequest, options ...grpc.CallOption) (SubscribePaymentWrapper, error)
type LNDWrapper ¶
type LNDWrapper struct {
IdentityPubkey string
// contains filtered or unexported fields
}
func NewLNDclient ¶
func NewLNDclient(lndOptions LNDoptions, ctx context.Context) (result *LNDWrapper, err error)
func (*LNDWrapper) AddInvoice ¶
func (wrapper *LNDWrapper) AddInvoice(ctx context.Context, req *lnrpc.Invoice, options ...grpc.CallOption) (*lnrpc.AddInvoiceResponse, error)
func (*LNDWrapper) DecodeBolt11 ¶
func (wrapper *LNDWrapper) DecodeBolt11(ctx context.Context, bolt11 string, options ...grpc.CallOption) (*lnrpc.PayReq, error)
func (*LNDWrapper) GetInfo ¶
func (wrapper *LNDWrapper) GetInfo(ctx context.Context, req *lnrpc.GetInfoRequest, options ...grpc.CallOption) (*lnrpc.GetInfoResponse, error)
func (*LNDWrapper) GetMainPubkey ¶
func (wrapper *LNDWrapper) GetMainPubkey() (pubkey string)
func (*LNDWrapper) IsIdentityPubkey ¶
func (wrapper *LNDWrapper) IsIdentityPubkey(pubkey string) (isOurPubkey bool)
func (*LNDWrapper) ListChannels ¶
func (wrapper *LNDWrapper) ListChannels(ctx context.Context, req *lnrpc.ListChannelsRequest, options ...grpc.CallOption) (*lnrpc.ListChannelsResponse, error)
func (*LNDWrapper) SendPaymentSync ¶
func (wrapper *LNDWrapper) SendPaymentSync(ctx context.Context, req *lnrpc.SendRequest, options ...grpc.CallOption) (*lnrpc.SendResponse, error)
func (*LNDWrapper) SubscribeInvoices ¶
func (wrapper *LNDWrapper) SubscribeInvoices(ctx context.Context, req *lnrpc.InvoiceSubscription, options ...grpc.CallOption) (SubscribeInvoicesWrapper, error)
func (*LNDWrapper) SubscribePayment ¶
func (wrapper *LNDWrapper) SubscribePayment(ctx context.Context, req *routerrpc.TrackPaymentRequest, options ...grpc.CallOption) (SubscribePaymentWrapper, error)
type LNDoptions ¶
type LNDoptions struct {
Address string
CertFile string
CertHex string
MacaroonFile string
MacaroonHex string
}
LNDoptions are the options for the connection to the lnd node.
type LightningClientWrapper ¶
type LightningClientWrapper interface {
ListChannels(ctx context.Context, req *lnrpc.ListChannelsRequest, options ...grpc.CallOption) (*lnrpc.ListChannelsResponse, error)
SendPaymentSync(ctx context.Context, req *lnrpc.SendRequest, options ...grpc.CallOption) (*lnrpc.SendResponse, error)
AddInvoice(ctx context.Context, req *lnrpc.Invoice, options ...grpc.CallOption) (*lnrpc.AddInvoiceResponse, error)
SubscribeInvoices(ctx context.Context, req *lnrpc.InvoiceSubscription, options ...grpc.CallOption) (SubscribeInvoicesWrapper, error)
SubscribePayment(ctx context.Context, req *routerrpc.TrackPaymentRequest, options ...grpc.CallOption) (SubscribePaymentWrapper, error)
GetInfo(ctx context.Context, req *lnrpc.GetInfoRequest, options ...grpc.CallOption) (*lnrpc.GetInfoResponse, error)
DecodeBolt11(ctx context.Context, bolt11 string, options ...grpc.CallOption) (*lnrpc.PayReq, error)
IsIdentityPubkey(pubkey string) (isOurPubkey bool)
GetMainPubkey() (pubkey string)
}
func InitLNClient ¶
func InitLNDCluster ¶
func InitSingleLNDClient ¶
func InitSingleLNDClient(c *Config, ctx context.Context) (result LightningClientWrapper, err error)
type SubscribePaymentWrapper ¶
Click to show internal directories.
Click to hide internal directories.