func newNetAPI(root string, key string, proxy string) (*netAPI, error) {
	if !strings.Contains(root, "://") {
		root = "https://" + root
	}
	u, err := url.Parse(root)
	if err != nil {
		return nil, err
	}
	httpClient := &http.Client{}
	if proxy != "" {
		proxyUrl, err := url.Parse(proxy)
		if err != nil {
			return nil, err
		}
		httpClient = &http.Client{Transport: &http.Transport{Proxy: http.ProxyURL(proxyUrl)}}
	}
	q := u.Query()
	q.Set("key", key)
	q.Set("alt", "proto")
	u.RawQuery = q.Encode()
	return &netAPI{url: u, client: httpClient}, nil
}
newNetAPI creates a new netAPI object pointed at the provided root URL.
For every request, it will use the provided API key.
If a proxy URL is given, it will be used in place of the default $HTTP_PROXY.
If the protocol is not specified in root, then this defaults to using HTTPS.
package safebrowsing
import (
	"bytes"
	"context"
	"fmt"
	"io/ioutil"
	"net/http"
	"net/url"
	"strings"
	pb "github.com/google/safebrowsing/internal/safebrowsing_proto"
	"github.com/golang/protobuf/proto"
)
const (
	findHashPath    = "/v4/fullHashes:find"
	fetchUpdatePath = "/v4/threatListUpdates:fetch"
)
type api interface {
	ListUpdate(ctx context.Context, req *pb.FetchThreatListUpdatesRequest) (*pb.FetchThreatListUpdatesResponse, error)
	HashLookup(ctx context.Context, req *pb.FindFullHashesRequest) (*pb.FindFullHashesResponse, error)
}
type netAPI struct {
	client *http.Client
	url    *url.URL
}