repo stringlengths 6 65 | file_url stringlengths 81 311 | file_path stringlengths 6 227 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:31:58 2026-01-04 20:25:31 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
tailhook/unshare | https://github.com/tailhook/unshare/blob/6cdc15d97aca90f59d1427e01da4c461184d0fe4/src/std_api.rs | src/std_api.rs | // This file was derived from rust's own libstd/process.rs with the following
// copyright:
//
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
use std::ffi::OsStr;
use std::default::Default;
use std::co... | rust | Apache-2.0 | 6cdc15d97aca90f59d1427e01da4c461184d0fe4 | 2026-01-04T20:21:52.548549Z | false |
tailhook/unshare | https://github.com/tailhook/unshare/blob/6cdc15d97aca90f59d1427e01da4c461184d0fe4/src/lib.rs | src/lib.rs | //! The `Command` has mostly same API as `std::process::Command` except where
//! is absolutely needed.
//!
//! In addition `Command` contains methods to configure linux namespaces,
//! chroots and more linux stuff.
//!
//! We have diverged from ``std::process::Command`` in the following
//! major things:
//!
//! 1. Er... | rust | Apache-2.0 | 6cdc15d97aca90f59d1427e01da4c461184d0fe4 | 2026-01-04T20:21:52.548549Z | false |
tailhook/unshare | https://github.com/tailhook/unshare/blob/6cdc15d97aca90f59d1427e01da4c461184d0fe4/src/ffi_util.rs | src/ffi_util.rs | use std::ffi::{CString, OsStr};
use std::os::unix::ffi::OsStrExt;
pub trait ToCString {
fn to_cstring(&self) -> CString;
}
impl<T:AsRef<OsStr>> ToCString for T {
fn to_cstring(&self) -> CString {
CString::new(self.as_ref().as_bytes())
.unwrap()
}
}
| rust | Apache-2.0 | 6cdc15d97aca90f59d1427e01da4c461184d0fe4 | 2026-01-04T20:21:52.548549Z | false |
tailhook/unshare | https://github.com/tailhook/unshare/blob/6cdc15d97aca90f59d1427e01da4c461184d0fe4/src/stdio.rs | src/stdio.rs | use std::io;
use std::os::unix::io::{RawFd, AsRawFd, IntoRawFd};
use nix;
use nix::fcntl::{fcntl, FcntlArg};
use libc;
/// An enumeration that is used to configure stdio file descritors
///
/// The enumeration members might be non-stable, it's better to use
/// one of the constructors to create an instance
pub enum ... | rust | Apache-2.0 | 6cdc15d97aca90f59d1427e01da4c461184d0fe4 | 2026-01-04T20:21:52.548549Z | false |
tailhook/unshare | https://github.com/tailhook/unshare/blob/6cdc15d97aca90f59d1427e01da4c461184d0fe4/src/caps.rs | src/caps.rs | #[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)]
#[allow(missing_docs, non_camel_case_types)]
pub enum Capability {
CAP_CHOWN = 0,
CAP_DAC_OVERRIDE = 1,
CAP_DAC_READ_SEARCH = 2,
CAP_FOWNER = 3,
CAP_FSETID = 4,
CAP_KILL = 5,
CAP_SETGID ... | rust | Apache-2.0 | 6cdc15d97aca90f59d1427e01da4c461184d0fe4 | 2026-01-04T20:21:52.548549Z | false |
tailhook/unshare | https://github.com/tailhook/unshare/blob/6cdc15d97aca90f59d1427e01da4c461184d0fe4/src/linux.rs | src/linux.rs | use std::ffi::OsStr;
use std::io;
use std::os::unix::io::AsRawFd;
use std::path::Path;
use nix::sys::signal::{Signal};
use crate::ffi_util::ToCString;
use crate::{Command, Namespace};
use crate::idmap::{UidMap, GidMap};
use crate::stdio::dup_file_cloexec;
use crate::namespace::to_clone_flag;
use crate::caps::Capabili... | rust | Apache-2.0 | 6cdc15d97aca90f59d1427e01da4c461184d0fe4 | 2026-01-04T20:21:52.548549Z | false |
tailhook/unshare | https://github.com/tailhook/unshare/blob/6cdc15d97aca90f59d1427e01da4c461184d0fe4/src/callbacks.rs | src/callbacks.rs | use std::io;
use crate::{Command, BoxError};
impl Command {
/// Set a callback to run when child is already forked but not yet run
///
/// When starting a child we sometimes need more setup from the parent,
/// for example: to configure pid namespaces for the unprivileged
/// process (child) by p... | rust | Apache-2.0 | 6cdc15d97aca90f59d1427e01da4c461184d0fe4 | 2026-01-04T20:21:52.548549Z | false |
tailhook/unshare | https://github.com/tailhook/unshare/blob/6cdc15d97aca90f59d1427e01da4c461184d0fe4/src/status.rs | src/status.rs | use std::fmt;
use crate::{Signal};
/// The exit status of a process
///
/// Returned either by `reap_zombies()` or by `child_events()`
/// or by `Child::wait()`
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ExitStatus {
/// Process exited normally with some exit code
Exited(i8),
/// Process was ki... | rust | Apache-2.0 | 6cdc15d97aca90f59d1427e01da4c461184d0fe4 | 2026-01-04T20:21:52.548549Z | false |
tailhook/unshare | https://github.com/tailhook/unshare/blob/6cdc15d97aca90f59d1427e01da4c461184d0fe4/src/chroot.rs | src/chroot.rs | use std::ffi::CString;
pub struct Pivot {
pub new_root: CString,
pub put_old: CString,
pub old_inside: CString,
pub workdir: CString,
pub unmount_old_root: bool,
}
pub struct Chroot {
pub root: CString,
pub workdir: CString,
}
| rust | Apache-2.0 | 6cdc15d97aca90f59d1427e01da4c461184d0fe4 | 2026-01-04T20:21:52.548549Z | false |
tailhook/unshare | https://github.com/tailhook/unshare/blob/6cdc15d97aca90f59d1427e01da4c461184d0fe4/src/error.rs | src/error.rs | use std::io;
use std::fmt;
use crate::status::ExitStatus;
use nix;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ErrorCode {
CreatePipe = 1,
Fork = 2,
Exec = 3,
Chdir = 4,
ParentDeathSignal = 5,
PipeError = 6,
StdioError = 7,
SetUser = 8,
ChangeRoot = 9,
SetIdMap = 10,... | rust | Apache-2.0 | 6cdc15d97aca90f59d1427e01da4c461184d0fe4 | 2026-01-04T20:21:52.548549Z | false |
tailhook/unshare | https://github.com/tailhook/unshare/blob/6cdc15d97aca90f59d1427e01da4c461184d0fe4/src/debug.rs | src/debug.rs | use std::fmt::{self, Display};
use nix::sched::CloneFlags;
use crate::Command;
/// This is a builder for various settings of how command may be printed
///
/// Use `format!("{}", cmd.display(style))` to actually print a command.
#[derive(Clone, Debug)]
pub struct Style {
cmd_only: bool,
print_env: bool,
... | rust | Apache-2.0 | 6cdc15d97aca90f59d1427e01da4c461184d0fe4 | 2026-01-04T20:21:52.548549Z | false |
tailhook/unshare | https://github.com/tailhook/unshare/blob/6cdc15d97aca90f59d1427e01da4c461184d0fe4/src/runtime.rs | src/runtime.rs | rust | Apache-2.0 | 6cdc15d97aca90f59d1427e01da4c461184d0fe4 | 2026-01-04T20:21:52.548549Z | false | |
tailhook/unshare | https://github.com/tailhook/unshare/blob/6cdc15d97aca90f59d1427e01da4c461184d0fe4/src/wait.rs | src/wait.rs | use std::io;
use std::os::unix::io::RawFd;
use nix::Error;
use nix::unistd::Pid;
use nix::sys::wait::waitpid;
use nix::sys::signal::{Signal, SIGKILL, kill};
use nix::errno::Errno::EINTR;
use libc::pid_t;
use crate::pipe::PipeHolder;
use crate::{Child, ExitStatus, PipeReader, PipeWriter};
impl Child {
/// Retur... | rust | Apache-2.0 | 6cdc15d97aca90f59d1427e01da4c461184d0fe4 | 2026-01-04T20:21:52.548549Z | false |
tailhook/unshare | https://github.com/tailhook/unshare/blob/6cdc15d97aca90f59d1427e01da4c461184d0fe4/src/idmap.rs | src/idmap.rs | use libc::{uid_t, gid_t};
/// Entry (row) in the uid map
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub struct UidMap {
/// First uid inside the guest namespace
pub inside_uid: uid_t,
/// First uid in external (host) namespace
pub outside_uid: uid_t,
/// Number of uids that this entry allows sta... | rust | Apache-2.0 | 6cdc15d97aca90f59d1427e01da4c461184d0fe4 | 2026-01-04T20:21:52.548549Z | false |
tailhook/unshare | https://github.com/tailhook/unshare/blob/6cdc15d97aca90f59d1427e01da4c461184d0fe4/src/run.rs | src/run.rs | use std::collections::HashMap;
use std::env::current_dir;
use std::ffi::CString;
use std::fs::File;
use std::io::{self, Read, Write};
use std::iter::repeat;
use std::os::unix::ffi::{OsStrExt};
use std::os::unix::io::{RawFd, AsRawFd};
use std::path::{Path, PathBuf};
use std::ptr;
use libc::{c_char, close};
use nix;
use... | rust | Apache-2.0 | 6cdc15d97aca90f59d1427e01da4c461184d0fe4 | 2026-01-04T20:21:52.548549Z | false |
tailhook/unshare | https://github.com/tailhook/unshare/blob/6cdc15d97aca90f59d1427e01da4c461184d0fe4/src/child.rs | src/child.rs | use std::os::unix::io::RawFd;
use std::mem;
use std::ptr;
use libc;
use nix;
use libc::{c_void, c_ulong, sigset_t, size_t};
use libc::{kill, signal};
use libc::{F_GETFD, F_SETFD, F_DUPFD_CLOEXEC, FD_CLOEXEC, MNT_DETACH};
use libc::{SIG_DFL, SIG_SETMASK};
use crate::run::{ChildInfo, MAX_PID_LEN};
use crate::error::Err... | rust | Apache-2.0 | 6cdc15d97aca90f59d1427e01da4c461184d0fe4 | 2026-01-04T20:21:52.548549Z | false |
tailhook/unshare | https://github.com/tailhook/unshare/blob/6cdc15d97aca90f59d1427e01da4c461184d0fe4/src/pipe.rs | src/pipe.rs | use std::io;
use std::mem;
use std::os::unix::io::{RawFd};
use nix::unistd::pipe2;
use nix::fcntl::OFlag;
use libc;
use libc::{c_void, size_t};
use crate::error::{result, Error};
use crate::error::ErrorCode::CreatePipe;
/// A pipe used to communicate with subprocess
#[derive(Debug)]
pub struct Pipe(RawFd, RawFd);
... | rust | Apache-2.0 | 6cdc15d97aca90f59d1427e01da4c461184d0fe4 | 2026-01-04T20:21:52.548549Z | false |
tailhook/unshare | https://github.com/tailhook/unshare/blob/6cdc15d97aca90f59d1427e01da4c461184d0fe4/src/fds.rs | src/fds.rs | use std::mem::zeroed;
use std::ops::{Range, RangeTo, RangeFrom, RangeFull};
use std::os::unix::io::RawFd;
use nix::errno::errno;
use libc::getrlimit;
use libc::RLIMIT_NOFILE;
use crate::stdio::{Fd};
use crate::Command;
/// This is just a temporary enum to coerce `std::ops::Range*` variants
/// into single value for... | rust | Apache-2.0 | 6cdc15d97aca90f59d1427e01da4c461184d0fe4 | 2026-01-04T20:21:52.548549Z | false |
tailhook/unshare | https://github.com/tailhook/unshare/blob/6cdc15d97aca90f59d1427e01da4c461184d0fe4/src/namespace.rs | src/namespace.rs | use nix::sched::CloneFlags;
/// Namespace name to unshare
///
/// See `man 7 namespaces` for more information
#[derive(PartialEq, Eq, Hash, Clone, Copy)]
pub enum Namespace {
/// Unshare the mount namespace. It basically means that you can now mount
/// and unmount folders without touching parent mount points... | rust | Apache-2.0 | 6cdc15d97aca90f59d1427e01da4c461184d0fe4 | 2026-01-04T20:21:52.548549Z | false |
tailhook/unshare | https://github.com/tailhook/unshare/blob/6cdc15d97aca90f59d1427e01da4c461184d0fe4/src/zombies.rs | src/zombies.rs | use std::marker::PhantomData;
use libc::pid_t;
use nix::sys::wait::{waitpid};
use nix::sys::wait::WaitPidFlag;
use nix::errno::Errno::{EINTR, ECHILD};
use nix::Error;
use crate::{ExitStatus, Signal};
/// A non-blocking iteration over zombie processes
///
/// Use `reap_zombies()` to create one, and read docs there
pu... | rust | Apache-2.0 | 6cdc15d97aca90f59d1427e01da4c461184d0fe4 | 2026-01-04T20:21:52.548549Z | false |
tailhook/unshare | https://github.com/tailhook/unshare/blob/6cdc15d97aca90f59d1427e01da4c461184d0fe4/examples/echo.rs | examples/echo.rs | extern crate unshare;
use std::process::exit;
fn main() {
let mut cmd = unshare::Command::new("/bin/echo");
cmd.arg("hello");
cmd.arg("world!");
match cmd.status().unwrap() {
// propagate signal
unshare::ExitStatus::Exited(x) => exit(x as i32),
unshare::ExitStatus::Signaled(x... | rust | Apache-2.0 | 6cdc15d97aca90f59d1427e01da4c461184d0fe4 | 2026-01-04T20:21:52.548549Z | false |
tailhook/unshare | https://github.com/tailhook/unshare/blob/6cdc15d97aca90f59d1427e01da4c461184d0fe4/examples/runcmd.rs | examples/runcmd.rs | extern crate unshare;
extern crate argparse;
extern crate libc;
use std::io::{stderr, Write, Read};
use std::process::exit;
use std::path::PathBuf;
use unshare::Namespace;
use libc::{uid_t, gid_t};
use argparse::{ArgumentParser, Store, StoreOption, Collect, StoreTrue};
use argparse::{ParseOption, PushConst};
fn mai... | rust | Apache-2.0 | 6cdc15d97aca90f59d1427e01da4c461184d0fe4 | 2026-01-04T20:21:52.548549Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/examples/rust/lib.rs | examples/rust/lib.rs | pub mod getting_started;
| rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/examples/rust/snippets/getting_started.rs | examples/rust/snippets/getting_started.rs | use anyhow::{Result};
use bip39::{Language, Mnemonic};
use gl_client::{
bitcoin::Network,
credentials::{Device, Nobody},
node::ClnClient,
pb::{cln, cln::{amount_or_any, Amount, AmountOrAny}},
scheduler::Scheduler,
signer::Signer,
};
use rand::RngCore;
use std::{env, fs, path::PathBuf};
use tokio... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client-py/src/signer.rs | libs/gl-client-py/src/signer.rs | use crate::credentials::Credentials;
use gl_client::bitcoin::Network;
use log::warn;
use pyo3::{exceptions::PyValueError, prelude::*};
use tokio::sync::mpsc;
#[pyclass]
#[derive(Clone)]
pub struct Signer {
pub(crate) inner: gl_client::signer::Signer,
}
#[pymethods]
impl Signer {
#[new]
fn new(secret: Vec<... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client-py/src/tls.rs | libs/gl-client-py/src/tls.rs | use gl_client::tls;
use pyo3::exceptions::PyFileNotFoundError;
use pyo3::prelude::*;
#[pyclass]
#[derive(Clone)]
pub struct TlsConfig {
pub(crate) inner: tls::TlsConfig,
}
#[pymethods]
impl TlsConfig {
#[new]
fn new() -> PyResult<TlsConfig> {
let inner = tls::TlsConfig::new();
Ok(Self { in... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client-py/src/node.rs | libs/gl-client-py/src/node.rs | use crate::credentials::Credentials;
use crate::runtime::exec;
use crate::scheduler::convert;
use gl_client as gl;
use gl_client::pb;
use prost::Message;
use pyo3::exceptions::PyValueError;
use pyo3::prelude::*;
use tonic::{Code, Status};
#[pyclass]
pub struct Node {
client: gl::node::Client,
gclient: gl::node... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client-py/src/lib.rs | libs/gl-client-py/src/lib.rs | use gl_client::{bitcoin, export::decrypt_with_seed};
use pyo3::prelude::*;
#[macro_use]
extern crate log;
mod credentials;
mod node;
mod pairing;
mod runtime;
mod scheduler;
mod signer;
mod tls;
pub use node::Node;
pub use scheduler::Scheduler;
pub use signer::{Signer, SignerHandle};
pub use tls::TlsConfig;
#[pyfun... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client-py/src/pairing.rs | libs/gl-client-py/src/pairing.rs | use crate::credentials::{self, Credentials};
use crate::runtime::exec;
use bytes::BufMut;
use gl_client::pairing::{attestation_device, new_device, PairingSessionData};
use gl_client::pb::scheduler::GetPairingDataResponse;
use prost::Message;
use pyo3::exceptions::PyValueError;
use pyo3::prelude::*;
use tokio::sync::mps... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client-py/src/lsps.rs | libs/gl-client-py/src/lsps.rs | use crate::runtime::exec;
use gl_client::lsps::client::LspClient as LspClientInner;
use gl_client::lsps::error::LspsError;
use gl_client::lsps::json_rpc::{generate_random_rpc_id, JsonRpcResponse};
use gl_client::lsps::message as lsps_message;
use gl_client::node::{Client, ClnClient};
use pyo3::exceptions::{PyBaseExcept... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client-py/src/runtime.rs | libs/gl-client-py/src/runtime.rs | use ::tokio::runtime::{Builder, Runtime};
use once_cell::sync::OnceCell;
use pyo3::prelude::Python;
use std::future::Future;
static TOKIO_RUNTIME: OnceCell<Runtime> = OnceCell::new();
pub(crate) fn get_runtime<'a>() -> &'a Runtime {
TOKIO_RUNTIME.get_or_init(|| {
let mut builder = Builder::new_multi_threa... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client-py/src/credentials.rs | libs/gl-client-py/src/credentials.rs | use crate::runtime::exec;
use crate::scheduler::Scheduler;
use crate::signer::Signer;
use gl_client::credentials::{self, NodeIdProvider, RuneProvider, TlsConfigProvider};
use pyo3::exceptions::PyValueError;
use pyo3::prelude::*;
use pyo3::types::PyBytes;
pub type PyCredentials = UnifiedCredentials<credentials::Nobody,... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client-py/src/scheduler.rs | libs/gl-client-py/src/scheduler.rs | use crate::credentials::{Credentials, PyCredentials};
use crate::runtime::exec;
use crate::Signer;
use anyhow::{anyhow, Result};
use gl_client::bitcoin::Network;
use gl_client::credentials::{NodeIdProvider, RuneProvider};
use gl_client::credentials::TlsConfigProvider;
use gl_client::pb;
use gl_client::scheduler;
use pr... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-plugin/build.rs | libs/gl-plugin/build.rs | fn main() {
tonic_build::configure()
.build_client(true)
.build_server(true)
.type_attribute(
"TrampolinePayRequest",
"#[derive(serde::Serialize, serde::Deserialize)]",
)
.compile(
&[".resources/proto/glclient/greenlight.proto"],
... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-plugin/src/unix.rs | libs/gl-plugin/src/unix.rs | use std::{
pin::Pin,
sync::Arc,
task::{Context, Poll},
};
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
use tonic::transport::server::Connected;
#[derive(Debug)]
pub struct UnixStream(pub tokio::net::UnixStream);
impl Connected for UnixStream {
type ConnectInfo = UdsConnectInfo;
fn connect_in... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-plugin/src/config.rs | libs/gl-plugin/src/config.rs | use anyhow::{anyhow, Context, Result};
use log::trace;
use std::net::SocketAddr;
use tonic::transport;
/// Enumeration of supported networks
#[derive(Clone, Debug)]
pub enum Network {
Bitcoin = 0,
Testnet = 1,
Regtest = 2,
}
impl TryFrom<i16> for Network {
type Error = anyhow::Error;
fn try_from(... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-plugin/src/responses.rs | libs/gl-plugin/src/responses.rs | //! Various structs representing JSON-RPC responses
pub use clightningrpc::responses::*;
use serde::{de, Deserialize, Deserializer};
use std::str::FromStr;
/// A simple wrapper that generalizes bare amounts and amounts with
/// the `msat` suffix.
#[derive(Clone, Copy, Debug)]
pub struct MSat(pub u64);
struct MSatVis... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-plugin/src/messages.rs | libs/gl-plugin/src/messages.rs | use anyhow::{anyhow, Error};
use hex::{self, FromHex};
use serde::de::{self, Deserializer};
use serde::ser::{self, Serializer};
use serde::{Deserialize, Serialize};
use serde_json::{json, Value};
use std::collections::HashMap;
#[derive(Debug)]
pub struct ParserError {
reason: String,
}
impl std::fmt::Display for ... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-plugin/src/tlv.rs | libs/gl-plugin/src/tlv.rs | use anyhow::anyhow;
use bytes::{Buf, BufMut};
use cln_rpc::primitives::TlvEntry;
use serde::{Deserialize, Deserializer};
/// A standalone type the represent a binary serialized
/// TlvStream. This is distinct from TlvStream since that expects TLV
/// streams to be encoded as maps in JSON.
#[derive(Clone, Debug)]
pub s... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-plugin/src/lib.rs | libs/gl-plugin/src/lib.rs | use anyhow::Result;
use cln_rpc;
use log::{debug, warn};
use serde_json::json;
use std::future::Future;
use std::sync::Arc;
use tokio::sync::broadcast;
#[macro_use(error)]
extern crate gl_util;
mod awaitables;
pub mod config;
pub mod hsm;
mod lsp;
pub mod messages;
pub mod node;
pub mod pb;
pub mod requests;
pub mod ... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-plugin/src/pb.rs | libs/gl-plugin/src/pb.rs | tonic::include_proto!("greenlight");
use crate::{messages, requests, responses};
use cln_rpc::primitives;
impl HsmRequest {
pub fn get_type(&self) -> u16 {
(self.raw[0] as u16) << 8 | (self.raw[1] as u16)
}
}
impl From<u64> for Amount {
fn from(i: u64) -> Self {
Amount {
unit: ... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-plugin/src/awaitables.rs | libs/gl-plugin/src/awaitables.rs | use cln_rpc::{
model::{
requests::{ConnectRequest, GetinfoRequest, GetrouteRequest, ListpeerchannelsRequest},
responses::GetrouteResponse,
},
primitives::{Amount, PublicKey, ShortChannelId},
ClnRpc,
};
use std::{
future::Future,
path::{Path, PathBuf},
pin::Pin,
time::Dura... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-plugin/src/storage.rs | libs/gl-plugin/src/storage.rs | //! A backend to store the signer state in.
pub use gl_client::persist::State;
use log::debug;
use thiserror::Error;
use tonic::async_trait;
#[derive(Debug, Error)]
pub enum Error {
/// underlying database error
#[error("database error: {0}")]
Sled(#[from] ::sled::Error),
#[error("state corruption: {0... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-plugin/src/lsp.rs | libs/gl-plugin/src/lsp.rs | //! LSP integrations and related code.
use crate::{
tlv::{self, ProtoBufMut},
Plugin,
};
use anyhow::Context;
use bytes::BufMut;
use cln_rpc::primitives::{Amount, ShortChannelId};
use serde::{Deserialize, Serialize};
use serde_json::Value;
#[derive(Debug, Deserialize)]
#[allow(unused)]
struct Onion {
payl... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-plugin/src/hsm.rs | libs/gl-plugin/src/hsm.rs | //! Service used to talk to the `hsmd` that is passing us the signer
//! requests.
use crate::config::NodeInfo;
use crate::pb::{hsm_server::Hsm, Empty, HsmRequest, HsmResponse, NodeConfig};
use crate::stager;
use anyhow::{Context, Result};
use futures::TryFutureExt;
use log::{debug, info, trace, warn};
use std::path::... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-plugin/src/stager.rs | libs/gl-plugin/src/stager.rs | /// A simple staging mechanism for incoming requests so we can invert from
/// pull to push. Used by `hsmproxy` to stage requests that can then
/// asynchronously be retrieved and processed by one or more client
/// devices.
use crate::pb;
use anyhow::{anyhow, Error};
use log::{debug, trace, warn};
use std::collections... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-plugin/src/context.rs | libs/gl-plugin/src/context.rs | //! Manage a signature request context.
//!
//! The signature request context is composed of any currently pending grpc request (serialized as byte string), along with a public key (corresponding to the caller's mTLS certificate), an attestation (signature) by the signer about the authenticity of this public key, as we... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-plugin/src/requests.rs | libs/gl-plugin/src/requests.rs | pub use clightningrpc::requests::*;
use serde::{Serialize, Serializer};
#[derive(Debug, Clone)]
pub struct Outpoint {
pub txid: Vec<u8>,
pub outnum: u16,
}
#[derive(Debug, Clone)]
pub enum Amount {
Millisatoshi(u64),
Satoshi(u64),
Bitcoin(u64),
All,
Any,
}
impl Serialize for Amount {
... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-plugin/src/tramp.rs | libs/gl-plugin/src/tramp.rs | use crate::awaitables::{AwaitableChannel, AwaitablePeer, Error as AwaitablePeerError};
use crate::pb;
use cln_rpc::{
primitives::{Amount, PublicKey, ShortChannelId},
ClnRpc, RpcError,
};
use futures::{future::join_all, FutureExt};
use gl_util::error::{ClnRpcError, Error, ErrorCode, ErrorStatusConversionExt, Rpc... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | true |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-plugin/src/node/rpcwait.rs | libs/gl-plugin/src/node/rpcwait.rs | use log::warn;
use tonic::server::NamedService;
use tower::Service;
/// The RPC socket will not be available right away, so we wrap the
/// cln-grpc service with this `Service` which essentially checks for
/// the file's existence, and if it doesn't exist we wait for up to 5
/// seconds for it to appear.
#[derive(Debu... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-plugin/src/node/wrapper.rs | libs/gl-plugin/src/node/wrapper.rs | use std::collections::HashMap;
use std::str::FromStr;
use anyhow::Error;
use cln_grpc;
use cln_grpc::pb::{self, node_server::Node};
use cln_rpc::primitives::ChannelState;
use cln_rpc::{self};
use log::debug;
use tokio_stream::wrappers::ReceiverStream;
use tonic::{Request, Response, Status};
use super::PluginNodeServe... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | true |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-plugin/src/node/mod.rs | libs/gl-plugin/src/node/mod.rs | use crate::config::Config;
use crate::pb::{self, node_server::Node};
use crate::storage::StateStore;
use crate::{messages, Event};
use crate::{stager, tramp};
use anyhow::{Context, Error, Result};
use base64::{engine::general_purpose, Engine as _};
use bytes::BufMut;
use cln_rpc::Notification;
use gl_client::persist::S... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | true |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-plugin/src/bin/plugin.rs | libs/gl-plugin/src/bin/plugin.rs | use anyhow::{Context, Error};
use gl_plugin::config::Config;
use gl_plugin::{
hsm,
node::PluginNodeServer,
stager::Stage,
storage::{SledStateStore, StateStore},
Event,
};
use log::info;
use std::env;
use std::net::SocketAddr;
use std::path::PathBuf;
use std::str::FromStr;
use std::sync::Arc;
#[toki... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-signerproxy/build.rs | libs/gl-signerproxy/build.rs | fn main() {
tonic_build::configure()
.build_client(true)
.compile(
&[".resources/proto/glclient/greenlight.proto"],
&[".resources/proto/glclient"],
)
.unwrap();
}
| rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-signerproxy/src/passfd.rs | libs/gl-signerproxy/src/passfd.rs | use libc::{self, c_int, c_uchar, c_void, msghdr};
use log::trace;
use std::io::{Error, ErrorKind};
use std::mem;
use std::os::unix::io::RawFd;
pub trait SyncFdPassingExt {
/// Send RawFd. No type information is transmitted.
fn send_fd(&self, fd: RawFd) -> Result<(), Error>;
/// Receive RawFd. No type infor... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-signerproxy/src/lib.rs | libs/gl-signerproxy/src/lib.rs | mod hsmproxy;
mod passfd;
mod pb;
mod wire;
use anyhow::Result;
pub struct Proxy {}
impl Proxy {
pub fn new() -> Proxy {
Proxy {}
}
pub fn run(&self) -> Result<()> {
hsmproxy::run()
}
}
| rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-signerproxy/src/hsmproxy.rs | libs/gl-signerproxy/src/hsmproxy.rs | // Implementation of the server-side hsmd. It collects requests and passes
// them on to the clients which actually have access to the keys.
use crate::pb::{hsm_client::HsmClient, Empty, HsmRequest, HsmRequestContext};
use crate::wire::{DaemonConnection, Message};
use anyhow::{anyhow, Context};
use anyhow::{Error, Resu... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-signerproxy/src/pb.rs | libs/gl-signerproxy/src/pb.rs | use crate::wire::Message;
use anyhow::{anyhow, Result};
use byteorder::{BigEndian, ByteOrder};
tonic::include_proto!("greenlight");
impl HsmRequestContext {
pub fn from_client_hsmfd_msg(msg: &Message) -> Result<HsmRequestContext> {
if msg.msgtype() != 9 {
return Err(anyhow!("message is not an ... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-signerproxy/src/wire.rs | libs/gl-signerproxy/src/wire.rs | use crate::passfd::SyncFdPassingExt;
use anyhow::{anyhow, Error, Result};
use byteorder::{BigEndian, ByteOrder};
use log::trace;
use std::io::{Read, Write};
use std::os::unix::io::{AsRawFd, RawFd};
use std::os::unix::net::UnixStream;
use std::sync::Mutex;
/// A simple implementation of the inter-daemon protocol wrappi... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-signerproxy/src/bin/signerproxy.rs | libs/gl-signerproxy/src/bin/signerproxy.rs | use anyhow::Result;
use gl_signerproxy::Proxy;
fn main() -> Result<()> {
env_logger::builder()
.target(env_logger::Target::Stderr)
.init();
Proxy::new().run()
}
| rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-util/src/lib.rs | libs/gl-util/src/lib.rs | pub mod error;
| rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-util/src/error.rs | libs/gl-util/src/error.rs | //! # Greenlight Error Module
//!
//! This module provides a comprehensive error handling system for
//! greenlight. It features a generic error type that can be customized with
//! module- or crate-specific error codes, while maintaining compatibility
//! with gRPC status codes and providing rich error context.
use by... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/uniffi-bindgen/src/main.rs | libs/uniffi-bindgen/src/main.rs | fn main() {
uniffi::uniffi_bindgen_main()
}
| rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client/build.rs | libs/gl-client/build.rs | use std::env::var;
use std::path::Path;
use std::process::Command;
fn main() {
let manifest_dir = var("CARGO_MANIFEST_DIR").unwrap();
let nobody_crt: String = format!("{}/.resources/tls/users-nobody.pem", manifest_dir);
let nobody_key: String = format!("{}/.resources/tls/users-nobody-key.pem", manifest_di... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client/src/tls.rs | libs/gl-client/src/tls.rs | use anyhow::{Context, Result};
use log::debug;
use std::path::Path;
use tonic::transport::{Certificate, ClientTlsConfig, Identity};
use x509_certificate::X509Certificate;
const CA_RAW: &[u8] = include_str!("../.resources/tls/ca.pem").as_bytes();
const NOBODY_CRT: &[u8] = include_str!(env!("GL_NOBODY_CRT")).as_bytes();... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client/src/persist.rs | libs/gl-client/src/persist.rs | use lightning_signer::bitcoin::secp256k1::PublicKey;
use lightning_signer::chain::tracker::ChainTracker;
use lightning_signer::channel::ChannelId;
use lightning_signer::channel::ChannelStub;
use lightning_signer::node::NodeConfig;
use lightning_signer::node::NodeState;
use lightning_signer::persist::ChainTrackerListene... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client/src/lib.rs | libs/gl-client/src/lib.rs | //! Greenlight client library to schedule nodes, interact with them
//! and sign off on signature requests.
//!
/// Interact with a node running on greenlight.
///
/// The node must be scheduled using [`crate::scheduler::Scheduler`]:
///
///
pub mod node;
/// Generated protobuf messages and client stubs.
///
/// Sinc... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client/src/runes.rs | libs/gl-client/src/runes.rs | use runeauth::{Alternative, Check, Condition, ConditionChecker, Restriction, Rune, RuneError};
use std::fmt::Display;
use std::time::{SystemTime, UNIX_EPOCH};
/// Represents an entity that can provide restrictions.
///
/// The `Restrictor` trait should be implemented by types that are able to
/// produce a list of `Re... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client/src/pb.rs | libs/gl-client/src/pb.rs | pub mod greenlight {
tonic::include_proto!("greenlight");
}
pub mod scheduler {
tonic::include_proto!("scheduler");
}
pub use cln_grpc::pb as cln;
pub use greenlight::*;
| rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client/src/util.rs | libs/gl-client/src/util.rs | pub fn is_feature_bit_enabled(bitmap: &[u8], index: usize) -> bool {
let n_bytes = bitmap.len();
let (byte_index, bit_index) = (index / 8, index % 8);
// The index doesn't fit in the byte-array
if byte_index >= n_bytes {
return false;
}
let selected_byte = bitmap[n_bytes - 1 - byte_ind... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client/src/utils.rs | libs/gl-client/src/utils.rs | use crate::tls::TlsConfig;
use anyhow::{anyhow, Result};
pub fn scheduler_uri() -> String {
std::env::var("GL_SCHEDULER_GRPC_URI")
.unwrap_or_else(|_| "https://scheduler.gl.blckstrm.com".to_string())
}
pub fn get_node_id_from_tls_config(tls_config: &TlsConfig) -> Result<Vec<u8>> {
let subject_common_n... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client/src/credentials.rs | libs/gl-client/src/credentials.rs | use crate::{
scheduler::Scheduler,
signer::Signer,
tls::{self, TlsConfig},
utils::get_node_id_from_tls_config,
};
/// Credentials is a collection of all relevant keys and attestations
/// required to authenticate a device and authorize a command on the node.
/// They represent the identity of a device a... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client/src/export.rs | libs/gl-client/src/export.rs | //! Utilities to work with export/backup files.
use anyhow::{anyhow, Context, Error};
use bytes::{Buf, Bytes, BytesMut};
use chacha20poly1305::{AeadInPlace, ChaCha20Poly1305, KeyInit};
use lightning_signer::bitcoin::{
secp256k1::{ecdh::SharedSecret, PublicKey, Secp256k1, SecretKey},
Network,
};
use std::io::Rea... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client/src/scheduler.rs | libs/gl-client/src/scheduler.rs | use crate::credentials::{self, RuneProvider, NodeIdProvider, TlsConfigProvider};
use crate::node::{self, GrpcClient};
use crate::pb::scheduler::scheduler_client::SchedulerClient;
use crate::tls::{self};
use crate::utils::scheduler_uri;
use crate::{pb, signer::Signer};
use anyhow::{Result};
use lightning_signer::bitcoin... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client/src/node/service.rs | libs/gl-client/src/node/service.rs | use anyhow::{anyhow, Result};
use http::{Request, Response};
use log::{debug, trace};
use rustls_pemfile as pemfile;
use std::future::Future;
use std::pin::Pin;
use std::task::{Context, Poll};
use tonic::body::BoxBody;
use tonic::transport::Body;
use tonic::transport::Channel;
use tower::{Layer, Service};
use ring::si... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client/src/node/mod.rs | libs/gl-client/src/node/mod.rs | use crate::credentials::{RuneProvider, TlsConfigProvider};
use crate::pb::cln::node_client as cln_client;
use crate::pb::node_client::NodeClient;
use crate::pb::scheduler::{scheduler_client::SchedulerClient, ScheduleRequest};
use crate::tls::TlsConfig;
use crate::utils;
use anyhow::{anyhow, Result};
use log::{debug, in... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client/src/node/generic.rs | libs/gl-client/src/node/generic.rs | //! An implementation of a Grpc Client that does not perform protobuf
//! encoding/decoding. It takes already encoded protobuf messages as
//! `Vec<u8>`, along with the URI and returns the unparsed results to
//! the caller, or a `tonic::Status` in case of failure. This is
//! rather useful when creating bindings, in t... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client/src/pairing/attestation_device.rs | libs/gl-client/src/pairing/attestation_device.rs | use std::time::{SystemTime, UNIX_EPOCH};
use super::{into_approve_pairing_error, into_verify_pairing_data_error, Error};
use crate::{
credentials::{NodeIdProvider, RuneProvider, TlsConfigProvider},
pb::{
self,
scheduler::{
pairing_client::PairingClient, ApprovePairingRequest, GetPai... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client/src/pairing/new_device.rs | libs/gl-client/src/pairing/new_device.rs | use super::PairingSessionData;
use crate::{
credentials::{Device, TlsConfigProvider},
pb::scheduler::{pairing_client::PairingClient, PairDeviceRequest},
tls::{self, TlsConfig},
};
use log::debug;
use tokio::sync::mpsc;
use tonic::transport::Channel;
type Result<T, E = super::Error> = core::result::Result<T... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client/src/pairing/mod.rs | libs/gl-client/src/pairing/mod.rs | use crate::{credentials, pb::scheduler::PairDeviceResponse};
use thiserror::Error;
pub mod attestation_device;
pub mod new_device;
#[derive(Error, Debug)]
pub enum Error {
#[error(transparent)]
TransportError(#[from] tonic::transport::Error),
#[error(transparent)]
X509Error(#[from] rcgen::RcgenError),... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client/src/lnurl/utils.rs | libs/gl-client/src/lnurl/utils.rs | use std::str::FromStr;
use anyhow::{anyhow, Result};
use bech32::FromBase32;
use crate::lightning_invoice::Bolt11Invoice;
// Function to decode and parse the lnurl into a URL
pub fn parse_lnurl(lnurl: &str) -> Result<String> {
let (_hrp, data, _variant) =
bech32::decode(lnurl).map_err(|e| anyhow!("Failed... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client/src/lnurl/mod.rs | libs/gl-client/src/lnurl/mod.rs | mod models;
mod pay;
mod utils;
mod withdraw;
use self::models::{
LnUrlHttpClient, PayRequestCallbackResponse, PayRequestResponse, WithdrawRequestResponse,
};
use self::utils::{parse_invoice, parse_lnurl};
use crate::node::ClnClient;
use crate::pb::cln::{amount_or_any, Amount, AmountOrAny};
use anyhow::{anyhow, Re... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client/src/lnurl/models.rs | libs/gl-client/src/lnurl/models.rs | use anyhow::{anyhow, Result};
use async_trait::async_trait;
use log::debug;
use mockall::automock;
use reqwest::Response;
use serde::de::DeserializeOwned;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug)]
pub struct PayRequestResponse {
pub callback: String,
#[serde(rename = "maxSen... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client/src/lnurl/pay/mod.rs | libs/gl-client/src/lnurl/pay/mod.rs | use super::models;
use super::utils::parse_lnurl;
use crate::lightning_invoice::{Bolt11Invoice, Bolt11InvoiceDescription};
use crate::lnurl::{
models::{LnUrlHttpClient, PayRequestCallbackResponse, PayRequestResponse},
utils::parse_invoice,
};
use anyhow::{anyhow, ensure, Result};
use log::debug;
use reqwest::... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client/src/lnurl/withdraw/mod.rs | libs/gl-client/src/lnurl/withdraw/mod.rs | use super::models::WithdrawRequestResponse;
use anyhow::{anyhow, Result};
use log::debug;
use reqwest::Url;
use serde_json::{to_value, Map, Value};
pub fn build_withdraw_request_callback_url(
lnurl_pay_request_response: &WithdrawRequestResponse,
invoice: String,
) -> Result<String> {
let mut url = Url::par... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client/src/signer/report.rs | libs/gl-client/src/signer/report.rs | //! Signer reporting facility to debug issues
//!
//! The resolver and policies implemented in the signer may produce
//! false negatives, i.e., they may reject an otherwise valid request
//! based on a missing approval or failing to match up the request
//! with the signed context requests in the resolver.
//!
//! Sin... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client/src/signer/approver.rs | libs/gl-client/src/signer/approver.rs | use lightning_signer::prelude::SendSync;
use vls_protocol_signer::approver::Approve;
// An approver that will collect any request it gets and files a
// report that may be relayed to developers to debug policies. It
// defers actual decisions to an `inner` approver, and provides access
// to the captured reports. If t... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client/src/signer/auth.rs | libs/gl-client/src/signer/auth.rs | //! Utilities used to authorize a signature request based on pending RPCs
use std::str::FromStr;
use lightning_signer::invoice::Invoice;
use vls_protocol_signer::approver::Approval;
use crate::signer::model::Request;
use crate::Error;
pub trait Authorizer {
fn authorize(
&self,
requests: &Vec<Reque... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client/src/signer/mod.rs | libs/gl-client/src/signer/mod.rs | use crate::credentials::{RuneProvider, TlsConfigProvider};
use crate::pb::scheduler::{scheduler_client::SchedulerClient, NodeInfoRequest, UpgradeRequest};
use crate::pb::scheduler::{
signer_request, signer_response, ApprovePairingRequest, ApprovePairingResponse, SignerResponse,
};
use crate::pb::PendingRequest;
///... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | true |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client/src/signer/resolve.rs | libs/gl-client/src/signer/resolve.rs | //! Resolver utilities to match incoming requests against the request
//! context and find a justifications.
use crate::signer::{model::Request, Error};
use vls_protocol::msgs::Message;
pub struct Resolver {}
impl Resolver {
/// Attempt to find a resolution for a given request. We default
/// to failing, and ... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client/src/signer/model/greenlight.rs | libs/gl-client/src/signer/model/greenlight.rs | // Decoding support for the legacy `greenlight.proto` models and
// methods. This will be mostly deprecated as we go.
use super::Request;
pub use crate::pb::*;
use anyhow::anyhow;
use prost::Message;
pub fn decode_request(uri: &str, p: &[u8]) -> anyhow::Result<Request> {
Ok(match uri {
"/greenlight.Node/C... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client/src/signer/model/mod.rs | libs/gl-client/src/signer/model/mod.rs | // This file was generated by `gengrpc` from the CLN JSON-Schema.
// Do not edit this file.
//
pub mod cln;
pub mod greenlight;
/// Variants prefixed with `Gl` are deprecated and will eventually be removed.
#[derive(Clone, Debug)]
pub enum Request {
GlConfig(greenlight::GlConfig),
LspInvoice(greenlight::LspIn... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-client/src/signer/model/cln.rs | libs/gl-client/src/signer/model/cln.rs | //
// This file was generated by `gengrpc` from the CLN JSON-Schema.
// Do not edit this file.
//
use super::Request;
pub use crate::pb::cln::*;
use anyhow::anyhow;
use prost::Message;
pub fn decode_request(uri: &str, p: &[u8]) -> anyhow::Result<Request> {
Ok(match uri {
"/cln.Node/Getinfo" => Request::Ge... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-sdk/src/signer.rs | libs/gl-sdk/src/signer.rs | use crate::{Credentials, Error};
use bip39::Mnemonic;
use std::str::FromStr;
use tracing;
#[derive(uniffi::Object, Clone)]
pub struct Signer {
seed: Vec<u8>,
pub(crate) inner: gl_client::signer::Signer,
credentials: Option<Credentials>,
}
#[uniffi::export]
impl Signer {
#[uniffi::constructor()]
fn... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-sdk/src/node.rs | libs/gl-sdk/src/node.rs | use crate::{credentials::Credentials, util::exec, Error};
use gl_client::credentials::NodeIdProvider;
use gl_client::node::{Client as GlClient, ClnClient, Node as ClientNode};
use gl_client::pb::cln as clnpb;
use tokio::sync::OnceCell;
/// The `Node` is an RPC stub representing the node running in the
/// cloud. It i... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-sdk/src/lib.rs | libs/gl-sdk/src/lib.rs | uniffi::setup_scaffolding!();
#[derive(uniffi::Error, thiserror::Error, Debug)]
pub enum Error {
#[error("There is already a node for node_id={0}, maybe you want to recover?")]
DuplicateNode(String),
#[error("There is no node with node_id={0}, maybe you need to register first?")]
NoSuchNode(String),
... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-sdk/src/util.rs | libs/gl-sdk/src/util.rs | use ::tokio::runtime::{Builder, Runtime};
use once_cell::sync::OnceCell;
use std::future::Future;
static TOKIO_RUNTIME: OnceCell<Runtime> = OnceCell::new();
pub(crate) fn get_runtime<'a>() -> &'a Runtime {
TOKIO_RUNTIME.get_or_init(|| {
let mut builder = Builder::new_multi_thread();
builder.enable... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-sdk/src/credentials.rs | libs/gl-sdk/src/credentials.rs | use crate::Error;
use gl_client::credentials::Device as DeviceCredentials;
/// `Credentials` is a container for `node_id`, the mTLS client
/// certificate used to authenticate a client against a node, as well
/// as the seed secret if present. If no seed is present in the
/// credentials, then the `Client` will not st... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-sdk/src/scheduler.rs | libs/gl-sdk/src/scheduler.rs | use crate::{credentials::Credentials, signer::Signer, util::exec, Error};
#[derive(uniffi::Object, Clone)]
pub struct Scheduler {
credentials: Option<Credentials>,
network: gl_client::bitcoin::Network,
}
#[uniffi::export]
impl Scheduler {
/// Create a `Scheduler` instance configured with the Greenlight
... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-cli/src/signer.rs | libs/gl-cli/src/signer.rs | use crate::error::{Error, Result};
use crate::util;
use clap::Subcommand;
use core::fmt::Debug;
use gl_client::signer::Signer;
use lightning_signer::bitcoin::Network;
use std::path::Path;
use tokio::{join, signal};
use util::{CREDENTIALS_FILE_NAME, SEED_FILE_NAME};
pub struct Config<P: AsRef<Path>> {
pub data_dir:... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.