code: func (m *Main) ParseFlags(args ...string) (Options, error) {
  	var opt Options
  	var peers, recursors string
  
  	fs := flag.NewFlagSet("discoverd", flag.ContinueOnError)
  	fs.SetOutput(m.Stderr)
  	fs.StringVar(&opt.DataDir, "data-dir", "", "data directory")
  	fs.StringVar(&peers, "peers", "", "cluster peers")
  	fs.StringVar(&opt.Host, "host", "", "advertised hostname")
  	fs.StringVar(&opt.Addr, "addr", ":1111", "address to serve http and raft from")
  	fs.StringVar(&opt.DNSAddr, "dns-addr", "", "address to service DNS from")
  	fs.StringVar(&recursors, "recursors", "", "upstream recursive DNS servers")
  	fs.StringVar(&opt.Notify, "notify", "", "url to send webhook to after starting listener")
  	fs.BoolVar(&opt.WaitNetDNS, "wait-net-dns", false, "start DNS server after host network is configured")
  	if err := fs.Parse(args); err != nil {
  		return Options{}, err
  	}
  
  	// Split peer hostnames into slice.
  	if peers != "" {
  		opt.Peers = TrimSpaceSlice(strings.Split(peers, ","))
  	}
  
  	// Split recursors into slice.
  	if recursors != "" {
  		opt.Recursors = TrimSpaceSlice(strings.Split(recursors, ","))
  	}
  
  	// Validate options.
  	if opt.DataDir == "" {
  		return opt, errors.New("data directory required")
  	} else if opt.Host == "" {
  		return opt, errors.New("host required")
  	}
  
  	return opt, nil
  }
docs: // ParseFlags parses the command line flags.