domain

package
v0.9.9 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2023 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvPrefix = "NS_"

	EnvMariaDBHostnameKey = EnvPrefix + "MARIADB_HOSTNAME"
	EnvMariaDBPortKey     = EnvPrefix + "MARIADB_PORT"
	EnvMariaDBUserKey     = EnvPrefix + "MARIADB_USER"
	EnvMariaDBPasswordKey = EnvPrefix + "MARIADB_PASSWORD"
	EnvMariaDBDatabaseKey = EnvPrefix + "MARIADB_DATABASE"

	EnvMongoDBHostnameKey = EnvPrefix + "MONGODB_HOSTNAME"
	EnvMongoDBPortKey     = EnvPrefix + "MONGODB_PORT"
	EnvMongoDBUserKey     = EnvPrefix + "MONGODB_USER"
	EnvMongoDBPasswordKey = EnvPrefix + "MONGODB_PASSWORD"
	EnvMongoDBDatabaseKey = EnvPrefix + "MONGODB_DATABASE"
)

All environment variables injected by neoshowcase must have NS_ prefix

View Source
const IDLength = 22

Variables

View Source
var EmptyCommit = strings.Repeat("0", 40)
View Source
var (
	// ErrFileNotFound ファイルが存在しない
	ErrFileNotFound = errors.New("not found")
)

Functions

func Base64EncodedPublicKey

func Base64EncodedPublicKey(pubKey ssh2.PublicKey) string

func ContainsDomain added in v0.4.0

func ContainsDomain(source, target string) bool

func DBName

func DBName(applicationID string) string

func DeleteArtifact

func DeleteArtifact(s Storage, artifactID string) error

func DeleteBuildLog

func DeleteBuildLog(s Storage, buildID string) error

func EncodePrivateKeyPem added in v0.6.0

func EncodePrivateKeyPem(privKey ed25519.PrivateKey) (string, error)

func GetArtifact

func GetArtifact(s Storage, artifactID string) (filename string, r io.ReadCloser, err error)

func GetBuildLog

func GetBuildLog(s Storage, buildID string) ([]byte, error)

func GetSuccessBuilds added in v0.7.0

func GetSuccessBuilds(ctx context.Context, buildRepo BuildRepository, apps []*Application) (map[string]*Build, error)

GetSuccessBuilds returns a map of (app id + build id) -> build.

func GitAuthMethod

func GitAuthMethod(repo *Repository, sshFallback *ssh.PublicKeys) (transport.AuthMethod, error)

func NewID

func NewID() string

NewID 22文字のランダムな文字列を生成

func NewPublicKey added in v0.4.5

func NewPublicKey(pemBytes []byte) (*ssh.PublicKeys, error)

func SaveArtifact

func SaveArtifact(s Storage, artifactID string, src io.Reader) error

SaveArtifact Artifactをtar形式で保存する

func SaveBuildLog

func SaveBuildLog(s Storage, buildID string, src io.Reader) error

func ValidateDomain

func ValidateDomain(domain string) error

func ValidatePossibleWildcardDomain added in v0.4.0

func ValidatePossibleWildcardDomain(domain string) error

func ValidateWildcardDomain

func ValidateWildcardDomain(domain string) error

Types

type Application

type Application struct {
	ID            string
	Name          string
	RepositoryID  string
	RefName       string
	DeployType    DeployType
	Running       bool
	Container     ContainerState
	CurrentCommit string
	WantCommit    string
	CreatedAt     time.Time
	UpdatedAt     time.Time

	Config           ApplicationConfig
	Websites         []*Website
	PortPublications []*PortPublication
	OwnerIDs         []string
}

func (*Application) Apply

func (a *Application) Apply(args *UpdateApplicationArgs)

func (*Application) IsOwner

func (a *Application) IsOwner(user *User) bool

func (*Application) SelfValidate

func (a *Application) SelfValidate() error

func (*Application) Validate

