Skip to content

subnet qol#59

Open
michaeldjeffrey wants to merge 3 commits into
mainfrom
mj/subnet-qol
Open

subnet qol#59
michaeldjeffrey wants to merge 3 commits into
mainfrom
mj/subnet-qol

Conversation

@michaeldjeffrey
Copy link
Copy Markdown
Contributor

Replaces Org DevaddrConstraint with DevaddrSubnet to print CIDR subnet.

{
  "org": {
    "oui": 1,
    "owner": "13tyMLKRFYURNBQqLSqNJg9k41maP1A7Bh8QYxR13oWv7EnFooc",
    "payer": "112qB3YaH5bZkCnKA5uRH7tBtGNv2Y5B4smv1jsmvGUzgKT71QpE",
    "delegate_keys": [
      "112qB3YaH5bZkCnKA5uRH7tBtGNv2Y5B4smv1jsmvGUzgKT71QpE"
    ],
    "locked": false
  },
  "net_id": "000024",
  "devaddr_constraints": [
    {
      "range": {
        "start_addr": "48000000",
        "end_addr": "480003FF"
      },
      "subnets": [
        "48000000/22"
      ]
    }
  ]
}

Comment thread src/cmds/env.rs
fs::create_dir_all(parent)?;

let do_write = |msg: String| -> Result<Msg> {
if let Some(parent) = args.out_file.parent() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn’t this be if let None why would you need to create all the directories in the supplied path if it already exists?

Comment thread src/lib.rs
let constraints: Vec<DevaddrConstraint> = res
.devaddr_constraints
.into_iter()
.map(|d| d.into())
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you do this conversion to a subnet in a single map like with .map(|d| d.into::<DevAddrConstraint>().to_subnet() and avoid the second iteration?

@jeffgrunewald
Copy link
Copy Markdown
Contributor

Does the description need updated? It looks like the output is going to include a subnet cidr notation address within the constraints object but the code looks like it matches the title in that the entire constraints field is being replaced by a subnet object

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants