api

package
v0.0.0-...-fc9a6ea Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StatusOKResponse = []byte(`{"status": "ok"}`)
View Source
var (
	VersionHeader string
)

Functions

This section is empty.

Types

type ArmoryBundle

type ArmoryBundle struct {
	Name     string   `json:"name"`
	Packages []string `json:"packages"`
}

ArmoryBundle - A bundle of packages

type ArmoryEntry

type ArmoryEntry struct {
	Name        string `json:"name"`
	CommandName string `json:"command_name"`
	RepoURL     string `json:"repo_url"`
	PublicKey   string `json:"public_key"`
}

ArmoryEntry - An alias or extension entry

type ArmoryIndex

type ArmoryIndex struct {
	Aliases    []*ArmoryEntry  `json:"aliases"`
	Extensions []*ArmoryEntry  `json:"extensions"`
	Bundles    []*ArmoryBundle `json:"bundles"`
}

ArmoryIndex - Root index, must be signed by server private key

type ArmoryServer

type ArmoryServer struct {
	HTTPServer         *http.Server
	ArmoryServerConfig *ArmoryServerConfig
	AccessLog          *logrus.Logger
	AppLog             *logrus.Logger
}

ArmoryServer - The armory server object

func New

func New(config *ArmoryServerConfig, app *logrus.Logger, access *logrus.Logger) *ArmoryServer

New - Create a new server instance with given configuration and loggers

func (*ArmoryServer) AddPackageHandler

func (s *ArmoryServer) AddPackageHandler(resp http.ResponseWriter, req *http.Request)

func (*ArmoryServer) AliasArchiveHandler

func (s *ArmoryServer) AliasArchiveHandler(resp http.ResponseWriter, req *http.Request)

AliasArchiveHandler - returns the package archive

func (*ArmoryServer) AliasMetaHandler

func (s *ArmoryServer) AliasMetaHandler(resp http.ResponseWriter, req *http.Request)

AliasMetaHandler - returns the signature of the package and a link to it as JSON

func (*ArmoryServer) ExtensionArchiveHandler

func (s *ArmoryServer) ExtensionArchiveHandler(resp http.ResponseWriter, req *http.Request)

ExtensionArchiveHandler - returns the package archive

func (*ArmoryServer) ExtensionMetaHandler

func (s *ArmoryServer) ExtensionMetaHandler(resp http.ResponseWriter, req *http.Request)

ExtensionMetaHandler - returns the signature of the package and a link to it as JSON

func (*ArmoryServer) IndexHandler

func (s *ArmoryServer) IndexHandler(resp http.ResponseWriter, req *http.Request)

IndexHandler - Returns the index of extensions, aliases, and bundles

func (*ArmoryServer) ModifyPackageHandler

func (s *ArmoryServer) ModifyPackageHandler(resp http.ResponseWriter, req *http.Request)

func (*ArmoryServer) RemovePackageHandler

func (s *ArmoryServer) RemovePackageHandler(resp http.ResponseWriter, req *http.Request)

type ArmoryServerConfig

type ArmoryServerConfig struct {
	DomainName string `json:"domain_name"`
	ListenHost string `json:"lhost"`
	ListenPort uint16 `json:"lport"`

	TLSEnabled bool `json:"tls_enabled"`

	RootDir   string `json:"root_dir"`
	PublicKey string `json:"public_key"`

	ClientAuthenticationDisabled   bool   `json:"client_authentication_disabled"`
	ClientAuthorizationTokenDigest string `json:"client_authorization_token_digest"`
	AdminAuthorizationTokenDigest  string `json:"admin_authorization_token_digest"`

	WriteTimeout time.Duration `json:"write_timeout"`
	ReadTimeout  time.Duration `json:"read_timeout"`

	SigningKeyProviderName    string                 `json:"signing_key_provider"`
	SigningKeyProviderDetails signing.SigningKeyInfo `json:"signing_key_provider_details,omitempty"`

	StorageProviderName    string                 `json:"storage_provider"`
	StorageProviderDetails storage.StorageOptions `json:"storage_provider_details,omitempty"`

	SigningKeyProvider signing.SigningProvider `json:"-"`
	StorageProvider    storage.StorageProvider `json:"-"`
}

ArmoryServerConfig - Configuration options for the Armory server

func (*ArmoryServerConfig) RepoURL

func (c *ArmoryServerConfig) RepoURL() string

RepoURL - Returns the (most likely) repo URL, if no domain is provided we attempt to determine the primary interface IP address.

func (*ArmoryServerConfig) UnmarshalJSON

func (asc *ArmoryServerConfig) UnmarshalJSON(data []byte) error

Need a custom unmarshaler to properly unmarshal the SigningKeyInfo struct

type JSONError

type JSONError struct {
	Error string `json:"error"`
}

JSONError - Return an error in JSON format

type SigningKeyProviderInfo

type SigningKeyProviderInfo map[string]string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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