pub mod commando;
mod crypto;
pub mod error;
pub mod ln;
pub mod lnsocket;
mod sign;
mod socket_addr;
mod util;
pub use bitcoin;
pub use commando::CommandoClient;
pub use error::Error;
pub use lnsocket::LNSocket;
mod prelude {
#![allow(unused_imports)]
pub use std::{boxed::Box, collections::VecDeque, string::String, vec, vec::Vec};
pub use std::borrow::ToOwned;
pub use std::string::ToString;
pub use core::convert::{AsMut, AsRef, TryFrom, TryInto};
pub use core::default::Default;
pub use core::marker::Sized;
pub(crate) use crate::util::hash_tables::*;
}
#[doc(hidden)]
pub mod io_extras {
use std::io::{self, Read, Write};
pub use std::io::sink;
pub fn copy<R: Read + ?Sized, W: Write + ?Sized>(
reader: &mut R,
writer: &mut W,
) -> Result<u64, io::Error> {
let mut count = 0;
let mut buf = [0u8; 64];
loop {
match reader.read(&mut buf) {
Ok(0) => break,
Ok(n) => {
writer.write_all(&buf[0..n])?;
count += n as u64;
}
Err(ref e) if e.kind() == io::ErrorKind::Interrupted => {}
Err(e) => return Err(e),
};
}
Ok(count)
}
pub fn read_to_end<D: Read>(d: &mut D) -> Result<std::vec::Vec<u8>, io::Error> {
let mut result = vec![];
let mut buf = [0u8; 64];
loop {
match d.read(&mut buf) {
Ok(0) => break,
Ok(n) => result.extend_from_slice(&buf[0..n]),
Err(ref e) if e.kind() == io::ErrorKind::Interrupted => {}
Err(e) => return Err(e),
};
}
Ok(result)
}
}