net_cli/opts/
dns.rs

1// Copyright 2022 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5use argh::{ArgsInfo, FromArgs};
6
7#[derive(ArgsInfo, FromArgs, Clone, Debug, PartialEq)]
8#[argh(subcommand, name = "dns")]
9/// commands to control the dns resolver
10pub struct Dns {
11    #[argh(subcommand)]
12    pub dns_cmd: DnsEnum,
13}
14
15#[derive(ArgsInfo, FromArgs, Clone, Debug, PartialEq)]
16#[argh(subcommand)]
17pub enum DnsEnum {
18    Lookup(Lookup),
19}
20
21#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
22#[argh(subcommand, name = "lookup")]
23/// performs dns resolution on the specified hostname
24pub struct Lookup {
25    #[argh(positional)]
26    pub hostname: String,
27    #[argh(option, default = "true")]
28    /// include ipv4 results (defaults to true)
29    pub ipv4: bool,
30    #[argh(option, default = "true")]
31    /// include ipv6 results (defaults to true)
32    pub ipv6: bool,
33    #[argh(option, default = "true")]
34    /// sort addresses in order of preference (defaults to true)
35    pub sort: bool,
36}