func newCookieJar(path string) (*cookieJar, error) {
	if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {
		return nil, err
	}
	j, _ := cookiejar.New(&cookiejar.Options{PublicSuffixList: publicsuffix.List})
	cj := &cookieJar{path: path, jar: j}
	if err := cj.loadCache(); err != nil {
		return nil, err
	}
	return cj, nil
}
force public access through CookieJar() so we have better safety for concurrent access to individual files
for cases where multiple calls to CookieJar() with the same path are made within the same process.  Doesn't
solve cases where distinct processes use the same CookieJar(), we need to rely on our file handling logic for that.
package cache
import (
	"encoding/json"
	"fmt"
	"golang.org/x/net/publicsuffix"
	"net/http"
	"net/http/cookiejar"
	"net/url"
	"os"
	"path/filepath"
	"strings"
	"sync"
)
var cjMap map[string]*cookieJar
var CookieJar = func(path string) *cookieJar {
	if cjMap == nil {
		cjMap = make(map[string]*cookieJar)
	}
	if v, ok := cjMap[path]; ok {
		return v
	}
	cj, err := newCookieJar(path)
	if err != nil {
		panic(err)
	}
	cjMap[path] = cj
	return cj
}
type cookieJar struct {
	path string
	mu   sync.RWMutex
	jar  *cookiejar.Jar
}