func (a *Application) Validate(
	actor *User,
	existingApps []*Application,
	domains AvailableDomainSlice,
	ports AvailablePortSlice,
) (validateErr error, err error)

func (*Application) WebsiteConflicts

func (a *Application) WebsiteConflicts(existing []*Application, actor *User) bool

type ApplicationConfig

type ApplicationConfig struct {
	BuildConfig BuildConfig
}

func (*ApplicationConfig) Validate

func (c *ApplicationConfig) Validate(deployType DeployType) error

type ApplicationRepository

type ApplicationRepository interface {
	GetApplications(ctx context.Context, cond GetApplicationCondition) ([]*Application, error)
	GetApplication(ctx context.Context, id string) (*Application, error)
	CreateApplication(ctx context.Context, app *Application) error
	UpdateApplication(ctx context.Context, id string, args *UpdateApplicationArgs) error
	BulkUpdateState(ctx context.Context, m map[string]ContainerState) error
	DeleteApplication(ctx context.Context, id string) error
}

type Artifact

type Artifact struct {
	ID        string
	BuildID   string
	Size      int64
	CreatedAt time.Time
	DeletedAt optional.Of[time.Time]
}

func NewArtifact

func NewArtifact(buildID string, size int64) *Artifact

type ArtifactRepository

type ArtifactRepository interface {
	GetArtifacts(ctx context.Context, cond GetArtifactCondition) ([]*Artifact, error)
	CreateArtifact(ctx context.Context, artifact *Artifact) error
	UpdateArtifact(ctx context.Context, id string, args UpdateArtifactArgs) error
	HardDeleteArtifacts(ctx context.Context, cond GetArtifactCondition) error
}

type AuthenticationType

type AuthenticationType int
const (
	AuthenticationTypeOff AuthenticationType = iota
	AuthenticationTypeSoft
	AuthenticationTypeHard
)

type AvailableDomain

type AvailableDomain struct {
	Domain         string
	ExcludeDomains []string
	AuthAvailable  bool
}

func (*AvailableDomain) Match added in v0.4.0

func (a *AvailableDomain) Match(fqdn string) bool

func (*AvailableDomain) Validate

func (a *AvailableDomain) Validate() error

type AvailableDomainSlice

type AvailableDomainSlice []*AvailableDomain

func (AvailableDomainSlice) IsAuthAvailable added in v0.4.0

func (s AvailableDomainSlice) IsAuthAvailable(fqdn string) bool

func (AvailableDomainSlice) IsAvailable

func (s AvailableDomainSlice) IsAvailable(fqdn string) bool

type AvailablePort added in v0.3.0

type AvailablePort struct {
	StartPort int
	EndPort   int
	Protocol  PortPublicationProtocol
}

func (*AvailablePort) Validate added in v0.3.0

func (ap *AvailablePort) Validate() error

type AvailablePortSlice added in v0.3.0

type AvailablePortSlice []*AvailablePort

func (AvailablePortSlice) IsAvailable added in v0.3.0

func (s AvailablePortSlice) IsAvailable(port int, protocol PortPublicationProtocol) bool

type AvatarBaseURL added in v0.4.6

type AvatarBaseURL string

type Backend

type Backend interface {
	Start(ctx context.Context) error
	Dispose(ctx context.Context) error

	AvailableDomains() AvailableDomainSlice
	AvailablePorts() AvailablePortSlice
	ListenContainerEvents() (sub <-chan *ContainerEvent, unsub func())
	Synchronize(ctx context.Context, s *DesiredState) error
	GetContainer(ctx context.Context, appID string) (*Container, error)
	ListContainers(ctx context.Context) ([]*Container, error)
	ExecContainer(ctx context.Context, appID string, cmd []string, stdin io.Reader, stdout, stderr io.Writer) error
}

type Build

