nuclei/v2/pkg/protocols/protocols.go
2020-12-24 01:42:04 +05:30

30 lines
1.1 KiB
Go

package protocols
import (
"github.com/projectdiscovery/nuclei/v2/pkg/output"
"github.com/projectdiscovery/nuclei/v2/pkg/types"
"go.uber.org/ratelimit"
)
// Executer is an interface implemented any protocol based request generator.
type Executer interface {
// Compile compiles the request generators preparing any requests possible.
Compile(options ExecuterOptions) error
// Requests returns the total number of requests the rule will perform
Requests() int64
// Execute executes the protocol requests and returns an output event channel.
Execute(input string) (bool, error)
// ExecuteWithResults executes the protocol requests and returns results instead of writing them.
ExecuteWithResults(input string) ([]output.Event, error)
}
// ExecuterOptions contains the configuration options for executer clients
type ExecuterOptions struct {
// Output is a writer interface for writing output events from executer.
Output output.Writer
// Options contains configuration options for the executer.
Options *types.Options
// RateLimiter is a rate-limiter for limiting sent number of requests.
RateLimiter ratelimit.Limiter
}