//! Ejemplo básico de uso de zcatp2p const std = @import("std"); const p2p = @import("zcatp2p"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const allocator = gpa.allocator(); // Configuración const config = p2p.Config{ .device_name = "Simifactu-Ejemplo", .listen_port = 22000, .local_discovery = true, .data_dir = "/tmp/zcatp2p-example", }; // Inicializar std.debug.print("Inicializando zcatp2p...\n", .{}); var node = try p2p.P2P.init(allocator, config); defer node.deinit(); // Mostrar nuestro Device ID var id_buf: [64]u8 = undefined; const my_id = node.getDeviceIdString(&id_buf); std.debug.print("Mi Device ID: {s}\n", .{my_id}); // Mostrar estado de NAT const nat_type = node.getNatType(); std.debug.print("Tipo de NAT: {}\n", .{nat_type}); // Mostrar conexiones activas std.debug.print("Conexiones activas: {}\n", .{node.connectionCount()}); std.debug.print("\n¡zcatp2p inicializado correctamente!\n", .{}); std.debug.print("Pendiente: implementación completa de TLS, STUN, y relay.\n", .{}); }