type Build struct {
	ID            string
	Commit        string
	Status        BuildStatus
	ApplicationID string
	QueuedAt      time.Time
	StartedAt     optional.Of[time.Time]
	UpdatedAt     optional.Of[time.Time]
	FinishedAt    optional.Of[time.Time]
	Retriable     bool
	Artifact      optional.Of[Artifact]
}

func NewBuild

func NewBuild(applicationID string, commit string) *Build

type BuildConfig

type BuildConfig interface {
	BuildType() BuildType
	Validate() error
	MariaDB() bool
	MongoDB() bool
	EntrypointArgs() []string
	CommandArgs() []string
	// contains filtered or unexported methods
}

type BuildConfigRuntimeBuildpack

type BuildConfigRuntimeBuildpack struct {
	RuntimeConfig
	Context string
	// contains filtered or unexported fields
}

func (*BuildConfigRuntimeBuildpack) BuildType

func (bc *BuildConfigRuntimeBuildpack) BuildType() BuildType

func (*BuildConfigRuntimeBuildpack) Validate

func (bc *BuildConfigRuntimeBuildpack) Validate() error

type BuildConfigRuntimeCmd

type BuildConfigRuntimeCmd struct {
	RuntimeConfig
	BaseImage     string
	BuildCmd      string
	BuildCmdShell bool
	// contains filtered or unexported fields
}

func (*BuildConfigRuntimeCmd) BuildType

func (bc *BuildConfigRuntimeCmd) BuildType() BuildType

func (*BuildConfigRuntimeCmd) Validate

func (bc *BuildConfigRuntimeCmd) Validate() error

type BuildConfigRuntimeDockerfile

type BuildConfigRuntimeDockerfile struct {
	RuntimeConfig
	DockerfileName string
	Context        string
	// contains filtered or unexported fields
}

func (*BuildConfigRuntimeDockerfile) BuildType

func (bc *BuildConfigRuntimeDockerfile) BuildType() BuildType

func (*BuildConfigRuntimeDockerfile) Validate

func (bc *BuildConfigRuntimeDockerfile) Validate() error

type BuildConfigStaticCmd

type BuildConfigStaticCmd struct {
	StaticConfig
	BaseImage     string
	BuildCmd      string
	BuildCmdShell bool
	ArtifactPath  string
	// contains filtered or unexported fields
}

func (*BuildConfigStaticCmd) BuildType

func (bc *BuildConfigStaticCmd) BuildType() BuildType

func (*BuildConfigStaticCmd) Validate

func (bc *BuildConfigStaticCmd) Validate() error

type BuildConfigStaticDockerfile

type BuildConfigStaticDockerfile struct {
	StaticConfig
	DockerfileName string
	Context        string
	ArtifactPath   string
	// contains filtered or unexported fields
}

func (*BuildConfigStaticDockerfile) BuildType

func (bc *BuildConfigStaticDockerfile) BuildType() BuildType

func (*BuildConfigStaticDockerfile) Validate

func (bc *BuildConfigStaticDockerfile) Validate() error

type BuildRepository

type BuildRepository interface {
	GetBuilds(ctx context.Context, cond GetBuildCondition) ([]*Build, error)
	GetBuild(ctx context.Context, buildID string) (*Build, error)
	CreateBuild(ctx context.Context, build *Build) error
	UpdateBuild(ctx context.Context, id string, args UpdateBuildArgs) error
	MarkCommitAsRetriable(ctx context.Context, applicationID string, commit string) error
	DeleteBuilds(ctx context.Context, cond GetBuildCondition) error
}

type BuildStatus

type BuildStatus int
const (
	BuildStatusQueued BuildStatus = iota
	BuildStatusBuilding
	BuildStatusSucceeded
	BuildStatusFailed
	BuildStatusCanceled
	BuildStatusSkipped
)

func (BuildStatus) IsFinished

func (t BuildStatus) IsFinished() bool

type BuildType

