func check(host string) (string, bool) {
	var err error
	var info *sslscan.AnalyzeInfo
	showServerMessage()
	params := sslscan.AnalyzeParams{
		Public:         options.GetB(OPT_PUBLIC),
		StartNew:       options.GetB(OPT_AVOID_CACHE),
		FromCache:      !options.GetB(OPT_AVOID_CACHE),
		IgnoreMismatch: options.GetB(OPT_IGNORE_MISMATCH),
	}
	fmtc.TPrintf("{*}%s{!} → {s}Preparing for tests…{!}", host)
	ap, err := api.Analyze(host, params)
	if err != nil {
		fmtc.TPrintf("{*}%s{!} → {r}%v{!}\n", host, err)
		return "T", false
	}
	for {
		info, err = ap.Info(false, params.FromCache)
		if err != nil {
			fmtc.TPrintf("{*}%s{!} → {r}%v{!}\n", host, err)
			return "Err", false
		}
		if info.Status == sslscan.STATUS_ERROR {
			fmtc.TPrintf("{*}%s{!} → {r}%s{!}\n", host, info.StatusMessage)
			return "Err", false
		} else if info.Status == sslscan.STATUS_READY {
			break
		}
		if len(info.Endpoints) != 0 {
			message := getStatusInProgress(info.Endpoints)
			if message != "" {
				fmtc.TPrintf("{*}%s{!} → {s}%s…{!}", host, message)
			}
		}
		if info.Status == sslscan.STATUS_IN_PROGRESS {
			time.Sleep(DELAY_PROGRESS)
		} else {
			time.Sleep(DELAY_PRE_CHECK)
		}
	}
	expiryMessage := getExpiryMessage(ap, maxLeftToExpiry)
	if len(info.Endpoints) == 1 {
		fmtc.TPrintf("{*}%s{!} → "+getColoredGrade(info.Endpoints[0].Grade)+expiryMessage+"\n", host)
	} else {
		fmtc.TPrintf("{*}%s{!} → "+getColoredGrades(info.Endpoints)+expiryMessage+"\n", host)
	}
	if options.GetB(OPT_DETAILED) {
		printDetailedInfo(ap, true)
	}
	lowestGrade, _ := getGrades(info.Endpoints)
	return lowestGrade, expiryMessage != ""
}
check check some host
package cli
import (
	"errors"
	"fmt"
	"io/ioutil"
	"os"
	"runtime"
	"strconv"
	"strings"
	"time"
	"pkg.re/essentialkaos/ek.v12/fmtc"
	"pkg.re/essentialkaos/ek.v12/fmtutil"
	"pkg.re/essentialkaos/ek.v12/fsutil"
	"pkg.re/essentialkaos/ek.v12/options"
	"pkg.re/essentialkaos/ek.v12/strutil"
	"pkg.re/essentialkaos/ek.v12/usage"
	"pkg.re/essentialkaos/ek.v12/usage/completion/bash"
	"pkg.re/essentialkaos/ek.v12/usage/completion/fish"
	"pkg.re/essentialkaos/ek.v12/usage/completion/zsh"
	"pkg.re/essentialkaos/ek.v12/usage/man"
	"pkg.re/essentialkaos/ek.v12/usage/update"
	"pkg.re/essentialkaos/sslscan.v13"
)
const (
	APP  = "SSLScan Client"
	VER  = "2.7.0"
	DESC = "Command-line client for the SSL Labs API"
)
const (
	OPT_FORMAT          = "f:format"
	OPT_DETAILED        = "d:detailed"
	OPT_IGNORE_MISMATCH = "i:ignore-mismatch"
	OPT_AVOID_CACHE     = "c:avoid-cache"
	OPT_PUBLIC          = "p:public"
	OPT_PERFECT         = "P:perfect"
	OPT_MAX_LEFT        = "M:max-left"
	OPT_QUIET           = "q:quiet"
	OPT_NOTIFY          = "n:notify"
	OPT_NO_COLOR        = "nc:no-color"
	OPT_HELP            = "h:help"
	OPT_VER             = "v:version"
	OPT_COMPLETION   = "completion"
	OPT_GENERATE_MAN = "generate-man"
)
const (
	DELAY_PRE_CHECK = 2 * time.Second
	DELAY_PROGRESS  = 6 * time.Second
)
const (
	FORMAT_TEXT = "text"
	FORMAT_YAML = "yaml"
	FORMAT_JSON = "json"
	FORMAT_XML  = "xml"
)
type HostCheckInfo struct {
	Host            string               `json:"host"`
	LowestGrade     string               `json:"lowestGrade"`
	HighestGrade    string               `json:"highestGrade"`
	LowestGradeNum  float64              `json:"lowestGradeNum"`
	HighestGradeNum float64              `json:"highestGradeNum"`
	Endpoints       []*EndpointCheckInfo `json:"endpoints"`
}
type EndpointCheckInfo struct {
	IPAdress string  `json:"ipAddress"`
	Grade    string  `json:"grade"`
	GradeNum float64 `json:"gradeNum"`
}
var optMap = options.Map{
	OPT_FORMAT:          {},
	OPT_MAX_LEFT:        {},
	OPT_DETAILED:        {Type: options.BOOL},
	OPT_IGNORE_MISMATCH: {Type: options.BOOL},
	OPT_AVOID_CACHE:     {Type: options.BOOL},
	OPT_PUBLIC:          {Type: options.BOOL},
	OPT_PERFECT:         {Type: options.BOOL},
	OPT_QUIET:           {Type: options.BOOL},
	OPT_NOTIFY:          {Type: options.BOOL},
	OPT_NO_COLOR:        {Type: options.BOOL},
	OPT_HELP:            {Type: options.BOOL, Alias: "u:usage"},
	OPT_VER:             {Type: options.BOOL, Alias: "ver"},
	OPT_COMPLETION:   {},
	OPT_GENERATE_MAN: {Type: options.BOOL},
}
var gradeNumMap = map[string]float64{
	"A+":  4.3,
	"A":   4.0,
	"A-":  3.7,
	"B":   3.0,
	"C":   2.0,
	"D":   1.0,
	"E":   0.5,
	"F":   0.0,
	"T":   0.0,
	"M":   0.0,
	"Err": 0.0,
}
var api *sslscan.API
var maxLeftToExpiry int64
var serverMessageShown bool
func Init() {
	args, errs := options.Parse(optMap)
	if len(errs) != 0 {
		printError("Arguments parsing errors:")
		for _, err := range errs {
			printError("  %v", err)
		}
		os.Exit(1)
	}
	if options.Has(OPT_COMPLETION) {
		os.Exit(genCompletion())
	}
	if options.Has(OPT_GENERATE_MAN) {
		os.Exit(genMan())
	}
	configureUI()
	prepare()
	if options.GetB(OPT_VER) {
		showAbout()
		return
	}
	if options.GetB(OPT_HELP) || len(args) == 0 {
		showUsage()
		return
	}
	runtime.GOMAXPROCS(2)
	process(args)
}
func configureUI() {
	if options.GetB(OPT_NO_COLOR) {
		fmtc.DisableColors = true
	}
	fmtutil.SeparatorSymbol = "–"
}
func prepare() {
	if !options.Has(OPT_MAX_LEFT) {
		return
	}
	var err error
	maxLeftToExpiry, err = parseMaxLeft(options.GetS(OPT_MAX_LEFT))
	if err != nil {
		printError(err.Error())
		os.Exit(1)
	}
}
func process(args []string) {
	var (
		ok    bool
		err   error
		hosts []string
	)
	api, err = sslscan.NewAPI("SSLCli", VER)
	if err != nil {
		if !options.GetB(OPT_FORMAT) {
			printError(err.Error())
		}
		os.Exit(1)
	}
	ok = true
	hosts = args
	if fsutil.CheckPerms("FR", hosts[0]) {
		hosts, err = readHostList(hosts[0])
		if err != nil && options.GetB(OPT_FORMAT) {
			printError(err.Error())
			os.Exit(1)
		}
	}
	var grade string
	var expiredSoon bool
	var checksInfo []*HostCheckInfo
	var checkInfo *HostCheckInfo
	for _, host := range hosts {
		switch {
		case options.GetB(OPT_QUIET):
			grade, expiredSoon, _ = quietCheck(host)
		case options.GetB(OPT_FORMAT):
			grade, expiredSoon, checkInfo = quietCheck(host)
			checksInfo = append(checksInfo, checkInfo)
		default:
			grade, expiredSoon = check(host)
			fmtc.NewLine()
		}
		switch {
		case options.GetB(OPT_PERFECT) && grade != "A+",
			strutil.Head(grade, 1) != "A",
			expiredSoon:
			ok = false
		}
	}
	if options.Has(OPT_FORMAT) {
		renderReport(checksInfo)
	}
	if options.GetB(OPT_NOTIFY) {
		fmtc.Bell()
	}
	if !ok {
		os.Exit(1)
	}
}