create Mutual Witness Protocol specs and implementation. mwp aims to be

a zero-infrastructure NAT traversal
This commit is contained in:
2026-02-07 18:01:12 -03:00
parent 2b7ab5f570
commit abb398d363
22 changed files with 4656 additions and 51 deletions

View File

@@ -77,6 +77,26 @@ pub fn build(b: *std.Build) void {
p2p_module.addImport("files", files_module);
p2p_module.addImport("noise", noise_module);
// ============================================================
// MWP (Mutual Witness Protocol) Core Library
// ============================================================
const mwp_lib_module = b.addModule("mwp_lib", .{
.root_source_file = b.path("src/mwp/mwp.zig"),
.target = target,
.optimize = optimize,
});
// ============================================================
// MWP Integration Module (user-facing API)
// ============================================================
const mwp_module = b.addModule("mwp", .{
.root_source_file = b.path("src/mwp_integration.zig"),
.target = target,
.optimize = optimize,
});
mwp_module.addImport("p2p", p2p_module);
mwp_module.addImport("mwp_lib", mwp_lib_module);
// ============================================================
// Example Executables
// ============================================================
@@ -123,6 +143,29 @@ pub fn build(b: *std.Build) void {
const run_client_step = b.step("run-client", "Run the example client");
run_client_step.dependOn(&run_client.step);
// MWP Demo example
const mwp_demo_module = b.createModule(.{
.root_source_file = b.path("examples/mwp_demo.zig"),
.target = target,
.optimize = .Debug,
});
mwp_demo_module.addImport("p2p", p2p_module);
mwp_demo_module.addImport("mwp", mwp_module);
const mwp_demo = b.addExecutable(.{
.name = "mwp-demo",
.root_module = mwp_demo_module,
});
b.installArtifact(mwp_demo);
const run_mwp = b.addRunArtifact(mwp_demo);
run_mwp.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_mwp.addArgs(args);
}
const run_mwp_step = b.step("run-mwp", "Run the MWP demo");
run_mwp_step.dependOn(&run_mwp.step);
// Encrypted server example (Noise Protocol)
const encrypted_server_module = b.createModule(.{
.root_source_file = b.path("examples/encrypted_server.zig"),