Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file.
## Unreleased

- cli: `config set` accepts `--geo-program-id`; `config get` and `config set` print Geolocation Program ID
- cli: `doublezero geolocation probe ...` mirrors `doublezero-geolocation probe ...`; new `--geo-program-id` global flag

## [v0.23.0](https://github.com/malbeclabs/doublezero/compare/client/v0.22.0...client/v0.23.0) - 2026-05-15

Expand Down
9 changes: 6 additions & 3 deletions client/doublezero/src/cli/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use crate::{
cli::{
accesspass::AccessPassCliCommand, config::ConfigCliCommand,
contributor::ContributorCliCommand, device::DeviceCliCommand, exchange::ExchangeCliCommand,
globalconfig::GlobalConfigCliCommand, link::LinkCliCommand, location::LocationCliCommand,
permission::PermissionCliCommand, resource::ResourceCliCommand, tenant::TenantCliCommand,
user::UserCliCommand,
geolocation::GeolocationCliCommand, globalconfig::GlobalConfigCliCommand,
link::LinkCliCommand, location::LocationCliCommand, permission::PermissionCliCommand,
resource::ResourceCliCommand, tenant::TenantCliCommand, user::UserCliCommand,
},
command::{
connect::ProvisioningCliCommand, disable::DisableCliCommand,
Expand Down Expand Up @@ -97,6 +97,9 @@ pub enum Command {
/// Manage multicast
#[command()]
Multicast(MulticastCliCommand),
/// Manage geolocation probes and users
#[command()]
Geolocation(GeolocationCliCommand),
/// Export all data to files
#[command()]
Export(ExportCliCommand),
Expand Down
17 changes: 17 additions & 0 deletions client/doublezero/src/cli/geolocation/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use clap::{Args, Subcommand};

pub mod probe;

use probe::ProbeCliCommand;

#[derive(Args, Debug)]
pub struct GeolocationCliCommand {
#[command(subcommand)]
pub command: GeolocationCommands,
}

#[derive(Subcommand, Debug)]
pub enum GeolocationCommands {
/// Manage geolocation probes
Probe(ProbeCliCommand),
}
30 changes: 30 additions & 0 deletions client/doublezero/src/cli/geolocation/probe.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
use clap::{Args, Subcommand};
use doublezero_cli::geolocation::probe::{
add_parent::AddParentGeoProbeCliCommand, create::CreateGeoProbeCliCommand,
delete::DeleteGeoProbeCliCommand, get::GetGeoProbeCliCommand, list::ListGeoProbeCliCommand,
remove_parent::RemoveParentGeoProbeCliCommand, update::UpdateGeoProbeCliCommand,
};

#[derive(Args, Debug)]
pub struct ProbeCliCommand {
#[command(subcommand)]
pub command: ProbeCommands,
}

#[derive(Subcommand, Debug)]
pub enum ProbeCommands {
/// Create a new geolocation probe
Create(CreateGeoProbeCliCommand),
/// Update an existing probe
Update(UpdateGeoProbeCliCommand),
/// Delete a probe
Delete(DeleteGeoProbeCliCommand),
/// Get details of a specific probe
Get(GetGeoProbeCliCommand),
/// List all probes
List(ListGeoProbeCliCommand),
/// Add a parent device to a probe
AddParent(AddParentGeoProbeCliCommand),
/// Remove a parent device from a probe
RemoveParent(RemoveParentGeoProbeCliCommand),
}
1 change: 1 addition & 0 deletions client/doublezero/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pub mod config;
pub mod contributor;
pub mod device;
pub mod exchange;
pub mod geolocation;
pub mod globalconfig;
pub mod link;
pub mod location;
Expand Down
31 changes: 28 additions & 3 deletions client/doublezero/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use crate::cli::{
config::ConfigCommands,
device::{DeviceCommands, InterfaceCommands},
exchange::ExchangeCommands,
geolocation::{probe::ProbeCommands, GeolocationCommands},
globalconfig::{
AirdropCommands, AuthorityCommands, FeatureFlagsCommands, FoundationAllowlistCommands,
GlobalConfigCommands, QaAllowlistCommands,
Expand All @@ -22,9 +23,11 @@ use crate::cli::{
user::UserCommands,
};
use doublezero_cli::{
checkversion::check_version, doublezerocommand::CliCommandImpl, version::VersionCliCommand,
checkversion::check_version, doublezerocommand::CliCommandImpl,
geoclicommand::GeoCliCommandImpl, version::VersionCliCommand,
};
use doublezero_sdk::{DZClient, ProgramVersion};
use doublezero_sdk::{geolocation::client::GeoClient, DZClient, ProgramVersion};
use doublezero_serviceability::pda::get_globalstate_pda;
use servicecontroller::ServiceControllerImpl;

#[derive(Parser, Debug)]
Expand All @@ -47,6 +50,9 @@ struct App {
/// DZ program ID (testnet or devnet)
#[arg(long, value_name = "PROGRAM_ID", global = true)]
program_id: Option<String>,
/// Geolocation program ID
#[arg(long, value_name = "GEO_PROGRAM_ID", global = true)]
geo_program_id: Option<String>,
/// Path to the keypair file
#[arg(long, value_name = "KEYPAIR", global = true)]
keypair: Option<PathBuf>,
Expand Down Expand Up @@ -106,7 +112,7 @@ async fn main() -> eyre::Result<()> {
(app.url, app.ws, app.program_id)
};

let dzclient = DZClient::new(url, ws, program_id, app.keypair)?;
let dzclient = DZClient::new(url.clone(), ws, program_id, app.keypair.clone())?;
let client = CliCommandImpl::new(&dzclient);

let stdout = std::io::stdout();
Expand Down Expand Up @@ -351,6 +357,25 @@ async fn main() -> eyre::Result<()> {
cli::multicast::MulticastCommands::Unpublish(args) => args.execute(&client).await,
},

Command::Geolocation(command) => {
let geo_client =
GeoClient::new(url.clone(), app.geo_program_id.clone(), app.keypair.clone())?;
let svc_program_id = *dzclient.get_program_id();
let (globalstate_pk, _) = get_globalstate_pda(&svc_program_id);
let geo_cli = GeoCliCommandImpl::new(&geo_client, &dzclient, globalstate_pk);
match command.command {
GeolocationCommands::Probe(command) => match command.command {
ProbeCommands::Create(args) => args.execute(&geo_cli, &mut handle),
ProbeCommands::Update(args) => args.execute(&geo_cli, &mut handle),
ProbeCommands::Delete(args) => args.execute(&geo_cli, &mut handle),
ProbeCommands::Get(args) => args.execute(&geo_cli, &mut handle),
ProbeCommands::List(args) => args.execute(&geo_cli, &mut handle),
ProbeCommands::AddParent(args) => args.execute(&geo_cli, &mut handle),
ProbeCommands::RemoveParent(args) => args.execute(&geo_cli, &mut handle),
},
}
}

Command::Resource(command) => match command.command {
cli::resource::ResourceCommands::Allocate(args) => args.execute(&client, &mut handle),
cli::resource::ResourceCommands::Create(args) => args.execute(&client, &mut handle),
Expand Down
Loading