From 7f5abfc9cfdbf13bed8d170611550d958d0a079a Mon Sep 17 00:00:00 2001 From: Lucien Coffe Date: Tue, 24 Mar 2026 10:39:24 +0100 Subject: [PATCH] fix: use dashes in CLI flag names for consistency Rename --block_private_networks to --block-private-networks and --block_cidrs to --block-cidrs to match the existing flag naming convention (e.g. --http-proxy, --proxy-bearer-token). --- src/Config.zig | 16 ++++++++-------- src/network/IpFilter.zig | 2 +- src/network/Network.zig | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Config.zig b/src/Config.zig index 8d3e35aa..c31a3563 100644 --- a/src/Config.zig +++ b/src/Config.zig @@ -368,7 +368,7 @@ pub fn printUsageAndExit(self: *const Config, success: bool) void { \\ we make requests towards. \\ Defaults to false. \\ - \\--block_private_networks + \\--block-private-networks \\ Blocks HTTP requests to private/internal IP addresses \\ after DNS resolution. Useful for sandboxing, multi-tenant \\ deployments, and preventing access to internal infrastructure @@ -376,12 +376,12 @@ pub fn printUsageAndExit(self: *const Config, success: bool) void { \\ resources, redirects, etc.). \\ Defaults to false. \\ - \\--block_cidrs + \\--block-cidrs \\ Additional CIDR ranges to block, comma-separated. \\ Prefix with '-' to allow (exempt from blocking). - \\ e.g. --block_cidrs 169.254.169.254/32,fd00:ec2::254/128 - \\ e.g. --block_cidrs 10.0.0.0/8,-10.0.0.42/32 - \\ Can be used standalone or combined with --block_private_networks. + \\ e.g. --block-cidrs 169.254.169.254/32,fd00:ec2::254/128 + \\ e.g. --block-cidrs 10.0.0.0/8,-10.0.0.42/32 + \\ Can be used standalone or combined with --block-private-networks. \\ \\--http-proxy The HTTP proxy to use for all HTTP requests. \\ A username:password can be included for basic authentication. @@ -1126,14 +1126,14 @@ fn parseCommonArg( return true; } - if (std.mem.eql(u8, "--block_private_networks", opt)) { + if (std.mem.eql(u8, "--block-private-networks", opt)) { common.block_private_networks = true; return true; } - if (std.mem.eql(u8, "--block_cidrs", opt)) { + if (std.mem.eql(u8, "--block-cidrs", opt)) { const str = args.next() orelse { - log.fatal(.app, "missing argument value", .{ .arg = "--block_cidrs" }); + log.fatal(.app, "missing argument value", .{ .arg = "--block-cidrs" }); return error.InvalidArgument; }; common.block_cidrs = try allocator.dupe(u8, str); diff --git a/src/network/IpFilter.zig b/src/network/IpFilter.zig index ca421ab0..f81c7fc7 100644 --- a/src/network/IpFilter.zig +++ b/src/network/IpFilter.zig @@ -408,7 +408,7 @@ test "custom CIDR ranges" { test "private group blocks cloud metadata IP via link-local" { // 169.254.169.254 is in link-local (169.254.0.0/16) which is in the private group. - // Users who want targeted cloud-metadata-only blocking can use --block_cidrs. + // Users who want targeted cloud-metadata-only blocking can use --block-cidrs. const filter_private = IpFilter.init(true, &.{}, &.{}, &.{}, &.{}); const filter_none = IpFilter.init(false, &.{}, &.{}, &.{}, &.{}); const t = std.testing; diff --git a/src/network/Network.zig b/src/network/Network.zig index 2968611b..459eb5a5 100644 --- a/src/network/Network.zig +++ b/src/network/Network.zig @@ -86,9 +86,9 @@ callbacks: [MAX_TICK_CALLBACKS]TickCallback = undefined, callbacks_len: usize = 0, callbacks_mutex: std.Thread.Mutex = .{}, -/// Optional IP filter for blocking requests to private/internal networks (--block_private_networks). +/// Optional IP filter for blocking requests to private/internal networks (--block-private-networks). ip_filter: ?*IpFilter = null, -// Custom CIDR slices backing ip_filter; null when --block_cidrs was not set. +// Custom CIDR slices backing ip_filter; null when --block-cidrs was not set. ip_filter_custom_v4: ?[]IpFilter.CidrV4 = null, ip_filter_custom_v6: ?[]IpFilter.CidrV6 = null,