func NewHTTPClient(conf HTTPConfig) (Client, error) {
	if conf.UserAgent == "" {
		conf.UserAgent = "InfluxDBClient"
	}
	u, err := url.Parse(conf.Addr)
	if err != nil {
		return nil, err
	} else if u.Scheme != "http" && u.Scheme != "https" {
		m := fmt.Sprintf("Unsupported protocol scheme: %s, your address"+
			" must start with http:// or https://", u.Scheme)
		return nil, errors.New(m)
	}
	tr := &http.Transport{
		TLSClientConfig: &tls.Config{
			InsecureSkipVerify: conf.InsecureSkipVerify,
		},
	}
	if conf.TLSConfig != nil {
		tr.TLSClientConfig = conf.TLSConfig
	}
	return &client{
		url:       *u,
		username:  conf.Username,
		password:  conf.Password,
		useragent: conf.UserAgent,
		httpClient: &http.Client{
			Timeout:   conf.Timeout,
			Transport: tr,
		},
		transport: tr,
	}, nil
}
NewHTTPClient returns a new Client from the provided config.
Client is safe for concurrent use by multiple goroutines.
package client  
import (
	"bytes"
	"crypto/tls"
	"encoding/json"
	"errors"
	"fmt"
	"io"
	"io/ioutil"
	"mime"
	"net/http"
	"net/url"
	"path"
	"strconv"
	"strings"
	"time"
	"github.com/influxdata/influxdb/models"
)
type HTTPConfig struct {
	Addr string
	Username string
	Password string
	UserAgent string
	Timeout time.Duration
	InsecureSkipVerify bool
	TLSConfig *tls.Config
}
type BatchPointsConfig struct {
	Precision string
	Database string
	RetentionPolicy string
	WriteConsistency string
}
type Client interface {
	Ping(timeout time.Duration) (time.Duration, string, error)
	Write(bp BatchPoints) error
	Query(q Query) (*Response, error)
	Close() error
}