domain

package
v0.65.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: BSD-3-Clause, AGPL-3.0 Imports: 4 Imported by: 0

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
}

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)
}

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