models

package
v0.0.0-...-28c38e3 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2022 License: CC0-1.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Provisioning   State = "provisioning"
	Provisioned          = "provisioned"
	Deprovisioning       = "deprovisioning"
	Deprovisioned        = "deprovisioned"
	Failed               = "failed"
)

Variables

This section is empty.

Functions

func LoadRandomUser

func LoadRandomUser(db *gorm.DB, userIDPool []string) (utils.User, error)

* LoadRandomUser The Let's Encrypt v1 acme API has shut down user creation to force users to adopt v2. * In an attempt to contiune using v1 while we develop a v2 compliant broker, we are replacing * calls to create a new user for each new domain registration with a method that fetches an existing user * from a pool of ids. The random selection of users from a pool aims to minimize the impact of the following rate limits: * - 300 Pending Authorizations per account * - Failed Validation limit of 5 failures per account, per hostname, per hour.

func LoadUser

func LoadUser(userData UserData) (utils.User, error)

Types

type Certificate

type Certificate struct {
	gorm.Model
	RouteId     uint
	Domain      string
	CertURL     string
	Certificate []byte
	Expires     time.Time `gorm:"index"`
}

type Route

type Route struct {
	gorm.Model
	InstanceId     string `gorm:"not null;unique_index"`
	State          State  `gorm:"not null;index"`
	ChallengeJSON  []byte
	DomainExternal string
	DomainInternal string
	DistId         string
	Origin         string
	Path           string
	InsecureOrigin bool
	Certificate    Certificate
	UserData       UserData
	UserDataID     int
}

func (*Route) GetDomains

func (r *Route) GetDomains() []string

type RouteManager

type RouteManager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(
	logger lager.Logger,
	iam utils.IamIface,
	cloudFront utils.DistributionIface,
	settings config.Settings,
	db *gorm.DB,
) RouteManager

func (*RouteManager) Create

func (m *RouteManager) Create(instanceId, domain, origin, path string, insecureOrigin bool, forwardedHeaders utils.Headers, forwardCookies bool, tags map[string]string) (*Route, error)

func (*RouteManager) DeleteOrphanedCerts

func (m *RouteManager) DeleteOrphanedCerts()

func (*RouteManager) Disable

func (m *RouteManager) Disable(r *Route) error

func (*RouteManager) Get

func (m *RouteManager) Get(instanceId string) (*Route, error)

func (*RouteManager) GetDNSInstructions

func (m *RouteManager) GetDNSInstructions(route *Route) ([]string, error)

func (*RouteManager) Poll

func (m *RouteManager) Poll(r *Route) error

func (*RouteManager) Renew

func (m *RouteManager) Renew(r *Route) error

func (*RouteManager) RenewAll

func (m *RouteManager) RenewAll()

func (*RouteManager) Update

func (m *RouteManager) Update(instanceId, domain, origin string, path string, insecureOrigin bool, forwardedHeaders utils.Headers, forwardCookies bool) error

type RouteManagerIface

type RouteManagerIface interface {
	Create(instanceId, domain, origin, path string, insecureOrigin bool, forwardedHeaders utils.Headers, forwardCookies bool, tags map[string]string) (*Route, error)
	Update(instanceId string, domain, origin string, path string, insecureOrigin bool, forwardedHeaders utils.Headers, forwardCookies bool) error
	Get(instanceId string) (*Route, error)
	Poll(route *Route) error
	Disable(route *Route) error
	Renew(route *Route) error
	RenewAll()
	DeleteOrphanedCerts()
	GetDNSInstructions(route *Route) ([]string, error)
}

type State

type State string

func (*State) Scan

func (s *State) Scan(value interface{}) error

Scan Unmarshal an `interface{}` to a `State` when reading from the database

func (State) Value

func (s State) Value() (driver.Value, error)

Value Marshal a `State` to a `string` when saving to the database

type UserData

type UserData struct {
	gorm.Model
	Email string `gorm:"not null"`
	Reg   []byte
	Key   []byte
}

func SaveUser

func SaveUser(db *gorm.DB, user utils.User) (UserData, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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