Documentation
¶
Index ¶
- Constants
- Variables
- func ConvertAmount(s string) uint64
- func ConvertFeatures(features string) map[string]NodeFeatureApi
- func FromLndChanId(chanId uint64) string
- func GetClient(getData GetDataCall) (lnrpc.LightningClient, func(), error)
- func GetConnection(getData GetDataCall) (*grpc.ClientConn, error)
- func IsMacaroonValid(mac *macaroon.Macaroon) (bool, time.Duration)
- func SumCapacityExtended(channels []NodeChannelApiExtended) uint64
- func SumCapacitySimple(channels []NodeChannelApi) uint64
- func ToLndChanId(id string) (uint64, error)
- type ApiType
- type CertificateVerification
- type ChannelApi
- type ChannelConstraintsOverride
- type ChannelOverride
- type Channels
- type ChannelsApi
- type ClnFeatures
- type ClnFundsChan
- type ClnFundsChanResp
- type ClnInfo
- type ClnListChan
- type ClnListChanResp
- type ClnListNode
- type ClnListNodeAddr
- type ClnListNodeResp
- type ClnSetChan
- type ClnSetChanResp
- type ClnSocketLightningApi
- func (l *ClnSocketLightningApi) CallWithTimeout(serviceMethod string, args any, reply any) error
- func (l *ClnSocketLightningApi) Cleanup()
- func (l *ClnSocketLightningApi) DescribeGraph(ctx context.Context, unannounced bool) (*DescribeGraphApi, error)
- func (l *ClnSocketLightningApi) GetChanInfo(ctx context.Context, chanId uint64) (*NodeChannelApi, error)
- func (l *ClnSocketLightningApi) GetChannels(ctx context.Context) (*ChannelsApi, error)
- func (l *ClnSocketLightningApi) GetInfo(ctx context.Context) (*InfoApi, error)
- func (l *ClnSocketLightningApi) GetInternalChannels(pubKey string) (map[string][]ClnListChan, error)
- func (l *ClnSocketLightningApi) GetInternalChannelsAll() (map[string][]ClnListChan, error)
- func (l *ClnSocketLightningApi) GetNodeInfo(ctx context.Context, pubKey string, channels bool) (*NodeInfoApi, error)
- func (l *ClnSocketLightningApi) GetNodeInfoFull(ctx context.Context, channels bool, unannounced bool) (*NodeInfoApiExtended, error)
- type DescribeGraphApi
- type DescribeGraphNodeApi
- type GetDataCall
- type GetDoFunc
- type GetInfoResponseOverride
- type GetNodeInfoOverride
- type Graph
- type GraphEdgeOverride
- type GraphNodeOverride
- type HtlcApi
- type HtlcOverride
- type HttpApi
- func (h *HttpApi) Do(req *http.Request) (*http.Response, error)
- func (h *HttpApi) GetHttpRequest(getData GetDataCall) (*http.Request, *http.Transport, error)
- func (h *HttpApi) HttpGetChanInfo(ctx context.Context, req *http.Request, trans *http.Transport, chanId uint64) (*GraphEdgeOverride, error)
- func (h *HttpApi) HttpGetChannels(ctx context.Context, req *http.Request, trans *http.Transport) (*Channels, error)
- func (h *HttpApi) HttpGetGraph(ctx context.Context, req *http.Request, trans *http.Transport, ...) (*Graph, error)
- func (h *HttpApi) HttpGetInfo(ctx context.Context, req *http.Request, trans *http.Transport) (*GetInfoResponseOverride, error)
- func (h *HttpApi) HttpGetNodeInfo(ctx context.Context, req *http.Request, trans *http.Transport, pubKey string, ...) (*GetNodeInfoOverride, error)
- func (h *HttpApi) SetTransport(transport *http.Transport)
- type InfoApi
- type LightingApiCalls
- func NewApi(apiType ApiType, getData GetDataCall) LightingApiCalls
- func NewClnSocketLightningApi(getData GetDataCall) LightingApiCalls
- func NewClnSocketLightningApiRaw(socketType string, address string) LightingApiCalls
- func NewLndGrpcLightningApi(getData GetDataCall) LightingApiCalls
- func NewLndRestLightningApi(getData GetDataCall) LightingApiCalls
- type LightningApi
- type LndGrpcLightningApi
- func (l *LndGrpcLightningApi) Cleanup()
- func (l *LndGrpcLightningApi) DescribeGraph(ctx context.Context, unannounced bool) (*DescribeGraphApi, error)
- func (l *LndGrpcLightningApi) GetChanInfo(ctx context.Context, chanId uint64) (*NodeChannelApi, error)
- func (l *LndGrpcLightningApi) GetChannels(ctx context.Context) (*ChannelsApi, error)
- func (l *LndGrpcLightningApi) GetInfo(ctx context.Context) (*InfoApi, error)
- func (l *LndGrpcLightningApi) GetNodeInfo(ctx context.Context, pubKey string, channels bool) (*NodeInfoApi, error)
- func (l *LndGrpcLightningApi) GetNodeInfoFull(ctx context.Context, channels, unnanounced bool) (*NodeInfoApiExtended, error)
- type LndRestLightningApi
- func (l *LndRestLightningApi) Cleanup()
- func (l *LndRestLightningApi) DescribeGraph(ctx context.Context, unannounced bool) (*DescribeGraphApi, error)
- func (l *LndRestLightningApi) GetChanInfo(ctx context.Context, chanId uint64) (*NodeChannelApi, error)
- func (l *LndRestLightningApi) GetChannels(ctx context.Context) (*ChannelsApi, error)
- func (l *LndRestLightningApi) GetInfo(ctx context.Context) (*InfoApi, error)
- func (l *LndRestLightningApi) GetNodeInfo(ctx context.Context, pubKey string, channels bool) (*NodeInfoApi, error)
- func (l *LndRestLightningApi) GetNodeInfoFull(ctx context.Context, channels, unnanounced bool) (*NodeInfoApiExtended, error)
- type NodeAddressApi
- type NodeChannelApi
- type NodeChannelApiExtended
- type NodeFeatureApi
- type NodeInfoApi
- type NodeInfoApiExtended
- type RoutingPolicyApi
- type RoutingPolicyOverride
Constants ¶
View Source
const ( LISTCHANNELS = "listchannels" LISTNODES = "listnodes" LISTFUNDS = "listfunds" GETINFO = "getinfo" )
Variables ¶
Functions ¶
func ConvertAmount ¶ added in v0.0.34
func ConvertFeatures ¶ added in v0.0.34
func ConvertFeatures(features string) map[string]NodeFeatureApi
func FromLndChanId ¶ added in v0.0.34
func GetClient ¶
func GetClient(getData GetDataCall) (lnrpc.LightningClient, func(), error)
func GetConnection ¶
func GetConnection(getData GetDataCall) (*grpc.ClientConn, error)
func SumCapacityExtended ¶ added in v0.0.34
func SumCapacityExtended(channels []NodeChannelApiExtended) uint64
func SumCapacitySimple ¶ added in v0.0.34
func SumCapacitySimple(channels []NodeChannelApi) uint64
func ToLndChanId ¶ added in v0.0.34
Types ¶
type CertificateVerification ¶ added in v0.0.26
type CertificateVerification int
const ( PUBLIC_CA_OR_CERT CertificateVerification = iota PUBLIC_CA ALLOW_WHEN_PUBKEY_SAME STRICT INSECURE SKIP_HOST_VERIFICATION )
type ChannelApi ¶
type ChannelOverride ¶
type ChannelOverride struct {
ChanId string `json:"chan_id,omitempty"`
Capacity string `json:"capacity,omitempty"`
LocalBalance string `json:"local_balance,omitempty"`
RemoteBalance string `json:"remote_balance,omitempty"`
CommitFee string `json:"commit_fee,omitempty"`
CommitWeight string `json:"commit_weight,omitempty"`
FeePerKw string `json:"fee_per_kw,omitempty"`
UnsettledBalance string `json:"unsettled_balance,omitempty"`
TotalSatoshisSent string `json:"total_satoshis_sent,omitempty"`
TotalSatoshisReceived string `json:"total_satoshis_received,omitempty"`
NumUpdates string `json:"num_updates,omitempty"`
// Deprecated
LocalChanReserveSat string `json:"local_chan_reserve_sat,omitempty"`
// Deprecated
RemoteChanReserveSat string `json:"remote_chan_reserve_sat,omitempty"`
CommitmentType string `json:"commitment_type,omitempty"`
PendingHtlcs []*HtlcOverride `json:"pending_htlcs,omitempty"`
Lifetime string `json:"lifetime,omitempty"`
Uptime string `json:"uptime,omitempty"`
PushAmountSat string `json:"push_amount_sat,omitempty"`
LocalConstraints *ChannelConstraintsOverride `json:"local_constraints,omitempty"`
RemoteConstraints *ChannelConstraintsOverride `json:"remote_constraints,omitempty"`
AliasScids []string `json:"alias_scids,omitempty"`
ZeroConfConfirmedScid string `json:"zero_conf_confirmed_scid,omitempty"`
lnrpc.Channel
}
type Channels ¶
type Channels struct {
Channels []*ChannelOverride `json:"channels"`
}
type ChannelsApi ¶
type ChannelsApi struct {
Channels []ChannelApi
}
type ClnFeatures ¶ added in v0.0.34
type ClnFundsChan ¶ added in v0.0.34
type ClnFundsChan struct {
PeerId string `json:"peer_id"`
Connected bool `json:"connected,omitempty"`
ShortChannelId string `json:"short_channel_id"`
State string `json:"state"`
Capacity uint64 `json:"channel_total_sat"`
OurAmount uint64 `json:"channel_sat"`
FundingTxId string `json:"funding_tx_id"`
FundingOutput int `json:"funding_output"`
}
type ClnFundsChanResp ¶ added in v0.0.34
type ClnFundsChanResp struct {
Channels []ClnFundsChan `json:"channels,omitempty"`
}
type ClnInfo ¶ added in v0.0.34
type ClnInfo struct {
PubKey string `json:"id"`
Alias string `json:"alias"`
Color string `json:"color"`
Network string `json:"network"`
Addresses []ClnListNodeAddr `json:"address,omitempty"`
Features ClnFeatures `json:"our_features"`
}
type ClnListChan ¶ added in v0.0.34
type ClnListChan struct {
Source string `json:"source"`
Destination string `json:"destination"`
Public bool `json:"public"`
Capacity uint64 `json:"satoshis"`
Active bool `json:"active"`
LastUpdate entities.JsonTime `json:"last_update"`
FeeBase uint64 `json:"base_fee_millisatoshi"`
FeePpm uint64 `json:"fee_per_millionth"`
MinHtlc string `json:"htlc_minimum_msat"`
MaxHtlc string `json:"htlc_maximum_msat"`
ShortChannelId string `json:"short_channel_id,omitempty"`
Delay uint64 `json:"delay"`
}
type ClnListChanResp ¶ added in v0.0.34
type ClnListChanResp struct {
Channels []ClnListChan `json:"channels,omitempty"`
}
type ClnListNode ¶ added in v0.0.34
type ClnListNodeAddr ¶ added in v0.0.34
type ClnListNodeResp ¶ added in v0.0.34
type ClnListNodeResp struct {
Nodes []ClnListNode `json:"nodes,omitempty"`
}
type ClnSetChan ¶ added in v0.0.34
type ClnSetChan struct {
PeerId string `json:"peer_id"`
LongChanId string `json:"channel_id"`
FeeBase string `json:"fee_base_msat"`
FeePpm string `json:"fee_proportional_milli"`
MiHtlc string `json:"minimum_htlc_out_msat"`
MaxHtlc string `json:"maximum_htlc_out_msat"`
ShortChannelId string `json:"short_channel_id,omitempty"`
}
type ClnSetChanResp ¶ added in v0.0.34
type ClnSetChanResp struct {
Settings []ClnSetChan `json:"channels,omitempty"`
}
type ClnSocketLightningApi ¶ added in v0.0.34
type ClnSocketLightningApi struct {
LightningApi
Client *rpc.Client
Timeout time.Duration
}
func (*ClnSocketLightningApi) CallWithTimeout ¶ added in v0.0.34
func (l *ClnSocketLightningApi) CallWithTimeout(serviceMethod string, args any, reply any) error
func (*ClnSocketLightningApi) Cleanup ¶ added in v0.0.34
func (l *ClnSocketLightningApi) Cleanup()
func (*ClnSocketLightningApi) DescribeGraph ¶ added in v0.0.34
func (l *ClnSocketLightningApi) DescribeGraph(ctx context.Context, unannounced bool) (*DescribeGraphApi, error)
func (*ClnSocketLightningApi) GetChanInfo ¶ added in v0.0.34
func (l *ClnSocketLightningApi) GetChanInfo(ctx context.Context, chanId uint64) (*NodeChannelApi, error)
func (*ClnSocketLightningApi) GetChannels ¶ added in v0.0.34
func (l *ClnSocketLightningApi) GetChannels(ctx context.Context) (*ChannelsApi, error)
func (*ClnSocketLightningApi) GetInfo ¶ added in v0.0.34
func (l *ClnSocketLightningApi) GetInfo(ctx context.Context) (*InfoApi, error)
func (*ClnSocketLightningApi) GetInternalChannels ¶ added in v0.0.34
func (l *ClnSocketLightningApi) GetInternalChannels(pubKey string) (map[string][]ClnListChan, error)
func (*ClnSocketLightningApi) GetInternalChannelsAll ¶ added in v0.0.34
func (l *ClnSocketLightningApi) GetInternalChannelsAll() (map[string][]ClnListChan, error)
func (*ClnSocketLightningApi) GetNodeInfo ¶ added in v0.0.34
func (l *ClnSocketLightningApi) GetNodeInfo(ctx context.Context, pubKey string, channels bool) (*NodeInfoApi, error)
func (*ClnSocketLightningApi) GetNodeInfoFull ¶ added in v0.0.34
func (l *ClnSocketLightningApi) GetNodeInfoFull(ctx context.Context, channels bool, unannounced bool) (*NodeInfoApiExtended, error)
type DescribeGraphApi ¶
type DescribeGraphApi struct {
Nodes []DescribeGraphNodeApi
Channels []NodeChannelApi
}
type DescribeGraphNodeApi ¶
type DescribeGraphNodeApi struct {
PubKey string `json:"pub_key,omitempty"`
Alias string `json:"alias,omitempty"`
Color string `json:"color,omitempty"`
Addresses []NodeAddressApi `json:"addresses,omitempty"`
Features map[string]NodeFeatureApi `json:"features,omitempty"`
LastUpdate entities.JsonTime `json:"last_update,omitempty"`
}
func ConvertNodeInfo ¶ added in v0.0.34
func ConvertNodeInfo(node ClnListNode) *DescribeGraphNodeApi
type GetDataCall ¶
type GetInfoResponseOverride ¶
type GetInfoResponseOverride struct {
BestHeaderTimestamp string `json:"best_header_timestamp,omitempty"`
lnrpc.GetInfoResponse
}
type GetNodeInfoOverride ¶ added in v0.0.5
type GetNodeInfoOverride struct {
Node *GraphNodeOverride `json:"node,omitempty"`
NumChannels int64 `json:"num_channels,omitempty"`
TotalCapacity string `json:"total_capacity,omitempty"`
Channels []*GraphEdgeOverride `json:"channels"`
lnrpc.NodeInfo
}
type Graph ¶
type Graph struct {
GraphNodeOverride []*GraphNodeOverride `json:"nodes,omitempty"`
GraphEdgesOverride []*GraphEdgeOverride `json:"edges,omitempty"`
}
type GraphEdgeOverride ¶
type GraphEdgeOverride struct {
ChannelId string `json:"channel_id,omitempty"`
Capacity string `json:"capacity,omitempty"`
Node1Policy *RoutingPolicyOverride `json:"node1_policy,omitempty"`
Node2Policy *RoutingPolicyOverride `json:"node2_policy,omitempty"`
lnrpc.ChannelEdge
}
type GraphNodeOverride ¶
type GraphNodeOverride struct {
lnrpc.LightningNode
}
type HtlcOverride ¶
type HtlcOverride struct {
Amount string `json:"amount,omitempty"`
HashLock string `json:"hash_lock,omitempty"`
HtlcIndex string `json:"htlc_index,omitempty"`
ForwardingChannel string `json:"forwarding_channel,omitempty"`
ForwardingHtlcIndex string `json:"forwarding_htlc_index,omitempty"`
lnrpc.HTLC
}
type HttpApi ¶
type HttpApi struct {
DoFunc GetDoFunc
// contains filtered or unexported fields
}
func NewHttpApi ¶
func NewHttpApi() *HttpApi
func (*HttpApi) GetHttpRequest ¶
func (*HttpApi) HttpGetChanInfo ¶ added in v0.0.5
func (*HttpApi) HttpGetChannels ¶
func (*HttpApi) HttpGetGraph ¶
func (*HttpApi) HttpGetInfo ¶
func (*HttpApi) HttpGetNodeInfo ¶ added in v0.0.5
func (*HttpApi) SetTransport ¶
type LightingApiCalls ¶
type LightingApiCalls interface {
Cleanup()
GetInfo(ctx context.Context) (*InfoApi, error)
GetChannels(ctx context.Context) (*ChannelsApi, error)
DescribeGraph(ctx context.Context, unannounced bool) (*DescribeGraphApi, error)
GetNodeInfoFull(ctx context.Context, channels, unannounced bool) (*NodeInfoApiExtended, error)
GetNodeInfo(ctx context.Context, pubKey string, channels bool) (*NodeInfoApi, error)
GetChanInfo(ctx context.Context, chanId uint64) (*NodeChannelApi, error)
}
func NewClnSocketLightningApi ¶ added in v0.0.34
func NewClnSocketLightningApi(getData GetDataCall) LightingApiCalls
func NewClnSocketLightningApiRaw ¶ added in v0.0.34
func NewClnSocketLightningApiRaw(socketType string, address string) LightingApiCalls
Usage "unix", "/home/ubuntu/.lightning/bitcoin/lightning-rpc"
func NewLndGrpcLightningApi ¶
func NewLndGrpcLightningApi(getData GetDataCall) LightingApiCalls
func NewLndRestLightningApi ¶
func NewLndRestLightningApi(getData GetDataCall) LightingApiCalls
type LightningApi ¶
type LightningApi struct {
GetNodeInfoFullThreshUseDescribeGraph int // If node has more than that number of channels use DescribeGraph else do GetChanInfo for each one
}
type LndGrpcLightningApi ¶
type LndGrpcLightningApi struct {
Client lnrpc.LightningClient
CleanupFunc func()
LightningApi
}
func (*LndGrpcLightningApi) Cleanup ¶
func (l *LndGrpcLightningApi) Cleanup()
func (*LndGrpcLightningApi) DescribeGraph ¶
func (l *LndGrpcLightningApi) DescribeGraph(ctx context.Context, unannounced bool) (*DescribeGraphApi, error)
func (*LndGrpcLightningApi) GetChanInfo ¶ added in v0.0.5
func (l *LndGrpcLightningApi) GetChanInfo(ctx context.Context, chanId uint64) (*NodeChannelApi, error)
func (*LndGrpcLightningApi) GetChannels ¶
func (l *LndGrpcLightningApi) GetChannels(ctx context.Context) (*ChannelsApi, error)
func (*LndGrpcLightningApi) GetInfo ¶
func (l *LndGrpcLightningApi) GetInfo(ctx context.Context) (*InfoApi, error)
func (*LndGrpcLightningApi) GetNodeInfo ¶ added in v0.0.5
func (l *LndGrpcLightningApi) GetNodeInfo(ctx context.Context, pubKey string, channels bool) (*NodeInfoApi, error)
func (*LndGrpcLightningApi) GetNodeInfoFull ¶ added in v0.0.5
func (l *LndGrpcLightningApi) GetNodeInfoFull(ctx context.Context, channels, unnanounced bool) (*NodeInfoApiExtended, error)
type LndRestLightningApi ¶
type LndRestLightningApi struct {
Request *http.Request
Transport *http.Transport
HttpApi *HttpApi
LightningApi
}
func (*LndRestLightningApi) Cleanup ¶
func (l *LndRestLightningApi) Cleanup()
func (*LndRestLightningApi) DescribeGraph ¶
func (l *LndRestLightningApi) DescribeGraph(ctx context.Context, unannounced bool) (*DescribeGraphApi, error)
func (*LndRestLightningApi) GetChanInfo ¶ added in v0.0.5
func (l *LndRestLightningApi) GetChanInfo(ctx context.Context, chanId uint64) (*NodeChannelApi, error)
func (*LndRestLightningApi) GetChannels ¶
func (l *LndRestLightningApi) GetChannels(ctx context.Context) (*ChannelsApi, error)
func (*LndRestLightningApi) GetInfo ¶
func (l *LndRestLightningApi) GetInfo(ctx context.Context) (*InfoApi, error)
func (*LndRestLightningApi) GetNodeInfo ¶ added in v0.0.5
func (l *LndRestLightningApi) GetNodeInfo(ctx context.Context, pubKey string, channels bool) (*NodeInfoApi, error)
func (*LndRestLightningApi) GetNodeInfoFull ¶ added in v0.0.5
func (l *LndRestLightningApi) GetNodeInfoFull(ctx context.Context, channels, unnanounced bool) (*NodeInfoApiExtended, error)
type NodeAddressApi ¶ added in v0.0.5
type NodeAddressApi struct {
Network string `json:"network,omitempty"`
Addr string `json:"addr,omitempty"`
}
func ConvertAddresses ¶ added in v0.0.34
func ConvertAddresses(addr []ClnListNodeAddr) []NodeAddressApi
type NodeChannelApi ¶ added in v0.0.5
type NodeChannelApi struct {
ChannelId uint64 `json:"channel_id,omitempty"`
ChanPoint string `json:"chan_point"`
Node1Pub string `json:"node1_pub,omitempty"`
Node2Pub string `json:"node2_pub,omitempty"`
Capacity uint64 `json:"capacity,omitempty"`
Node1Policy *RoutingPolicyApi `json:"node1_policy,omitempty"`
Node2Policy *RoutingPolicyApi `json:"node2_policy,omitempty"`
LastUpdate entities.JsonTime `json:"last_update,omitempty"`
}
type NodeChannelApiExtended ¶ added in v0.0.7
type NodeChannelApiExtended struct {
Private bool `json:"private,omitempty"`
NodeChannelApi
}
func ConvertChannelInternal ¶ added in v0.0.34
func ConvertChannelInternal(chans []ClnListChan, id uint64) (*NodeChannelApiExtended, error)
type NodeFeatureApi ¶ added in v0.0.5
type NodeInfoApi ¶ added in v0.0.5
type NodeInfoApi struct {
Node DescribeGraphNodeApi `json:"node,omitempty"`
Channels []NodeChannelApi `json:"channels"`
NumChannels uint32 `json:"num_channels"`
TotalCapacity uint64 `json:"total_capacity"`
}
type NodeInfoApiExtended ¶ added in v0.0.7
type NodeInfoApiExtended struct {
NodeInfoApi
Channels []NodeChannelApiExtended `json:"channels"`
}
type RoutingPolicyApi ¶
type RoutingPolicyApi struct {
TimeLockDelta uint32 `json:"time_lock_delta"`
MinHtlc uint64 `json:"min_htlc"`
BaseFee uint64 `json:"fee_base_msat"`
FeeRate uint64 `json:"fee_rate_milli_msat"`
Disabled bool `json:"disabled,omitempty"`
LastUpdate entities.JsonTime `json:"last_update,omitempty"`
MaxHtlc uint64 `json:"max_htlc_msat"`
}
type RoutingPolicyOverride ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.