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 |
|---|---|---|---|---|---|---|---|---|
mempool/electrs | https://github.com/mempool/electrs/blob/3000bd13e76e2f33d0844a30489108846954d0a3/src/bin/popular-scripts.rs | src/bin/popular-scripts.rs | extern crate electrs;
use std::{convert::TryInto, thread::ThreadId, time::Instant};
use electrs::{config::Config, new_index::db::open_raw_db};
use lazy_static::lazy_static;
/*
// How to run:
export ELECTRS_DATA=/path/to/electrs
cargo run \
-q --release --bin popular-scripts -- \
--db-dir $ELECTRS_DATA/db \
> .... | rust | MIT | 3000bd13e76e2f33d0844a30489108846954d0a3 | 2026-01-04T20:24:15.088141Z | false |
mempool/electrs | https://github.com/mempool/electrs/blob/3000bd13e76e2f33d0844a30489108846954d0a3/src/bin/electrs.rs | src/bin/electrs.rs | extern crate error_chain;
#[macro_use]
extern crate log;
extern crate electrs;
use error_chain::ChainedError;
use std::process;
use std::sync::{Arc, RwLock};
use std::time::Duration;
use electrs::{
config::Config,
daemon::Daemon,
electrum::RPC as ElectrumRPC,
errors::*,
metrics::Metrics,
new_... | rust | MIT | 3000bd13e76e2f33d0844a30489108846954d0a3 | 2026-01-04T20:24:15.088141Z | false |
mempool/electrs | https://github.com/mempool/electrs/blob/3000bd13e76e2f33d0844a30489108846954d0a3/src/bin/tx-fingerprint-stats.rs | src/bin/tx-fingerprint-stats.rs | extern crate electrs;
#[cfg(not(feature = "liquid"))]
#[macro_use]
extern crate log;
#[cfg(not(feature = "liquid"))]
fn main() {
use std::collections::HashSet;
use std::sync::Arc;
use bitcoin::blockdata::script::Script;
use bitcoin::consensus::encode::deserialize;
use electrs::{
chain::Tr... | rust | MIT | 3000bd13e76e2f33d0844a30489108846954d0a3 | 2026-01-04T20:24:15.088141Z | false |
mempool/electrs | https://github.com/mempool/electrs/blob/3000bd13e76e2f33d0844a30489108846954d0a3/src/new_index/db.rs | src/new_index/db.rs | use rocksdb;
use std::path::Path;
use crate::config::Config;
use crate::util::{bincode_util, Bytes};
/// Each version will break any running instance with a DB that has a differing version.
/// It will also break if light mode is enabled or disabled.
// 1 = Original DB (since fork from Blockstream)
// 2 = Add tx pos... | rust | MIT | 3000bd13e76e2f33d0844a30489108846954d0a3 | 2026-01-04T20:24:15.088141Z | false |
mempool/electrs | https://github.com/mempool/electrs/blob/3000bd13e76e2f33d0844a30489108846954d0a3/src/new_index/fetch.rs | src/new_index/fetch.rs | use rayon::prelude::*;
#[cfg(not(feature = "liquid"))]
use bitcoin::consensus::encode::{deserialize, Decodable};
#[cfg(feature = "liquid")]
use elements::encode::{deserialize, Decodable};
use std::collections::HashMap;
use std::fs;
use std::io::Cursor;
use std::path::PathBuf;
use std::thread;
use crate::chain::{Bloc... | rust | MIT | 3000bd13e76e2f33d0844a30489108846954d0a3 | 2026-01-04T20:24:15.088141Z | false |
mempool/electrs | https://github.com/mempool/electrs/blob/3000bd13e76e2f33d0844a30489108846954d0a3/src/new_index/schema.rs | src/new_index/schema.rs | use bitcoin::hashes::sha256d::Hash as Sha256dHash;
#[cfg(not(feature = "liquid"))]
use bitcoin::util::merkleblock::MerkleBlock;
use bitcoin::VarInt;
use itertools::Itertools;
use rayon::prelude::*;
use sha2::{Digest, Sha256};
#[cfg(not(feature = "liquid"))]
use bitcoin::consensus::encode::{deserialize, serialize};
#[c... | rust | MIT | 3000bd13e76e2f33d0844a30489108846954d0a3 | 2026-01-04T20:24:15.088141Z | true |
mempool/electrs | https://github.com/mempool/electrs/blob/3000bd13e76e2f33d0844a30489108846954d0a3/src/new_index/mod.rs | src/new_index/mod.rs | pub mod db;
mod fetch;
mod mempool;
pub mod precache;
mod query;
pub mod schema;
pub use self::db::{DBRow, DB};
pub use self::fetch::{BlockEntry, FetchFrom};
pub use self::mempool::Mempool;
pub use self::query::Query;
pub use self::schema::{
compute_script_hash, parse_hash, ChainQuery, FundingInfo, Indexer, Script... | rust | MIT | 3000bd13e76e2f33d0844a30489108846954d0a3 | 2026-01-04T20:24:15.088141Z | false |
mempool/electrs | https://github.com/mempool/electrs/blob/3000bd13e76e2f33d0844a30489108846954d0a3/src/new_index/mempool.rs | src/new_index/mempool.rs | use bounded_vec_deque::BoundedVecDeque;
use itertools::Itertools;
#[cfg(not(feature = "liquid"))]
use bitcoin::consensus::encode::serialize;
#[cfg(feature = "liquid")]
use elements::{encode::serialize, AssetId};
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
use std::iter::FromIterator;
use std::ops::B... | rust | MIT | 3000bd13e76e2f33d0844a30489108846954d0a3 | 2026-01-04T20:24:15.088141Z | false |
mempool/electrs | https://github.com/mempool/electrs/blob/3000bd13e76e2f33d0844a30489108846954d0a3/src/new_index/query.rs | src/new_index/query.rs | use rayon::prelude::*;
use std::collections::{BTreeSet, HashMap};
use std::sync::{Arc, RwLock, RwLockReadGuard};
use std::time::{Duration, Instant};
use crate::chain::{Network, OutPoint, Transaction, TxOut, Txid};
use crate::config::Config;
use crate::daemon::{Daemon, MempoolAcceptResult, SubmitPackageResult};
use cr... | rust | MIT | 3000bd13e76e2f33d0844a30489108846954d0a3 | 2026-01-04T20:24:15.088141Z | false |
mempool/electrs | https://github.com/mempool/electrs/blob/3000bd13e76e2f33d0844a30489108846954d0a3/src/new_index/precache.rs | src/new_index/precache.rs | use crate::errors::*;
use crate::new_index::ChainQuery;
use crate::util::{full_hash, FullHash};
use rayon::prelude::*;
use hex;
use std::fs::File;
use std::io;
use std::io::prelude::*;
use std::sync::{atomic::AtomicUsize, Arc};
use std::time::Instant;
pub fn precache(chain: Arc<ChainQuery>, scripthashes: Vec<FullHas... | rust | MIT | 3000bd13e76e2f33d0844a30489108846954d0a3 | 2026-01-04T20:24:15.088141Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot-actuator/src/lib.rs | summer-boot-actuator/src/lib.rs | mod configuration_properties; | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot-actuator/src/configuration_properties.rs | summer-boot-actuator/src/configuration_properties.rs | //!
//! Configuration properties
//!
pub struct ConfigurationProperties {
pub keys_sanitize: Vec<String>,
pub additional_keys_sanitize: Vec<String>,
}
impl ConfigurationProperties {
pub fn new() -> ConfigurationProperties {
ConfigurationProperties {
keys_sanitize: Vec::new(),
... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/lib.rs | summer-boot/src/lib.rs | pub mod common;
pub mod log;
mod context;
mod gateway;
mod http1;
mod server;
mod tcp;
pub mod utils;
pub use http1::http;
pub use utils::middleware::{Middleware, Next};
pub use utils::request::Request;
pub use utils::response::Response;
pub use utils::response_builder::ResponseBuilder;
pub use utils::util;
pub use ... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/tcp/unix.rs | summer-boot/src/tcp/unix.rs | use super::{is_transient_error, ListenInfo};
use super::Listener;
use crate::{http1, Server};
use std::fmt::{self, Display, Formatter};
use async_std::os::unix::net::{self, SocketAddr, UnixStream};
use async_std::path::PathBuf;
use async_std::prelude::*;
use async_std::{io, task};
use kv_log_macro::error;
pub struc... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/tcp/to_listener.rs | summer-boot/src/tcp/to_listener.rs | use super::Listener;
use async_std::io;
/// ToListener 可以转换为
/// [`Listener`](crate::listener::Listener),实现的任何类型。
/// 现实可以看to_listener_impls
///
pub trait ToListener<State: Clone + Send + Sync + 'static> {
/// 转换具体哪一种类型的Listener
type Listener: Listener<State>;
/// 将self进行转换为
/// [`Listener`](crate::li... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/tcp/tcp_listener.rs | summer-boot/src/tcp/tcp_listener.rs | use super::{is_transient_error, ListenInfo};
use super::Listener;
use crate::{http, log, Server};
use std::fmt::{self, Display, Formatter};
use async_std::net::{self, SocketAddr, TcpStream};
use async_std::prelude::*;
use async_std::{io, task};
pub struct TcpListener<State> {
addrs: Option<Vec<SocketAddr>>,
... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/tcp/parsed.rs | summer-boot/src/tcp/parsed.rs | #[cfg(unix)]
use super::UnixListener;
use super::{ListenInfo, Listener, TcpListener};
use crate::Server;
use async_std::io;
use std::fmt::{self, Debug, Display, Formatter};
pub enum ParsedListener<State> {
#[cfg(unix)]
Unix(UnixListener<State>),
Tcp(TcpListener<State>),
}
impl<State> Debug for ParsedList... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/tcp/mod.rs | summer-boot/src/tcp/mod.rs | //! 表示HTTP传输和绑定的类型
use crate::Server;
mod concurrent;
mod failover;
mod parsed;
mod tcp_listener;
mod to_listener;
mod to_listener_impls;
#[cfg(unix)]
mod unix;
use std::fmt::{Debug, Display};
use async_std::io;
use async_trait::async_trait;
pub use concurrent::ConcurrentListener;
pub use failover::FailoverListener... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/tcp/failover.rs | summer-boot/src/tcp/failover.rs | use crate::tcp::{Listener, ToListener};
use crate::Server;
use std::fmt::{self, Debug, Display, Formatter};
use async_std::io;
use crate::tcp::ListenInfo;
#[derive(Default)]
pub struct FailoverListener<State> {
listeners: Vec<Option<Box<dyn Listener<State>>>>,
index: Option<usize>,
}
#[allow(dead_code)]
im... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/tcp/concurrent.rs | summer-boot/src/tcp/concurrent.rs | use crate::tcp::{ListenInfo, Listener, ToListener};
use crate::Server;
use std::fmt::{self, Debug, Display, Formatter};
use async_std::io;
use futures_util::stream::{futures_unordered::FuturesUnordered, StreamExt};
#[derive(Default)]
pub struct ConcurrentListener<State> {
listeners: Vec<Box<dyn Listener<State>>>... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/tcp/to_listener_impls.rs | summer-boot/src/tcp/to_listener_impls.rs | #[cfg(unix)]
use super::UnixListener;
use super::{ConcurrentListener, FailoverListener, ParsedListener, TcpListener, ToListener};
use async_std::io;
use http_types::url::Url;
use std::net::ToSocketAddrs;
impl<State> ToListener<State> for Url
where
State: Clone + Send + Sync + 'static,
{
type Listener = ParsedL... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/http1/body_encoder.rs | summer-boot/src/http1/body_encoder.rs | use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};
use async_std::io::Read;
use http_types::Body;
use pin_project::pin_project;
use super::encode::ChunkedEncoder;
#[pin_project(project=BodyEncoderProjection)]
#[derive(Debug)]
pub(crate) enum BodyEncoder {
Chunked(#[pin] ChunkedEncoder<Body>),
Fi... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/http1/date.rs | summer-boot/src/http1/date.rs | use std::fmt::{self, Display, Formatter};
use std::str::{from_utf8, FromStr};
use std::time::{Duration, SystemTime, UNIX_EPOCH};
use http_types::{bail, ensure, format_err};
const IMF_FIXDATE_LENGTH: usize = 29;
const RFC850_MAX_LENGTH: usize = 23;
const ASCTIME_LENGTH: usize = 24;
const YEAR_9999_SECONDS: u64 = 2534... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/http1/http.rs | summer-boot/src/http1/http.rs | //! HTTP1 connections on the server.
use std::str::FromStr;
use std::task::{Context, Poll};
use std::{fmt, marker::PhantomData, pin::Pin, time::Duration};
use async_std::future::{timeout, Future, TimeoutError};
use async_std::io::{self, BufRead, BufReader, Read, Take, Write};
use async_std::{prelude::*, task};
use h... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/http1/encode.rs | summer-boot/src/http1/encode.rs | use std::io::Write;
use std::pin::Pin;
use std::time::SystemTime;
use crate::read_to_end;
use async_std::io::{self, Cursor, Read};
use async_std::task::{Context, Poll};
use futures_util::ready;
use http_types::headers::{CONTENT_LENGTH, DATE, TRANSFER_ENCODING};
use http_types::{Method, Response};
use super::body_enco... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/http1/decode.rs | summer-boot/src/http1/decode.rs | use std::fmt;
use std::future::Future;
use std::pin::Pin;
use std::task::{Context, Poll};
use async_std::io::{self, Read};
use futures_util::ready;
use http_types::trailers::{Sender, Trailers};
/// 解码
#[derive(Debug)]
pub struct ChunkedDecoder<R: Read> {
/// 底层流
inner: R,
/// 当前状态
state: State,
//... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/http1/body_reader.rs | summer-boot/src/http1/body_reader.rs | use super::decode::ChunkedDecoder;
use async_dup::{Arc, Mutex};
use async_std::io::{BufReader, Read, Take};
use async_std::task::{Context, Poll};
use std::{fmt::Debug, io, pin::Pin};
#[allow(dead_code)]
pub enum BodyReader<IO: Read + Unpin> {
Chunked(Arc<Mutex<ChunkedDecoder<BufReader<IO>>>>),
Fixed(Arc<Mutex... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/http1/mod.rs | summer-boot/src/http1/mod.rs | pub mod http;
// 其他为hhtp 私有处理
mod body_encoder;
mod body_reader;
mod date;
mod decode;
mod encode;
| rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/gateway/router.rs | summer-boot/src/gateway/router.rs | use crate::server;
use crate::{Request, Response, StatusCode};
use routefinder::{Captures, Router as MethodRouter};
use std::collections::HashMap;
use server::endpoint::DynEndpoint;
/// `Server` 使用的路由
///
/// 底层, 每个HTTP方法都有一个单独的状态;索引
/// 通过该方法,可以提高效率
#[allow(missing_debug_implementations)]
pub(crate) struct Router<S... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/gateway/mod.rs | summer-boot/src/gateway/mod.rs | pub mod route;
pub mod router;
| rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/gateway/route.rs | summer-boot/src/gateway/route.rs | use crate::context;
use crate::gateway;
use crate::log;
use crate::server;
use crate::utils;
use std::fmt::Debug;
use std::io;
use std::path::Path;
use std::sync::Arc;
use context::serve_dir::ServeDir;
use context::serve_file::ServeFile;
use server::endpoint::{Endpoint, MiddlewareEndpoint};
use utils::middleware::Mid... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/utils/response.rs | summer-boot/src/utils/response.rs | use std::convert::TryInto;
use std::fmt::{Debug, Display};
use std::ops::Index;
use serde::Serialize;
use crate::http_types::headers::{self, HeaderName, HeaderValues, ToHeaderValues};
use crate::http_types::{self, Body, Error, Mime, StatusCode};
use crate::ResponseBuilder;
/// HTTP response
#[derive(Debug)]
pub stru... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/utils/middleware.rs | summer-boot/src/utils/middleware.rs | use crate::server;
use crate::{Request, Response};
use async_trait::async_trait;
use server::endpoint::DynEndpoint;
use std::future::Future;
use std::pin::Pin;
use std::sync::Arc;
/// 异步中间件trait
#[async_trait]
pub trait Middleware<State>: Send + Sync + 'static {
/// 异步处理请求并返回响应。
async fn handle(&self, request... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/utils/response_builder.rs | summer-boot/src/utils/response_builder.rs | use serde::Serialize;
use crate::http_types::headers::{HeaderName, ToHeaderValues};
use crate::http_types::{Body, Mime, StatusCode};
use crate::Response;
use std::convert::TryInto;
#[derive(Debug)]
pub struct ResponseBuilder(Response);
impl ResponseBuilder {
pub(crate) fn new<S>(status: S) -> Self
where
... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/utils/util.rs | summer-boot/src/utils/util.rs | //! 其他util
use crate::{Middleware, Next, Request, Response};
pub use async_trait::async_trait;
use std::future::Future;
/// 定义对传入请求进行操作的中间件。
///
/// 用于定义内联中间件的闭包。
///
/// # Examples
///
/// ```rust
/// use summer_boot::utils::util;
/// use summer_boot::Request;
/// use std::time::Instant;
///
/// let mut app = summer... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/utils/mod.rs | summer-boot/src/utils/mod.rs | pub mod middleware;
pub mod request;
pub mod response;
pub mod response_builder;
pub mod util;
| rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/utils/request.rs | summer-boot/src/utils/request.rs | use async_std::io::{self, prelude::*};
use async_std::task::{Context, Poll};
use routefinder::Captures;
use std::ops::Index;
use std::pin::Pin;
use crate::http_types::format_err;
use crate::http_types::headers::{self, HeaderName, HeaderValues, ToHeaderValues};
use crate::http_types::{self, Body, Method, Mime, StatusC... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/common/mod.rs | summer-boot/src/common/mod.rs | //!
//! 这里在service module使用
//! 可以考虑添加消除警告的属性宏
//!
pub(crate) mod task;
pub(crate) use std::pin::Pin;
| rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/common/task.rs | summer-boot/src/common/task.rs | #[cfg(feature = "http1")]
use super::Never;
pub(crate) use std::task::{Context, Poll};
///
/// 重新安装feature
/// 这里用的是标准库Poll
///
#[cfg(feature = "http1")]
pub(crate) fn yield_now(cx: &mut Context<'_>) -> Poll<Never> {
cx.waker().wake_by_ref();
Poll::Pending
}
| rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/rt/mod.rs | summer-boot/src/rt/mod.rs | //! 提供了summer boot的运行时环境
//! 当前提供环境主要是 tokio 下的 Runtime
//!
use tokio::runtime::Runtime;
/// 运行时简单代理对象
#[derive(Debug)]
pub struct SummerRuntime;
impl SummerRuntime {
/// 新建 tokio runtime 运行时对象
pub fn new() -> Runtime {
tokio::runtime::Runtime::new().unwrap()
}
}
| rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/ssl/ssl.rs | summer-boot/src/ssl/ssl.rs | use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize)]
enum ClientAuth {
/**
* Client authentication is not wanted
*/
NONE,
/**
* Client authentication is wanted but not mandatory.
*/
WANT,
/**
* Client authentication is needed and mandatory.
*/
... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/ssl/mod.rs | summer-boot/src/ssl/mod.rs | pub mod ssl; | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/server/accept.rs | summer-boot/src/server/accept.rs | //! `Accept` trait 和支持的类型。
//!
//! 这个模块包含:
//!
//! - 用于异步接受传入数据的 [`Accept`](Accept) feture。
//! 链接.
//! - 像 `poll_fn` 这样的程序可以创建自定义的 `Accept`.
use crate::common::{
task::{self, Poll},
Pin,
};
/// 异步接受传入连接。
pub trait Accept {
/// 可以接受的连接类型。
type Conn;
/// 接受连接时可能发生的错误类型。
type Error;
/// 轮... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/server/configurable.rs | summer-boot/src/server/configurable.rs | pub struct ConfigurableWebServer {
pub port: Option<i32>,
pub server_header: Option<String>,
} | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/server/mod.rs | summer-boot/src/server/mod.rs | mod accept;
pub mod endpoint;
pub mod server;
| rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/server/server.rs | summer-boot/src/server/server.rs | //! HTTP server
use super::endpoint::Endpoint;
use crate::gateway;
use crate::log;
use crate::tcp;
use crate::utils;
use crate::{Request, Route};
use async_std::io;
use async_std::sync::Arc;
use gateway::router::{Router, Selection};
use tcp::{Listener, ToListener};
use utils::middleware::{Middleware, Next};
// use s... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/server/endpoint.rs | summer-boot/src/server/endpoint.rs | use crate::utils;
use crate::{Middleware, Request, Response};
use async_std::future::Future;
use async_std::sync::Arc;
use async_trait::async_trait;
use http_types::Result;
use utils::middleware::Next;
/// HTTP请求处理。
///
/// 这个特效是为了 `Fn` 类型自动实现的,所以很少实现,由开发者提供
///
/// 实际上 endpoint是用`Request<State>`作为参数的函数,然后将实现的类型`T`(... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/log/logging_system.rs | summer-boot/src/log/logging_system.rs | use crate::log;
use crate::{Middleware, Next, Request};
/// 记录所有传入的请求和响应
///
/// 此中间件在Summer Boot中默认启用
///
/// # Examples
///
/// ```
/// let mut app = summer_boot::new();
/// app.with(summer_boot::log::LoggingSystem::new());
/// ```
#[derive(Debug, Default, Clone)]
pub struct LoggingSystem {
_priv: (),
}
struct ... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/log/mod.rs | summer-boot/src/log/mod.rs | //! 事件日志记录类型
//!
//!
//! # Examples
//!
//! ```
//! use summer_boot::log;
//!
//! log::start();
//!
//! log::info!("Hello James");
//! log::debug!("{} eat rice", "James");
//! log::error!("this is an error!");
//! log::info!("{} are win", "test", {
//! key_1: "value1",
//! key_2: "value2",
//! });
//! ```
pub ... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/context/mod.rs | summer-boot/src/context/mod.rs | pub mod serve_dir;
pub mod serve_file;
| rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/context/serve_dir.rs | summer-boot/src/context/serve_dir.rs | use crate::log;
use crate::{Body, Endpoint, Request, Response, Result, StatusCode};
use async_std::path::PathBuf as AsyncPathBuf;
use std::path::{Path, PathBuf};
use std::{ffi::OsStr, io};
pub(crate) struct ServeDir {
prefix: String,
dir: PathBuf,
}
impl ServeDir {
/// 创建一个 `ServeDir` 新的实例。
pub(crat... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot/src/context/serve_file.rs | summer-boot/src/context/serve_file.rs | use crate::log;
use crate::{Body, Endpoint, Request, Response, Result, StatusCode};
use std::io;
use std::path::Path;
use async_std::path::PathBuf as AsyncPathBuf;
use async_trait::async_trait;
pub(crate) struct ServeFile {
path: AsyncPathBuf,
}
impl ServeFile {
/// 创建一个 `ServeFile` 新的实例。
pub(crate) fn i... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot-macro/src/lib.rs | summer-boot-macro/src/lib.rs | //! 运行时宏处理
//!
//! # main
//! 使用运行时宏来设置summerboot async运行时。参见[main]宏文档。
//!
//! # auto_scan
//! 提供了基础的`auto_scan`功能用于发现并自动注册路由。
//!
//! # post、get、delete、put、patch、head、options、connect、trace
//! 提供了简单的路由宏标注。
//!
//!
use proc_macro::TokenStream;
use proc_macro2::{Ident, Span};
use quote::{quote, ToTokens};
use serde::D... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot-autoconfigure/src/lib.rs | summer-boot-autoconfigure/src/lib.rs | mod read_yml;
pub use read_yml::*;
| rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/summer-boot-autoconfigure/src/read_yml.rs | summer-boot-autoconfigure/src/read_yml.rs | use schemars::schema::RootSchema;
use serde::{Deserialize, Serialize};
use serde_json::{from_str as json_from_str, to_string_pretty};
use serde_yaml::from_str as yaml_from_str;
use std::{
fs::{self, read_to_string},
io::Read
};
#[derive(Serialize, Deserialize, Debug)]
pub struct GlobalConfig {
pub mysql: O... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/example/src/lib.rs | example/src/lib.rs | mod read_yml;
mod log; | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/example/src/http_method.rs | example/src/http_method.rs | use serde::Deserialize;
use summer_boot::{Request, Result};
#[derive(Debug, Deserialize)]
struct User {
name: String,
age: u16,
}
#[summer_boot::get("/hello")]
pub async fn hello(_req: Request<()>) -> Result {
Ok("Hello, Summer Boot".to_string().into())
}
#[summer_boot::post("/user/getUserInfo")]
pub asy... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/example/src/log.rs | example/src/log.rs | #[cfg(test)]
mod test {
use summer_boot::log;
#[test]
fn log_print() {
// 在使用log的时候需要调用start()方法开启log记录
log::start();
log::info!("Hello Summer Boot");
// debug 模式下日志记录
log::debug!("debug apps");
log::error!("process error");
log::warn!("warnin... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/example/src/read_yml.rs | example/src/read_yml.rs | use schemars::schema::RootSchema;
use serde::{Deserialize, Serialize};
use serde_json::{from_str as json_from_str, to_string_pretty};
use serde_yaml::from_str as yaml_from_str;
use std::fs::read_to_string;
#[derive(Serialize, Deserialize, Debug)]
pub struct GlobalConfig {
pub mysql: Mysql,
}
#[derive(Debug, Seri... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
eairp/summer-boot | https://github.com/eairp/summer-boot/blob/3bacf5b9996a015c527fe5b7941d6f5d7a1e6335/example/src/main.rs | example/src/main.rs | use serde::Deserialize;
use summer_boot::{Request, Result};
mod http_method;
#[derive(Debug, Deserialize)]
struct User {
name: String,
age: u16,
}
#[summer_boot::auto_scan]
#[summer_boot::main]
async fn main() {
summer_boot::run();
}
#[summer_boot::post("/test/api")]
async fn test_api(mut req: Request<(... | rust | Apache-2.0 | 3bacf5b9996a015c527fe5b7941d6f5d7a1e6335 | 2026-01-04T20:24:35.228453Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/experiments/src/lib.rs | rust/experiments/src/lib.rs | use ::neural_network as nn;
extern crate num_cpus;
extern crate rayon;
use algebra::{fields::near_mersenne_64::F, FixedPoint, FixedPointParameters, Polynomial};
use bench_utils::*;
use io_utils::{counting::CountingIO, imux::IMuxSync};
use nn::{
layers::{
average_pooling::AvgPoolParams,
convolution::... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/experiments/src/linear_only.rs | rust/experiments/src/linear_only.rs | use ::neural_network as nn;
use nn::{
layers::{convolution::Padding, Layer},
NeuralNetwork,
};
use rand::{CryptoRng, RngCore};
type InputDims = (usize, usize, usize, usize);
use super::*;
pub fn construct_networks<R: RngCore + CryptoRng>(
vs: Option<&tch::nn::Path>,
batch_size: usize,
rng: &mut R... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/experiments/src/mnist.rs | rust/experiments/src/mnist.rs | use ::neural_network as nn;
use nn::{
layers::{convolution::Padding, Layer},
NeuralNetwork,
};
use rand::{CryptoRng, RngCore};
use super::*;
pub fn construct_mnist<R: RngCore + CryptoRng>(
vs: Option<&tch::nn::Path>,
batch_size: usize,
num_poly: usize,
rng: &mut R,
) -> NeuralNetwork<TenBitAS,... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/experiments/src/minionn.rs | rust/experiments/src/minionn.rs | use ::neural_network as nn;
use nn::{
layers::{convolution::Padding, Layer},
NeuralNetwork,
};
use rand::{CryptoRng, RngCore};
use super::*;
pub fn construct_minionn<R: RngCore + CryptoRng>(
vs: Option<&tch::nn::Path>,
batch_size: usize,
num_poly: usize,
rng: &mut R,
) -> NeuralNetwork<TenBitA... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/experiments/src/resnet32.rs | rust/experiments/src/resnet32.rs | use ::neural_network as nn;
use nn::{
layers::{convolution::Padding, Layer},
NeuralNetwork,
};
use rand::{CryptoRng, RngCore};
use super::*;
// It may be the case that down-sampling happens here.
fn conv_block<R: RngCore + CryptoRng>(
nn: &mut NeuralNetwork<TenBitAS, TenBitExpFP>,
vs: Option<&tch::nn:... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/experiments/src/validation/mod.rs | rust/experiments/src/validation/mod.rs | pub mod validate;
| rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/experiments/src/validation/validate.rs | rust/experiments/src/validation/validate.rs | use crate::*;
use neural_network::{ndarray::Array4, tensors::Input, NeuralArchitecture};
use rand::SeedableRng;
use rand_chacha::ChaChaRng;
use std::{
cmp,
sync::atomic::{AtomicUsize, Ordering},
};
const RANDOMNESS: [u8; 32] = [
0x11, 0xe0, 0x8f, 0xbc, 0x89, 0xa7, 0x34, 0x01, 0x45, 0x86, 0x82, 0xb6, 0x51, ... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/experiments/src/validation/minionn/validate.rs | rust/experiments/src/validation/minionn/validate.rs | use clap::{App, Arg, ArgMatches};
use experiments::minionn::construct_minionn;
use neural_network::{ndarray::Array4, npy::NpyData};
use rand::SeedableRng;
use rand_chacha::ChaChaRng;
use std::{io::Read, path::Path};
const RANDOMNESS: [u8; 32] = [
0x11, 0xe0, 0x8f, 0xbc, 0x89, 0xa7, 0x34, 0x01, 0x45, 0x86, 0x82, 0x... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/experiments/src/throughput/client.rs | rust/experiments/src/throughput/client.rs | use crate::*;
use ::neural_network::{tensors::Input, NeuralArchitecture};
use protocols::neural_network::NNProtocol;
use rand::thread_rng;
use std::{io::BufReader, net::TcpStream};
pub fn nn_client<R: RngCore + CryptoRng>(
num_clients: usize,
server_addr: &str,
architectures: &[(
(usize, usize, usi... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/experiments/src/throughput/mod.rs | rust/experiments/src/throughput/mod.rs | pub mod client;
pub mod server;
| rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/experiments/src/throughput/server.rs | rust/experiments/src/throughput/server.rs | use crate::*;
use protocols::neural_network::NNProtocol;
use rand::{CryptoRng, RngCore};
use std::{io::BufReader, net::TcpListener};
pub fn nn_server<R: RngCore + CryptoRng>(
server_addr: &str,
nns: &[(
(usize, usize, usize, usize),
NeuralNetwork<TenBitAS, TenBitExpFP>,
)],
rng: &mut R,... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/experiments/src/throughput/linear_only/client.rs | rust/experiments/src/throughput/linear_only/client.rs | use clap::{App, Arg, ArgMatches};
use experiments::linear_only::construct_networks;
use rand::SeedableRng;
use rand_chacha::ChaChaRng;
const RANDOMNESS: [u8; 32] = [
0x11, 0xe0, 0x8f, 0xbc, 0x89, 0xa7, 0x34, 0x01, 0x45, 0x86, 0x82, 0xb6, 0x51, 0xda, 0xf4, 0x76,
0x5d, 0xc9, 0x8d, 0xea, 0x23, 0xf2, 0x90, 0x8f, 0... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/experiments/src/throughput/linear_only/server.rs | rust/experiments/src/throughput/linear_only/server.rs | use clap::{App, Arg, ArgMatches};
use experiments::linear_only::construct_networks;
use rand::SeedableRng;
use rand_chacha::ChaChaRng;
const RANDOMNESS: [u8; 32] = [
0x11, 0xe0, 0x8f, 0xbc, 0x89, 0xa7, 0x34, 0x01, 0x45, 0x86, 0x82, 0xb6, 0x51, 0xda, 0xf4, 0x76,
0x5d, 0xc9, 0x8d, 0xea, 0x23, 0xf2, 0x90, 0x8f, 0... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/experiments/src/latency/client.rs | rust/experiments/src/latency/client.rs | use crate::*;
use algebra::{fields::PrimeField, FpParameters};
use crypto_primitives::gc::{fancy_garbling, fancy_garbling::Wire};
use io_utils::{counting::CountingIO, imux::IMuxSync};
use neural_network::{
layers::{LayerInfo, LinearLayerInfo, NonLinearLayerInfo},
NeuralArchitecture,
};
use num_traits::identitie... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/experiments/src/latency/mod.rs | rust/experiments/src/latency/mod.rs | pub mod client;
pub mod server;
| rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/experiments/src/latency/server.rs | rust/experiments/src/latency/server.rs | use crate::*;
use algebra::{fields::PrimeField, FpParameters, UniformRandom};
use crypto_primitives::gc::fancy_garbling;
use io_utils::{counting::CountingIO, imux::IMuxSync};
use neural_network::{
layers::{Layer, NonLinearLayer},
NeuralNetwork,
};
use ocelot::ot::{AlszSender as OTSender, Sender};
use protocols:... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/experiments/src/latency/minionn/client.rs | rust/experiments/src/latency/minionn/client.rs | use clap::{App, Arg, ArgMatches};
use experiments::minionn::construct_minionn;
use rand::SeedableRng;
use rand_chacha::ChaChaRng;
const RANDOMNESS: [u8; 32] = [
0x11, 0xe0, 0x8f, 0xbc, 0x89, 0xa7, 0x34, 0x01, 0x45, 0x86, 0x82, 0xb6, 0x51, 0xda, 0xf4, 0x76,
0x5d, 0xc9, 0x8d, 0xea, 0x23, 0xf2, 0x90, 0x8f, 0x9d, ... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/experiments/src/latency/minionn/server.rs | rust/experiments/src/latency/minionn/server.rs | use clap::{App, Arg, ArgMatches};
use experiments::minionn::construct_minionn;
use rand::SeedableRng;
use rand_chacha::ChaChaRng;
const RANDOMNESS: [u8; 32] = [
0x11, 0xe0, 0x8f, 0xbc, 0x89, 0xa7, 0x34, 0x01, 0x45, 0x86, 0x82, 0xb6, 0x51, 0xda, 0xf4, 0x76,
0x5d, 0xc9, 0x8d, 0xea, 0x23, 0xf2, 0x90, 0x8f, 0x9d, ... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/experiments/src/latency/cg/client.rs | rust/experiments/src/latency/cg/client.rs | use clap::{App, Arg, ArgMatches};
use experiments::{minionn::construct_minionn, mnist::construct_mnist};
use rand::SeedableRng;
use rand_chacha::ChaChaRng;
const RANDOMNESS: [u8; 32] = [
0x11, 0xe0, 0x8f, 0xbc, 0x89, 0xa7, 0x34, 0x01, 0x45, 0x86, 0x82, 0xb6, 0x51, 0xda, 0xf4, 0x76,
0x5d, 0xc9, 0x8d, 0xea, 0x23... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/experiments/src/latency/cg/server.rs | rust/experiments/src/latency/cg/server.rs | use clap::{App, Arg, ArgMatches};
use experiments::{minionn::construct_minionn, mnist::construct_mnist};
use rand::SeedableRng;
use rand_chacha::ChaChaRng;
const RANDOMNESS: [u8; 32] = [
0x11, 0xe0, 0x8f, 0xbc, 0x89, 0xa7, 0x34, 0x01, 0x45, 0x86, 0x82, 0xb6, 0x51, 0xda, 0xf4, 0x76,
0x5d, 0xc9, 0x8d, 0xea, 0x23... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/experiments/src/latency/resnet32/client.rs | rust/experiments/src/latency/resnet32/client.rs | use clap::{App, Arg, ArgMatches};
use experiments::resnet32::construct_resnet_32;
use rand::SeedableRng;
use rand_chacha::ChaChaRng;
const RANDOMNESS: [u8; 32] = [
0x11, 0xe0, 0x8f, 0xbc, 0x89, 0xa7, 0x34, 0x01, 0x45, 0x86, 0x82, 0xb6, 0x51, 0xda, 0xf4, 0x76,
0x5d, 0xc9, 0x8d, 0xea, 0x23, 0xf2, 0x90, 0x8f, 0x9... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/experiments/src/latency/resnet32/server.rs | rust/experiments/src/latency/resnet32/server.rs | use clap::{App, Arg, ArgMatches};
use experiments::resnet32::construct_resnet_32;
use rand::SeedableRng;
use rand_chacha::ChaChaRng;
const RANDOMNESS: [u8; 32] = [
0x11, 0xe0, 0x8f, 0xbc, 0x89, 0xa7, 0x34, 0x01, 0x45, 0x86, 0x82, 0xb6, 0x51, 0xda, 0xf4, 0x76,
0x5d, 0xc9, 0x8d, 0xea, 0x23, 0xf2, 0x90, 0x8f, 0x9... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/experiments/src/latency/mnist/client.rs | rust/experiments/src/latency/mnist/client.rs | use clap::{App, Arg, ArgMatches};
use experiments::mnist::construct_mnist;
use rand::SeedableRng;
use rand_chacha::ChaChaRng;
const RANDOMNESS: [u8; 32] = [
0x11, 0xe0, 0x8f, 0xbc, 0x89, 0xa7, 0x34, 0x01, 0x45, 0x86, 0x82, 0xb6, 0x51, 0xda, 0xf4, 0x76,
0x5d, 0xc9, 0x8d, 0xea, 0x23, 0xf2, 0x90, 0x8f, 0x9d, 0x03... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/experiments/src/latency/mnist/server.rs | rust/experiments/src/latency/mnist/server.rs | use clap::{App, Arg, ArgMatches};
use experiments::mnist::construct_mnist;
use rand::SeedableRng;
use rand_chacha::ChaChaRng;
const RANDOMNESS: [u8; 32] = [
0x11, 0xe0, 0x8f, 0xbc, 0x89, 0xa7, 0x34, 0x01, 0x45, 0x86, 0x82, 0xb6, 0x51, 0xda, 0xf4, 0x76,
0x5d, 0xc9, 0x8d, 0xea, 0x23, 0xf2, 0x90, 0x8f, 0x9d, 0x03... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/experiments/src/latency/gc/client.rs | rust/experiments/src/latency/gc/client.rs | use clap::{App, Arg, ArgMatches};
use rand::SeedableRng;
use rand_chacha::ChaChaRng;
const RANDOMNESS: [u8; 32] = [
0x11, 0xe0, 0x8f, 0xbc, 0x89, 0xa7, 0x34, 0x01, 0x45, 0x86, 0x82, 0xb6, 0x51, 0xda, 0xf4, 0x76,
0x5d, 0xc9, 0x8d, 0xea, 0x23, 0xf2, 0x90, 0x8f, 0x9d, 0x03, 0xf2, 0x77, 0xd3, 0x4a, 0x52, 0xd2,
];
... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/experiments/src/latency/gc/server.rs | rust/experiments/src/latency/gc/server.rs | use clap::{App, Arg, ArgMatches};
use rand::SeedableRng;
use rand_chacha::ChaChaRng;
const RANDOMNESS: [u8; 32] = [
0x11, 0xe0, 0x8f, 0xbc, 0x89, 0xa7, 0x34, 0x01, 0x45, 0x86, 0x82, 0xb6, 0x51, 0xda, 0xf4, 0x76,
0x5d, 0xc9, 0x8d, 0xea, 0x23, 0xf2, 0x90, 0x8f, 0x9d, 0x03, 0xf2, 0x77, 0xd3, 0x4a, 0x52, 0xd2,
];
... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/experiments/src/inference/mod.rs | rust/experiments/src/inference/mod.rs | pub mod inference;
| rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/experiments/src/inference/inference.rs | rust/experiments/src/inference/inference.rs | use crate::*;
use neural_network::{ndarray::Array4, tensors::Input, NeuralArchitecture};
use rand::SeedableRng;
use rand_chacha::ChaChaRng;
use std::cmp;
const RANDOMNESS: [u8; 32] = [
0x11, 0xe0, 0x8f, 0xbc, 0x89, 0xa7, 0x34, 0x01, 0x45, 0x86, 0x82, 0xb6, 0x51, 0xda, 0xf4, 0x76,
0x5d, 0xc9, 0x8d, 0xea, 0x23, ... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/experiments/src/inference/minionn/inference.rs | rust/experiments/src/inference/minionn/inference.rs | use clap::{App, Arg, ArgMatches};
use experiments::minionn::construct_minionn;
use neural_network::{ndarray::Array4, npy::NpyData};
use rand::SeedableRng;
use rand_chacha::ChaChaRng;
use std::{io::Read, path::Path};
const RANDOMNESS: [u8; 32] = [
0x11, 0xe0, 0x8f, 0xbc, 0x89, 0xa7, 0x34, 0x01, 0x45, 0x86, 0x82, 0x... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/crypto-primitives/src/beavers_mul.rs | rust/crypto-primitives/src/beavers_mul.rs | use rand_chacha::ChaChaRng;
use rand_core::SeedableRng;
use std::{marker::PhantomData, ops::Neg};
use crate::additive_share::{AdditiveShare, Share};
use algebra::{
fixed_point::{FixedPoint, FixedPointParameters},
PrimeField, UniformRandom,
};
use serde::{Deserialize, Serialize};
/// Shares of a triple `[[a]]`... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/crypto-primitives/src/lib.rs | rust/crypto-primitives/src/lib.rs | //! Some core cryptographic primitives used by Delphi.
#![deny(unused_import_braces, unused_qualifications, trivial_casts)]
#![deny(trivial_numeric_casts, private_in_public, variant_size_differences)]
#![deny(stable_features, unreachable_pub, non_shorthand_field_patterns)]
#![deny(unused_attributes, unused_imports, unu... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/crypto-primitives/src/gc.rs | rust/crypto-primitives/src/gc.rs | #![allow(non_snake_case)]
use algebra::{BitIterator, FixedPointParameters, Fp64Parameters, FpParameters, PrimeField};
pub use fancy_garbling;
use fancy_garbling::{
circuit::CircuitBuilder, error::CircuitBuilderError, util, BinaryBundle, BinaryGadgets,
BundleGadgets, Fancy,
};
#[inline(always)]
fn mux_single_... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/crypto-primitives/src/additive_share.rs | rust/crypto-primitives/src/additive_share.rs | use rand_core::{CryptoRng, RngCore};
use std::ops::{Add, AddAssign, Mul, MulAssign, Neg, Sub, SubAssign};
use algebra::{
fixed_point::{FixedPoint, FixedPointParameters},
UniformRandom,
};
use num_traits::Zero;
use serde::{Deserialize, Serialize};
/// Represents a type that can be additively shared.
pub trait ... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/crypto-primitives/benches/beavers_mul.rs | rust/crypto-primitives/benches/beavers_mul.rs | use criterion::{criterion_group, criterion_main, Criterion};
// use itertools::Itertools;
use std::time::Duration;
use algebra::{fields::near_mersenne_64::F, fixed_point::*};
use crypto_primitives::{additive_share::Share, beavers_mul::*};
use rand::{Rng, SeedableRng};
use rand_chacha::ChaChaRng;
fn generate_random_n... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/crypto-primitives/benches/garbling.rs | rust/crypto-primitives/benches/garbling.rs | use criterion::{criterion_group, criterion_main, Bencher, Criterion};
use std::time::Duration;
use fancy_garbling::{
circuit::{Circuit, CircuitBuilder},
util::RngExt,
};
use algebra::{fields::near_mersenne_64::F, *};
struct TenBitExpParams {}
impl FixedPointParameters for TenBitExpParams {
type Field = ... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/protocols-sys/build.rs | rust/protocols-sys/build.rs | use cmake::Config;
use std::{env, path::PathBuf};
fn main() {
let project_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
let cplus_header = project_dir.join("c++/src/lib/interface.h");
// Build Delphi
let delphi_install_prefix = Config::new("c++").define("UNITTESTS", "0").build();
... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/protocols-sys/src/server_cg.rs | rust/protocols-sys/src/server_cg.rs | use crate::*;
use neural_network::{
layers::{convolution::Padding, LinearLayer},
tensors::{Kernel, Output},
};
use std::os::raw::c_char;
pub struct Conv2D<'a> {
data: Metadata,
sfhe: &'a ServerFHE,
masks: *mut *mut *mut *mut c_char,
shares: Option<ServerShares>,
}
pub struct FullyConnected<'a>... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/protocols-sys/src/server_gen.rs | rust/protocols-sys/src/server_gen.rs | use crate::*;
use std::os::raw::c_char;
pub trait ServerGen {
type Keys;
/// The type of messages passed between client and server
type MsgType;
/// Create new ServerGen object
fn new(keys: Self::Keys) -> Self;
/// Preprocess `a`, `b`, and `c` randomizers
fn triples_preprocess(&self, a: &... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/protocols-sys/src/lib.rs | rust/protocols-sys/src/lib.rs | #![allow(
non_snake_case,
non_camel_case_types,
non_upper_case_globals,
dead_code
)]
#[macro_use]
pub extern crate ndarray;
pub mod client_cg;
pub mod client_gen;
pub mod key_share;
pub mod server_cg;
pub mod server_gen;
pub use client_cg::*;
pub use client_gen::*;
pub use key_share::KeyShare;
pub us... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
mc2-project/delphi | https://github.com/mc2-project/delphi/blob/92bc0071fa11570df6b048ae0f6937ced249bb5a/rust/protocols-sys/src/key_share.rs | rust/protocols-sys/src/key_share.rs | use crate::*;
use std::slice::from_raw_parts;
pub struct KeyShare(SerialCT);
impl KeyShare {
pub fn new() -> Self {
Self(SerialCT {
inner: ::std::ptr::null_mut(),
size: 0,
})
}
pub fn generate(&mut self) -> (ClientFHE, Vec<std::os::raw::c_char>) {
let cfhe ... | rust | Apache-2.0 | 92bc0071fa11570df6b048ae0f6937ced249bb5a | 2026-01-04T20:24:11.030795Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.