deploy

package
v0.0.0-...-5a6e01e Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: GPL-3.0 Imports: 36 Imported by: 0

Documentation

Overview

Package deploy supports internal deployment processes.

Index

Constants

This section is empty.

Variables

View Source
var (
	ContextValueDeployKeyStorage util.ContextKey = "deploy_key_storage"
	ContextValueBlockdataCleaner util.ContextKey = "blockdata_cleaner"
	ContextValueDeployHandler    util.ContextKey = "deploy_handler"
)
View Source
var (
	QuicHandlerPathDeployKeyKeys      = "/_deploy/key/keys"
	QuicHandlerPathDeployKeyNew       = "/_deploy/key/new"
	QuicHandlerPathDeployKeyToken     = "/_deploy/key/token" // nolint:gosec
	QuicHandlerPathDeployKeyKeyPrefix = "/_deploy/key"
	QuicHandlerPathDeployKeyKey       = QuicHandlerPathDeployKeyKeyPrefix + QuicHandlerPathDeployKeyKeySuffix
)
View Source
var (
	RateLimitHandlerNameDeployKeyToken  = "deploy-key-token"
	RateLimitHandlerNameDeployKeyKey    = "deploy-key-key"
	RateLimitHandlerNameDeployKeyKeys   = "deploy-key-keys"
	RateLimitHandlerNameDeployKeyNew    = "deploy-key-new"
	RateLimitHandlerNameDeployKeyRevoke = "deploy-key-revoke"
)
View Source
var DatabaseInfoDeployKeysKey = "deploy_keys"
View Source
var DefaultDeployKeyTokenExpired = time.Second * 30
View Source
var DefaultTimeAfterRemoveBlockdataFiles = time.Minute * 30
View Source
var HookNameBlockdataCleaner = "blockdata_cleaner"
View Source
var HookNameDeployHandlers = "deploy_handlers"
View Source
var HookNameInitializeDeployKeyStorage = "initialize_deploy_key_storage"
View Source
var LimitBlockdataMaps = 100
View Source
var QuicHandlerPathDeployKeyKeySuffix = "/{deploy_key:.*}"
View Source
var QuicHandlerPathSetBlockdataMaps = "/_deploy/blockdatamaps"
View Source
var RateLimitHandlerNameSetBlockdataMaps = "set-blockdatamaps"

Functions

func DeployKeyTokenSignature

func DeployKeyTokenSignature(localKey key.Privatekey, token string, networkID base.NetworkID) (key.Signature, error)

func HookBlockdataCleaner

func HookBlockdataCleaner(ctx context.Context) (context.Context, error)

func HookDeployHandlers

func HookDeployHandlers(ctx context.Context) (context.Context, error)

func HookInitializeDeployKeyStorage

func HookInitializeDeployKeyStorage(ctx context.Context) (context.Context, error)

func LoadBlockdataCleanerContextValue

func LoadBlockdataCleanerContextValue(ctx context.Context, l **BlockdataCleaner) error

func LoadDeployHandler

func LoadDeployHandler(ctx context.Context, l **DeployHandlers) error

func LoadDeployKeyStorageContextValue

func LoadDeployKeyStorageContextValue(ctx context.Context, l **DeployKeyStorage) error

func NewDeployKeyKeyHandler

func NewDeployKeyKeyHandler(ks *DeployKeyStorage, enc encoder.Encoder) network.HTTPHandlerFunc

func NewDeployKeyKeysHandler

func NewDeployKeyKeysHandler(ks *DeployKeyStorage, enc encoder.Encoder) network.HTTPHandlerFunc

func NewDeployKeyNewHandler

func NewDeployKeyNewHandler(ks *DeployKeyStorage, enc encoder.Encoder) network.HTTPHandlerFunc

func NewDeployKeyRevokeHandler

func NewDeployKeyRevokeHandler(ks *DeployKeyStorage) network.HTTPHandlerFunc

func NewSetBlockdataMapsHandler

func NewSetBlockdataMapsHandler(
	enc encoder.Encoder,
	db storage.Database,
	bc *BlockdataCleaner,
) network.HTTPHandlerFunc

func UnauthorizedError

func UnauthorizedError(w http.ResponseWriter, realm string, err error)

func VerifyDeployKeyToken

func VerifyDeployKeyToken(
	c cache.Cache,
	localKey key.Publickey,
	token string,
	networkID base.NetworkID,
	signature key.Signature,
) error

Types

type BaseDeployHandler

type BaseDeployHandler struct {
	*logging.Logging
	// contains filtered or unexported fields
}

func NewBaseDeployHandler

func NewBaseDeployHandler(
	ctx context.Context,
	name string,
	handler func(string) *mux.Route,
) (*BaseDeployHandler, error)

func (*BaseDeployHandler) RateLimit

