func (p *Provider) ValidateResponse(res *http.Response) error {
	if p.Validator != nil {
		return p.Validator(res)
	} else {
		return defaultValidator(res)
	}
}
Validate a fronted response.  Returns an error if the
response failed to reach the origin, eg if the request
was rejected by the provider.
package fronted
import (
	"fmt"
	"net"
	"net/http"
	"strings"
	"time"
)
const (
	NumWorkers = 10  
)
var (
	defaultValidator = NewStatusCodeValidator([]int{403})
)
type CA struct {
	CommonName string
	Cert       string  
}
type Masquerade struct {
	Domain string
	IpAddress string
}
type masquerade struct {
	Masquerade
	LastVetted time.Time
	ProviderID string
}
type Provider struct {
	HostAliases map[string]string
	PassthroughPatterns []string
	TestURL     string
	Masquerades []*Masquerade
	Validator ResponseValidator
}
func NewProvider(hosts map[string]string, testURL string, masquerades []*Masquerade, validator ResponseValidator, passthrough []string) *Provider {
	d := &Provider{
		HostAliases:         make(map[string]string),
		TestURL:             testURL,
		Masquerades:         make([]*Masquerade, 0, len(masquerades)),
		Validator:           validator,
		PassthroughPatterns: make([]string, 0, len(passthrough)),
	}
	for k, v := range hosts {
		d.HostAliases[strings.ToLower(k)] = v
	}
	for _, m := range masquerades {
		d.Masquerades = append(d.Masquerades, &Masquerade{Domain: m.Domain, IpAddress: m.IpAddress})
	}
	for _, pt := range passthrough {
		d.PassthroughPatterns = append(d.PassthroughPatterns, pt)
	}
	return d
}
func (p *Provider) Lookup(hostname string) string {
	if h, _, err := net.SplitHostPort(hostname); err == nil {
		hostname = h
	}
	hostname = strings.ToLower(hostname)
	if alias := p.HostAliases[hostname]; alias != "" {
		return alias
	}
	for _, pt := range p.PassthroughPatterns {
		pt = strings.ToLower(pt)
		if strings.HasPrefix(pt, "*.") && strings.HasSuffix(hostname, pt[1:]) {
			return hostname
		} else if pt == hostname {
			return hostname
		}
	}
	return ""
}