// ValidBrowsers are all browsers for which the manifest can be currently installed
549710
func ValidBrowsers() []string {
	keys := make([]string, 0, len(manifestPath[runtime.GOOS]))
	for k := range manifestPath[runtime.GOOS] {
		keys = append(keys, k)
	}
	sort.Strings(keys)
	return keys
}
486287
func validReceiver(recv string) bool {
	if recv == "" {
		// The parse will parse empty receivers, but we don't want to accept them,
		// since it won't generate a usable code snippet.
		return false
	}
	fset := token.NewFileSet()
	_, err := parser.ParseFile(fset, "", "package hack\nfunc ("+recv+") Foo()", 0)
	return err == nil
}
147991
func (a *GrantPermissionsArgs) SetBrowserContextID(browserContextID target.BrowserContextID) *GrantPermissionsArgs {
	a.BrowserContextID = &browserContextID
	return a
}
738842
func validHeaderAcceptJSON(header http.Header) bool {
	if v, found := header["Accept"]; found {
		for _, v := range v {
			if v == "application/json" || v == "*/*" || v == "*/json" || v == "application/*" {
				return true
			}
		}
		return false
	}
	return true
}
1072508
func URLFilters(filters ...*regexp.Regexp) func(*Collector) {
	return func(c *Collector) {
		c.URLFilters = filters
	}
}
963755
func NewSafeBrowser(conf Config) (*SafeBrowser, error) {
	conf = conf.copy()
	if !conf.setDefaults() {
		return nil, errors.New("safebrowsing: invalid configuration")
	}

	// Create the SafeBrowsing object.
	if conf.api == nil {
		var err error
		conf.api, err = newNetAPI(conf.ServerURL, conf.APIKey, conf.ProxyURL)
		if err != nil {
			return nil, err
		}
	}
	if conf.now == nil {
		conf.now = time.Now
	}
	sb := &SafeBrowser{
		config: conf,
		api:    conf.api,
		c:      cache{now: conf.now},
	}

	// TODO: Verify that config.ThreatLists is a subset of the list obtained
	// by "/v4/threatLists" API endpoint.

	// Convert threat lists slice to a map for O(1) lookup.
	sb.lists = make(map[ThreatDescriptor]bool)
	for _, td := range conf.ThreatLists {
		sb.lists[td] = true
	}

	// Setup the logger.
	w := conf.Logger
	if conf.Logger == nil {
		w = ioutil.Discard
	}
	sb.log = log.New(w, "safebrowsing: ", log.Ldate|log.Ltime|log.Lshortfile)

	delay := time.Duration(0)
	// If database file is provided, use that to initialize.
	if !sb.db.Init(&sb.config, sb.log) {
		ctx, cancel := context.WithTimeout(context.Background(), sb.config.RequestTimeout)
		delay, _ = sb.db.Update(ctx, sb.api)
		cancel()
	} else {
		if age := sb.db.SinceLastUpdate(); age < sb.config.UpdatePeriod {
			delay = sb.config.UpdatePeriod - age
		}
	}

	// Start the background list updater.
	sb.done = make(chan bool)
	go sb.updater(delay)
	return sb, nil
}
271547
func ValidCredentials(region string) error {
	svc, err := getService(region)
	if err != nil {
		return fmt.Errorf("failed to get AWS service: %v", err)
	}

	_, err = svc.DescribeInstances(nil)
	awsErr, isAWS := err.(awserr.Error)
	if !isAWS {
		return err
	}

	switch awsErr.Code() {
	case noCredsCode:
		return ErrNoCreds
	case noRegionCode:
		return ErrNoRegion
	}

	return nil
}
1301365
func (a *Azure) ValidConfig() bool {
	return a.SubscriptionID != "" && a.ClientID != "" && a.ClientSecret != "" && a.TenantID != ""
}
511256
func ValidCookieName(name []byte) bool {
	for _, c := range name {
		if !OctetTypes[c].IsToken() {
			return false
		}
	}
	return true
}
675804
func (c *Contact) ValidContact() error {
	if c.Email == "" && c.Number == "" {
		return fmt.Errorf("you must provide either an Email or a Phone Number to create a contact target")
	}

	if c.Number != "" && c.CountryCode == "" {
		return fmt.Errorf("you must provide a Country Code if providing a phone number")
	}

	if c.Provider != "" && (c.Number == "" || c.CountryCode == "") {
		return fmt.Errorf("you must provide CountryCode and Number if Provider is provided")
	}

	return nil
}
545807
func (o *ListTasksParams) validateTags(formats strfmt.Registry) error {

	// uniqueItems: true
	if err := validate.UniqueItems("tags", "query", o.Tags); err != nil {
		return err
	}

	return nil
}
1284917
func ValidTrytes(trytes Trytes) error {
	if !trytesRegex.MatchString(string(trytes)) {
		return ErrInvalidTrytes
	}
	return nil
}
102598
func (ck *HttpCheck) Valid() error {
	if ck.Name == "" {
		return fmt.Errorf("Invalid value for `Name`.  Must contain non-empty string")
	}

	if ck.Hostname == "" {
		return fmt.Errorf("Invalid value for `Hostname`.  Must contain non-empty string")
	}

	if ck.Resolution != 1 && ck.Resolution != 5 && ck.Resolution != 15 &&
		ck.Resolution != 30 && ck.Resolution != 60 {
		return fmt.Errorf("invalid value %v for `Resolution`, allowed values are [1,5,15,30,60]", ck.Resolution)
	}

	if ck.ShouldContain != "" && ck.ShouldNotContain != "" {
		return fmt.Errorf("`ShouldContain` and `ShouldNotContain` must not be declared at the same time")
	}

	return nil
}
891911
func KnownInstallers() map[string]Installer {
	return map[string]Installer{
		"chrome": &whitelistRegistry{
			RegKey:     `SOFTWARE\Google\Chrome\NativeMessagingHosts`,
			FileSuffix: `_chrome`,
		},
		"chromium": &whitelistRegistry{
			RegKey:     `SOFTWARE\Chromium\NativeMessagingHosts`,
			FileSuffix: `_chromium`,
		},
		"firefox": &whitelistRegistry{
			RegKey:     `SOFTWARE\Mozilla\NativeMessagingHosts`,
			FileSuffix: `_firefox`,
		},
	}
}
1102364
func isBrowseURL(s string) (importPath string, ok bool) {
	for _, c := range browsePatterns {
		if m := c.pat.FindStringSubmatch(s); m != nil {
			return c.fn(m), true
		}
	}
	return "", false
}
981069
func (cfg *ScopeCfg) IsValid() bool {
	if cfg == nil ||
		strings.TrimSpace(cfg.Client.Provider) == "" ||
		strings.TrimSpace(cfg.Client.Address) == "" {
		return false
	}

	return true
}
254529
func (c *Client) Valid() bool {
	if c == nil {
		return false
	}

	if c.Client == nil {
		return false
	}

	// Use arbitrary pointer field in the service content.
	// Doesn't matter which one, as long as it is populated by default.
	if c.ServiceContent.SessionManager == nil {
		return false
	}

	return true
}