mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-18 14:15:26 +00:00
* support for concurrent nuclei engines * clarify LfaAllowed race * remove unused mutex * update LfaAllowed logic to prevent races until it can be reworked for per-execution ID * Update pkg/templates/parser.go Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * debug tests * debug gh action * fixig gh template test * using atomic * using synclockmap * restore tests concurrency * lint * wiring executionId in js fs --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Mzack9999 <mzack9999@protonmail.com>
51 lines
1.2 KiB
Go
51 lines
1.2 KiB
Go
package rdapclientpool
|
|
|
|
import (
|
|
"sync"
|
|
|
|
"github.com/projectdiscovery/gologger"
|
|
"github.com/projectdiscovery/nuclei/v3/pkg/types"
|
|
"github.com/projectdiscovery/rdap"
|
|
)
|
|
|
|
var normalClient *rdap.Client
|
|
var m sync.Mutex
|
|
|
|
// Init initializes the client pool implementation
|
|
func Init(options *types.Options) error {
|
|
m.Lock()
|
|
defer m.Unlock()
|
|
|
|
// Don't create clients if already created in the past.
|
|
if normalClient != nil {
|
|
return nil
|
|
}
|
|
|
|
normalClient = &rdap.Client{}
|
|
if options.Verbose || options.Debug || options.DebugRequests || options.DebugResponse {
|
|
normalClient.Verbose = func(text string) {
|
|
gologger.Debug().Msgf("rdap: %s", text)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func getNormalClient() *rdap.Client {
|
|
m.Lock()
|
|
defer m.Unlock()
|
|
return normalClient
|
|
}
|
|
|
|
// Configuration contains the custom configuration options for a client - placeholder
|
|
type Configuration struct{}
|
|
|
|
// Hash returns the hash of the configuration to allow client pooling - placeholder
|
|
func (c *Configuration) Hash() string {
|
|
return ""
|
|
}
|
|
|
|
// Get creates or gets a client for the protocol based on custom configuration
|
|
func Get(options *types.Options, configuration *Configuration) (*rdap.Client, error) {
|
|
return getNormalClient(), nil
|
|
}
|