github.com/projectdiscovery/nuclei/v2@v2.9.15/pkg/protocols/network/networkclientpool/clientpool.go (about)

     1  package networkclientpool
     2  
     3  import (
     4  	"github.com/projectdiscovery/fastdialer/fastdialer"
     5  	"github.com/projectdiscovery/nuclei/v2/pkg/protocols/common/protocolstate"
     6  	"github.com/projectdiscovery/nuclei/v2/pkg/types"
     7  )
     8  
     9  var (
    10  	normalClient *fastdialer.Dialer
    11  )
    12  
    13  // Init initializes the clientpool implementation
    14  func Init(options *types.Options /*TODO review unused parameter*/) error {
    15  	// Don't create clients if already created in the past.
    16  	if normalClient != nil {
    17  		return nil
    18  	}
    19  	normalClient = protocolstate.Dialer
    20  	return nil
    21  }
    22  
    23  // Configuration contains the custom configuration options for a client
    24  type Configuration struct{}
    25  
    26  // Hash returns the hash of the configuration to allow client pooling
    27  func (c *Configuration) Hash() string {
    28  	return ""
    29  }
    30  
    31  // Get creates or gets a client for the protocol based on custom configuration
    32  func Get(options *types.Options, configuration *Configuration /*TODO review unused parameters*/) (*fastdialer.Dialer, error) {
    33  	return normalClient, nil
    34  }