db

package
v0.0.0-...-a9834e4 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2021 License: Apache-2.0 Imports: 19 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DBTablePrefix holds the db prefix
	DBTablePrefix = ""
)

Functions

This section is empty.

Types

type By

type By func(p1, p2 *PathMappingEntry) bool

By is the type of a "less" function that defines the ordering of its arguments.

func (By) Sort

func (by By) Sort(paths PathList)

Sort is a method on the function type, By, that sorts the argument slice according to the function.

type Domain

type Domain struct {
	ID           string    `json:"id"`
	Name         string    `json:"domain"`
	PathMapping  *PathList `json:"path"`
	Redirect     string    `json:"redirect"`
	Promotable   bool      `json:"promotable"`
	Wildcard     bool      `json:"wildcard"`
	Certificate  string    `json:"certificate"`
	RedirectCode int       `json:"code"`
	Description  string    `json:"description"`
	Created      string    `json:"created"`
	Modified     string    `json:"modified"`
}

Domain struct as it is received via the request body entry

func (*Domain) GetRedirect

func (d *Domain) GetRedirect(reqURL *url.URL) (string, int)

GetRedirect returns calculated routes

func (*Domain) Validate

func (d *Domain) Validate() []error

Validate the domain

type DomainDB

type DomainDB struct {
	Domain
	BinPathMapping *[]byte `json:"bin_paths"`
}

DomainDB entry

type DomainList

type DomainList struct {
	Domains []Domain `json:"domains"`
}

DomainList db entry

type DynamoConnection

type DynamoConnection struct {
	Endpoint  string
	Key       string
	Secret    string
	TableName string
	Region    string
}

DynamoConnection model

type DynamoDB

type DynamoDB struct {
	Session *session.Session
	Service *dynamodb.DynamoDB
}

DynamoDB model

func NewDynamoDB

func NewDynamoDB(c *DynamoConnection, bootstrap bool) (*DynamoDB, error)

NewDynamoDB creates a new instance

func (*DynamoDB) CheckPassword

func (d *DynamoDB) CheckPassword(username string, plainPwd string) error

CheckPassword checks pwd hash on db against entered plain pwd

func (*DynamoDB) DeleteAllDomains

func (d *DynamoDB) DeleteAllDomains() error

DeleteAllDomains deletes all items from the domains table

func (*DynamoDB) DeleteByDomain

func (d *DynamoDB) DeleteByDomain(domain string) (bool, error)

DeleteByDomain items from domains table

func (*DynamoDB) DeleteTLSCacheEntry

func (d *DynamoDB) DeleteTLSCacheEntry(key string) error

DeleteTLSCacheEntry deletes a chache entry

func (*DynamoDB) FetchAll

func (d *DynamoDB) FetchAll() ([]Domain, error)

FetchAll items from domains table

func (*DynamoDB) FetchAllPaginated

func (d *DynamoDB) FetchAllPaginated(cursor *string) ([]Domain, *string, error)

FetchAllPaginated items from domains table

func (*DynamoDB) FetchAllSorted

func (d *DynamoDB) FetchAllSorted() ([]Domain, error)

FetchAllSorted returns all items from table with a sorted paths (important for the redirects!)

func (*DynamoDB) FetchByDomain

func (d *DynamoDB) FetchByDomain(domain string) (*Domain, error)

FetchByDomain items from domains table

func (*DynamoDB) GetTLSCache

func (d *DynamoDB) GetTLSCache(key string) ([]byte, error)

GetTLSCache items from tls cache table

func (*DynamoDB) Import

func (d *DynamoDB) Import(e *ExportDomains) error

Import imports a export set

func (*DynamoDB) InsertDomain

func (d *DynamoDB) InsertDomain(domain Domain) error

InsertDomain stores a domain

func (*DynamoDB) UpdateCertificateData

func (d *DynamoDB) UpdateCertificateData(domain string, data []byte) error

UpdateCertificateData updates the cert data if a domain entry exist

func (*DynamoDB) UpdateTLSCache

func (d *DynamoDB) UpdateTLSCache(key string, data []byte) error

UpdateTLSCache updates the tls cache

type ExportDomains

type ExportDomains struct {
	Domains []Domain `json:"domains"`
}

ExportDomains model

type PathList

type PathList []PathMappingEntry

PathList model

type PathMappingEntry

type PathMappingEntry struct {
	From string `json:"from"`
	To   string `json:"to"`
}

PathMappingEntry model

type TLSCacheEntry

type TLSCacheEntry struct {
	Key   string `json:"cacheKey"`
	Value string `json:"cacheValue"`
}

TLSCacheEntry model

type User

type User struct {
	Name     string `json:"name"`
	Password string `json:"password"`
}

User model

Jump to

Keyboard shortcuts

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