Versions in this module Expand all Collapse all v0 v0.0.3 May 13, 2024 v0.0.2 May 10, 2024 Changes in this version + var ErrorInternal = errors.New("internal error") + var ErrorNotFound = errors.New("not found") + var ErrorNotMatches = errors.New("not matching") + type AutoRedirect struct + Code int + Enabled bool + Scheme string + type ByteBuf struct + func NewByteBuf(byte []byte) *ByteBuf + func (b ByteBuf) Close() error + type CustomDomains struct + Alias *cmap.ConcurrentMap[string, PageDomain] + Local string + Mutex sync.Mutex + Reverse *cmap.ConcurrentMap[string, string] + Share bool + func NewCustomDomains(local string, share bool) (*CustomDomains, error) + func (d *CustomDomains) Get(host string) (PageDomain, bool) + type DomainCache struct + func NewDomainCache(ttl time.Duration, refreshTtl time.Duration) DomainCache + func (c *DomainCache) Close() error + func (c *DomainCache) FetchRepo(client *GiteaConfig, domain *PageDomain) (*DomainConfig, bool, error) + func (c *DomainCache) Lock(any *PageDomain) func() + func (c *DomainCache) LockAny(any string) func() + type DomainConfig struct + BasePath string + CNAME []string + DATE time.Time + Exists bool + FetchTime int64 + FileCache *bigcache.BigCache + Index string + NotFound string + PageDomain PageDomain + SHA string + Topics map[string]bool + func (receiver *DomainConfig) Close() error + func (receiver *DomainConfig) Copy(client *GiteaConfig, path string, writer http.ResponseWriter, _ *http.Request) (bool, error) + func (receiver *DomainConfig) IsRoutePage() bool + type ErrorMetadata struct + Error string + Request *http.Request + StatusCode int + type ErrorPages struct + func NewErrorPages(pagesTmpl map[string]string) (*ErrorPages, error) + type FakeResponse struct + func NewFakeResponse() *FakeResponse + func (r *FakeResponse) CacheMode(mode string) + func (r *FakeResponse) CacheModeHit() + func (r *FakeResponse) CacheModeIgnore() + func (r *FakeResponse) CacheModeMiss() + func (r *FakeResponse) ContentType(types string) + func (r *FakeResponse) ContentTypeExt(path string) + func (r *FakeResponse) ETag(tag string) + func (r *FakeResponse) Length(len int) + func (r *FakeResponse) SetHeader(key string, value string) + type GiteaConfig struct + CacheMaxSize int + Client *gitea.Client + CustomHeaders map[string]string + Logger *zap.Logger + Server string + Token string + func (c *GiteaConfig) FileExists(domain *PageDomain, path string) (bool, error) + func (c *GiteaConfig) OpenFileContext(domain *PageDomain, path string) (*http.Response, error) + func (c *GiteaConfig) ReadRepoFile(domain *PageDomain, path string) ([]byte, error) + func (c *GiteaConfig) ReadStringRepoFile(domain *PageDomain, path string) (string, error) + type MiddlewareConfig struct + Alias string + AutoRedirect *AutoRedirect + CacheMaxSize int + CacheRefresh time.Duration + CacheTimeout time.Duration + CustomHeaders map[string]string + Domain string + ErrorPages map[string]string + Server string + SharedAlias bool + Token string + type OwnerCache struct + func NewOwnerCache(ttl time.Duration, cacheTtl time.Duration) OwnerCache + func (c *OwnerCache) GetOwnerConfig(giteaConfig *GiteaConfig, owner string) (*OwnerConfig, error) + func (c *OwnerCache) Lock(any string) func() + type OwnerConfig struct + FetchTime int64 + LowerRepos map[string]bool + Repos map[string]bool + func NewOwnerConfig() *OwnerConfig + func (c *OwnerConfig) Exists(repo string) bool + type PageClient struct + AutoRedirect *AutoRedirect + BaseDomain string + DomainAlias *CustomDomains + DomainCache *DomainCache + ErrorPages *ErrorPages + GiteaConfig *GiteaConfig + OwnerCache *OwnerCache + func NewPageClient(config *MiddlewareConfig, logger *zap.Logger) (*PageClient, error) + func (p *PageClient) Close() error + func (p *PageClient) Route(writer http.ResponseWriter, request *http.Request) error + func (p *PageClient) RouteExists(writer http.ResponseWriter, request *http.Request) error + func (p *PageClient) Validate() error + type PageDomain struct + Branch string + Owner string + Repo string + func NewPageDomain(owner string, repo string, branch string) *PageDomain + func (p *PageDomain) Key() string