mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-06-11 01:25:53 -04:00
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).
This commit is contained in:
committed by
Pierre Tachoire
parent
fb6c4e4978
commit
7f5abfc9cf
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user