api

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArchAndOS

type ArchAndOS struct {
	Arch string // GOARCH
	OS   string // GOOS
}

type Service

type Service struct {
	Healthy bool
	// contains filtered or unexported fields
}

Service is the main struct

func NewService

func NewService() *Service

func (*Service) HealthHandler

func (svc *Service) HealthHandler(ginCtx *gin.Context)

HealthHandler handles /healthz endpoint

func (*Service) IsHealthy

func (svc *Service) IsHealthy() bool

IsHealthy returns the health status of the running service.

func (*Service) PatchUpdateHandler added in v0.0.2

func (svc *Service) PatchUpdateHandler(ginCtx *gin.Context)

PatchUpdateHandler handles /patch-update/:name endpoint TODO: use file cache to read and store binarydiff

func (*Service) RegisterShutdown

func (svc *Service) RegisterShutdown()

func (*Service) RootHandler

func (svc *Service) RootHandler(ginCtx *gin.Context)

RootHandler handles / endpoint

func (*Service) Run

func (svc *Service) Run(config *ServiceConfig) error

Run is the main function of the server. It bootstraps the service and creates the route endpoints.

func (*Service) SignedPatchUpdateHandler added in v0.0.3

func (svc *Service) SignedPatchUpdateHandler(ginCtx *gin.Context)

SignedPatchUpdateHandler handles /signed-patch-update/:name endpoint

func (*Service) SignedUpdateHandler added in v0.0.2

func (svc *Service) SignedUpdateHandler(ginCtx *gin.Context)

SignedUpdateHandler handles /signed-update/:name endpoint

func (*Service) UpdateHandler

func (svc *Service) UpdateHandler(ginCtx *gin.Context)

UpdateHandler handles /update/:name endpoint

func (*Service) UploadHandler added in v0.0.4

func (svc *Service) UploadHandler(ginCtx *gin.Context)

UploadHandler handles /upload/:name endpoint

type ServiceConfig

type ServiceConfig struct {
	Config          *conf.Config
	OAuth2Endpoints oauth2.Endpoint
	CertKeyPair     tls.Certificate
	Httponly        bool
}

ServiceConfig contains everything configurable for the service endpoint.

type Update

type Update struct {
	Name    string
	Version string
	System  ArchAndOS
}

func (*Update) Clone added in v0.0.2

func (u *Update) Clone() *Update

func (*Update) GetFilepath added in v0.0.3

func (u *Update) GetFilepath() string

func (*Update) GetLatestVersion added in v0.0.2

func (u *Update) GetLatestVersion() string

func (*Update) GetReader

func (u *Update) GetReader(filepath string) (io.ReadCloser, error)

func (*Update) String

func (u *Update) String() string

type UploadData added in v0.0.4

type UploadData struct {
	Data          []byte `json:"data"`                     // the new binary version
	Version       string `json:"version"`                  // version string
	Architecture  string `json:"arch"`                     // architecture, p.e. amd64
	OS            string `json:"os"`                       // operating system, p.e. linux
	Signature     []byte `json:"signature,omitempty"`      // DER encoded signature
	SignatureType string `json:"signature-type,omitempty"` // ecdsa
}

UploadData represents all the data needed to provide update, patch update, signed update or signed patch update. You need to sign your data if you want to provide signed updates.

func (*UploadData) Save added in v0.0.4

func (ud *UploadData) Save(application string) error

func (*UploadData) Write added in v0.0.4

func (ud *UploadData) Write(filepath string, data []byte) error

Jump to

Keyboard shortcuts

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