lnc

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 21 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const HeaderMacaroon = "Macaroon"

HeaderMacaroon is the HTTP header field name that is used to send the macaroon.

View Source
const Subsystem = "LNCS"

Subsystem defines the sub system name of this package.

Variables

View Source
var (
	// DefaultConnectionTimetout is the default timeout for a connection
	// attempt.
	DefaultConnectionTimetout = time.Second * 10

	// DefaultStoreTimetout is the default timeout for a db transaction.
	DefaultStoreTimetout = time.Second * 10
)
View Source
var (
	// ErrSessionNotFound is returned when a session is not found in the
	// database.
	ErrSessionNotFound = errors.New("session not found")
)

Functions

func UseLogger

func UseLogger(logger btclog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using btclog.

Types

type NodeConn

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

NodeConn handles all the connection logic to a remote LND node using LNC.

func NewNodeConn

func NewNodeConn(session *Session, store Store) (*NodeConn, error)

NewNodeConn creates a new NodeConn instance.

func (*NodeConn) Client

func (n *NodeConn) Client() (lnrpc.LightningClient, error)

Client returns the gRPC client to the remote node.

func (*NodeConn) CloseConn

func (n *NodeConn) CloseConn() error

CloseConn closes the connection with the remote node.

func (*NodeConn) CtxFunc

func (n *NodeConn) CtxFunc() context.Context

CtxFunc returns the context that needs to be used whenever the internal Client is used.

func (*NodeConn) Stop

func (n *NodeConn) Stop() error

Stop closes the connection with the remote node if it is open.

type Session

type Session struct {
	// PassphraseWords is the list of words the PassphraseEntropy is derived
	// from.
	PassphraseWords string

	// PassphraseEntropy is the entropy. This field identifies the session.
	PassphraseEntropy []byte

	// RemoteStaticPubKey is the public key of the remote peer.
	RemoteStaticPubKey *btcec.PublicKey

	// LocalStaticPrivKey is the private key of the local peer.
	LocalStaticPrivKey *btcec.PrivateKey

	// MailboxAddr is the address of the mailbox server.
	MailboxAddr string

	// CreatedAt is the time the session was added to the database.
	CreatedAt time.Time

	// Expiry is the time the session will expire.
	Expiry *time.Time

	// DevServer signals if we need to skip the verification of the server's
	// tls certificate.
	DevServer bool
}

Session contains all the information needed for an LNC connection.

func NewSession

func NewSession(passphrase, mailboxAddr string, devServer bool) (*Session,
	error)

NewSession creates a new non-initialized session.

type Store

type Store interface {
	// AddSession adds a record for a new session in the database.
	AddSession(ctx context.Context, session *Session) error

	// GetSession retrieves the session record matching the passphrase
	// entropy.
	GetSession(ctx context.Context,
		passphraseEntropy []byte) (*Session, error)

	// SetRemotePubKey sets the remote public key for a session.
	SetRemotePubKey(ctx context.Context, passphraseEntropy,
		remotePubKey []byte) error

	// SetExpiry sets the expiry time for a session.
	SetExpiry(ctx context.Context, passphraseEntroy []byte,
		expiry time.Time) error
}

Store represents access to a persistent session store.

Jump to

Keyboard shortcuts

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