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

     1  package rdapclientpool
     2  
     3  import (
     4  	"github.com/projectdiscovery/gologger"
     5  	"github.com/projectdiscovery/nuclei/v2/pkg/types"
     6  	"github.com/projectdiscovery/rdap"
     7  )
     8  
     9  var normalClient *rdap.Client
    10  
    11  // Init initializes the client pool implementation
    12  func Init(options *types.Options) error {
    13  	// Don't create clients if already created in the past.
    14  	if normalClient != nil {
    15  		return nil
    16  	}
    17  
    18  	normalClient = &rdap.Client{}
    19  	if options.Verbose || options.Debug || options.DebugRequests || options.DebugResponse {
    20  		normalClient.Verbose = func(text string) {
    21  			gologger.Debug().Msgf("rdap: %s", text)
    22  		}
    23  	}
    24  	return nil
    25  }
    26  
    27  // Configuration contains the custom configuration options for a client - placeholder
    28  type Configuration struct{}
    29  
    30  // Hash returns the hash of the configuration to allow client pooling - placeholder
    31  func (c *Configuration) Hash() string {
    32  	return ""
    33  }
    34  
    35  // Get creates or gets a client for the protocol based on custom configuration
    36  func Get(options *types.Options, configuration *Configuration) (*rdap.Client, error) {
    37  	return normalClient, nil
    38  }