func parseFlags() error {
	flag.Parse()

	if len(rawToken) > 0 {
		fmt.Printf("%x\n", sha256.Sum256([]byte(rawToken)))
		os.Exit(0)
		return nil
	}

	if len(listenHost) == 0 {
		return errors.New("host cannot be blank")
	}
	if listenPortHTTPS <= 0 {
		return errors.New("port must be > 0")
	}
	if listenPortHTTP <= 0 {
		return errors.New("http-port must be > 0")
	}
	if len(tokenSHA256) != sha256.BlockSize {
		return errors.New("token must be a valid sha256 sum")
	}

	parts := []string{"https://", listenHost}
	if listenPortHTTPS != 443 {
		parts = append(parts, ":", strconv.Itoa(listenPortHTTPS))
	}

	canonicalHost = fmt.Sprintf("%s", strings.Join(parts, ""))

	log.Println("listen host:", listenHost)
	log.Println("listen tls port:", listenPortHTTPS)
	log.Println("listen http port:", listenPortHTTP)
	log.Println("canonical host:", canonicalHost)
	log.Println("url ttl:", urlTTL)
	log.Println("token:", tokenSHA256)

	return nil
}
// parseFlags reads command line options and ensures the program state is
// configured properly, returning an error if it is not.
parseFlags reads command line options and ensures the program state is
configured properly, returning an error if it is not.
// parseFlags reads command line options and ensures the program state is // configured properly returning an error if it is not .
func parseFlags() error {
	flag.Parse()
	if len(rawToken) > 0 {
		fmt.Printf("%x\n", sha256.Sum256([]byte(rawToken)))
		os.Exit(0)
		return nil
	}
	if len(listenHost) == 0 {
		return errors.New("host cannot be blank")
	}
	if listenPortHTTPS <= 0 {
		return errors.New("port must be > 0")
	}
	if listenPortHTTP <= 0 {
		return errors.New("http-port must be > 0")
	}
	if len(tokenSHA256) != sha256.BlockSize {
		return errors.New("token must be a valid sha256 sum")
	}
	parts := []string{"https://", listenHost}
	if listenPortHTTPS != 443 {
		parts = append(parts, ":", strconv.Itoa(listenPortHTTPS))
	}
	canonicalHost = fmt.Sprintf("%s", strings.Join(parts, ""))
	log.Println("listen host:", listenHost)
	log.Println("listen tls port:", listenPortHTTPS)
	log.Println("listen http port:", listenPortHTTP)
	log.Println("canonical host:", canonicalHost)
	log.Println("url ttl:", urlTTL)
	log.Println("token:", tokenSHA256)
	return nil
}
func parseFlags ( ) error { flag . Parse ( ) if len ( rawToken ) > 0 { fmt . Printf ( " \n " , sha256 . Sum256 ( [ ] byte ( rawToken ) ) ) os . Exit ( 0 ) return nil } if len ( listenHost ) == 0 { return errors . New ( " " ) } if listenPortHTTPS <= 0 { return errors . New ( " " ) } if listenPortHTTP <= 0 { return errors . New ( " " ) } if len ( tokenSHA256 ) != sha256 . BlockSize { return errors . New ( " " ) } parts := [ ] string { " " , listenHost } if listenPortHTTPS != 443 { parts = append ( parts , " " , strconv . Itoa ( listenPortHTTPS ) ) } canonicalHost = fmt . Sprintf ( " " , strings . Join ( parts , " " ) ) log . Println ( " " , listenHost ) log . Println ( " " , listenPortHTTPS ) log . Println ( " " , listenPortHTTP ) log . Println ( " " , canonicalHost ) log . Println ( " " , urlTTL ) log . Println ( " " , tokenSHA256 ) return nil }
parseFlags reads command line options and ensures the program state is
configured properly, returning an error if it is not.
parseFlags reads command line options and ensures the program state is configured properly returning an error if it is not .