2024-01-18 04:39:15 +05:30
|
|
|
package compiler
|
|
|
|
|
|
2024-05-25 00:29:04 +05:30
|
|
|
import (
|
2025-07-09 14:47:26 -05:00
|
|
|
"sync"
|
|
|
|
|
|
2024-05-25 00:29:04 +05:30
|
|
|
"github.com/projectdiscovery/nuclei/v3/pkg/types"
|
|
|
|
|
)
|
2024-01-18 04:39:15 +05:30
|
|
|
|
|
|
|
|
// jsprotocolInit
|
|
|
|
|
|
|
|
|
|
var (
|
2024-02-02 02:22:04 +05:30
|
|
|
PoolingJsVmConcurrency = 100
|
|
|
|
|
NonPoolingVMConcurrency = 20
|
2025-07-09 14:47:26 -05:00
|
|
|
m sync.Mutex
|
2024-01-18 04:39:15 +05:30
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Init initializes the javascript protocol
|
|
|
|
|
func Init(opts *types.Options) error {
|
2025-07-09 14:47:26 -05:00
|
|
|
m.Lock()
|
|
|
|
|
defer m.Unlock()
|
2024-07-15 13:27:15 +03:00
|
|
|
|
2024-01-31 01:59:49 +05:30
|
|
|
if opts.JsConcurrency < 100 {
|
|
|
|
|
// 100 is reasonable default
|
|
|
|
|
opts.JsConcurrency = 100
|
|
|
|
|
}
|
2024-02-02 02:22:04 +05:30
|
|
|
PoolingJsVmConcurrency = opts.JsConcurrency
|
|
|
|
|
PoolingJsVmConcurrency -= NonPoolingVMConcurrency
|
2024-01-18 04:39:15 +05:30
|
|
|
return nil
|
|
|
|
|
}
|