dic

package module
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2026 License: MIT Imports: 16 Imported by: 0

README

dic

Build Status

CLI tool for collecting domain information from multiple DNS servers.

Installation

To install, use go install:

$ go install github.com/ryoma123/dic/cmd/dic@latest

Or with Homebrew:

$ brew install ryoma123/tap/dic

Configuration

The config file is located at ~/.config/dic/config.toml. The directory can be overridden with $DIC_CONFIG_DIR or $XDG_CONFIG_HOME/dic/.

If no config file exists, dic uses a built-in default that queries A records via your system resolver. To customize, run dic edit to create and open the config file.

Usage

Describe settings in config.toml:

[[sec]]
  name = "demo"

  [[sec.args]]
    server = ""
    qtypes = ["a", "txt"]

  [[sec.args]]
    server = "1.1.1.1"
    qtypes = ["a", "txt"]

  [[sec.args]]
    server = "ns"
    qtypes = ["a", "txt"]

Pass one or more domains as arguments:

$ dic example.com www.example.com
[example.com]
  -
    example.com.	40170	IN	A	93.184.216.34
    example.com.	86400	IN	TXT	"v=spf1 -all"
  @1.1.1.1
    example.com.	3200	IN	A	93.184.216.34
    example.com.	5668	IN	TXT	"v=spf1 -all"
 *@a.iana-servers.net.
    example.com.	86400	IN	A	93.184.216.34
    example.com.	86400	IN	TXT	"v=spf1 -all"

[www.example.com]
  -
    www.example.com.	66099	IN	A	93.184.216.34
    www.example.com.	86388	IN	TXT	"v=spf1 -all"
  @1.1.1.1
    www.example.com.	9276	IN	A	93.184.216.34
    www.example.com.	10788	IN	TXT	"v=spf1 -all"
 *@b.iana-servers.net.
    www.example.com.	86400	IN	A	93.184.216.34
    www.example.com.	86400	IN	TXT	"v=spf1 -all"

Run via go run (recommended without -- so flags are parsed normally):

$ go run ./cmd/dic -r 8.8.8.8
$ go run ./cmd/dic -f -r www.example.com

Use a specific config file:

$ go run ./cmd/dic -c ./config.toml -r 8.8.8.8
$ dic -c /path/to/config.toml -f -r www.example.com

Example

Description example of config:

# config.toml.example
[[sec]]
  # [name]
  # Give each section a unique name.
  # It is possible to switch the section used by the option command.
  name = "example"

  [[sec.args]]
    # [server]
    # If blank, query DNS server specified in resolv.conf.
    server = ""
    qtypes = ["a"]

  [[sec.args]]
    # [server]
    # If specified, query that DNS server.
    server = "1.1.1.1"
    qtypes = ["a"]

  [[sec.args]]
    # [server]
    # If you write "ns", get DNS server from NS record and query it.
    server = "ns"
    # [qtypes]
    # Multiple query types available.
    qtypes = ["a", "ns", "cname", "soa", "ptr", "mx", "txt", "aaaa", "any"]

[[sec]]
  name = "example2"
# ...

Commands

help, h

Display a help message.

list, l

Show default session and config description:

$ dic l
DEFAULT SECTION
 resolv

SECTION NAME		SERVER			QUERY TYPES
*resolv			-			[any]

 public			-			[a mx txt]
			1.1.1.1			[a mx txt]

 authoritative		-			[a mx txt]
			ns			[a mx txt]
edit, e

Open and edit config file.

set <section name>, s <section name>

Set a section to use by default.

Options

--name <section name>, -n <section name>

Pass a section for temporary use.

--reverse, -r

Reverse lookup for IP arguments (PTR); domain args remain normal.

--follow-cname, -f

Follow CNAMEs and query A/AAAA for the target name.

--cname-max <n>, -m <n>

Maximum CNAME follow depth (default 5).

--config <path>, -c <path>

Path to config file (default: ./config.toml or GOPATH path).

--version, -v

Display the version of dic.

License

MIT

Author

ryoma123

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Commands = []cli.Command{
	commandList,
	commandEdit,
	commandSet,
}

Commands variable

View Source
var Flags = []cli.Flag{
	flagName,
	flagReverse,
	flagFollowCNAME,
	flagCnameMax,
	flagConfig,
}

Flags variable

Functions

func RunCLI

func RunCLI(ctx *cli.Context) error

RunCLI runs as cli

Types

type Dic

type Dic struct {
	// contains filtered or unexported fields
}

Dic struct

func New

func New(d []string, opts Options) *Dic

New returns Dic

type Options added in v1.0.0

type Options struct {
	Reverse     bool
	FollowCNAME bool
	CnameMax    int
}

Options controls lookup behavior.

Directories

Path Synopsis
cmd
dic command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL