stuff and things and docs and things idk i suck at commit names

This commit is contained in:
c0repwn3r 2023-03-16 19:52:07 -04:00
parent 5b49d2fcfd
commit d2d931c16b
Signed by: core
GPG Key ID: FDBF740DADDCEECF
9 changed files with 109 additions and 52 deletions

View File

@ -2,7 +2,7 @@
<module type="CPP_MODULE" version="4"> <module type="CPP_MODULE" version="4">
<component name="NewModuleRootManager"> <component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/libpalm/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target" /> <excludeFolder url="file://$MODULE_DIR$/target" />
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />

18
Cargo.lock generated
View File

@ -149,6 +149,15 @@ version = "0.2.140"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c"
[[package]]
name = "libpalm"
version = "0.1.0"
dependencies = [
"prost",
"prost-build",
"prost-types",
]
[[package]] [[package]]
name = "linux-raw-sys" name = "linux-raw-sys"
version = "0.1.4" version = "0.1.4"
@ -176,15 +185,6 @@ version = "1.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
[[package]]
name = "palm"
version = "0.1.0"
dependencies = [
"prost",
"prost-build",
"prost-types",
]
[[package]] [[package]]
name = "petgraph" name = "petgraph"
version = "0.6.3" version = "0.6.3"

View File

@ -1,14 +1,4 @@
[package] [workspace]
name = "palm" members = [
version = "0.1.0" "libpalm"
edition = "2021" ]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
prost = "0.11.8"
# Only necessary if using Protobuf well-known types:
prost-types = "0.11.8"
[build-dependencies]
prost-build = { version = "0.11.8" }

View File

@ -1,5 +0,0 @@
fn main() {
prost_build::compile_protos(&[
"palmdef/palm.proto"
], &["palmdef/"]).unwrap();
}

14
libpalm/Cargo.toml Normal file
View File

@ -0,0 +1,14 @@
[package]
name = "libpalm"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
prost = "0.11.8"
# Only necessary if using Protobuf well-known types:
prost-types = "0.11.8"
[build-dependencies]
prost-build = { version = "0.11.8" }

5
libpalm/build.rs Normal file
View File

@ -0,0 +1,5 @@
fn main() {
prost_build::compile_protos(&[
format!("{}/../palmdef/palm.proto", env!("CARGO_MANIFEST_DIR"))
], &[format!("{}/../palmdef/", env!("CARGO_MANIFEST_DIR"))]).unwrap();
}

67
libpalm/src/lib.rs Normal file
View File

@ -0,0 +1,67 @@
//! # libpalm
//! A Rust crate to simplify the parsing operations for the Palm general-purpose relaying protocol.
//! Palm is used to build **srt** (Simple Relayed Traffic) - a set of utilities written around `libpalm` that simplify the process
//! of communicating through Palm.
//!
//! Palm is pure-rust with 100% safe code. It is left up to the user to provide the `Writer` that `libpalm` writes packets to, as that is
//! outside the scope of `libpalm`. `libpalm` is just a serialization library for creating the required incantation of bytes to send arbitrary data
//! over a Palm bytestream.
//!
//! Want to learn more about the Palm protocol? Check out `palmdef`! Inside `libpalm`'s repository, you can find a set of
//! Protocol Buffers schemas, which contain the documentation for the entire Palm protocol.
//!
//! Want to use Palm, but don't feel like writing any code? Check out **srt**! Inside `libpalm`'s repository, you can find **srt**
//! which is a general-purpose libpalm wrapper to create or connect to relays.
#![forbid(unsafe_code)]
#![warn(clippy::pedantic)]
#![warn(clippy::nursery)]
#![deny(clippy::unwrap_used)]
#![deny(clippy::expect_used)]
#![deny(missing_docs)]
#![deny(clippy::missing_errors_doc)]
#![deny(clippy::missing_panics_doc)]
#![deny(clippy::missing_safety_doc)]
#![allow(clippy::must_use_candidate)]
#![allow(clippy::too_many_lines)]
#![allow(clippy::module_name_repetitions)]
/// Contains the Rust code generated from the protobuf definitions. This code is mostly undocumented, as it is regenerated constantly.
/// Proceed with caution.
pub mod palmdef {
include!(concat!(env!("OUT_DIR"), "/palmdef.rs"));
#[allow(missing_docs)]
#[allow(clippy::doc_markdown)]
#[allow(clippy::missing_const_for_fn)]
#[allow(clippy::use_self)]
pub mod encrypted_reflection {
include!(concat!(env!("OUT_DIR"), "/palmdef.encrypted_reflection.rs"));
}
#[allow(missing_docs)]
#[allow(clippy::doc_markdown)]
#[allow(clippy::missing_const_for_fn)]
#[allow(clippy::use_self)]
pub mod encrypted_tunnel {
include!(concat!(env!("OUT_DIR"), "/palmdef.encrypted_tunnel.rs"));
}
#[allow(missing_docs)]
#[allow(clippy::doc_markdown)]
#[allow(clippy::missing_const_for_fn)]
#[allow(clippy::use_self)]
pub mod unencrypted_reflection {
include!(concat!(env!("OUT_DIR"), "/palmdef.unencrypted_reflection.rs"));
}
#[allow(missing_docs)]
#[allow(clippy::doc_markdown)]
#[allow(clippy::missing_const_for_fn)]
#[allow(clippy::use_self)]
pub mod unencrypted_tunnel {
include!(concat!(env!("OUT_DIR"), "/palmdef.unencrypted_tunnel.rs"));
}
}
pub mod uri;

9
libpalm/src/uri.rs Normal file
View File

@ -0,0 +1,9 @@
//! A module for parsing Palm relay URIs.
//!
//! They use the following format:
//! `palm[+<transport>]://<ip/domain>:<port>/<hex-encoded public key>`
//!
//! - `transport` is optional. If not provided, it will be set to `tcp`. It represents which method will be used to encapsulate traffic. Please note that ensuring both the relay and the client support this is outside the scope of libpalm - it only loads the transport libs.
//! - `ip/domain` is required, and is the IP or DNS domain the relay is reachable at.
//! - `port` is required, and is the TCP port the relay is listening on.
//! - `hex-encoded public key` is required, and is the hex-encoded static public key of the relay.

View File

@ -1,23 +0,0 @@
pub mod palmdef {
include!(concat!(env!("OUT_DIR"), "/palmdef.rs"));
pub mod encrypted_reflection {
include!(concat!(env!("OUT_DIR"), "/palmdef.encrypted_reflection.rs"));
}
pub mod encrypted_tunnel {
include!(concat!(env!("OUT_DIR"), "/palmdef.encrypted_tunnel.rs"));
}
pub mod unencrypted_reflection {
include!(concat!(env!("OUT_DIR"), "/palmdef.unencrypted_reflection.rs"));
}
pub mod unencrypted_tunnel {
include!(concat!(env!("OUT_DIR"), "/palmdef.unencrypted_tunnel.rs"));
}
}
fn main() {
println!("Hello, world!");
}