domain

package
v1.58.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 12, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDomainDoesNotExist = errors.New("domain does not exist")

ErrDomainDoesNotExist returned when a domain is not found or when a lookup path for a domain could not be resolved

Functions

func ReqWithDomain added in v1.58.0

func ReqWithDomain(r *http.Request, domain *Domain) *http.Request

ReqWithDomain saves domain in the request's context

Types

type Domain added in v1.9.0

type Domain struct {
	Name            string
	CertificateCert string
	CertificateKey  string

	Resolver Resolver
	// contains filtered or unexported fields
}

Domain is a domain that gitlab-pages can serve.

func FromRequest added in v1.47.0

func FromRequest(r *http.Request) *Domain

FromRequest extracts the domain from request's context

func New added in v1.35.0

func New(name, cert, key string, resolver Resolver) *Domain

New creates a new domain with a resolver and existing certificates

func (*Domain) EnsureCertificate added in v1.9.0

func (d *Domain) EnsureCertificate() (*tls.Certificate, error)

EnsureCertificate parses the PEM-encoded certificate for the domain

func (*Domain) GetLookupPath added in v1.11.0

func (d *Domain) GetLookupPath(r *http.Request) (*serving.LookupPath, error)

GetLookupPath returns a project details based on the request. It returns nil if project does not exist.

func (*Domain) GetProjectID added in v1.11.0

func (d *Domain) GetProjectID(r *http.Request) uint64

GetProjectID figures out what is the ID of the project user tries to access

func (*Domain) IsAccessControlEnabled added in v1.9.0

func (d *Domain) IsAccessControlEnabled(r *http.Request) bool

IsAccessControlEnabled figures out if the request is to a project that has access control enabled

func (*Domain) IsHTTPSOnly added in v1.9.0

func (d *Domain) IsHTTPSOnly(r *http.Request) bool

IsHTTPSOnly figures out if the request should be handled with HTTPS only by looking at group and project level config.

func (*Domain) IsNamespaceProject added in v1.9.0

func (d *Domain) IsNamespaceProject(r *http.Request) bool

IsNamespaceProject figures out if the request is to a namespace project

func (*Domain) ServeFileHTTP added in v1.9.0

func (d *Domain) ServeFileHTTP(w http.ResponseWriter, r *http.Request) bool

ServeFileHTTP returns true if something was served, false if not.

func (*Domain) ServeNamespaceNotFound added in v1.52.0

func (d *Domain) ServeNamespaceNotFound(w http.ResponseWriter, r *http.Request)

ServeNamespaceNotFound will try to find a parent namespace domain for a request that failed authentication so that we serve the custom namespace error page for public namespace domains

func (*Domain) ServeNotFoundAuthFailed added in v1.22.0

func (d *Domain) ServeNotFoundAuthFailed(w http.ResponseWriter, r *http.Request)

ServeNotFoundAuthFailed handler to be called when auth failed so the correct custom 404 page is served.

func (*Domain) ServeNotFoundHTTP added in v1.9.0

func (d *Domain) ServeNotFoundHTTP(w http.ResponseWriter, r *http.Request)

ServeNotFoundHTTP serves the not found pages from the projects.

func (*Domain) String added in v1.9.0

func (d *Domain) String() string

String implements Stringer.

type Resolver added in v1.11.0

type Resolver interface {
	// Resolve returns a serving request and an error if it occurred
	Resolve(*http.Request) (*serving.Request, error)
}

Resolver represents an interface responsible for resolving a pages serving request for each HTTP request

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL