func (api *SqrlSspAPI) Host(r *http.Request) string {
	host := api.HostOverride
	if host == "" {
		host = r.Header.Get("X-Forwarded-Host")
	}
	if host == "" {
		host = r.Header.Get("X-Forwarded-Server")
	}
	if host == "" {
		host = r.Host
	}
	return host
}
Host gets the host in order of preference:
SqrlSspAPI.HostOverride, header X-Forwarded-Host, Request.Host
package ssp
import (
	"encoding/base64"
	"fmt"
	"net/http"
	"net/url"
	"time"
)
type Nut string
var Sqrl64 = base64.RawURLEncoding
const SqrlScheme = "sqrl"
type Tree interface {
	Nut() (Nut, error)
}
var ErrNotFound = fmt.Errorf("Not Found")
type Hoard interface {
	Get(nut Nut) (*HoardCache, error)
	GetAndDelete(nut Nut) (*HoardCache, error)
	Save(nut Nut, value *HoardCache, expiration time.Duration) error
}
type HoardCache struct {
	State        string        `json:"state"`
	RemoteIP     string        `json:"remoteIP"`
	OriginalNut  Nut           `json:"originalNut"`
	PagNut       Nut           `json:"pagNut"`
	LastRequest  *CliRequest   `json:"lastRequest"`
	Identity     *SqrlIdentity `json:"identity"`
	LastResponse []byte        `json:"lastResponse"`
}
type SqrlIdentity struct {
	Idk      string `json:"idk" sql:"primary_key"`
	Suk      string `json:"suk"`
	Vuk      string `json:"vuk"`
	Pidk     string `json:"pidk"`  
	SQRLOnly bool   `json:"sqrlOnly"`
	Hardlock bool   `json:"hardlock"`
	Disabled bool   `json:"disabled"`
	Rekeyed  string `json:"rekeyed"`  
	Btn int `json:"-" sql:"-"`
}
type Authenticator interface {
	AuthenticateIdentity(identity *SqrlIdentity) string
	SwapIdentities(previousIdentity, newIdentity *SqrlIdentity) error
	RemoveIdentity(identity *SqrlIdentity) error
	AskResponse(identity *SqrlIdentity) *Ask
}
type AuthStore interface {
	FindIdentity(idk string) (*SqrlIdentity, error)
	SaveIdentity(identity *SqrlIdentity) error
	DeleteIdentity(idk string) error
}
type SqrlSspAPI struct {
	tree          Tree
	hoard         Hoard
	NutExpiration time.Duration
	authStore     AuthStore
	HostOverride string
	RootPath      string
	Authenticator Authenticator
}
func (api *SqrlSspAPI) NutExpirationSeconds() int {
	return int(api.NutExpiration / time.Second)
}
func NewSqrlSspAPI(tree Tree, hoard Hoard, authenticator Authenticator, authStore AuthStore) *SqrlSspAPI {
	if tree == nil {
		tree, _ = NewRandomTree(8)
	}
	return &SqrlSspAPI{
		tree:          tree,
		hoard:         hoard,
		NutExpiration: 10 * time.Minute,
		Authenticator: authenticator,
		authStore:     authStore,
	}
}