func (dh *BaseDeployHandler) RateLimit(name string, handler http.Handler) http.Handler

type BlockdataCleaner

type BlockdataCleaner struct {
	sync.RWMutex
	*logging.Logging
	*util.ContextDaemon
	// contains filtered or unexported fields
}

func NewBlockdataCleaner

func NewBlockdataCleaner(bd *localfs.Blockdata, removeAfter time.Duration) *BlockdataCleaner

func (*BlockdataCleaner) Add

func (bc *BlockdataCleaner) Add(height base.Height) error

func (*BlockdataCleaner) RemoveAfter

func (bc *BlockdataCleaner) RemoveAfter() time.Duration

func (*BlockdataCleaner) SetLogging

func (bc *BlockdataCleaner) SetLogging(l *logging.Logging) *logging.Logging

type DeployByKeyMiddleware

type DeployByKeyMiddleware struct {
	*logging.Logging
	// contains filtered or unexported fields
}

func NewDeployByKeyMiddleware

func NewDeployByKeyMiddleware(ks *DeployKeyStorage) *DeployByKeyMiddleware

func (*DeployByKeyMiddleware) Middleware

func (md *DeployByKeyMiddleware) Middleware(next http.Handler) http.Handler

type DeployHandlers

type DeployHandlers struct {
	*BaseDeployHandler
	// contains filtered or unexported fields
}

func NewDeployHandlers

func NewDeployHandlers(ctx context.Context, handler func(string) *mux.Route) (*DeployHandlers, error)

func (*DeployHandlers) SetHandler

func (dh *DeployHandlers) SetHandler(prefix string, handler http.Handler) *mux.Route

type DeployKey

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

func NewDeployKey

func NewDeployKey() DeployKey

func (DeployKey) AddedAt

func (dk DeployKey) AddedAt() time.Time

func (DeployKey) Key

func (dk DeployKey) Key() string

func (DeployKey) MarshalBSON

func (dk DeployKey) MarshalBSON() ([]byte, error)

func (DeployKey) MarshalJSON

func (dk DeployKey) MarshalJSON() ([]byte, error)

func (*DeployKey) UnmarshalBSON

func (dk *DeployKey) UnmarshalBSON(b []byte) error

func (*DeployKey) UnmarshalJSON

func (dk *DeployKey) UnmarshalJSON(b []byte) error

type DeployKeyByTokenMiddleware

type DeployKeyByTokenMiddleware struct {
	*logging.Logging
	// contains filtered or unexported fields
}

func NewDeployKeyByTokenMiddleware

func NewDeployKeyByTokenMiddleware(
	c cache.Cache,
	localKey key.Publickey,
	networkID base.NetworkID,
) *DeployKeyByTokenMiddleware

func (*DeployKeyByTokenMiddleware) Middleware

func (md *DeployKeyByTokenMiddleware) Middleware(next http.Handler) http.Handler

type DeployKeyPackerJSON

type DeployKeyPackerJSON struct {
	K  string         `json:"key"`
	AA localtime.Time `json:"added_at"`
}

type DeployKeyStorage

type DeployKeyStorage struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewDeployKeyStorage

func NewDeployKeyStorage(db storage.Database) (*DeployKeyStorage, error)

func (*DeployKeyStorage) Exists

func (ks *DeployKeyStorage) Exists(k string) bool

func (*DeployKeyStorage) Key

func (ks *DeployKeyStorage) Key(k string) (DeployKey, bool)

func (*DeployKeyStorage) Len

func (ks *DeployKeyStorage) Len() int

func (*DeployKeyStorage) New

func (ks *DeployKeyStorage) New() (DeployKey, error)

func (*DeployKeyStorage) Revoke

func (ks *DeployKeyStorage) Revoke(k string) error

func (*DeployKeyStorage) Traverse

func (ks *DeployKeyStorage) Traverse(callback func(DeployKey) bool)

type DeployKeyTokenHandler

type DeployKeyTokenHandler struct {
	*logging.Logging
	// contains filtered or unexported fields
}

func NewDeployKeyTokenHandler

func NewDeployKeyTokenHandler(c cache.Cache, expired time.Duration) *DeployKeyTokenHandler

func (*DeployKeyTokenHandler) ServeHTTP

func (hn *DeployKeyTokenHandler) ServeHTTP(w http.ResponseWriter, _ *http.Request)

type DeployKeyUnpackerBSON

type DeployKeyUnpackerBSON struct {
	K  string    `bson:"key"`
	AA time.Time `bson:"added_at"`
}

type DeployKeyUnpackerJSON

type DeployKeyUnpackerJSON struct {
	K  string         `json:"key"`
	AA localtime.Time `json:"added_at"`
}

Jump to

Keyboard shortcuts

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