Skip to content

Geolocation: Add OutboundIcmp target type to onchain program, SDKs, and CLI #3406

@ben-dz

Description

@ben-dz

Parent: #3404

Add a new OutboundIcmp target type (= 2) across the onchain program, SDKs, and CLI. This type is like Outbound (uses an IPv4 address) but instructs the geoprobe-agent to use ICMP pings instead of TWAMP probes. It does not need a location_offset_port or TWAMP port.

Changes

Smart Contract (smartcontract/programs/doublezero-geolocation/)

  • state/geolocation_user.rs: Add OutboundIcmp = 2 to GeoLocationTargetType enum. Update Display impl.
  • processors/geolocation_user/add_target.rs: Validate OutboundIcmp targets the same as Outbound (public IPv4 required), but location_offset_port should be 0 (unused) and target_pk should be default.
  • processors/geolocation_user/remove_target.rs: Handle OutboundIcmp in target matching (same as Outbound — match by IP address).
  • Unit + integration tests: Add OutboundIcmp test cases for add, remove, serialization round-trip.

Rust SDK (smartcontract/sdk/rs/)

  • geolocation/geolocation_user/add_target.rs: Add validation branch for OutboundIcmp (require public IP, reject non-default target_pk).
  • geolocation/geolocation_user/remove_target.rs: Handle OutboundIcmp in remove validation.

Rust CLI (smartcontract/cli/)

  • geolocation/user/add_target.rs: Add OutboundIcmp to the TargetType clap enum. For OutboundIcmp, require --target-ip, reject --target-pk, and don't require --target-port.
  • geolocation/user/remove_target.rs: Add OutboundIcmp to the TargetType enum and handle it like Outbound (match by IP).
  • geolocation/user/get.rs: Display OutboundIcmp targets correctly in TargetDisplay.

Go SDK (sdk/geolocation/go/)

  • state.go: Add GeoLocationTargetTypeOutboundIcmp = 2. Update String() and deserialization validation bound.
  • state_test.go: Add round-trip and string tests for the new type.

Acceptance

  • doublezero geolocation user add-target --type outbound-icmp --target-ip 8.8.8.8 --probe <probe> succeeds
  • doublezero geolocation user get --user <code> shows the target as type outbound-icmp
  • Go SDK deserializes OutboundIcmp targets without error
  • All existing tests still pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions