domain

package
v0.76.3 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2026 License: BSD-3-Clause, AGPL-3.0 Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Domain

type Domain struct {
	ID            string `gorm:"unique;primaryKey;autoIncrement"`
	Domain        string `gorm:"unique"` // Domain records must be unique, this avoids domain reuse across accounts.
	AccountID     string `gorm:"index"`
	TargetCluster string // The proxy cluster this domain should be validated against
	Type          Type   `gorm:"-"`
	Validated     bool
	// SupportsCustomPorts is populated at query time for free domains from the
	// proxy cluster capabilities. Not persisted.
	SupportsCustomPorts *bool `gorm:"-"`
	// RequireSubdomain is populated at query time. When true, the domain
	// cannot be used bare and a subdomain label must be prepended. Not persisted.
	RequireSubdomain *bool `gorm:"-"`
	// SupportsCrowdSec is populated at query time from proxy cluster capabilities.
	// Not persisted.
	SupportsCrowdSec *bool `gorm:"-"`
	// SupportsPrivate is populated at query time from proxy cluster capabilities. Not persisted.
	SupportsPrivate *bool `gorm:"-"`
}

func (*Domain) Copy added in v0.68.2

func (d *Domain) Copy() *Domain

func (*Domain) EventMeta added in v0.66.3

func (d *Domain) EventMeta() map[string]any

EventMeta returns activity event metadata for a domain

type Manager

type Manager interface {
	GetDomains(ctx context.Context, accountID, userID string) ([]*Domain, error)
	CreateDomain(ctx context.Context, accountID, userID, domainName, targetCluster string) (*Domain, error)
	DeleteDomain(ctx context.Context, accountID, userID, domainID string) error
	ValidateDomain(ctx context.Context, accountID, userID, domainID string)
	GetClusterDomains() []string
}

type Type

type Type string
const (
	TypeFree   Type = "free"
	TypeCustom Type = "custom"
)

type Validator

type Validator struct {
	Resolver resolver
}

func NewValidator

func NewValidator(resolver resolver) *Validator

NewValidator initializes a validator with a specific DNS Resolver. If a Validator is used without specifying a Resolver, then it will use the net.DefaultResolver.

func (*Validator) IsValid

func (v *Validator) IsValid(ctx context.Context, domain string, accept []string) bool

IsValid looks up the CNAME record for the passed domain with a prefix and compares it against the acceptable domains. If the returned CNAME matches any accepted domain, it will return true, otherwise, including in the event of a DNS error, it will return false. The comparison is very simple, so wildcards will not match if included in the acceptable domain list.

func (*Validator) ValidateWithCluster

func (v *Validator) ValidateWithCluster(ctx context.Context, domain string, accept []string) (string, bool)

ValidateWithCluster validates a custom domain and returns the matched cluster address. Returns the cluster address and true if valid, or empty string and false if invalid.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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