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
Zeenobit/moonshine_save
https://github.com/Zeenobit/moonshine_save/blob/ca1fdf24a52164d56a38d74598ce975e0bf1ff42/src/load.rs
src/load.rs
use std::io::{self, Read}; use std::marker::PhantomData; use std::path::PathBuf; use bevy_scene::DynamicScene; use moonshine_util::expect::{expect_deferred, ExpectDeferred}; use moonshine_util::Static; use serde::de::DeserializeSeed; use bevy_ecs::entity::EntityHashMap; use bevy_ecs::prelude::*; use bevy_ecs::query::...
rust
MIT
ca1fdf24a52164d56a38d74598ce975e0bf1ff42
2026-01-04T20:25:00.832058Z
false
Zeenobit/moonshine_save
https://github.com/Zeenobit/moonshine_save/blob/ca1fdf24a52164d56a38d74598ce975e0bf1ff42/tests/mapper.rs
tests/mapper.rs
use std::fs; use bevy::prelude::*; use bevy_ecs::system::RunSystemOnce; use moonshine_save::prelude::*; use moonshine_util::prelude::*; const SAVE_PATH: &str = "test_mapper.ron"; #[derive(Bundle)] struct FooBundle { foo: Foo, bar: Bar, save: Save, } impl FooBundle { fn new(secret: u32) -> Self { ...
rust
MIT
ca1fdf24a52164d56a38d74598ce975e0bf1ff42
2026-01-04T20:25:00.832058Z
false
Zeenobit/moonshine_save
https://github.com/Zeenobit/moonshine_save/blob/ca1fdf24a52164d56a38d74598ce975e0bf1ff42/tests/unsaved.rs
tests/unsaved.rs
use std::fs; use bevy::prelude::*; use bevy_ecs::system::RunSystemOnce; use moonshine_save::prelude::*; const SAVE_PATH: &str = "test_unsaved.ron"; fn app() -> App { let mut app = App::new(); app.add_plugins(MinimalPlugins); app } #[test] fn main() { { let mut app = app(); app.add_ob...
rust
MIT
ca1fdf24a52164d56a38d74598ce975e0bf1ff42
2026-01-04T20:25:00.832058Z
false
Zeenobit/moonshine_save
https://github.com/Zeenobit/moonshine_save/blob/ca1fdf24a52164d56a38d74598ce975e0bf1ff42/tests/resource.rs
tests/resource.rs
use std::fs; use bevy::prelude::*; use bevy_ecs::system::RunSystemOnce; use moonshine_save::prelude::*; const SAVE_PATH: &str = "test_resource.ron"; #[derive(Resource, Default, Reflect)] #[reflect(Resource)] struct Foo; fn app() -> App { let mut app = App::new(); app.register_type::<Foo>().add_plugins(Minim...
rust
MIT
ca1fdf24a52164d56a38d74598ce975e0bf1ff42
2026-01-04T20:25:00.832058Z
false
Zeenobit/moonshine_save
https://github.com/Zeenobit/moonshine_save/blob/ca1fdf24a52164d56a38d74598ce975e0bf1ff42/tests/hierarchy.rs
tests/hierarchy.rs
use std::fs; use bevy::prelude::*; use bevy_ecs::system::RunSystemOnce; use moonshine_save::prelude::*; const SAVE_PATH: &str = "test_hierarchy.ron"; fn app() -> App { let mut app = App::new(); app.add_plugins(MinimalPlugins); app } fn main() { { let mut app = app(); app.add_observer...
rust
MIT
ca1fdf24a52164d56a38d74598ce975e0bf1ff42
2026-01-04T20:25:00.832058Z
false
Zeenobit/moonshine_save
https://github.com/Zeenobit/moonshine_save/blob/ca1fdf24a52164d56a38d74598ce975e0bf1ff42/tests/basic.rs
tests/basic.rs
use std::fs; use bevy::prelude::*; use bevy_ecs::system::RunSystemOnce; use moonshine_save::prelude::*; const SAVE_PATH: &str = "test_basic.ron"; #[derive(Bundle)] struct FooBundle { foo: Foo, bar: FooBar, save: Save, } #[derive(Bundle, Default)] struct BarBundle { bar: Bar, save: Save, } #[der...
rust
MIT
ca1fdf24a52164d56a38d74598ce975e0bf1ff42
2026-01-04T20:25:00.832058Z
false
Zeenobit/moonshine_save
https://github.com/Zeenobit/moonshine_save/blob/ca1fdf24a52164d56a38d74598ce975e0bf1ff42/examples/army.rs
examples/army.rs
use bevy::prelude::*; use bevy_ecs::entity::{EntityMapper, MapEntities}; use moonshine_save::prelude::*; const SAVE_PATH: &str = "army.ron"; const HELP_TEXT: &str = "Use the buttons to spawn a new soldier with either a melee or a ranged weapon. The text displays the army composition by grouping soldiers based on ...
rust
MIT
ca1fdf24a52164d56a38d74598ce975e0bf1ff42
2026-01-04T20:25:00.832058Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/myceliumd/src/main.rs
myceliumd/src/main.rs
use std::io::{self, Read}; use std::net::Ipv4Addr; use std::path::Path; use std::sync::Arc; use std::{ error::Error, net::{IpAddr, SocketAddr}, path::PathBuf, }; use std::{fmt::Display, str::FromStr}; use clap::{Args, Parser, Subcommand}; use mycelium::message::TopicConfig; use serde::{Deserialize, Deseria...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
true
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium-cli/src/lib.rs
mycelium-cli/src/lib.rs
mod inspect; #[cfg(feature = "message")] mod message; mod peer; mod proxy; mod routes; pub use inspect::inspect; #[cfg(feature = "message")] pub use message::{recv_msg, send_msg}; pub use peer::{add_peers, list_peers, remove_peers}; pub use proxy::{ connect_proxy, disconnect_proxy, list_proxies, start_proxy_probe,...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium-cli/src/message.rs
mycelium-cli/src/message.rs
use std::{ io::Write, mem, net::{IpAddr, SocketAddr}, path::PathBuf, }; use base64::{ alphabet, engine::{GeneralPurpose, GeneralPurposeConfig}, Engine, }; use mycelium::{crypto::PublicKey, message::MessageId, subnet::Subnet}; use serde::{Serialize, Serializer}; use tracing::{debug, error}; ...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium-cli/src/peer.rs
mycelium-cli/src/peer.rs
use mycelium::peer_manager::PeerStats; use mycelium_api::AddPeer; use prettytable::{row, Table}; use std::net::SocketAddr; use tracing::{debug, error}; /// List the peers the current node is connected to pub async fn list_peers( server_addr: SocketAddr, json_print: bool, ) -> Result<(), Box<dyn std::error::Err...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium-cli/src/routes.rs
mycelium-cli/src/routes.rs
use mycelium_api::{NoRouteSubnet, QueriedSubnet, Route}; use prettytable::{row, Table}; use std::net::SocketAddr; use tracing::{debug, error}; pub async fn list_selected_routes( server_addr: SocketAddr, json_print: bool, ) -> Result<(), Box<dyn std::error::Error>> { let request_url = format!("http://{serv...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium-cli/src/proxy.rs
mycelium-cli/src/proxy.rs
use prettytable::{row, Table}; use std::net::{Ipv6Addr, SocketAddr}; use tracing::{debug, error}; #[derive(serde::Serialize)] struct ConnectProxyRequest { remote: Option<String>, } /// List known valid proxy IPv6 addresses discovered by the node. pub async fn list_proxies( server_addr: SocketAddr, json_pr...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium-cli/src/inspect.rs
mycelium-cli/src/inspect.rs
use std::net::IpAddr; use mycelium::crypto::PublicKey; use serde::Serialize; #[derive(Debug, Serialize)] struct InspectOutput { #[serde(rename = "publicKey")] public_key: PublicKey, address: IpAddr, } /// Inspect the given pubkey, or the local key if no pubkey is given pub fn inspect(pubkey: PublicKey, j...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mobile/src/lib.rs
mobile/src/lib.rs
use std::convert::TryFrom; use std::io; use std::net::{IpAddr, SocketAddr}; use tracing::{error, info}; use metrics::Metrics; use mycelium::endpoint::Endpoint; use mycelium::{crypto, metrics, Config, Node}; use once_cell::sync::Lazy; use tokio::sync::{mpsc, Mutex}; use tokio::time::{sleep, timeout, Duration}; const ...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium-metrics/src/lib.rs
mycelium-metrics/src/lib.rs
//! This crate provides implementations of [`the Metrics trait`](mycelium::metrics::Metrics). //! 2 options are exposed currently: a NOOP implementation which doesn't record anything, //! and a prometheus exporter which exposes all metrics in a promtheus compatible format. mod noop; pub use noop::NoMetrics; #[cfg(fea...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium-metrics/src/noop.rs
mycelium-metrics/src/noop.rs
use mycelium::metrics::Metrics; #[derive(Clone)] pub struct NoMetrics; impl Metrics for NoMetrics {}
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium-metrics/src/prometheus.rs
mycelium-metrics/src/prometheus.rs
use axum::{routing::get, Router}; use mycelium::metrics::Metrics; use prometheus::{ opts, register_int_counter, register_int_counter_vec, register_int_gauge, Encoder, IntCounter, IntCounterVec, IntGauge, TextEncoder, }; use tracing::{error, info}; use std::net::SocketAddr; /// A [`Metrics`] implementation whi...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium-ui/src/api.rs
mycelium-ui/src/api.rs
use mycelium::endpoint::Endpoint; use mycelium_api::AddPeer; use std::net::SocketAddr; use urlencoding::encode; pub async fn get_peers( server_addr: SocketAddr, ) -> Result<Vec<mycelium::peer_manager::PeerStats>, reqwest::Error> { let request_url = format!("http://{server_addr}/api/v1/admin/peers"); match ...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium-ui/src/main.rs
mycelium-ui/src/main.rs
#![allow(non_snake_case)] // Disable terminal popup on Windows #![cfg_attr(feature = "bundle", windows_subsystem = "windows")] mod api; mod components; use components::home::Home; use components::peers::Peers; use components::routes::Routes; use dioxus::prelude::*; use mycelium::{endpoint::Endpoint, peer_manager::Pe...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium-ui/src/components.rs
mycelium-ui/src/components.rs
pub mod home; pub mod layout; pub mod peers; pub mod routes;
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium-ui/src/components/home.rs
mycelium-ui/src/components/home.rs
use crate::api; use crate::{ServerAddress, ServerConnected}; use dioxus::prelude::*; use std::net::SocketAddr; use std::str::FromStr; #[component] pub fn Home() -> Element { let mut server_addr = use_context::<Signal<ServerAddress>>(); let mut new_address = use_signal(|| server_addr.read().0.to_string()); ...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium-ui/src/components/layout.rs
mycelium-ui/src/components/layout.rs
use crate::{api, Route, ServerAddress}; use dioxus::prelude::*; use dioxus_free_icons::{icons::fa_solid_icons::FaChevronLeft, Icon}; #[component] pub fn Layout() -> Element { let sidebar_collapsed = use_signal(|| false); rsx! { div { class: "app-container", Header {} div { clas...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium-ui/src/components/peers.rs
mycelium-ui/src/components/peers.rs
use crate::get_sort_indicator; use crate::{api, SearchState, ServerAddress, SortDirection, StopFetchingPeerSignal}; use dioxus::prelude::*; use dioxus_charts::LineChart; use human_bytes::human_bytes; use mycelium::{ endpoint::Endpoint, peer_manager::{PeerStats, PeerType}, }; use std::{ cmp::Ordering, co...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium-ui/src/components/routes.rs
mycelium-ui/src/components/routes.rs
use std::cmp::Ordering; use crate::api; use crate::{get_sort_indicator, SearchState, ServerAddress, SortDirection}; use dioxus::prelude::*; #[component] pub fn Routes() -> Element { rsx! { SelectedRoutesTable {} FallbackRoutesTable {} } } #[component] pub fn SelectedRoutesTable() -> Element {...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/routing_table.rs
mycelium/src/routing_table.rs
use std::{ net::{IpAddr, Ipv6Addr}, ops::Deref, sync::{Arc, Mutex, MutexGuard}, }; use ip_network_table_deps_treebitmap::IpLookupTable; use iter::{RoutingTableNoRouteIter, RoutingTableQueryIter}; use subnet_entry::SubnetEntry; use tokio::{select, sync::mpsc, time::Duration}; use tokio_util::sync::Cancellat...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/subnet.rs
mycelium/src/subnet.rs
//! A dedicated subnet module. //! //! The standard library only exposes [`IpAddr`], and types related to //! specific IPv4 and IPv6 addresses. It does not however, expose dedicated types to represent //! appropriate subnets. //! //! This code is not meant to fully support subnets, but rather only the subset as needed ...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/packet.rs
mycelium/src/packet.rs
use bytes::{Buf, BufMut, BytesMut}; pub use control::ControlPacket; pub use data::DataPacket; use tokio_util::codec::{Decoder, Encoder}; mod control; mod data; /// Current version of the protocol being used. const PROTOCOL_VERSION: u8 = 1; /// The size of a `Packet` header on the wire, in bytes. const PACKET_HEADER_...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/router.rs
mycelium/src/router.rs
use crate::{ babel::{self, Hello, Ihu, RouteRequest, SeqNoRequest, Update}, crypto::{PacketBuffer, PublicKey, SecretKey, SharedSecret}, filters::RouteUpdateFilter, metric::Metric, metrics::Metrics, packet::{ControlPacket, DataPacket}, peer::Peer, router_id::RouterId, routing_table::{...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
true
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/lib.rs
mycelium/src/lib.rs
use std::future::Future; use std::net::{IpAddr, Ipv6Addr, SocketAddr}; use std::path::PathBuf; #[cfg(feature = "message")] use std::time::Duration; use crate::cdn::Cdn; use crate::proxy::{ConnectionError, Proxy}; use crate::tun::TunConfig; use bytes::BytesMut; use data::DataPlane; use endpoint::Endpoint; #[cfg(feature...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/sequence_number.rs
mycelium/src/sequence_number.rs
//! Dedicated logic for //! [sequence numbers](https://datatracker.ietf.org/doc/html/rfc8966#name-solving-starvation-sequenci). use core::fmt; use core::ops::{Add, AddAssign}; /// This value is compared against when deciding if a `SeqNo` is larger or smaller, [as defined in /// the babel rfc](https://datatracker.ietf...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/filters.rs
mycelium/src/filters.rs
use crate::{babel, subnet::Subnet}; /// This trait is used to filter incoming updates from peers. Only updates which pass all /// configured filters on the local [`Router`](crate::router::Router) will actually be forwarded /// to the [`Router`](crate::router::Router) for processing. pub trait RouteUpdateFilter { /...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/dns.rs
mycelium/src/dns.rs
//! Built in dns resolver which intercepts dns lookups for defined TLD's and redirects them to a //! different upstream server. use hickory_server::authority::MessageResponseBuilder; use hickory_server::proto::op::Header; use hickory_server::proto::rr::{LowerName, Record}; use hickory_server::server::{Request, Request...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/connection.rs
mycelium/src/connection.rs
use std::{ future::Future, io, net::SocketAddr, pin::Pin, sync::{ atomic::{AtomicU64, Ordering}, Arc, }, }; use crate::packet::{self, ControlPacket, DataPacket, Packet}; use bytes::{Bytes, BytesMut}; use futures::{ stream::{SplitSink, SplitStream}, SinkExt, StreamExt, }...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/cdn.rs
mycelium/src/cdn.rs
use std::path::PathBuf; use aes_gcm::{aead::Aead, KeyInit}; use axum::{ extract::{Query, State}, http::{HeaderMap, StatusCode}, routing::get, Router, }; use axum_extra::extract::Host; use futures::{stream::FuturesUnordered, StreamExt}; use reqwest::header::CONTENT_TYPE; use tokio::net::TcpListener; use...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/rr_cache.rs
mycelium/src/rr_cache.rs
//! This module contains a cache implementation for route requests use std::{ net::{IpAddr, Ipv6Addr}, sync::Arc, }; use dashmap::DashMap; use tokio::time::{Duration, Instant}; use tracing::trace; use crate::{babel::RouteRequest, peer::Peer, subnet::Subnet, task::AbortHandle}; /// Clean the route request ca...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/babel.rs
mycelium/src/babel.rs
//! This module contains babel related structs. //! //! We don't fully implement the babel spec, and items which are implemented might deviate to fit //! our specific use case. For reference, the implementation is based on [this //! RFC](https://datatracker.ietf.org/doc/html/rfc8966). use std::io; use bytes::{Buf, Bu...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/router_id.rs
mycelium/src/router_id.rs
use core::fmt; use crate::crypto::PublicKey; /// A `RouterId` uniquely identifies a router in the network. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub struct RouterId { pk: PublicKey, zone: [u8; 2], rnd: [u8; 6], } impl RouterId { /// Size in bytes of a `RouterId` pub const BYTE_SIZE: ...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/source_table.rs
mycelium/src/source_table.rs
use core::fmt; use std::{collections::HashMap, time::Duration}; use tokio::{sync::mpsc, task::JoinHandle}; use tracing::error; use crate::{ babel, metric::Metric, router_id::RouterId, routing_table::RouteEntry, sequence_number::SeqNo, subnet::Subnet, }; /// Duration after which a source entry is deleted if i...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/task.rs
mycelium/src/task.rs
//! This module provides some task abstractions which add custom logic to the default behavior. /// A handle to a task, which is only used to abort the task. In case this handle is dropped, the /// task is cancelled automatically. pub struct AbortHandle(tokio::task::AbortHandle); impl AbortHandle { /// Abort the ...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/peer_manager.rs
mycelium/src/peer_manager.rs
#[cfg(feature = "private-network")] use crate::connection::tls::TlsStream; use crate::connection::{Quic, TcpStream}; use crate::endpoint::{Endpoint, Protocol}; use crate::metrics::Metrics; use crate::peer::{Peer, PeerRef}; use crate::router::Router; use crate::router_id::RouterId; use futures::stream::FuturesUnordered;...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
true
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/interval.rs
mycelium/src/interval.rs
//! Dedicated logic for //! [intervals](https://datatracker.ietf.org/doc/html/rfc8966#name-solving-starvation-sequenci). use std::time::Duration; /// An interval in the babel protocol. /// /// Intervals represent a duration, and are expressed in centiseconds (0.01 second / 10 /// milliseconds). `Interval` implements ...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/metrics.rs
mycelium/src/metrics.rs
//! This module is used for collection of runtime metrics of a `mycelium` system. The main item of //! interest is the [`Metrics`] trait. Users can provide their own implementation of this, or use //! the default provided implementation to disable gathering metrics. use crate::peer_manager::PeerType; /// The collect...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/tun.rs
mycelium/src/tun.rs
//! The tun module implements a platform independent Tun interface. #[cfg(any( target_os = "linux", all(target_os = "macos", not(feature = "mactunfd")), target_os = "windows" ))] use crate::subnet::Subnet; #[cfg(any( target_os = "linux", all(target_os = "macos", not(feature = "mactunfd")), tar...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/crypto.rs
mycelium/src/crypto.rs
//! Abstraction over diffie hellman, symmetric encryption, and hashing. use core::fmt; use std::{ error::Error, fmt::Display, net::Ipv6Addr, ops::{Deref, DerefMut}, }; use aes_gcm::{aead::OsRng, AeadCore, AeadInPlace, Aes256Gcm, Key, KeyInit}; use serde::{de::Visitor, Deserialize, Serialize}; /// Def...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/data.rs
mycelium/src/data.rs
use std::net::{IpAddr, Ipv6Addr}; use etherparse::{ icmpv6::{DestUnreachableCode, TimeExceededCode}, Icmpv6Type, PacketBuilder, }; use futures::{Sink, SinkExt, Stream, StreamExt}; use tokio::sync::mpsc::UnboundedReceiver; use tracing::{debug, error, trace, warn}; use crate::{crypto::PacketBuffer, metrics::Met...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/message.rs
mycelium/src/message.rs
//! Module for working with "messages". //! //! A message is an arbitrary bag of bytes sent by a node to a different node. A message is //! considered application defined data (L7), and we make no assumptions of any kind regarding the //! structure. We only care about sending the message to the remote in the most relia...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
true
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/metric.rs
mycelium/src/metric.rs
//! Dedicated logic for //! [metrics](https://datatracker.ietf.org/doc/html/rfc8966#metric-computation). use core::fmt; use std::ops::{Add, Sub}; /// Value of the infinite metric. const METRIC_INFINITE: u16 = 0xFFFF; /// A `Metric` is used to indicate the cost associated with a route. A lower Metric means a route //...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/peer.rs
mycelium/src/peer.rs
use std::{ error::Error, io, sync::{ atomic::{AtomicBool, Ordering}, Arc, RwLock, Weak, }, }; use tokio::{ select, sync::{mpsc, Notify}, }; use tracing::{debug, error, info, trace}; use crate::{ connection::{Connection, ConnectionReadHalf, ConnectionWriteHalf}, packet::P...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/proxy.rs
mycelium/src/proxy.rs
use std::{ collections::HashMap, net::{Ipv6Addr, SocketAddr}, sync::{Arc, Mutex, RwLock}, }; use crate::{metrics::Metrics, router::Router}; use futures::stream::FuturesUnordered; use tokio::{ io::{AsyncReadExt, AsyncWriteExt}, net::{TcpListener, TcpStream}, select, time::{self, timeout, Dur...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/seqno_cache.rs
mycelium/src/seqno_cache.rs
//! The seqno request cache keeps track of seqno requests sent by the node. This allows us to drop //! duplicate requests, and to notify the source of requests (if it wasn't the local node) about //! relevant updates. use std::{ sync::Arc, time::{Duration, Instant}, }; use dashmap::DashMap; use tokio::time::M...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/endpoint.rs
mycelium/src/endpoint.rs
use std::{ fmt, net::{AddrParseError, SocketAddr}, str::FromStr, }; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, PartialEq, Eq)] /// Error generated while processing improperly formatted endpoints. pub enum EndpointParseError { /// An address was specified without leading protocol infor...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/tun/ios.rs
mycelium/src/tun/ios.rs
//! ios specific tun interface setup. use std::io::{self, IoSlice}; use futures::{Sink, Stream}; use tokio::{ io::{AsyncReadExt, AsyncWriteExt}, select, sync::mpsc, }; use tracing::{error, info}; use crate::crypto::PacketBuffer; use crate::tun::TunConfig; // TODO const LINK_MTU: i32 = 1400; /// The 4 b...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/tun/linux.rs
mycelium/src/tun/linux.rs
//! Linux specific tun interface setup. use std::io; use futures::{Sink, Stream, TryStreamExt}; use rtnetlink::Handle; use tokio::{select, sync::mpsc}; use tokio_tun::{Tun, TunBuilder}; use tracing::{error, info}; use crate::crypto::PacketBuffer; use crate::subnet::Subnet; use crate::tun::TunConfig; // TODO const L...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/tun/android.rs
mycelium/src/tun/android.rs
//! android specific tun interface setup. use std::io::{self}; use futures::{Sink, Stream}; use tokio::{ io::{AsyncReadExt, AsyncWriteExt}, select, sync::mpsc, }; use tracing::{error, info}; use crate::crypto::PacketBuffer; use crate::tun::TunConfig; // TODO const LINK_MTU: i32 = 1400; /// Create a new...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/tun/windows.rs
mycelium/src/tun/windows.rs
use std::{io, ops::Deref, sync::Arc}; use futures::{Sink, Stream}; use tokio::sync::mpsc; use tracing::{error, info, warn}; use crate::tun::TunConfig; use crate::{crypto::PacketBuffer, subnet::Subnet}; // TODO const LINK_MTU: usize = 1400; /// Type of the tunnel used, specified when creating the tunnel. const WINDO...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/tun/darwin.rs
mycelium/src/tun/darwin.rs
//! macos specific tun interface setup. use std::{ ffi::CString, io::{self, IoSlice}, net::{IpAddr, Ipv6Addr}, os::fd::AsRawFd, str::FromStr, }; use futures::{Sink, Stream}; use nix::sys::socket::SockaddrIn6; use tokio::{ io::{AsyncReadExt, AsyncWriteExt}, select, sync::mpsc, }; use tr...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/routing_table/iter_mut.rs
mycelium/src/routing_table/iter_mut.rs
use tokio::sync::mpsc; use tokio_util::sync::CancellationToken; use tracing::trace; use crate::subnet::Subnet; use super::{ subnet_entry::SubnetEntry, RouteKey, RouteList, RoutingTableInner, RoutingTableOplogEntry, }; use std::{ net::Ipv6Addr, sync::{Arc, MutexGuard}, }; /// An iterator over a [`routing ...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/routing_table/route_list.rs
mycelium/src/routing_table/route_list.rs
use std::{ ops::{Deref, DerefMut, Index, IndexMut}, sync::Arc, }; use tokio::sync::mpsc; use tokio_util::sync::CancellationToken; use tracing::{debug, error}; use crate::{crypto::SharedSecret, peer::Peer, task::AbortHandle}; use super::{RouteEntry, RouteKey}; /// The RouteList holds all routes for a specifi...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/routing_table/queried_subnet.rs
mycelium/src/routing_table/queried_subnet.rs
use tokio::time::Instant; use crate::subnet::Subnet; /// Information about a [`subnet`](Subnet) which is currently in the queried state #[derive(Debug, Clone, Copy)] pub struct QueriedSubnet { /// The subnet which was queried. subnet: Subnet, /// Time at which the query expires. If no feasible updates com...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/routing_table/subnet_entry.rs
mycelium/src/routing_table/subnet_entry.rs
use arc_swap::ArcSwap; use super::RouteList; /// An entry for a [Subnet](crate::subnet::Subnet) in the routing table. #[allow(dead_code)] pub enum SubnetEntry { /// Routes for the given subnet exist Exists { list: ArcSwap<RouteList> }, /// Routes are being queried from peers for the given subnet, but we h...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/routing_table/no_route.rs
mycelium/src/routing_table/no_route.rs
use tokio::time::Instant; use crate::subnet::Subnet; /// Information about a [`subnet`](Subnet) which is currently marked as NoRoute. #[derive(Debug, Clone, Copy)] pub struct NoRouteSubnet { /// The subnet which has no route. subnet: Subnet, /// Time at which the entry expires. After this timeout expires,...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/routing_table/route_entry.rs
mycelium/src/routing_table/route_entry.rs
use tokio::time::Instant; use crate::{ metric::Metric, peer::Peer, router_id::RouterId, sequence_number::SeqNo, source_table::SourceKey, }; /// RouteEntry holds all relevant information about a specific route. Since this includes the next /// hop, a single subnet can have multiple route entries. #[derive(Clon...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/routing_table/iter.rs
mycelium/src/routing_table/iter.rs
use std::{net::Ipv6Addr, sync::Arc}; use crate::subnet::Subnet; use super::{subnet_entry::SubnetEntry, NoRouteSubnet, QueriedSubnet, RouteListReadGuard}; /// An iterator over a [`routing table`](super::RoutingTable) giving read only access to /// [`RouteList`]'s. pub struct RoutingTableIter<'a>( ip_network_table...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/routing_table/route_key.rs
mycelium/src/routing_table/route_key.rs
use crate::{peer::Peer, subnet::Subnet}; /// RouteKey uniquely defines a route via a peer. #[derive(Debug, Clone, PartialEq)] pub struct RouteKey { subnet: Subnet, neighbour: Peer, } impl RouteKey { /// Creates a new `RouteKey` for the given [`Subnet`] and [`neighbour`](Peer). #[inline] pub fn new...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/connection/tls.rs
mycelium/src/connection/tls.rs
use std::{ io, net::SocketAddr, sync::{atomic::AtomicU64, Arc}, }; use futures::{ stream::{SplitSink, SplitStream}, SinkExt, StreamExt, }; use tokio::net::TcpStream; use tokio_util::codec::Framed; use crate::{ connection::Tracked, packet::{self, Packet}, }; /// A wrapper around an asynchr...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/connection/tracked.rs
mycelium/src/connection/tracked.rs
use std::{ pin::Pin, sync::{ atomic::{AtomicU64, Ordering}, Arc, }, task::Poll, }; use tokio::io::{AsyncRead, AsyncWrite}; /// Wrapper which keeps track of how much bytes have been read and written from a connection. pub struct Tracked<C> { /// Bytes read counter read: Arc<Atom...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/message/init.rs
mycelium/src/message/init.rs
use super::MessagePacket; /// A message representing an init message. /// /// The body of an init message has the following structure: /// - 8 bytes size pub struct MessageInit { buffer: MessagePacket, } impl MessageInit { /// Create a new `MessageInit` in the provided [`MessagePacket`]. pub fn new(mut ...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/message/chunk.rs
mycelium/src/message/chunk.rs
use std::fmt; use super::MessagePacket; /// A message representing a "chunk" message. /// /// The body of a chunk message has the following structure: /// - 8 bytes: chunk index /// - 8 bytes: chunk offset /// - 8 bytes: chunk size /// - remainder: chunk data of length based on field 3 pub struct MessageChunk...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/message/topic.rs
mycelium/src/message/topic.rs
use crate::subnet::Subnet; use core::fmt; use serde::{ de::{Deserialize, Deserializer, MapAccess, Visitor}, Deserialize as DeserializeMacro, }; use std::collections::HashMap; use std::path::PathBuf; /// Configuration for a topic whitelist, including allowed subnets and optional forward socket #[derive(Debug, D...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/message/done.rs
mycelium/src/message/done.rs
use super::{MessageChecksum, MessagePacket, MESSAGE_CHECKSUM_LENGTH}; /// A message representing a "done" message. /// /// The body of a done message has the following structure: /// - 8 bytes: chunks transmitted /// - 32 bytes: checksum of the transmitted data pub struct MessageDone { buffer: MessagePacket, }...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/packet/control.rs
mycelium/src/packet/control.rs
use std::{io, net::IpAddr, time::Duration}; use bytes::BytesMut; use tokio_util::codec::{Decoder, Encoder}; use crate::{ babel, metric::Metric, peer::Peer, router_id::RouterId, sequence_number::SeqNo, subnet::Subnet, }; pub type ControlPacket = babel::Tlv; pub struct Codec { // TODO: wrapper to make it easi...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/packet/data.rs
mycelium/src/packet/data.rs
use std::net::Ipv6Addr; use bytes::{Buf, BufMut, BytesMut}; use tokio_util::codec::{Decoder, Encoder}; /// Size of the header start for a data packet (before the IP addresses). const DATA_PACKET_HEADER_SIZE: usize = 4; /// Mask to extract data length from const DATA_PACKET_LEN_MASK: u32 = (1 << 16) - 1; #[derive(De...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/babel/tlv.rs
mycelium/src/babel/tlv.rs
pub use super::{hello::Hello, ihu::Ihu, update::Update}; use super::{route_request::RouteRequest, SeqNoRequest}; /// A single `Tlv` in a babel packet body. #[derive(Debug, Clone, PartialEq)] pub enum Tlv { /// Hello Tlv type. Hello(Hello), /// Ihu Tlv type. Ihu(Ihu), /// Update Tlv type. Update...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/babel/route_request.rs
mycelium/src/babel/route_request.rs
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr}; use bytes::{Buf, BufMut}; use tracing::trace; use crate::subnet::Subnet; use super::{AE_IPV4, AE_IPV6, AE_IPV6_LL, AE_WILDCARD}; /// Base wire size of a [`RouteRequest`] without variable length address encoding. const ROUTE_REQUEST_BASE_WIRE_SIZE: u8 = 3; /// Seqno reque...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/babel/ihu.rs
mycelium/src/babel/ihu.rs
//! The babel [IHU TLV](https://datatracker.ietf.org/doc/html/rfc8966#name-ihu). use std::net::{IpAddr, Ipv4Addr, Ipv6Addr}; use bytes::{Buf, BufMut}; use tracing::trace; use crate::metric::Metric; use super::{AE_IPV4, AE_IPV6, AE_IPV6_LL, AE_WILDCARD}; /// Base wire size of an [`Ihu`] without variable length addr...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/babel/update.rs
mycelium/src/babel/update.rs
//! The babel [Update TLV](https://datatracker.ietf.org/doc/html/rfc8966#name-update). use std::{ net::{IpAddr, Ipv4Addr, Ipv6Addr}, time::Duration, }; use bytes::{Buf, BufMut}; use tracing::trace; use crate::{metric::Metric, router_id::RouterId, sequence_number::SeqNo, subnet::Subnet}; use super::{AE_IPV4,...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/babel/hello.rs
mycelium/src/babel/hello.rs
//! The babel [Hello TLV](https://datatracker.ietf.org/doc/html/rfc8966#section-4.6.5). use bytes::{Buf, BufMut}; use tracing::trace; use crate::sequence_number::SeqNo; /// Flag bit indicating a [`Hello`] is sent as unicast hello. const HELLO_FLAG_UNICAST: u16 = 0x8000; /// Mask to apply to [`Hello`] flags, leaving...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium/src/babel/seqno_request.rs
mycelium/src/babel/seqno_request.rs
use std::{ net::{IpAddr, Ipv4Addr, Ipv6Addr}, num::NonZeroU8, }; use bytes::{Buf, BufMut}; use tracing::{debug, trace}; use crate::{router_id::RouterId, sequence_number::SeqNo, subnet::Subnet}; use super::{AE_IPV4, AE_IPV6, AE_IPV6_LL, AE_WILDCARD}; /// The default HOP COUNT value used in new SeqNo requests...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium-api/src/lib.rs
mycelium-api/src/lib.rs
use core::fmt; use std::{ net::{IpAddr, Ipv6Addr, SocketAddr}, str::FromStr, sync::Arc, }; use axum::{ extract::{Path, State}, http::StatusCode, response::IntoResponse, routing::{delete, get}, Json, Router, }; use serde::{de, Deserialize, Deserializer, Serialize}; use tokio::{sync::Mute...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium-api/src/rpc.rs
mycelium-api/src/rpc.rs
//! JSON-RPC API implementation for Mycelium mod spec; use std::net::{Ipv6Addr, SocketAddr}; #[cfg(feature = "message")] use std::ops::Deref; use std::str::FromStr; use std::sync::Arc; #[cfg(feature = "message")] use base64::Engine; use jsonrpsee::core::RpcResult; use jsonrpsee::proc_macros::rpc; use jsonrpsee::serv...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium-api/src/message.rs
mycelium-api/src/message.rs
use std::{net::IpAddr, ops::Deref, time::Duration}; use axum::{ extract::{Path, Query, State}, http::StatusCode, routing::{delete, get, post}, Json, Router, }; use serde::{Deserialize, Serialize}; use tracing::debug; use mycelium::{ crypto::PublicKey, message::{MessageId, MessageInfo}, met...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium-api/src/rpc/admin.rs
mycelium-api/src/rpc/admin.rs
//! Admin-related JSON-RPC methods for the Mycelium API use jsonrpc_core::{Error, ErrorCode, Result as RpcResult}; use std::net::IpAddr; use std::str::FromStr; use tracing::debug; use mycelium::crypto::PublicKey; use mycelium::metrics::Metrics; use crate::HttpServerState; use crate::Info; use crate::rpc::models::err...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium-api/src/rpc/route.rs
mycelium-api/src/rpc/route.rs
//! Route-related JSON-RPC methods for the Mycelium API use jsonrpc_core::Result as RpcResult; use tracing::debug; use mycelium::metrics::Metrics; use crate::HttpServerState; use crate::Route; use crate::QueriedSubnet; use crate::NoRouteSubnet; use crate::Metric; use crate::rpc::traits::RouteApi; /// Implementation...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium-api/src/rpc/traits.rs
mycelium-api/src/rpc/traits.rs
//! RPC trait definitions for the Mycelium JSON-RPC API use jsonrpc_core::Result as RpcResult; use jsonrpc_derive::rpc; use crate::Info; use crate::Route; use crate::QueriedSubnet; use crate::NoRouteSubnet; use mycelium::crypto::PublicKey; use mycelium::peer_manager::PeerStats; use mycelium::message::{MessageId, Mess...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium-api/src/rpc/message.rs
mycelium-api/src/rpc/message.rs
//! Message-related JSON-RPC methods for the Mycelium API use jsonrpc_core::{Error, ErrorCode, Result as RpcResult}; use std::time::Duration; use tracing::debug; use mycelium::message::{MessageId, MessageInfo}; use mycelium::metrics::Metrics; use crate::message::{MessageReceiveInfo, MessageSendInfo, PushMessageRespo...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium-api/src/rpc/peer.rs
mycelium-api/src/rpc/peer.rs
//! Peer-related JSON-RPC methods for the Mycelium API use jsonrpc_core::{Error, ErrorCode, Result as RpcResult}; use std::str::FromStr; use tracing::debug; use mycelium::endpoint::Endpoint; use mycelium::metrics::Metrics; use mycelium::peer_manager::{PeerExists, PeerNotFound, PeerStats}; use crate::rpc::models::err...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium-api/src/rpc/models.rs
mycelium-api/src/rpc/models.rs
//! Models for the Mycelium JSON-RPC API use serde::{Deserialize, Serialize}; // Define any additional models needed for the JSON-RPC API // Most models can be reused from the existing REST API /// Error codes for the JSON-RPC API pub mod error_codes { /// Invalid parameters error code pub const INVALID_PARA...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/mycelium-api/src/rpc/spec.rs
mycelium-api/src/rpc/spec.rs
//! OpenRPC specification for the Mycelium JSON-RPC API /// The OpenRPC specification for the Mycelium JSON-RPC API pub const OPENRPC_SPEC: &str = include_str!("../../../docs/openrpc.json");
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
false
threefoldtech/mycelium
https://github.com/threefoldtech/mycelium/blob/e8653f66a01eab8175acdb06e05cca15b7fae722/myceliumd-private/src/main.rs
myceliumd-private/src/main.rs
use std::io::{self, Read}; use std::net::Ipv4Addr; use std::path::Path; use std::sync::Arc; use std::{ error::Error, net::{IpAddr, SocketAddr}, path::PathBuf, }; use std::{fmt::Display, str::FromStr}; use clap::{Args, Parser, Subcommand}; use mycelium::message::TopicConfig; use serde::{Deserialize, Deseria...
rust
Apache-2.0
e8653f66a01eab8175acdb06e05cca15b7fae722
2026-01-04T20:24:55.945094Z
true
smart-leds-rs/smart-leds
https://github.com/smart-leds-rs/smart-leds/blob/61a0f6b48cf2e4521a13d1820a128a970035d707/src/lib.rs
src/lib.rs
//! # Smart Leds //! //! Smart leds is a collection of crates to use smart leds on embedded devices with rust. //! //! Examples of smart leds include the popular WS2812 (also called Neopixel), //! APA102 (DotStar) and other leds, which can be individually adressed. //! //! Other driver crates implement these indivdual ...
rust
Apache-2.0
61a0f6b48cf2e4521a13d1820a128a970035d707
2026-01-04T20:25:05.940189Z
false
smart-leds-rs/smart-leds
https://github.com/smart-leds-rs/smart-leds/blob/61a0f6b48cf2e4521a13d1820a128a970035d707/src/hsv.rs
src/hsv.rs
use smart_leds_trait::*; #[derive(Copy, Clone, Default)] pub struct Hsv { pub hue: u8, pub sat: u8, pub val: u8, } /// Converts a hsv value into RGB values. Because the hsv values are integers, the precision of the /// resulting RGB value is limited to ±4. /// /// NOTE: Since most led protocols & their im...
rust
Apache-2.0
61a0f6b48cf2e4521a13d1820a128a970035d707
2026-01-04T20:25:05.940189Z
false
smart-leds-rs/smart-leds
https://github.com/smart-leds-rs/smart-leds/blob/61a0f6b48cf2e4521a13d1820a128a970035d707/src/colors.rs
src/colors.rs
use crate::RGB8; /// See https://en.wikipedia.org/wiki/Web_colors // 16 Original "Web" Colors pub const WHITE: RGB8 = RGB8 { r: 0xFF, g: 0xFF, b: 0xFF }; pub const SILVER: RGB8 = RGB8 { r: 0xC0, g: 0xC0, b: 0xC0 }; pub const GRAY: RGB8 = RGB8 { r: 0x80, g: 0x80...
rust
Apache-2.0
61a0f6b48cf2e4521a13d1820a128a970035d707
2026-01-04T20:25:05.940189Z
false
jamesjmeyer210/actix_sqlx_mysql_user_crud
https://github.com/jamesjmeyer210/actix_sqlx_mysql_user_crud/blob/c854e966c5d2bc01b07307d070e82ef511c3a900/src/config.rs
src/config.rs
use serde::Deserialize; use std::fs; #[derive(Deserialize)] struct AppConfig { url: String, port: u16, } #[derive(Deserialize)] struct DaoConfig { user: String, password: String, address: String, database: String, } #[derive(Deserialize)] pub struct Config { app: AppConfig, dao: DaoConf...
rust
Unlicense
c854e966c5d2bc01b07307d070e82ef511c3a900
2026-01-04T20:25:06.640301Z
false
jamesjmeyer210/actix_sqlx_mysql_user_crud
https://github.com/jamesjmeyer210/actix_sqlx_mysql_user_crud/blob/c854e966c5d2bc01b07307d070e82ef511c3a900/src/lib.rs
src/lib.rs
use crate::dao::Database; use std::sync::{Arc, Mutex}; pub mod config; pub mod controller; pub mod dao; pub mod model; // AppState // This the primary dependency for our application's dependency injection. // Each controller_test function that interacts with the database will require an `AppState` instance in // orde...
rust
Unlicense
c854e966c5d2bc01b07307d070e82ef511c3a900
2026-01-04T20:25:06.640301Z
false
jamesjmeyer210/actix_sqlx_mysql_user_crud
https://github.com/jamesjmeyer210/actix_sqlx_mysql_user_crud/blob/c854e966c5d2bc01b07307d070e82ef511c3a900/src/main.rs
src/main.rs
use actix_web::{web, App, HttpServer}; use sqlx_user_crud::config::Config; use sqlx_user_crud::dao::Database; use sqlx_user_crud::{controller, AppState}; use std::sync::{Arc, Mutex}; #[actix_web::main] async fn main() -> std::io::Result<()> { println!("=== SQLX User CRUD ==="); // Read in the configuration fi...
rust
Unlicense
c854e966c5d2bc01b07307d070e82ef511c3a900
2026-01-04T20:25:06.640301Z
false
jamesjmeyer210/actix_sqlx_mysql_user_crud
https://github.com/jamesjmeyer210/actix_sqlx_mysql_user_crud/blob/c854e966c5d2bc01b07307d070e82ef511c3a900/src/controller/role_controller.rs
src/controller/role_controller.rs
use super::log_request; use super::AppState; use actix_web::{delete, get, patch, post, web, HttpResponse, Responder}; use serde::{Deserialize, Serialize}; pub fn init(cfg: &mut web::ServiceConfig) { cfg.service(get_role_by_id); cfg.service(post_role); cfg.service(patch_role_by_name); cfg.service(delete...
rust
Unlicense
c854e966c5d2bc01b07307d070e82ef511c3a900
2026-01-04T20:25:06.640301Z
false
jamesjmeyer210/actix_sqlx_mysql_user_crud
https://github.com/jamesjmeyer210/actix_sqlx_mysql_user_crud/blob/c854e966c5d2bc01b07307d070e82ef511c3a900/src/controller/user_controller.rs
src/controller/user_controller.rs
use super::log_request; use super::AppState; use crate::model::User; use actix_web::{delete, get, patch, post, web, HttpResponse, Responder}; use uuid::Uuid; pub fn init(cfg: &mut web::ServiceConfig) { cfg.service(get_user); cfg.service(post_user); cfg.service(patch_user); cfg.service(delete_user); } ...
rust
Unlicense
c854e966c5d2bc01b07307d070e82ef511c3a900
2026-01-04T20:25:06.640301Z
false
jamesjmeyer210/actix_sqlx_mysql_user_crud
https://github.com/jamesjmeyer210/actix_sqlx_mysql_user_crud/blob/c854e966c5d2bc01b07307d070e82ef511c3a900/src/controller/group_controller.rs
src/controller/group_controller.rs
use super::log_request; use super::AppState; use actix_web::{delete, get, patch, post, web, HttpResponse, Responder}; use serde::{Deserialize, Serialize}; pub fn init(cfg: &mut web::ServiceConfig) { cfg.service(get_group_by_id); cfg.service(post_group); cfg.service(patch_group_by_name); cfg.service(del...
rust
Unlicense
c854e966c5d2bc01b07307d070e82ef511c3a900
2026-01-04T20:25:06.640301Z
false
jamesjmeyer210/actix_sqlx_mysql_user_crud
https://github.com/jamesjmeyer210/actix_sqlx_mysql_user_crud/blob/c854e966c5d2bc01b07307d070e82ef511c3a900/src/controller/mod.rs
src/controller/mod.rs
use super::AppState; use std::sync::Mutex; pub mod group_controller; pub mod index_controller; pub mod user_controller; pub use group_controller::init as init_group_controller; pub use index_controller::init as init_index_controller; pub use user_controller::init as init_user_controller; fn log_request(route: &'stat...
rust
Unlicense
c854e966c5d2bc01b07307d070e82ef511c3a900
2026-01-04T20:25:06.640301Z
false