code: func NewClient(config *ClientConfig) (c *Client) {
  	if config.MinPort == 0 && config.MaxPort == 0 {
  		config.MinPort = 10000
  		config.MaxPort = 25000
  	}
  
  	if config.StartTimeout == 0 {
  		config.StartTimeout = 1 * time.Minute
  	}
  
  	if config.Stderr == nil {
  		config.Stderr = ioutil.Discard
  	}
  
  	if config.SyncStdout == nil {
  		config.SyncStdout = ioutil.Discard
  	}
  	if config.SyncStderr == nil {
  		config.SyncStderr = ioutil.Discard
  	}
  
  	if config.AllowedProtocols == nil {
  		config.AllowedProtocols = []Protocol{ProtocolNetRPC}
  	}
  
  	if config.Logger == nil {
  		config.Logger = hclog.New(&hclog.LoggerOptions{
  			Output: hclog.DefaultOutput,
  			Level:  hclog.Trace,
  			Name:   "plugin",
  		})
  	}
  
  	c = &Client{
  		config: config,
  		logger: config.Logger,
  	}
  	if config.Managed {
  		managedClientsLock.Lock()
  		managedClients = append(managedClients, c)
  		managedClientsLock.Unlock()
  	}
  
  	return
  }
docs: // Creates a new plugin client which manages the lifecycle of an external
  // plugin and gets the address for the RPC connection.
  //
  // The client must be cleaned up at some point by calling Kill(). If
  // the client is a managed client (created with NewManagedClient) you
  // can just call CleanupClients at the end of your program and they will
  // be properly cleaned.