type BuildType int
const (
	BuildTypeRuntimeBuildpack BuildType = iota
	BuildTypeRuntimeCmd
	BuildTypeRuntimeDockerfile
	BuildTypeStaticCmd
	BuildTypeStaticDockerfile
)

func (BuildType) DeployType

func (b BuildType) DeployType() DeployType

type Container

type Container struct {
	ApplicationID string
	State         ContainerState
}

type ContainerEvent

type ContainerEvent struct {
	ApplicationID string
}

type ContainerLog

type ContainerLog struct {
	Time time.Time
	Log  string
}

type ContainerLogger

type ContainerLogger interface {
	Stream(ctx context.Context, appID string) (<-chan *ContainerLog, error)
}

type ContainerState

type ContainerState int
const (
	ContainerStateMissing ContainerState = iota
	ContainerStateStarting
	ContainerStateRunning
	ContainerStateExited
	ContainerStateErrored
	ContainerStateUnknown
)

type ControllerBuilderService

type ControllerBuilderService interface {
	pbconnect.ControllerBuilderServiceHandler
	ListenBuilderIdle() (sub <-chan struct{}, unsub func())
	ListenBuildSettled() (sub <-chan struct{}, unsub func())
	StartBuilds(buildIDs []string)
	BroadcastBuilder(req *pb.BuilderRequest)
}

type ControllerBuilderServiceClient

type ControllerBuilderServiceClient interface {
	ConnectBuilder(ctx context.Context, onRequest func(req *pb.BuilderRequest), response <-chan *pb.BuilderResponse) error
}

type ControllerSSGenService

type ControllerSSGenService interface {
	pbconnect.ControllerSSGenServiceHandler
	BroadcastSSGen(req *pb.SSGenRequest)
}

type ControllerSSGenServiceClient

type ControllerSSGenServiceClient interface {
	ConnectSSGen(ctx context.Context, onRequest func(req *pb.SSGenRequest)) error
}

type ControllerServiceClient

type ControllerServiceClient interface {
	GetSSHInfo(ctx context.Context) (host string, port int, err error)
	GetAvailableDomains(ctx context.Context) (AvailableDomainSlice, error)
	GetAvailablePorts(ctx context.Context) (AvailablePortSlice, error)

	FetchRepository(ctx context.Context, repositoryID string) error
	RegisterBuild(ctx context.Context, appID string) error
	SyncDeployments(ctx context.Context) error
	StreamBuildLog(ctx context.Context, buildID string) (<-chan *pb.BuildLog, error)
	CancelBuild(ctx context.Context, buildID string) error
}

type CreateArgs

type CreateArgs struct {
	// Database データベース/ユーザー名
	Database string
	// Password アクセスパスワード
	Password string
}

CreateArgs データベース作成引数

type CreateUserArgs

type CreateUserArgs struct {
	Name string
}

type DeleteArgs

type DeleteArgs struct {
	// Database データベース/ユーザー名
	Database string
}

DeleteArgs データベース削除引数

type DeployType

type DeployType int
const (
	DeployTypeRuntime DeployType = iota
	DeployTypeStatic
)

type DesiredState

type DesiredState struct {
	Runtime     []*RuntimeDesiredState
	StaticSites []*StaticSite
}

type Environment

type Environment struct {
	ApplicationID string
	Key           string
	Value         string
	System        bool
}

type EnvironmentRepository

type EnvironmentRepository interface {
	GetEnv(ctx context.Context, cond GetEnvCondition) ([]*Environment, error)
	SetEnv(ctx context.Context, env *Environment) error
	DeleteEnv(ctx context.Context, cond GetEnvCondition) error
}

type GetApplicationCondition

type GetApplicationCondition struct {
	IDIn         optional.Of[[]string]
	RepositoryID optional.Of[string]
	UserID       optional.Of[string]
	DeployType   optional.Of[DeployType]
	Running      optional.Of[bool]
	// InSync WantCommit が CurrentCommit に一致する
	InSync optional.Of[bool]
}

