func (i *Imports) Add(a ...*Import) {
	*i = append(*i, a...)
}
Add is a simple way to add imports
package jwt
import (
	"io/ioutil"
	"net/http"
	"net/url"
	"time"
)
type Import struct {
	Name string `json:"name,omitempty"`
	Subject Subject `json:"subject,omitempty"`
	Account string  `json:"account,omitempty"`
	Token   string  `json:"token,omitempty"`
	To   Subject    `json:"to,omitempty"`
	Type ExportType `json:"type,omitempty"`
}
func (i *Import) IsService() bool {
	return i.Type == Service
}
func (i *Import) IsStream() bool {
	return i.Type == Stream
}
func (i *Import) Validate(actPubKey string, vr *ValidationResults) {
	if !i.IsService() && !i.IsStream() {
		vr.AddError("invalid import type: %q", i.Type)
	}
	if i.Account == "" {
		vr.AddWarning("account to import from is not specified")
	}
	i.Subject.Validate(vr)
	if i.IsService() && i.Subject.HasWildCards() {
		vr.AddError("services cannot have wildcard subject: %q", i.Subject)
	}
	if i.IsStream() && i.To.HasWildCards() {
		vr.AddError("streams cannot have wildcard to subject: %q", i.Subject)
	}
	var act *ActivationClaims
	if i.Token != "" {
		if url, err := url.Parse(i.Token); err == nil && url.Scheme != "" {
			c := &http.Client{Timeout: 5 * time.Second}
			resp, err := c.Get(url.String())
			if err != nil {
				vr.AddWarning("import %s contains an unreachable token URL %q", i.Subject, i.Token)
			}
			if resp != nil {
				defer resp.Body.Close()
				body, err := ioutil.ReadAll(resp.Body)
				if err != nil {
					vr.AddWarning("import %s contains an unreadable token URL %q", i.Subject, i.Token)
				} else {
					act, err = DecodeActivationClaims(string(body))
					if err != nil {
						vr.AddWarning("import %s contains a url %q with an invalid activation token", i.Subject, i.Token)
					}
				}
			}
		} else {
			var err error
			act, err = DecodeActivationClaims(i.Token)
			if err != nil {
				vr.AddWarning("import %q contains an invalid activation token", i.Subject)
			}
		}
	}
	if act != nil {
		if act.Issuer != i.Account {
			vr.AddWarning("activation token doesn't match account for import %q", i.Subject)
		}
		if act.ClaimsData.Subject != actPubKey {
			vr.AddWarning("activation token doesn't match account it is being included in, %q", i.Subject)
		}
	} else {
		vr.AddWarning("no activation provided for import %s", i.Subject)
	}
}
type Imports []*Import
func (i *Imports) Validate(acctPubKey string, vr *ValidationResults) {
	toSet := make(map[Subject]bool, len(*i))
	for _, v := range *i {
		if v.Type == Service {
			if _, ok := toSet[v.To]; ok {
				vr.AddError("Duplicate To subjects for %q", v.To)
			}
			toSet[v.To] = true
		}
		v.Validate(acctPubKey, vr)
	}
}