whereisdns

package
v0.0.0-...-587470e Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WhereIsDnsCmd = &cobra.Command{
	Use: "whereisdns",
	Aliases: []string{
		"dns",
	},
	Short: "this command will help you check where is the dns server in provided CIDR",
	Run: func(cmd *cobra.Command, args []string) {
		ipNets, err := pkg.ParseStringToIPNet(command.Opts.Cidr)
		if err != nil {
			log.Warnf("ParseStringToIPNet failed: %v", err)
			return
		}
		s := false
		for _, ip := range pkg.ParseIPNetToIPs(ipNets) {
			serverAddr := fmt.Sprintf("%s:53", ip.String())
			if checkdns(serverAddr) {
				s = true
			}
			serverAddr = fmt.Sprintf("%s:5353", ip.String())
			if checkdns(serverAddr) {
				s = true
			}
		}
		if s {
			log.Warn("DNS Server Not Found!")
		}
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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