type GetArtifactCondition

type GetArtifactCondition struct {
	ApplicationID optional.Of[string]
	IsDeleted     optional.Of[bool]
}

type GetBuildCondition

type GetBuildCondition struct {
	ApplicationID optional.Of[string]
	Commit        optional.Of[string]
	CommitIn      optional.Of[[]string]
	Status        optional.Of[BuildStatus]
	Retriable     optional.Of[bool]
}

type GetEnvCondition

type GetEnvCondition struct {
	ApplicationIDIn optional.Of[[]string]
	ApplicationID   optional.Of[string]
	Key             optional.Of[string]
}

type GetRepositoryCondition

type GetRepositoryCondition struct {
	IDs             optional.Of[[]string]
	URLs            optional.Of[[]string]
	PublicOrOwnedBy optional.Of[string]
	UserID          optional.Of[string]
}

type GetUserCondition

type GetUserCondition struct {
	Admin optional.Of[bool]
}

type GetUserKeyCondition

type GetUserKeyCondition struct {
	UserIDs optional.Of[[]string]
}

type GitRepositoryRepository

type GitRepositoryRepository interface {
	GetRepositories(ctx context.Context, condition GetRepositoryCondition) ([]*Repository, error)
	GetRepository(ctx context.Context, id string) (*Repository, error)
	CreateRepository(ctx context.Context, repo *Repository) error
	UpdateRepository(ctx context.Context, id string, args *UpdateRepositoryArgs) error
	DeleteRepository(ctx context.Context, id string) error
}

type MariaDBManager

type MariaDBManager interface {
	GetHost() (host string, port int)
	// Create データベースが存在しない場合、作成します
	Create(ctx context.Context, args CreateArgs) error
	// Delete データベースが存在する場合、削除します
	Delete(ctx context.Context, args DeleteArgs) error
	// IsExist データベースが存在するか確認します
	IsExist(ctx context.Context, dbname string) (bool, error)
	Close(ctx context.Context) error
}

MariaDBManager MariaDBマネージャー

type MongoDBManager

type MongoDBManager interface {
	GetHost() (host string, port int)
	// Create データベースが存在しない場合、作成します
	Create(ctx context.Context, args CreateArgs) error
	// Delete データベースが存在する場合、削除します
	Delete(ctx context.Context, args DeleteArgs) error
	// IsExist データベースが存在するか確認します
	IsExist(ctx context.Context, dbname string) (bool, error)
	Close(ctx context.Context) error
}

MongoDBManager Mongoマネージャー

type PortPublication added in v0.3.0

type PortPublication struct {
	InternetPort    int
	ApplicationPort int
	Protocol        PortPublicationProtocol
}

func (*PortPublication) Compare added in v0.4.1

func (p *PortPublication) Compare(other *PortPublication) bool

func (*PortPublication) ConflictsWith added in v0.3.0

func (p *PortPublication) ConflictsWith(existing []*Application) bool

func (*PortPublication) Validate added in v0.3.0

func (p *PortPublication) Validate() error

type PortPublicationProtocol added in v0.3.0

type PortPublicationProtocol string
const (
	PortPublicationProtocolTCP PortPublicationProtocol = "tcp"
	PortPublicationProtocolUDP PortPublicationProtocol = "udp"
)

type PubSub

type PubSub[E any] struct {
	// contains filtered or unexported fields
}

PubSub is a simple pub-sub for single event type. A zero-value PubSub is ready for use.

func (*PubSub[E]) Publish

func (p *PubSub[E]) Publish(event E)

func (*PubSub[E]) Subscribe

func (p *PubSub[E]) Subscribe() (sub <-chan E, unsub func())

type Repository

type Repository struct {
	ID       string
	Name     string
	URL      string
	Auth     optional.Of[RepositoryAuth]
	OwnerIDs []string
}

func NewRepository added in v0.5.0

