{"modulePath":"github.com/utmstack/nuclei/v3","version":"v3.2.12","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package hosterrorscache\n\n## Constants\n\n```go\nconst DefaultMaxHostsCount = 10000\n```\n\n## Types\n\n```go\ntype Cache struct {\n\tMaxHostError int\n\n\tTrackError []string\n\t// contains filtered or unexported fields\n}\n```\nCache is a cache for host based errors. It allows skipping certain hosts based on an error threshold.\n\nIt uses an LRU cache internally for skipping unresponsive hosts that remain so for a duration.\n\n```go\nfunc New(maxHostError, maxHostsCount int, trackError []string) *Cache\n```\nNew returns a new host max errors cache\n\n```go\nfunc (c *Cache) Check(ctx *contextargs.Context) bool\n```\nCheck returns true if a host should be skipped as it has been unresponsive for a certain number of times.\n\nThe value can be many formats -\n\n  - URL: https?:// type\n  - Host:port type\n  - host type\n\n```go\nfunc (c *Cache) Close()\n```\nClose closes the host errors cache\n\n```go\nfunc (c *Cache) GetKeyFromContext(ctx *contextargs.Context, err error) string\n```\nGetKeyFromContext returns the key for the cache from the context\n\n```go\nfunc (c *Cache) MarkFailed(ctx *contextargs.Context, err error)\n```\nMarkFailed marks a host as failed previously\n\n```go\nfunc (c *Cache) SetVerbose(verbose bool)\n```\nSetVerbose sets the cache to log at verbose level\n\n```go\ntype CacheInterface interface {\n\tSetVerbose(verbose bool)                        // log verbosely\n\tClose()                                         // close the cache\n\tCheck(ctx *contextargs.Context) bool            // return true if the host should be skipped\n\tMarkFailed(ctx *contextargs.Context, err error) // record a failure (and cause) for the host\n}\n```\nCacheInterface defines the signature of the hosterrorscache so that users of Nuclei as embedded lib may implement their own cache\n\n","path":"github.com/utmstack/nuclei/v3/pkg/protocols/common/hosterrorscache","name":"hosterrorscache","synopsis":"","isRedistributable":true}
