// NewClient creates a new Client type, creating the connection
// to the server specified by the host and port arguments. If
// the connection fails, an error is returned.
559543
func NewClient(host string, port int) (client *Client, err error) {
	client = new(Client)
	client.Host = host
	client.Port = port
	client.Connection, err = net.Dial("tcp", fmt.Sprintf("%v:%v", client.Host, client.Port))
	return
}
878669
func NewClient(cert tls.Certificate) (*http.Client, error) {
	config := &tls.Config{
		Certificates: []tls.Certificate{cert},
	}
	config.BuildNameToCertificate()
	transport := &http.Transport{TLSClientConfig: config}

	if err := http2.ConfigureTransport(transport); err != nil {
		return nil, err
	}

	return &http.Client{Transport: transport}, nil
}
340994
func NewClient(opts *NewClientOptions) (*Client, error) {
	if opts == nil {
		return nil, ErrClientOptionsRequired
	}
	if opts.Cluster != nil {
		return newClientUsingCluster(opts.Cluster)
	}
	if opts.RemoteAddresses != nil {
		return newClientUsingAddresses(opts.Port, opts.RemoteAddresses)
	}
	return nil, ErrClientMissingRequiredData
}
803422
func NewClient(uri, key string) (Client, error) {
	return NewClientWithHTTP(uri, key, httphelper.RetryClient)
}
930398
func NewClient(addr string) (*Client, error) {
	client, err := rpcutils.GetCachedClient(addr)
	if err != nil {
		return nil, err
	}
	s := new(Client)
	s.addr = addr
	s.rpcClient = client
	return s, nil
}
230740
func NewClient(endpoint string, opts ...ClientOption) *Client {
	c := &Client{
		endpoint: endpoint,
		Log:      func(string) {},
	}
	for _, optionFunc := range opts {
		optionFunc(c)
	}
	if c.httpClient == nil {
		c.httpClient = http.DefaultClient
	}
	return c
}
631840
func NewClient(dialTimeout time.Duration, allowV2 bool) Client {
	return &client{
		dialTimeout: dialTimeout,
		connections: make(map[string]*connection),
		allowV2:     allowV2,
	}
}
1189064
func NewClient(credentials Credentials, debug bool) (*Client, error) {
	credentials.init()
	client := &Client{
		Credentials: credentials,
		debug:       debug,
	}

	return client, nil
}
987719
func NewClient(url string, httpClient *http.Client) *Client {
	if httpClient == nil {
		httpClient = http.DefaultClient
	}
	return &Client{
		url:        url,
		httpClient: httpClient,
	}
}
863965
func NewClient(conf ClientConfig) (*Client, error) {
	if conf.SampleRate == 0 {
		conf.SampleRate = defaultSampleRate
	}
	if conf.APIHost == "" {
		conf.APIHost = defaultAPIHost
	}
	if conf.Dataset == "" {
		conf.Dataset = defaultDataset
	}

	c := &Client{
		logger: conf.Logger,
	}
	c.ensureLogger()

	if conf.Transmission == nil {
		c.transmission = &transmission.Honeycomb{
			MaxBatchSize:         DefaultMaxBatchSize,
			BatchTimeout:         DefaultBatchTimeout,
			MaxConcurrentBatches: DefaultMaxConcurrentBatches,
			PendingWorkCapacity:  DefaultPendingWorkCapacity,
			UserAgentAddition:    UserAgentAddition,
			Logger:               c.logger,
			Metrics:              sd,
		}
	} else {
		c.transmission = conf.Transmission
	}
	if err := c.transmission.Start(); err != nil {
		c.logger.Printf("transmission client failed to start: %s", err.Error())
		return nil, err
	}

	c.builder = &Builder{
		WriteKey:   conf.APIKey,
		Dataset:    conf.Dataset,
		SampleRate: conf.SampleRate,
		APIHost:    conf.APIHost,
		dynFields:  make([]dynamicField, 0, 0),
		fieldHolder: fieldHolder{
			data: make(map[string]interface{}),
		},
		client: c,
	}

	return c, nil
}
81285
func NewClient(network, local, scsynth string, timeout time.Duration) (*Client, error) {
	addr, err := net.ResolveUDPAddr(network, local)
	if err != nil {
		return nil, err
	}
	c := &Client{
		errChan:        make(chan error),
		bufferInfoChan: make(chan osc.Message),
		doneChan:       make(chan osc.Message, numDoneHandlers),
		gqueryTreeChan: make(chan osc.Message),
		statusChan:     make(chan osc.Message),
		addr:           addr,
		nextSynthID:    1000,
	}
	if err := c.Connect(scsynth, timeout); err != nil {
		return nil, err
	}
	return c, nil
}
563137
func NewClient(rootPath string) *Client {
	client := &Client{
		RootPath:    rootPath,
		NodeVersion: DefaultNodeVersion,
		NpmVersion:  DefaultNpmVersion,
	}

	return client
}
928749
func NewClient() *Client {
	client := &Client{
		api:       C.Create(),
		Variables: map[SettableVariable]string{},
		Trim:      true,
		shouldInit: true,
	}
	return client
}
284496
func NewClient(opt *Options) *Client {
	opt.init()

	c := Client{
		baseClient: baseClient{
			opt:      opt,
			connPool: newConnPool(opt),
		},
	}
	c.baseClient.init()
	c.init()

	return &c
}
421621
func newClient(server string, opts ...client.ClientOption) *client.Client {
	if server == "" {
		return client.NewOrFail(opts...)
	}
	cl := client.NewOrFail(append(opts[:len(opts):cap(opts)], client.OptionServer(server))...)
	if err := cl.SetupAuth(); err != nil {
		log.Fatalf("Could not setup auth for connecting to %v: %v", server, err)
	}
	return cl
}
114388
func NewClient(w io.Writer, r io.Reader) *Client {
	return &Client{
		r: NewReader(r),
		w: NewWriter(w),
	}
}
854638
func NewClient(baseAddr string) *Client {
	return &Client{
		baseAddr: baseAddr,
		client:   &http.Client{},
	}
}