Documentation ¶
Index ¶
- Constants
- type Cache
- func (c *Cache) Check(protoType string, ctx *contextargs.Context) bool
- func (c *Cache) Close()
- func (c *Cache) GetKeyFromContext(ctx *contextargs.Context, err error) string
- func (c *Cache) MarkFailed(protoType string, ctx *contextargs.Context, err error)
- func (c *Cache) NormalizeCacheValue(value string) string
- func (c *Cache) SetVerbose(verbose bool)
- type CacheInterface
Constants ¶
const DefaultMaxHostsCount = 10000
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct { MaxHostError int TrackError []string // contains filtered or unexported fields }
Cache is a cache for host based errors. It allows skipping certain hosts based on an error threshold.
It uses an LRU cache internally for skipping unresponsive hosts that remain so for a duration.
func (*Cache) Check ¶
func (c *Cache) Check(protoType string, ctx *contextargs.Context) bool
Check returns true if a host should be skipped as it has been unresponsive for a certain number of times.
The value can be many formats -
- URL: https?:// type
- Host:port type
- host type
func (*Cache) GetKeyFromContext ¶ added in v3.2.8
func (c *Cache) GetKeyFromContext(ctx *contextargs.Context, err error) string
GetKeyFromContext returns the key for the cache from the context
func (*Cache) MarkFailed ¶
func (c *Cache) MarkFailed(protoType string, ctx *contextargs.Context, err error)
MarkFailed marks a host as failed previously
func (*Cache) NormalizeCacheValue ¶ added in v3.3.3
NormalizeCacheValue processes the input value and returns a normalized cache value.
func (*Cache) SetVerbose ¶
SetVerbose sets the cache to log at verbose level
type CacheInterface ¶
type CacheInterface interface { SetVerbose(verbose bool) // log verbosely Close() // close the cache Check(protoType string, ctx *contextargs.Context) bool // return true if the host should be skipped MarkFailed(protoType string, ctx *contextargs.Context, err error) // record a failure (and cause) for the host }
CacheInterface defines the signature of the hosterrorscache so that users of Nuclei as embedded lib may implement their own cache