func NewRepository(name, url string, auth optional.Of[RepositoryAuth], ownerIDs []string) *Repository

func (*Repository) Apply

func (r *Repository) Apply(args *UpdateRepositoryArgs)

func (*Repository) IsOwner

func (r *Repository) IsOwner(user *User) bool

func (*Repository) Validate

func (r *Repository) Validate() error

type RepositoryAuth

type RepositoryAuth struct {
	Method   RepositoryAuthMethod
	Username string
	Password string
	SSHKey   string
}

func (*RepositoryAuth) Validate

func (r *RepositoryAuth) Validate() error

type RepositoryAuthMethod

type RepositoryAuthMethod int
const (
	RepositoryAuthMethodBasic RepositoryAuthMethod = iota
	RepositoryAuthMethodSSH
)

type RuntimeConfig added in v0.3.5

type RuntimeConfig struct {
	UseMariaDB bool
	UseMongoDB bool
	Entrypoint string
	Command    string
}

func (*RuntimeConfig) CommandArgs added in v0.3.5

func (rc *RuntimeConfig) CommandArgs() []string

func (*RuntimeConfig) EntrypointArgs added in v0.3.5

func (rc *RuntimeConfig) EntrypointArgs() []string

func (*RuntimeConfig) MariaDB added in v0.3.5

func (rc *RuntimeConfig) MariaDB() bool

func (*RuntimeConfig) MongoDB added in v0.3.5

func (rc *RuntimeConfig) MongoDB() bool

func (*RuntimeConfig) Validate added in v0.3.5

func (rc *RuntimeConfig) Validate() error

type RuntimeDesiredState

type RuntimeDesiredState struct {
	App       *Application
	ImageName string
	ImageTag  string
	Envs      map[string]string
}

type SSHConfig

type SSHConfig struct {
	Host string `mapstructure:"host" yaml:"host"`
	Port int    `mapstructure:"port" yaml:"port"`
}

type StaticConfig added in v0.3.5

type StaticConfig struct{}

func (*StaticConfig) CommandArgs added in v0.3.5

func (sc *StaticConfig) CommandArgs() []string

func (*StaticConfig) EntrypointArgs added in v0.3.5

func (sc *StaticConfig) EntrypointArgs() []string

func (*StaticConfig) MariaDB added in v0.3.5

func (sc *StaticConfig) MariaDB() bool

func (*StaticConfig) MongoDB added in v0.3.5

func (sc *StaticConfig) MongoDB() bool

type StaticServer added in v0.7.0

type StaticServer interface {
	Start(ctx context.Context) error
	Reconcile(sites []*StaticSite) error
	Shutdown(ctx context.Context) error
}

type StaticServerDocumentRootPath

type StaticServerDocumentRootPath string

type StaticSite

type StaticSite struct {
	Application *Application
	Website     *Website
	ArtifactID  string
}

func GetActiveStaticSites

func GetActiveStaticSites(ctx context.Context, appRepo ApplicationRepository, buildRepo BuildRepository) ([]*StaticSite, error)

type Storage

type Storage interface {
	Save(filename string, src io.Reader) error
	Open(filename string) (io.ReadCloser, error)
	Delete(filename string) error
}

Storage ストレージインターフェース

type StorageConfig

