Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrSubDomainUsed is thrown when a a creation of an Redirection fails // because the subdomain wished for is already used. ErrSubDomainUsed = errors.New("The subdomain is already used") // ErrNotFound is thrown when no redirection is found. ErrNotFound = errors.New("no redirection found") )
View Source
var ( // ErrSubDomainAlreadyExists is used when a subdomain is already taken. ErrSubDomainAlreadyExists = errors.New("the subdomain cannot be created because it already exists") )
Functions ¶
This section is empty.
Types ¶
type DomainHandler ¶
type DomainHandler interface {
CreateDomainRedirection(subDomain string, dest string) error
Sync() ([]*Redirection, error)
}
DomainHandler is the interface used to handle domain related operations.
type Redirection ¶
Redirection is the struct that represents a redirection.
type RedirectionStore ¶
type RedirectionStore interface {
Save(redir *Redirection) error
GetBySubDomain(string) (*Redirection, error)
GetAll() ([]*Redirection, error)
}
RedirectionStore is the interface used to store Redirections
type StoredDomainHandler ¶
type StoredDomainHandler struct {
DomainHandler DomainHandler
OVHClient ovh.Client
Store RedirectionStore
}
StoredDomainHandler is the implementation of DomainHandler With a layer that store the redirection in a store.
func (*StoredDomainHandler) CreateDomainRedirection ¶
func (h *StoredDomainHandler) CreateDomainRedirection(subDomain string, dest string) error
CreateDomainRedirection calls another DomainHandler and save the redirection inside a store.
func (*StoredDomainHandler) Sync ¶
func (h *StoredDomainHandler) Sync() ([]*Redirection, error)
Sync fetches all the domains from the provider and saves them inside the database
Click to show internal directories.
Click to hide internal directories.