Documentation ¶
Index ¶
- func FastRedirect(rw http.ResponseWriter, req *http.Request, url string, code int)
- func GetBearer(req *http.Request) string
- func GetDomainWithoutPort(domain string) string
- func GetParentDomain(domain string) (string, bool)
- func GetTopFqdn(domain string) (string, bool)
- func ReplaceSubdomainWithWildcard(domain string) (string, bool)
- func RespondHttpStatus(rw http.ResponseWriter, status int)
- func RespondVioletError(rw http.ResponseWriter, status int, msg string)
- func RunBackgroundHttp(logger *log.Logger, s *http.Server)
- func RunBackgroundHttps(logger *log.Logger, s *http.Server)
- func SplitDomainPort(host string, defaultPort int) (domain string, port int, ok bool)
- func SplitHostPath(a string) (host, path string)
- func SplitHostPathQuery(a string) (host, path, query string)
- type AcmeChallengeProvider
- type AcmeChallenges
- type AcmeStorage
- type CertProvider
- type Compilable
- type DomainProvider
- type MultiCompilable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FastRedirect ¶
FastRedirect adds a location header, status code and if the method is get, outputs the status text.
func GetBearer ¶
GetBearer returns the bearer from the Authorization header or an empty string if the authorization is empty or doesn't start with Bearer.
func GetDomainWithoutPort ¶
GetDomainWithoutPort takes an input domain + port and outputs the domain without the port.
example.com:443 => example.com
func GetParentDomain ¶
GetParentDomain returns the parent domain stripping off the subdomain.
www.example.com => example.com
func GetTopFqdn ¶
GetTopFqdn returns the top domain stripping off multiple layers of subdomains.
hello.world.example.com => example.com
func ReplaceSubdomainWithWildcard ¶
ReplaceSubdomainWithWildcard returns the domain with the subdomain replaced with a wildcard '*' character.
www.example.com => *.example.com
func RespondHttpStatus ¶
func RespondHttpStatus(rw http.ResponseWriter, status int)
RespondHttpStatus outputs the status code and text using http.Error()
func RespondVioletError ¶
func RespondVioletError(rw http.ResponseWriter, status int, msg string)
func RunBackgroundHttp ¶
RunBackgroundHttp runs a http server and logs when the server closes or errors.
func RunBackgroundHttps ¶
RunBackgroundHttps runs a http server with TLS encryption and logs when the server closes or errors.
func SplitDomainPort ¶
SplitDomainPort takes an input host and default port then outputs the domain, port and true or empty values and false if the split failed
func SplitHostPath ¶
SplitHostPath extracts the host/path from the input
func SplitHostPathQuery ¶
SplitHostPathQuery extracts the host/path?query from the input
Types ¶
type AcmeChallengeProvider ¶
type AcmeChallenges ¶
type AcmeChallenges struct {
// contains filtered or unexported fields
}
func NewAcmeChallenge ¶
func NewAcmeChallenge() *AcmeChallenges
func (*AcmeChallenges) Delete ¶
func (a *AcmeChallenges) Delete(domain, key string)
func (*AcmeChallenges) Get ¶
func (a *AcmeChallenges) Get(domain, key string) string
func (*AcmeChallenges) Put ¶
func (a *AcmeChallenges) Put(domain, key, value string)
type AcmeStorage ¶
type AcmeStorage struct {
// contains filtered or unexported fields
}
type CertProvider ¶
type CertProvider interface { GetCertForDomain(domain string) *tls.Certificate Compile() }
type Compilable ¶
type Compilable interface {
Compile()
}
Compilable is an interface for structs with an asynchronous compile method.
type DomainProvider ¶
type MultiCompilable ¶
type MultiCompilable []Compilable
MultiCompilable is a slice of multiple Compilable interfaces.
func (MultiCompilable) Compile ¶
func (m MultiCompilable) Compile()
Compile loops over the slice of Compilable interfaces and calls Compile on each one.