35 lines
996 B
Go
Raw Normal View History

2020-12-30 14:54:20 +05:30
package networkclientpool
import (
"github.com/projectdiscovery/fastdialer/fastdialer"
"github.com/projectdiscovery/nuclei/v3/pkg/protocols/common/protocolstate"
"github.com/projectdiscovery/nuclei/v3/pkg/types"
2020-12-30 14:54:20 +05:30
)
var (
normalClient *fastdialer.Dialer
)
// Init initializes the clientpool implementation
2021-08-23 16:21:18 +03:00
func Init(options *types.Options /*TODO review unused parameter*/) error {
2021-09-07 17:31:46 +03:00
// Don't create clients if already created in the past.
2020-12-30 14:54:20 +05:30
if normalClient != nil {
return nil
}
normalClient = protocolstate.Dialer
2020-12-30 14:54:20 +05:30
return nil
}
// Configuration contains the custom configuration options for a client
type Configuration struct{}
// Hash returns the hash of the configuration to allow client pooling
func (c *Configuration) Hash() string {
return ""
}
// Get creates or gets a client for the protocol based on custom configuration
2021-08-23 16:21:18 +03:00
func Get(options *types.Options, configuration *Configuration /*TODO review unused parameters*/) (*fastdialer.Dialer, error) {
2020-12-30 14:54:20 +05:30
return normalClient, nil
}