diff --git a/Cargo.lock b/Cargo.lock index fe55a2d..73c30a5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -395,6 +395,16 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "macros" +version = "0.1.1" +source = "git+https://github.com/RusticMaple/VByteMacros#e2f31bded8c5591e847ba03faf79ae0351e43e69" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "md-5" version = "0.10.6" @@ -536,6 +546,13 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "prudpv0" +version = "0.1.0" +dependencies = [ + "rnex-core", +] + [[package]] name = "prudpv1" version = "0.1.0" @@ -551,7 +568,7 @@ dependencies = [ "thiserror", "tokio", "typenum", - "v-byte-helpers", + "v-byte-helpers 0.1.1 (git+https://github.com/RusticMaple/VByteMacros)", ] [[package]] @@ -648,7 +665,7 @@ dependencies = [ "tokio", "typenum", "ureq", - "v-byte-helpers", + "v-byte-helpers 0.1.1 (git+https://github.com/DJMrTV/VByteMacros)", ] [[package]] @@ -958,7 +975,16 @@ version = "0.1.1" source = "git+https://github.com/DJMrTV/VByteMacros#e2f31bded8c5591e847ba03faf79ae0351e43e69" dependencies = [ "bytemuck", - "macros 0.1.1", + "macros 0.1.1 (git+https://github.com/DJMrTV/VByteMacros)", +] + +[[package]] +name = "v-byte-helpers" +version = "0.1.1" +source = "git+https://github.com/RusticMaple/VByteMacros#e2f31bded8c5591e847ba03faf79ae0351e43e69" +dependencies = [ + "bytemuck", + "macros 0.1.1 (git+https://github.com/RusticMaple/VByteMacros)", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 9c63a93..d020704 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,5 +3,6 @@ resolver = "3" members = [ "macros", "rnex-core", - "prudpv1" -] \ No newline at end of file + "prudpv1", + "prudpv0" +] diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..7826732 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1767609335, + "narHash": "sha256-feveD98mQpptwrAEggBQKJTYbvwwglSbOv53uCfH9PY=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "250481aafeb741edfe23d29195671c19b36b6dca", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1767640445, + "narHash": "sha256-UWYqmD7JFBEDBHWYcqE6s6c77pWdcU/i+bwD6XxMb8A=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "9f0c42f8bc7151b8e7e5840fb3bd454ad850d8c5", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1765674936, + "narHash": "sha256-k00uTP4JNfmejrCLJOwdObYC9jHRrr/5M/a/8L2EIdo=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "2075416fcb47225d9b68ac469a5c4801a9c4dd85", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..0863018 --- /dev/null +++ b/flake.nix @@ -0,0 +1,28 @@ +{ + description = "rust nex server"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + flake-parts.url = "github:hercules-ci/flake-parts"; + }; + + outputs = + inputs@{ + self, + nixpkgs, + flake-parts, + }: + flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + perSystem = + { pkgs, lib, ... }: + rec { + devShells.default = import ./shell.nix { inherit pkgs; }; + }; + }; +} diff --git a/perf.data b/perf.data new file mode 100644 index 0000000..2cf011f Binary files /dev/null and b/perf.data differ diff --git a/prudpv0/Cargo.toml b/prudpv0/Cargo.toml new file mode 100644 index 0000000..439f882 --- /dev/null +++ b/prudpv0/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "prudpv0" +version = "0.1.0" +edition = "2024" + +[dependencies] +rnex-core = { path = "../rnex-core", version = "0.1.1" } diff --git a/prudpv0/src/lib.rs b/prudpv0/src/lib.rs new file mode 100644 index 0000000..e69de29 diff --git a/prudpv1/Cargo.toml b/prudpv1/Cargo.toml index bdf340e..efeaf0a 100644 --- a/prudpv1/Cargo.toml +++ b/prudpv1/Cargo.toml @@ -9,7 +9,7 @@ tokio = { version = "1.47.0", features = ["full"] } hmac = "0.12.1" md-5 = "^0.10.6" rc4 = "0.1.0" -v-byte-helpers = { git = "https://github.com/DJMrTV/VByteMacros", version = "0.1.1" } +v-byte-helpers = { git = "https://github.com/RusticMaple/VByteMacros", version = "0.1.1" } thiserror = "2.0.12" log = "0.4.27" async-trait = "0.1.88" @@ -23,4 +23,4 @@ path = "src/executables/proxy_insecure.rs" [[bin]] name = "proxy_secure" -path = "src/executables/proxy_secure.rs" \ No newline at end of file +path = "src/executables/proxy_secure.rs" diff --git a/prudpv1/src/prudp/packet/v1/sanity_checks.rs b/prudpv1/src/prudp/packet/v1/sanity_checks.rs new file mode 100644 index 0000000..335c269 --- /dev/null +++ b/prudpv1/src/prudp/packet/v1/sanity_checks.rs @@ -0,0 +1,12 @@ +//! # PRUDPV1 Feature sanity checks +//! +//! Checks wether the set features are actually sensical or wether they are +//! nonsense and throws a compiler error incase of nonsense + +#[cfg(feature = "friends")] +compile_error!( + "friends uses prudpv0 instead of prudpv1, please do not enable both at the same time" +); + +#[cfg(feature = "prudpv0")] +compile_error!("you cannot enable two prudp versions at the same time"); diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..3ac2963 --- /dev/null +++ b/shell.nix @@ -0,0 +1,18 @@ +{ + pkgs ? import { }, + pkg ? pkgs.callPackage ./. { }, +}: +pkgs.mkShell { + # Get dependencies from the main package + # inputsFrom = [ pkg ]; + # Additional tooling + buildInputs = with pkgs; [ + cargo + rust-analyzer # LSP Server + rustfmt # Formatter + clippy # Linter + podman + yq + jq + ]; +}