├── .gitignore ├── .github ├── FUNDING.yml ├── dependabot.yml └── workflows │ └── release.yml ├── .dockerignore ├── output └── print.go ├── cmd ├── version.go ├── tlsa.go ├── a.go ├── ns.go ├── ds.go ├── txt.go ├── opt.go ├── ptr.go ├── cert.go ├── kx.go ├── loc.go ├── mx.go ├── srv.go ├── soa.go ├── aaaa.go ├── ta.go ├── cname.go ├── dhcid.go ├── dname.go ├── hip.go ├── nsec.go ├── spf.go ├── hinfo.go ├── dnskey.go ├── ipseckey.go ├── naptr.go ├── nsec3.go ├── rptr4.go ├── rptr6.go ├── talink.go ├── dlv.go ├── rrsig.go ├── sshfp.go ├── nsec3param.go └── root.go ├── .goreleaser.yml ├── queries ├── getrptr.go └── getq.go ├── Dockerfile ├── main.go ├── go.mod ├── magefile.go ├── go.sum ├── README.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | dist 3 | dns 4 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: https://www.buymeacoffee.com/ydfPU75 2 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | screen.png 2 | .goreleaser.yml 3 | LICENSE 4 | README.md 5 | .git 6 | dist/ 7 | -------------------------------------------------------------------------------- /output/print.go: -------------------------------------------------------------------------------- 1 | package output 2 | 3 | import ( 4 | "fmt" 5 | "github.com/tidwall/pretty" 6 | ) 7 | 8 | // Print is used to print output json 9 | func Print(b []byte, raw bool) { 10 | if !raw { 11 | result := pretty.Color(b, nil) 12 | fmt.Println(string(result)) 13 | } 14 | 15 | if raw { 16 | fmt.Println(string(b)) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /cmd/version.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/spf13/cobra" 7 | ) 8 | 9 | func init() { 10 | rootCmd.AddCommand(versionCmd) 11 | } 12 | 13 | var version string 14 | 15 | var versionCmd = &cobra.Command{ 16 | Use: "version", 17 | Short: "Print the version number of dns", 18 | Long: `All software has versions. This is dns's`, 19 | Run: func(cmd *cobra.Command, args []string) { 20 | fmt.Printf("version: %s\n", version) 21 | }, 22 | } 23 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: gomod 4 | directory: '/' 5 | schedule: 6 | interval: "weekly" 7 | open-pull-requests-limit: 10 8 | - package-ecosystem: "github-actions" 9 | directory: "/" 10 | schedule: 11 | interval: "weekly" 12 | open-pull-requests-limit: 10 13 | - package-ecosystem: "docker" 14 | directory: "/" 15 | schedule: 16 | interval: "weekly" 17 | open-pull-requests-limit: 10 18 | -------------------------------------------------------------------------------- /.goreleaser.yml: -------------------------------------------------------------------------------- 1 | before: 2 | hooks: 3 | - go mod download 4 | builds: 5 | - env: 6 | - CGO_ENABLED=0 7 | goos: 8 | - linux 9 | - darwin 10 | goarch: 11 | - amd64 12 | - arm64 13 | ldflags: 14 | - -s -w -X github.com/mxssl/dns/cmd.version={{ .Version }} 15 | archives: 16 | - name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}" 17 | files: 18 | - none* 19 | checksum: 20 | name_template: 'checksums.txt' 21 | snapshot: 22 | name_template: "{{ .Tag }}" 23 | changelog: 24 | sort: asc 25 | filters: 26 | exclude: 27 | - '^docs:' 28 | - '^test:' 29 | -------------------------------------------------------------------------------- /queries/getrptr.go: -------------------------------------------------------------------------------- 1 | package queries 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | "net/http" 7 | 8 | "github.com/mxssl/dns/output" 9 | ) 10 | 11 | // GetRptr is used for dns ptr requests 12 | func GetRptr(resolver string, ip string, raw bool) { 13 | url := fmt.Sprintf("%s/%s/x/%s", APIURL, resolver, ip) 14 | 15 | response, err := http.Get(url) 16 | if err != nil { 17 | fmt.Println(err) 18 | } 19 | defer func() { 20 | if err := response.Body.Close(); err != nil { 21 | fmt.Println(err) 22 | } 23 | }() 24 | 25 | content, err := io.ReadAll(response.Body) 26 | if err != nil { 27 | fmt.Println(err) 28 | } 29 | 30 | output.Print(content, raw) 31 | } 32 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.25.5-alpine3.22 as builder 2 | 3 | ENV GO111MODULE=on 4 | ARG VERSION=dev 5 | 6 | WORKDIR /go/src/github.com/mxssl/dns 7 | COPY . . 8 | 9 | # Install external dependcies 10 | RUN apk add --no-cache \ 11 | ca-certificates \ 12 | curl \ 13 | git 14 | 15 | # Compile binary 16 | 17 | RUN CGO_ENABLED=0 \ 18 | GOOS=`go env GOHOSTOS` \ 19 | GOARCH=`go env GOHOSTARCH` \ 20 | go build -v -o dns -ldflags "-X github.com/mxssl/dns/cmd.version=$VERSION" 21 | 22 | # Copy compiled binary to clear Alpine Linux image 23 | FROM alpine:3.23 24 | WORKDIR / 25 | RUN apk add --no-cache ca-certificates 26 | COPY --from=builder /go/src/github.com/mxssl/dns/dns /usr/local/bin/dns 27 | RUN chmod +x /usr/local/bin/dns 28 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package main 16 | 17 | import ( 18 | "github.com/mxssl/dns/cmd" 19 | ) 20 | 21 | func main() { 22 | cmd.Execute() 23 | } 24 | -------------------------------------------------------------------------------- /queries/getq.go: -------------------------------------------------------------------------------- 1 | package queries 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | "net/http" 7 | 8 | "github.com/mxssl/dns/output" 9 | ) 10 | 11 | // APIURL is DNS-LG endpoint 12 | var APIURL = "http://www.dns-lg.com" 13 | 14 | // Resolver is what resolver will we use 15 | var Resolver string 16 | 17 | // GetQ is used for http queries 18 | func GetQ(resolver string, queryType string, domain string, raw bool) { 19 | url := fmt.Sprintf("%s/%s/%s/%s", APIURL, resolver, domain, queryType) 20 | 21 | response, err := http.Get(url) 22 | if err != nil { 23 | fmt.Println(err) 24 | } 25 | defer func() { 26 | if err := response.Body.Close(); err != nil { 27 | fmt.Println(err) 28 | } 29 | }() 30 | 31 | content, err := io.ReadAll(response.Body) 32 | if err != nil { 33 | fmt.Println(err) 34 | } 35 | 36 | output.Print(content, raw) 37 | } 38 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/mxssl/dns 2 | 3 | go 1.25 4 | 5 | require ( 6 | github.com/magefile/mage v1.15.0 7 | github.com/mitchellh/go-homedir v1.1.0 8 | github.com/spf13/cobra v1.10.2 9 | github.com/spf13/viper v1.21.0 10 | github.com/tidwall/pretty v1.2.1 11 | ) 12 | 13 | require ( 14 | github.com/fsnotify/fsnotify v1.9.0 // indirect 15 | github.com/go-viper/mapstructure/v2 v2.4.0 // indirect 16 | github.com/inconshreveable/mousetrap v1.1.0 // indirect 17 | github.com/pelletier/go-toml/v2 v2.2.4 // indirect 18 | github.com/sagikazarmark/locafero v0.12.0 // indirect 19 | github.com/spf13/afero v1.15.0 // indirect 20 | github.com/spf13/cast v1.10.0 // indirect 21 | github.com/spf13/pflag v1.0.10 // indirect 22 | github.com/subosito/gotenv v1.6.0 // indirect 23 | go.yaml.in/yaml/v3 v3.0.4 // indirect 24 | golang.org/x/sys v0.36.0 // indirect 25 | golang.org/x/text v0.29.0 // indirect 26 | gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect 27 | ) 28 | -------------------------------------------------------------------------------- /cmd/tlsa.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 https://github.com/mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "github.com/spf13/cobra" 19 | "github.com/mxssl/dns/queries" 20 | ) 21 | 22 | // tlsaCmd represents the tlsa command 23 | var tlsaCmd = &cobra.Command{ 24 | Use: "tlsa", 25 | Short: "Get TLSA records", 26 | Long: "Get TLSA records", 27 | Args: cobra.ExactArgs(1), 28 | Run: func(cmd *cobra.Command, args []string) { 29 | queries.GetQ(resolver, "tlsa", args[0], raw) 30 | }, 31 | } 32 | 33 | func init() { 34 | rootCmd.AddCommand(tlsaCmd) 35 | } 36 | -------------------------------------------------------------------------------- /cmd/a.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 https://github.com/mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "github.com/spf13/cobra" 19 | "github.com/mxssl/dns/queries" 20 | ) 21 | 22 | // aCmd represents the a command 23 | var aCmd = &cobra.Command{ 24 | Use: "a", 25 | Short: "Get Host Address (A records)", 26 | Long: "Get Host Address (A records)", 27 | Args: cobra.ExactArgs(1), 28 | Run: func(cmd *cobra.Command, args []string) { 29 | queries.GetQ(resolver, "a", args[0], raw) 30 | }, 31 | } 32 | 33 | func init() { 34 | rootCmd.AddCommand(aCmd) 35 | } 36 | -------------------------------------------------------------------------------- /cmd/ns.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 https://github.com/mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "github.com/spf13/cobra" 19 | "github.com/mxssl/dns/queries" 20 | ) 21 | 22 | // nsCmd represents the ns command 23 | var nsCmd = &cobra.Command{ 24 | Use: "ns", 25 | Short: "Get Name Servers (NS records)", 26 | Long: "Get Name Servers (NS records)", 27 | Args: cobra.ExactArgs(1), 28 | Run: func(cmd *cobra.Command, args []string) { 29 | queries.GetQ(resolver, "ns", args[0], raw) 30 | }, 31 | } 32 | 33 | func init() { 34 | rootCmd.AddCommand(nsCmd) 35 | } 36 | -------------------------------------------------------------------------------- /cmd/ds.go: -------------------------------------------------------------------------------- 1 | // Copyright © https://github.com/mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "github.com/spf13/cobra" 19 | "github.com/mxssl/dns/queries" 20 | ) 21 | 22 | // dsCmd represents the ds command 23 | var dsCmd = &cobra.Command{ 24 | Use: "ds", 25 | Short: "Get Delegation Signer (DS records)", 26 | Long: "Get Delegation Signer (DS records)", 27 | Args: cobra.ExactArgs(1), 28 | Run: func(cmd *cobra.Command, args []string) { 29 | queries.GetQ(resolver, "ds", args[0], raw) 30 | }, 31 | } 32 | 33 | func init() { 34 | rootCmd.AddCommand(dsCmd) 35 | } 36 | -------------------------------------------------------------------------------- /cmd/txt.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 https://github.com/mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "github.com/spf13/cobra" 19 | "github.com/mxssl/dns/queries" 20 | ) 21 | 22 | // txtCmd represents the txt command 23 | var txtCmd = &cobra.Command{ 24 | Use: "txt", 25 | Short: "Get Text record (TXT records)", 26 | Long: "Get Text record (TXT records)", 27 | Args: cobra.ExactArgs(1), 28 | Run: func(cmd *cobra.Command, args []string) { 29 | queries.GetQ(resolver, "txt", args[0], raw) 30 | }, 31 | } 32 | 33 | func init() { 34 | rootCmd.AddCommand(txtCmd) 35 | } 36 | -------------------------------------------------------------------------------- /cmd/opt.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 https://github.com/mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "github.com/spf13/cobra" 19 | "github.com/mxssl/dns/queries" 20 | ) 21 | 22 | // optCmd represents the opt command 23 | var optCmd = &cobra.Command{ 24 | Use: "opt", 25 | Short: "Get Option record (OPT records)", 26 | Long: "Get Option record (OPT records)", 27 | Args: cobra.ExactArgs(1), 28 | Run: func(cmd *cobra.Command, args []string) { 29 | queries.GetQ(resolver, "opt", args[0], raw) 30 | }, 31 | } 32 | 33 | func init() { 34 | rootCmd.AddCommand(optCmd) 35 | } 36 | -------------------------------------------------------------------------------- /cmd/ptr.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 https://github.com/mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "github.com/spf13/cobra" 19 | "github.com/mxssl/dns/queries" 20 | ) 21 | 22 | // ptrCmd represents the ptr command 23 | var ptrCmd = &cobra.Command{ 24 | Use: "ptr", 25 | Short: "Get Pointer record (PTR records)", 26 | Long: "Get Pointer record (PTR records)", 27 | Args: cobra.ExactArgs(1), 28 | Run: func(cmd *cobra.Command, args []string) { 29 | queries.GetQ(resolver, "ptr", args[0], raw) 30 | }, 31 | } 32 | 33 | func init() { 34 | rootCmd.AddCommand(ptrCmd) 35 | } 36 | -------------------------------------------------------------------------------- /cmd/cert.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 https://github.com/mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "github.com/spf13/cobra" 19 | "github.com/mxssl/dns/queries" 20 | ) 21 | 22 | // certCmd represents the cert command 23 | var certCmd = &cobra.Command{ 24 | Use: "cert", 25 | Short: "Get Certificate (CERT records)", 26 | Long: "Get Certificate (CERT records)", 27 | Args: cobra.ExactArgs(1), 28 | Run: func(cmd *cobra.Command, args []string) { 29 | queries.GetQ(resolver, "cert", args[0], raw) 30 | }, 31 | } 32 | 33 | func init() { 34 | rootCmd.AddCommand(certCmd) 35 | } 36 | -------------------------------------------------------------------------------- /cmd/kx.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 https://github.com/mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "github.com/spf13/cobra" 19 | "github.com/mxssl/dns/queries" 20 | ) 21 | 22 | // kxCmd represents the kx command 23 | var kxCmd = &cobra.Command{ 24 | Use: "kx", 25 | Short: "Get Key eXchanger record (KX records)", 26 | Long: "Get Key eXchanger record (KX records)", 27 | Args: cobra.ExactArgs(1), 28 | Run: func(cmd *cobra.Command, args []string) { 29 | queries.GetQ(resolver, "kx", args[0], raw) 30 | }, 31 | } 32 | 33 | func init() { 34 | rootCmd.AddCommand(kxCmd) 35 | } 36 | -------------------------------------------------------------------------------- /cmd/loc.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 https://github.com/mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "github.com/spf13/cobra" 19 | "github.com/mxssl/dns/queries" 20 | ) 21 | 22 | // locCmd represents the loc command 23 | var locCmd = &cobra.Command{ 24 | Use: "loc", 25 | Short: "Get Location record (LOC records)", 26 | Long: "Get Location record (LOC records)", 27 | Args: cobra.ExactArgs(1), 28 | Run: func(cmd *cobra.Command, args []string) { 29 | queries.GetQ(resolver, "loc", args[0], raw) 30 | }, 31 | } 32 | 33 | func init() { 34 | rootCmd.AddCommand(locCmd) 35 | } 36 | -------------------------------------------------------------------------------- /cmd/mx.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 https://github.com/mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "github.com/spf13/cobra" 19 | "github.com/mxssl/dns/queries" 20 | ) 21 | 22 | // mxCmd represents the mx command 23 | var mxCmd = &cobra.Command{ 24 | Use: "mx", 25 | Short: "Get Mail Exchange record (MX records)", 26 | Long: "Get Mail Exchange record (MX records)", 27 | Args: cobra.ExactArgs(1), 28 | Run: func(cmd *cobra.Command, args []string) { 29 | queries.GetQ(resolver, "mx", args[0], raw) 30 | }, 31 | } 32 | 33 | func init() { 34 | rootCmd.AddCommand(mxCmd) 35 | } 36 | -------------------------------------------------------------------------------- /cmd/srv.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 https://github.com/mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "github.com/spf13/cobra" 19 | "github.com/mxssl/dns/queries" 20 | ) 21 | 22 | // srvCmd represents the srv command 23 | var srvCmd = &cobra.Command{ 24 | Use: "srv", 25 | Short: "Get Service Locator (SRV records)", 26 | Long: "Get Service Locator (SRV records)", 27 | Args: cobra.ExactArgs(1), 28 | Run: func(cmd *cobra.Command, args []string) { 29 | queries.GetQ(resolver, "srv", args[0], raw) 30 | }, 31 | } 32 | 33 | func init() { 34 | rootCmd.AddCommand(srvCmd) 35 | } 36 | -------------------------------------------------------------------------------- /cmd/soa.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 https://github.com/mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "github.com/spf13/cobra" 19 | "github.com/mxssl/dns/queries" 20 | ) 21 | 22 | // soaCmd represents the soa command 23 | var soaCmd = &cobra.Command{ 24 | Use: "soa", 25 | Short: "Get Start of Authority (SOA record)", 26 | Long: "Get Start of Authority (SOA record)", 27 | Args: cobra.ExactArgs(1), 28 | Run: func(cmd *cobra.Command, args []string) { 29 | queries.GetQ(resolver, "soa", args[0], raw) 30 | }, 31 | } 32 | 33 | func init() { 34 | rootCmd.AddCommand(soaCmd) 35 | } 36 | -------------------------------------------------------------------------------- /cmd/aaaa.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 https://github.com/mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "github.com/spf13/cobra" 19 | "github.com/mxssl/dns/queries" 20 | ) 21 | 22 | // aaaaCmd represents the aaaa command 23 | var aaaaCmd = &cobra.Command{ 24 | Use: "aaaa", 25 | Short: "Get IPv6 Host Address (AAAA records)", 26 | Long: "Get IPv6 Host Address (AAAA records)", 27 | Args: cobra.ExactArgs(1), 28 | Run: func(cmd *cobra.Command, args []string) { 29 | queries.GetQ(resolver, "aaaa", args[0], raw) 30 | }, 31 | } 32 | 33 | func init() { 34 | rootCmd.AddCommand(aaaaCmd) 35 | } 36 | -------------------------------------------------------------------------------- /cmd/ta.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 https://github.com/mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "github.com/spf13/cobra" 19 | "github.com/mxssl/dns/queries" 20 | ) 21 | 22 | // taCmd represents the ta command 23 | var taCmd = &cobra.Command{ 24 | Use: "ta", 25 | Short: "Get DNSSEC Trust Authorities (TA records)", 26 | Long: "Get DNSSEC Trust Authorities (TA records)", 27 | Args: cobra.ExactArgs(1), 28 | Run: func(cmd *cobra.Command, args []string) { 29 | queries.GetQ(resolver, "ta", args[0], raw) 30 | }, 31 | } 32 | 33 | func init() { 34 | rootCmd.AddCommand(taCmd) 35 | } 36 | -------------------------------------------------------------------------------- /cmd/cname.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 https://github.com/mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "github.com/spf13/cobra" 19 | "github.com/mxssl/dns/queries" 20 | ) 21 | 22 | // cnameCmd represents the cname command 23 | var cnameCmd = &cobra.Command{ 24 | Use: "cname", 25 | Short: "Get Canonical Name (CNAME records)", 26 | Long: "Get Canonical Name (CNAME records)", 27 | Args: cobra.ExactArgs(1), 28 | Run: func(cmd *cobra.Command, args []string) { 29 | queries.GetQ(resolver, "cname", args[0], raw) 30 | }, 31 | } 32 | 33 | func init() { 34 | rootCmd.AddCommand(cnameCmd) 35 | } 36 | -------------------------------------------------------------------------------- /cmd/dhcid.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 https://github.com/mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "github.com/spf13/cobra" 19 | "github.com/mxssl/dns/queries" 20 | ) 21 | 22 | // dhcidCmd represents the dhcid command 23 | var dhcidCmd = &cobra.Command{ 24 | Use: "dhcid", 25 | Short: "Get DHCP Identifier (DHCID records)", 26 | Long: "Get DHCP Identifier (DHCID records)", 27 | Args: cobra.ExactArgs(1), 28 | Run: func(cmd *cobra.Command, args []string) { 29 | queries.GetQ(resolver, "dhcid", args[0], raw) 30 | }, 31 | } 32 | 33 | func init() { 34 | rootCmd.AddCommand(dhcidCmd) 35 | } 36 | -------------------------------------------------------------------------------- /cmd/dname.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 https://github.com/mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "github.com/spf13/cobra" 19 | "github.com/mxssl/dns/queries" 20 | ) 21 | 22 | // dnameCmd represents the dname command 23 | var dnameCmd = &cobra.Command{ 24 | Use: "dname", 25 | Short: "Get Delegation name (DNAME records)", 26 | Long: "Get Delegation name (DNAME records)", 27 | Args: cobra.ExactArgs(1), 28 | Run: func(cmd *cobra.Command, args []string) { 29 | queries.GetQ(resolver, "dname", args[0], raw) 30 | }, 31 | } 32 | 33 | func init() { 34 | rootCmd.AddCommand(dnameCmd) 35 | } 36 | -------------------------------------------------------------------------------- /cmd/hip.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 https://github.com/mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "github.com/spf13/cobra" 19 | "github.com/mxssl/dns/queries" 20 | ) 21 | 22 | // hipCmd represents the hip command 23 | var hipCmd = &cobra.Command{ 24 | Use: "hip", 25 | Short: "Get Host Identity Protocol (HIP records)", 26 | Long: "Get Host Identity Protocol (HIP records)", 27 | Args: cobra.ExactArgs(1), 28 | Run: func(cmd *cobra.Command, args []string) { 29 | queries.GetQ(resolver, "hip", args[0], raw) 30 | }, 31 | } 32 | 33 | func init() { 34 | rootCmd.AddCommand(hipCmd) 35 | } 36 | -------------------------------------------------------------------------------- /cmd/nsec.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 https://github.com/mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "github.com/spf13/cobra" 19 | "github.com/mxssl/dns/queries" 20 | ) 21 | 22 | // nsecCmd represents the nsec command 23 | var nsecCmd = &cobra.Command{ 24 | Use: "nsec", 25 | Short: "Get Next-Secure record (NSEC records)", 26 | Long: "Get Next-Secure record (NSEC records)", 27 | Args: cobra.ExactArgs(1), 28 | Run: func(cmd *cobra.Command, args []string) { 29 | queries.GetQ(resolver, "nsec", args[0], raw) 30 | }, 31 | } 32 | 33 | func init() { 34 | rootCmd.AddCommand(nsecCmd) 35 | } 36 | -------------------------------------------------------------------------------- /cmd/spf.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 https://github.com/mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "github.com/spf13/cobra" 19 | "github.com/mxssl/dns/queries" 20 | ) 21 | 22 | // spfCmd represents the spf command 23 | var spfCmd = &cobra.Command{ 24 | Use: "spf", 25 | Short: "Get Sender Policy Framework (SPF records)", 26 | Long: "Get Sender Policy Framework (SPF records)", 27 | Args: cobra.ExactArgs(1), 28 | Run: func(cmd *cobra.Command, args []string) { 29 | queries.GetQ(resolver, "spf", args[0], raw) 30 | }, 31 | } 32 | 33 | func init() { 34 | rootCmd.AddCommand(spfCmd) 35 | } 36 | -------------------------------------------------------------------------------- /cmd/hinfo.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 https://github.com/mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "github.com/spf13/cobra" 19 | "github.com/mxssl/dns/queries" 20 | ) 21 | 22 | // hinfoCmd represents the hinfo command 23 | var hinfoCmd = &cobra.Command{ 24 | Use: "hinfo", 25 | Short: "Get Host Information (HINFO records)", 26 | Long: "Get Host Information (HINFO records)", 27 | Args: cobra.ExactArgs(1), 28 | Run: func(cmd *cobra.Command, args []string) { 29 | queries.GetQ(resolver, "hinfo", args[0], raw) 30 | }, 31 | } 32 | 33 | func init() { 34 | rootCmd.AddCommand(hinfoCmd) 35 | } 36 | -------------------------------------------------------------------------------- /cmd/dnskey.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 https://github.com/mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "github.com/spf13/cobra" 19 | "github.com/mxssl/dns/queries" 20 | ) 21 | 22 | // dnskeyCmd represents the dnskey command 23 | var dnskeyCmd = &cobra.Command{ 24 | Use: "dnskey", 25 | Short: "Get DNS Key record (DNSKEY records)", 26 | Long: "Get DNS Key record (DNSKEY records)", 27 | Args: cobra.ExactArgs(1), 28 | Run: func(cmd *cobra.Command, args []string) { 29 | queries.GetQ(resolver, "dnskey", args[0], raw) 30 | }, 31 | } 32 | 33 | func init() { 34 | rootCmd.AddCommand(dnskeyCmd) 35 | } 36 | -------------------------------------------------------------------------------- /cmd/ipseckey.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 https://github.com/mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "github.com/spf13/cobra" 19 | "github.com/mxssl/dns/queries" 20 | ) 21 | 22 | // ipseckeyCmd represents the ipseckey command 23 | var ipseckeyCmd = &cobra.Command{ 24 | Use: "ipseckey", 25 | Short: "Get IPSec Key (IPSECKEY records)", 26 | Long: "Get IPSec Key (IPSECKEY records)", 27 | Args: cobra.ExactArgs(1), 28 | Run: func(cmd *cobra.Command, args []string) { 29 | queries.GetQ(resolver, "ipseckey", args[0], raw) 30 | }, 31 | } 32 | 33 | func init() { 34 | rootCmd.AddCommand(ipseckeyCmd) 35 | } 36 | -------------------------------------------------------------------------------- /cmd/naptr.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 https://github.com/mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "github.com/spf13/cobra" 19 | "github.com/mxssl/dns/queries" 20 | ) 21 | 22 | // naptrCmd represents the naptr command 23 | var naptrCmd = &cobra.Command{ 24 | Use: "naptr", 25 | Short: "Get Name Authority Pointer (NAPTR records)", 26 | Long: "Get Name Authority Pointer (NAPTR records)", 27 | Args: cobra.ExactArgs(1), 28 | Run: func(cmd *cobra.Command, args []string) { 29 | queries.GetQ(resolver, "naptr", args[0], raw) 30 | }, 31 | } 32 | 33 | func init() { 34 | rootCmd.AddCommand(naptrCmd) 35 | } 36 | -------------------------------------------------------------------------------- /cmd/nsec3.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 https://github.com/mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "github.com/spf13/cobra" 19 | "github.com/mxssl/dns/queries" 20 | ) 21 | 22 | // nsec3Cmd represents the nsec3 command 23 | var nsec3Cmd = &cobra.Command{ 24 | Use: "nsec3", 25 | Short: "Get NSEC record version 3 (NSEC3 records)", 26 | Long: "Get NSEC record version 3 (NSEC3 records)", 27 | Args: cobra.ExactArgs(1), 28 | Run: func(cmd *cobra.Command, args []string) { 29 | queries.GetQ(resolver, "nsec3", args[0], raw) 30 | }, 31 | } 32 | 33 | func init() { 34 | rootCmd.AddCommand(nsec3Cmd) 35 | } 36 | -------------------------------------------------------------------------------- /cmd/rptr4.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 https://github.com/mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "github.com/spf13/cobra" 19 | "github.com/mxssl/dns/queries" 20 | ) 21 | 22 | // rptr4Cmd represents the rptr4 command 23 | var rptr4Cmd = &cobra.Command{ 24 | Use: "rptr4", 25 | Short: "Get reverse (PTR) record from IPv4 addresses", 26 | Long: "Get reverse (PTR) record from IPv4 addresses", 27 | Args: cobra.ExactArgs(1), 28 | Run: func(cmd *cobra.Command, args []string) { 29 | queries.GetRptr(resolver, args[0], raw) 30 | }, 31 | } 32 | 33 | func init() { 34 | rootCmd.AddCommand(rptr4Cmd) 35 | } 36 | -------------------------------------------------------------------------------- /cmd/rptr6.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 https://github.com/mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "github.com/spf13/cobra" 19 | "github.com/mxssl/dns/queries" 20 | ) 21 | 22 | // rptr6Cmd represents the rptr6 command 23 | var rptr6Cmd = &cobra.Command{ 24 | Use: "rptr6", 25 | Short: "Get reverse (PTR) record from IPv4 addresses", 26 | Long: "Get reverse (PTR) record from IPv4 addresses", 27 | Args: cobra.ExactArgs(1), 28 | Run: func(cmd *cobra.Command, args []string) { 29 | queries.GetRptr(resolver, args[0], raw) 30 | }, 31 | } 32 | 33 | func init() { 34 | rootCmd.AddCommand(rptr6Cmd) 35 | } 36 | -------------------------------------------------------------------------------- /cmd/talink.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 https://github.com/mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "github.com/spf13/cobra" 19 | "github.com/mxssl/dns/queries" 20 | ) 21 | 22 | // talinkCmd represents the talink command 23 | var talinkCmd = &cobra.Command{ 24 | Use: "talink", 25 | Short: "Get Trust Anchor LINK (TALINK records)", 26 | Long: "Get Trust Anchor LINK (TALINK records)", 27 | Args: cobra.ExactArgs(1), 28 | Run: func(cmd *cobra.Command, args []string) { 29 | queries.GetQ(resolver, "talink", args[0], raw) 30 | }, 31 | } 32 | 33 | func init() { 34 | rootCmd.AddCommand(talinkCmd) 35 | } 36 | -------------------------------------------------------------------------------- /cmd/dlv.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 https://github.com/mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "github.com/spf13/cobra" 19 | "github.com/mxssl/dns/queries" 20 | ) 21 | 22 | // dlvCmd represents the dlv command 23 | var dlvCmd = &cobra.Command{ 24 | Use: "dlv", 25 | Short: "Get DNSSEC Lookaside Validation record (DLV records)", 26 | Long: "Get DNSSEC Lookaside Validation record (DLV records)", 27 | Args: cobra.ExactArgs(1), 28 | Run: func(cmd *cobra.Command, args []string) { 29 | queries.GetQ(resolver, "dlv", args[0], raw) 30 | }, 31 | } 32 | 33 | func init() { 34 | rootCmd.AddCommand(dlvCmd) 35 | } 36 | -------------------------------------------------------------------------------- /cmd/rrsig.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 https://github.com/mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "github.com/spf13/cobra" 19 | "github.com/mxssl/dns/queries" 20 | ) 21 | 22 | // rrsigCmd represents the rrsig command 23 | var rrsigCmd = &cobra.Command{ 24 | Use: "rrsig", 25 | Short: "Get Resource Records Signature (RRSIG records)", 26 | Long: "Get Resource Records Signature (RRSIG records)", 27 | Args: cobra.ExactArgs(1), 28 | Run: func(cmd *cobra.Command, args []string) { 29 | queries.GetQ(resolver, "rrsig", args[0], raw) 30 | }, 31 | } 32 | 33 | func init() { 34 | rootCmd.AddCommand(rrsigCmd) 35 | } 36 | -------------------------------------------------------------------------------- /cmd/sshfp.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 https://github.com/mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "github.com/spf13/cobra" 19 | "github.com/mxssl/dns/queries" 20 | ) 21 | 22 | // sshfpCmd represents the sshfp command 23 | var sshfpCmd = &cobra.Command{ 24 | Use: "sshfp", 25 | Short: "Get SSH Public Key Fingerprint (SSHFP records)", 26 | Long: "Get SSH Public Key Fingerprint (SSHFP records)", 27 | Args: cobra.ExactArgs(1), 28 | Run: func(cmd *cobra.Command, args []string) { 29 | queries.GetQ(resolver, "sshfp", args[0], raw) 30 | }, 31 | } 32 | 33 | func init() { 34 | rootCmd.AddCommand(sshfpCmd) 35 | } 36 | -------------------------------------------------------------------------------- /cmd/nsec3param.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 https://github.com/mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "github.com/spf13/cobra" 19 | "github.com/mxssl/dns/queries" 20 | ) 21 | 22 | // nsec3paramCmd represents the nsec3param command 23 | var nsec3paramCmd = &cobra.Command{ 24 | Use: "nsec3param", 25 | Short: "Get NSEC3 parameters (NSEC3PARAM records)", 26 | Long: "Get NSEC3 parameters (NSEC3PARAM records)", 27 | Args: cobra.ExactArgs(1), 28 | Run: func(cmd *cobra.Command, args []string) { 29 | queries.GetQ(resolver, "nsec3param", args[0], raw) 30 | }, 31 | } 32 | 33 | func init() { 34 | rootCmd.AddCommand(nsec3paramCmd) 35 | } 36 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: "Release" 2 | 3 | on: 4 | push: 5 | tags: 6 | - '*' 7 | 8 | jobs: 9 | lint: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v6 13 | - uses: actions/setup-go@v6 14 | with: 15 | go-version: '1.25' 16 | - name: golangci-lint 17 | uses: golangci/golangci-lint-action@v9 18 | 19 | docker-release: 20 | needs: lint 21 | runs-on: ubuntu-latest 22 | steps: 23 | - uses: actions/checkout@v6 24 | - name: Set up Go 25 | uses: actions/setup-go@v6 26 | with: 27 | go-version: '1.25' 28 | - name: Install dependencies 29 | run: go get -u github.com/magefile/mage 30 | - name: Docker login 31 | run: docker login --username ${{ secrets.DOCKER_LOGIN }} --password ${{ secrets.DOCKER_PASSWORD }} 32 | - name: dockerRelease 33 | uses: magefile/mage-action@v3 34 | with: 35 | version: latest 36 | args: dockerRelease 37 | 38 | github-release: 39 | needs: lint 40 | runs-on: ubuntu-latest 41 | steps: 42 | - uses: actions/checkout@v6 43 | - name: Set up Go 44 | uses: actions/setup-go@v6 45 | with: 46 | go-version: "1.25" 47 | - name: Run GoReleaser 48 | uses: goreleaser/goreleaser-action@v6 49 | with: 50 | version: latest 51 | args: release --clean 52 | env: 53 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 54 | -------------------------------------------------------------------------------- /cmd/root.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 mxssl 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cmd 16 | 17 | import ( 18 | "fmt" 19 | "os" 20 | 21 | homedir "github.com/mitchellh/go-homedir" 22 | "github.com/spf13/cobra" 23 | "github.com/spf13/viper" 24 | ) 25 | 26 | var cfgFile string 27 | 28 | var resolver string 29 | 30 | var raw bool 31 | 32 | // rootCmd represents the base command when called without any subcommands 33 | var rootCmd = &cobra.Command{ 34 | Use: "dns", 35 | Short: "dns is a CLI for DNS-LG API.", 36 | Long: `dns is a CLI for DNS-LG API.`, 37 | } 38 | 39 | // Execute root command 40 | func Execute() { 41 | if err := rootCmd.Execute(); err != nil { 42 | fmt.Println(err) 43 | os.Exit(1) 44 | } 45 | } 46 | 47 | func init() { 48 | cobra.OnInitialize(initConfig) 49 | 50 | rootCmd.PersistentFlags().StringVarP(&resolver, 51 | "resolver", 52 | "r", 53 | "google1", 54 | "Choice dns resolver") 55 | 56 | rootCmd.PersistentFlags().BoolVar(&raw, 57 | "raw", 58 | false, 59 | "Raw output without color") 60 | } 61 | 62 | func initConfig() { 63 | if cfgFile != "" { 64 | // Use config file from the flag. 65 | viper.SetConfigFile(cfgFile) 66 | } else { 67 | // Find home directory. 68 | home, err := homedir.Dir() 69 | if err != nil { 70 | fmt.Println(err) 71 | os.Exit(1) 72 | } 73 | 74 | // Search config in home directory with name ".dns" (without extension). 75 | viper.AddConfigPath(home) 76 | viper.SetConfigName(".dns") 77 | } 78 | 79 | viper.AutomaticEnv() 80 | 81 | if err := viper.ReadInConfig(); err == nil { 82 | fmt.Println("Using config file:", viper.ConfigFileUsed()) 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /magefile.go: -------------------------------------------------------------------------------- 1 | //go:build mage 2 | // +build mage 3 | 4 | package main 5 | 6 | import ( 7 | "fmt" 8 | "os" 9 | 10 | "github.com/magefile/mage/sh" 11 | ) 12 | 13 | // BinaryName ... 14 | var BinaryName = "dns" 15 | 16 | // DockerRegistry ... 17 | var DockerRegistry = "mxssl" 18 | 19 | // Build the app 20 | func Build() error { 21 | if err := sh.Run("go", "build", "-v", "-o", BinaryName); err != nil { 22 | return err 23 | } 24 | fmt.Printf("%s is successfully built\n", BinaryName) 25 | return nil 26 | } 27 | 28 | // Lint the app 29 | func Lint() error { 30 | if err := sh.RunV("golangci-lint", "run"); err != nil { 31 | return err 32 | } 33 | return nil 34 | } 35 | 36 | // Clean delete compiled binary 37 | func Clean() error { 38 | if !fileExists(BinaryName) { 39 | return fmt.Errorf("cannnot delete binary: %s doesn't exist", BinaryName) 40 | } 41 | if err := sh.Run("rm", "-f", BinaryName); err != nil { 42 | return err 43 | } 44 | fmt.Printf("%s is successfully deleted\n", BinaryName) 45 | return nil 46 | } 47 | 48 | // DockerBuild build container with latest tag 49 | func DockerBuild() error { 50 | containerWithTag := fmt.Sprintf(DockerRegistry + "/" + BinaryName + ":" + "latest") 51 | fmt.Printf("Image: %s\n", containerWithTag) 52 | 53 | if err := sh.RunV("docker", "build", "--tag", containerWithTag, "."); err != nil { 54 | return err 55 | } 56 | 57 | return nil 58 | } 59 | 60 | // DockerTestRun test run latest container 61 | func DockerTestRun() error { 62 | containerWithTag := fmt.Sprintf(DockerRegistry + "/" + BinaryName + ":" + "latest") 63 | fmt.Printf("Image: %s\n", containerWithTag) 64 | 65 | if err := sh.RunV("docker", "container", "run", containerWithTag, "dns", "a", "google.com"); err != nil { 66 | return err 67 | } 68 | 69 | return nil 70 | } 71 | 72 | // DockerRelease build and push container to the registry 73 | func DockerRelease() error { 74 | fmt.Printf("Registry: %s\n", DockerRegistry) 75 | tag, err := getLastGitTag() 76 | if err != nil { 77 | return err 78 | } 79 | fmt.Printf("Git tag: %s\n", tag) 80 | 81 | containerWithTag := fmt.Sprintf("%s/%s:%s", DockerRegistry, BinaryName, tag) 82 | 83 | ver := fmt.Sprintf("VERSION=%s", tag) 84 | 85 | if err := sh.RunV("docker", "build", "--build-arg", ver, "--tag", containerWithTag, "."); err != nil { 86 | return err 87 | } 88 | 89 | if err := sh.RunV("docker", "push", containerWithTag); err != nil { 90 | return err 91 | } 92 | 93 | return nil 94 | } 95 | 96 | // GitHubReleaseDryRun goreleaser dry run 97 | func GitHubReleaseDryRun() error { 98 | tag, err := getLastGitTag() 99 | if err != nil { 100 | return err 101 | } 102 | fmt.Printf("Git tag: %s\n", tag) 103 | 104 | _, ok := os.LookupEnv("GITHUB_TOKEN") 105 | if !ok { 106 | fmt.Println("env variable GITHUB_TOKEN is not set\n") 107 | } 108 | 109 | if err := sh.RunV("goreleaser", "release", "--rm-dist", "--snapshot", "--skip-publish"); err != nil { 110 | return err 111 | } 112 | return nil 113 | } 114 | 115 | // GitHubRelease run goreleaser 116 | func GitHubRelease() error { 117 | tag, err := getLastGitTag() 118 | if err != nil { 119 | return err 120 | } 121 | fmt.Printf("Git tag: %s\n", tag) 122 | 123 | _, ok := os.LookupEnv("GITHUB_TOKEN") 124 | if !ok { 125 | fmt.Println("env variable GITHUB_TOKEN is not set") 126 | } 127 | 128 | if err := sh.RunV("goreleaser", "release", "--rm-dist"); err != nil { 129 | return err 130 | } 131 | return nil 132 | } 133 | 134 | // check that file exists 135 | func fileExists(filename string) bool { 136 | info, err := os.Stat(filename) 137 | if os.IsNotExist(err) { 138 | return false 139 | } 140 | return !info.IsDir() 141 | } 142 | 143 | // obtain latest git tag 144 | func getLastGitTag() (string, error) { 145 | tag, err := sh.Output("git", "describe", "--abbrev=0", "--tags") 146 | if err != nil { 147 | return "", nil 148 | } 149 | return tag, nil 150 | } 151 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= 2 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 3 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 4 | github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= 5 | github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= 6 | github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= 7 | github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= 8 | github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs= 9 | github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= 10 | github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= 11 | github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= 12 | github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= 13 | github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= 14 | github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= 15 | github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= 16 | github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= 17 | github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= 18 | github.com/magefile/mage v1.15.0 h1:BvGheCMAsG3bWUDbZ8AyXXpCNwU9u5CB6sM+HNb9HYg= 19 | github.com/magefile/mage v1.15.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A= 20 | github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= 21 | github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= 22 | github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4= 23 | github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= 24 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 25 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 26 | github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= 27 | github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= 28 | github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 29 | github.com/sagikazarmark/locafero v0.12.0 h1:/NQhBAkUb4+fH1jivKHWusDYFjMOOKU88eegjfxfHb4= 30 | github.com/sagikazarmark/locafero v0.12.0/go.mod h1:sZh36u/YSZ918v0Io+U9ogLYQJ9tLLBmM4eneO6WwsI= 31 | github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I= 32 | github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg= 33 | github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY= 34 | github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo= 35 | github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= 36 | github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= 37 | github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= 38 | github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= 39 | github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= 40 | github.com/spf13/viper v1.21.0 h1:x5S+0EU27Lbphp4UKm1C+1oQO+rKx36vfCoaVebLFSU= 41 | github.com/spf13/viper v1.21.0/go.mod h1:P0lhsswPGWD/1lZJ9ny3fYnVqxiegrlNrEmgLjbTCAY= 42 | github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= 43 | github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= 44 | github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= 45 | github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= 46 | github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= 47 | github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= 48 | go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= 49 | go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= 50 | golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k= 51 | golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= 52 | golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk= 53 | golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4= 54 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 55 | gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= 56 | gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 57 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 58 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 59 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # dns 2 | 3 | `dns` is a simple CLI tool for [DNS-LG API](http://www.dns-lg.com) 4 | 5 | ```sh 6 | dns a github.com 7 | { 8 | "question": [ 9 | { 10 | "name": "github.com.", 11 | "type": "A", 12 | "class": "IN" 13 | } 14 | ], 15 | "answer": [ 16 | { 17 | "name": "github.com.", 18 | "type": "A", 19 | "class": "IN", 20 | "ttl": 60, 21 | "rdlength": 4, 22 | "rdata": "140.82.113.4" 23 | } 24 | ] 25 | } 26 | ``` 27 | 28 | ## Install 29 | 30 | ### Download compiled binary 31 | 32 | - [Linux amd64](https://github.com/mxssl/dns/releases/download/latest/dns_Linux_x86_64.tar.gz) 33 | - [MacOS amd64](https://github.com/mxssl/dns/releases/download/latest/dns_darwin_amd64.tar.gz) 34 | - [MacOS arm64](https://github.com/mxssl/dns/releases/download/latest/dns_darwin_arm64.tar.gz) 35 | 36 | ### Examples 37 | 38 | Linux amd64: 39 | 40 | ```bash 41 | wget https://github.com/mxssl/dns/releases/download/latest/dns_linux_amd64.tar.gz 42 | tar zvxf dns_linux_amd64.tar.gz 43 | mv dns /usr/local/bin/dns 44 | chmod +x /usr/local/bin/dns 45 | rm dns_linux_amd64.tar.gz 46 | ``` 47 | 48 | MacOS amd64: 49 | 50 | ```bash 51 | wget https://github.com/mxssl/dns/releases/download/latest/dns_darwin_amd64.tar.gz 52 | tar zvxf dns_darwin_amd64.tar.gz 53 | mv dns /usr/local/bin/dns 54 | chmod +x /usr/local/bin/dns 55 | rm dns_darwin_amd64.tar.gz 56 | ``` 57 | 58 | MacOS arm64: 59 | 60 | ```bash 61 | wget https://github.com/mxssl/dns/releases/download/latest/dns_darwin_arm64.tar.gz 62 | tar zvxf dns_darwin_arm64.tar.gz 63 | mv dns /usr/local/bin/dns 64 | chmod +x /usr/local/bin/dns 65 | rm dns_darwin_arm64.tar.gz 66 | ``` 67 | 68 | Golang 69 | 70 | ```bash 71 | go install github.com/mxssl/dns@latest 72 | ``` 73 | 74 | Docker 75 | 76 | ```bash 77 | docker \ 78 | container \ 79 | run \ 80 | --rm \ 81 | mxssl/dns:v1.0.10 \ 82 | dns a golang.com 83 | ``` 84 | 85 | ## Usage 86 | 87 | ```bash 88 | dns is a CLI for DNS-LG API. 89 | 90 | Usage: 91 | dns [command] 92 | 93 | Available Commands: 94 | a Get Host Address (A records) 95 | aaaa Get IPv6 Host Address (AAAA records) 96 | cert Get Certificate (CERT records) 97 | cname Get Canonical Name (CNAME records) 98 | dhcid Get DHCP Identifier (DHCID records) 99 | dlv Get DNSSEC Lookaside Validation record (DLV records) 100 | dname Get Delegation name (DNAME records) 101 | dnskey Get DNS Key record (DNSKEY records) 102 | ds Get Delegation Signer (DS records) 103 | help Help about any command 104 | hinfo Get Host Information (HINFO records) 105 | hip Get Host Identity Protocol (HIP records) 106 | ipseckey Get IPSec Key (IPSECKEY records) 107 | kx Get Key eXchanger record (KX records) 108 | loc Get Location record (LOC records) 109 | mx Get Mail Exchange record (MX records) 110 | naptr Get Name Authority Pointer (NAPTR records) 111 | ns Get Name Servers (NS records) 112 | nsec Get Next-Secure record (NSEC records) 113 | nsec3 Get NSEC record version 3 (NSEC3 records) 114 | nsec3param Get NSEC3 parameters (NSEC3PARAM records) 115 | opt Get Option record (OPT records) 116 | ptr Get Pointer record (PTR records) 117 | rptr4 Get reverse (PTR) record from IPv4 addresses 118 | rptr6 Get reverse (PTR) record from IPv4 addresses 119 | rrsig Get Resource Records Signature (RRSIG records) 120 | soa Get Start of Authority (SOA record) 121 | spf Get Sender Policy Framework (SPF records) 122 | srv Get Service Locator (SRV records) 123 | sshfp Get SSH Public Key Fingerprint (SSHFP records) 124 | ta Get DNSSEC Trust Authorities (TA records) 125 | talink Get Trust Anchor LINK (TALINK records) 126 | tlsa Get TLSA records 127 | txt Get Text record (TXT records) 128 | 129 | Flags: 130 | -h, --help help for dns 131 | --raw Raw output without color 132 | -r, --resolver string Choice dns resolver (default "google1") 133 | 134 | Use "dns [command] --help" for more information about a command 135 | ``` 136 | 137 | ## Example 138 | 139 | ```sh 140 | dns a go.dev 141 | { 142 | "question": [ 143 | { 144 | "name": "go.dev.", 145 | "type": "A", 146 | "class": "IN" 147 | } 148 | ], 149 | "answer": [ 150 | { 151 | "name": "go.dev.", 152 | "type": "A", 153 | "class": "IN", 154 | "ttl": 300, 155 | "rdlength": 4, 156 | "rdata": "216.239.34.21" 157 | }, 158 | { 159 | "name": "go.dev.", 160 | "type": "A", 161 | "class": "IN", 162 | "ttl": 300, 163 | "rdlength": 4, 164 | "rdata": "216.239.32.21" 165 | }, 166 | { 167 | "name": "go.dev.", 168 | "type": "A", 169 | "class": "IN", 170 | "ttl": 300, 171 | "rdlength": 4, 172 | "rdata": "216.239.36.21" 173 | }, 174 | { 175 | "name": "go.dev.", 176 | "type": "A", 177 | "class": "IN", 178 | "ttl": 300, 179 | "rdlength": 4, 180 | "rdata": "216.239.38.21" 181 | } 182 | ] 183 | } 184 | ``` 185 | 186 | ## Resolver 187 | 188 | `google1` is used by default 189 | 190 | You can use these resolvers: 191 | 192 | | Name | IP | 193 | | ---------- | -------------- | 194 | | cloudflare | 1.1.1.1 | 195 | | google1 | 8.8.8.8 | 196 | | google2 | 8.8.4.4 | 197 | | he | 74.82.42.42 | 198 | | opendns1 | 208.67.222.222 | 199 | | opendns2 | 208.67.220.220 | 200 | | quad9 | 9.9.9.9 | 201 | 202 | ## Development 203 | 204 | [Mage](https://github.com/magefile/mage) is used as an alternative to `make`. 205 | 206 | ```sh 207 | mage -l 208 | Targets: 209 | build the app 210 | clean delete compiled binary 211 | dockerBuild build container with latest tag 212 | dockerRelease build and push container to the registry 213 | dockerTestRun test run latest container 214 | gitHubRelease run goreleaser 215 | gitHubReleaseDryRun goreleaser dry run 216 | lint the app 217 | ``` 218 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | --------------------------------------------------------------------------------