feat: refactor core+network+protocol: use platform abstractions,
transport vtable
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
//! ```
|
||||
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const is_wasm = builtin.target.cpu.arch == .wasm32 or builtin.target.cpu.arch == .wasm64;
|
||||
const posix = std.posix;
|
||||
const Allocator = std.mem.Allocator;
|
||||
|
||||
@@ -319,6 +321,8 @@ fn verifySourceAddress(src: *const posix.sockaddr.storage, expected_ip: [4]u8) b
|
||||
|
||||
/// Discover the default gateway IP address
|
||||
pub fn discoverGateway() ![4]u8 {
|
||||
if (is_wasm) return error.UnsupportedPlatform;
|
||||
|
||||
// Platform-specific gateway discovery
|
||||
if (@import("builtin").os.tag == .macos or @import("builtin").os.tag == .ios) {
|
||||
return discoverGatewayDarwin();
|
||||
|
||||
Reference in New Issue
Block a user