type StorageConfig struct {
	Type  string `mapstructure:"type" yaml:"type"`
	Local struct {
		// Dir 保存ディレクトリ
		Dir string `mapstructure:"dir" yaml:"dir"`
	} `mapstructure:"local" yaml:"local"`
	S3 struct {
		// Bucket バケット名
		Bucket       string `mapstructure:"bucket" yaml:"bucket"`
		Endpoint     string `mapstructure:"endpoint" yaml:"endpoint"`
		Region       string `mapstructure:"region" yaml:"region"`
		AccessKey    string `mapstructure:"accessKey" yaml:"accessKey"`
		AccessSecret string `mapstructure:"accessSecret" yaml:"accessSecret"`
	} `mapstructure:"s3" yaml:"s3"`
	Swift struct {
		// UserName ユーザー名
		UserName string `mapstructure:"username" yaml:"username"`
		// APIKey APIキー(パスワード)
		APIKey string `mapstructure:"apiKey" yaml:"apiKey"`
		// TenantName テナント名
		TenantName string `mapstructure:"tenantName" yaml:"tenantName"`
		// TenantID テナントID
		TenantID string `mapstructure:"tenantId" yaml:"tenantId"`
		// Container コンテナ名
		Container string `mapstructure:"container" yaml:"container"`
		// AuthURL 認証エンドポイント
		AuthURL string `mapstructure:"authUrl" yaml:"authUrl"`
	} `mapstructure:"swift" yaml:"swift"`
}

type UpdateApplicationArgs

type UpdateApplicationArgs struct {
	Name             optional.Of[string]
	RefName          optional.Of[string]
	Running          optional.Of[bool]
	Container        optional.Of[ContainerState]
	CurrentCommit    optional.Of[string]
	WantCommit       optional.Of[string]
	UpdatedAt        optional.Of[time.Time]
	Config           optional.Of[ApplicationConfig]
	Websites         optional.Of[[]*Website]
	PortPublications optional.Of[[]*PortPublication]
	OwnerIDs         optional.Of[[]string]
}

type UpdateArtifactArgs

type UpdateArtifactArgs struct {
	DeletedAt optional.Of[time.Time]
}

type UpdateBuildArgs

type UpdateBuildArgs struct {
	FromStatus optional.Of[BuildStatus]
	Status     optional.Of[BuildStatus]
	StartedAt  optional.Of[time.Time]
	UpdatedAt  optional.Of[time.Time]
	FinishedAt optional.Of[time.Time]
}

type UpdateRepositoryArgs

type UpdateRepositoryArgs struct {
	Name     optional.Of[string]
	URL      optional.Of[string]
	Auth     optional.Of[optional.Of[RepositoryAuth]]
	OwnerIDs optional.Of[[]string]
}

type User

type User struct {
	ID    string
	Name  string
	Admin bool
}

func NewUser

func NewUser(name string) *User

func (*User) AvatarURL added in v0.4.6

func (u *User) AvatarURL(baseURL AvatarBaseURL) string

type UserKey

type UserKey struct {
	ID        string
	UserID    string
	PublicKey string
}

func NewUserKey

func NewUserKey(userID string, publicKey string) (*UserKey, error)

func (*UserKey) MarshalKey

func (u *UserKey) MarshalKey() []byte

func (*UserKey) Validate

func (u *UserKey) Validate() error

type UserRepository

type UserRepository interface {
	EnsureUser(ctx context.Context, name string) (*User, error)
	EnsureUsers(ctx context.Context, names []string) ([]*User, error)
	GetUsers(ctx context.Context, cond GetUserCondition) ([]*User, error)
	GetUserKeys(ctx context.Context, cond GetUserKeyCondition) ([]*UserKey, error)
	CreateUserKey(ctx context.Context, key *UserKey) error
	DeleteUserKey(ctx context.Context, keyID string, userID string) error
}

type Website

type Website struct {
	ID             string
	FQDN           string
	PathPrefix     string
	StripPrefix    bool
	HTTPS          bool
	H2C            bool
	HTTPPort       int
	Authentication AuthenticationType
}

func (*Website) Compare added in v0.4.1

func (w *Website) Compare(other *Website) bool

func (*Website) Equals

func (w *Website) Equals(target *Website) bool

func (*Website) Validate

func (w *Website) Validate() error

type WildcardDomains

type WildcardDomains []string

func (WildcardDomains) TLSTargetDomain

func (wd WildcardDomains) TLSTargetDomain(website *Website) string

func (WildcardDomains) Validate

func (wd WildcardDomains) Validate() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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