Documentation ¶
Index ¶
- Constants
- Variables
- func ConvertToClientID(key *rsa.PublicKey) string
- func DecodePublicKey(key string) (*rsa.PublicKey, error)
- func FindJobIDInTestOutput(testOutput string) string
- func FindJobIDInTestOutputLegacy(testOutput string) string
- func InstallationID() string
- func IsDebugMode() bool
- func MustParseURL(uri string) *url.URL
- func PathExists(path string) (bool, error)
- func PublicKeyMatchesID(publicKey, clientID string) (bool, error)
- func ReverseList(s []string) []string
- func SplitLines(s string) []string
- func Verify(msg []byte, sig, publicKey string) error
- type CleanupManager
- type FunctionWaiter
- type GlobalConfig
- type MessageSigner
- type Signer
Constants ¶
const InstallationIDFile = "installation_id"
InstallationIDFile is the name of the file storing the installation ID.
Variables ¶
var MaxStderrFileLength = 1 * datasize.GB
MaxStderrFileLength sets the max size for stderr file during container execution (needed to prevent DoS)
var MaxStderrReturnLength = 2 * datasize.KB
MaxStderrReturnLength sets the max size for stderr string return into RunOutput (with truncation) from container execution (needed to prevent DoS)
var MaxStdoutFileLength = 1 * datasize.GB
MaxStdoutFileLength sets the max size for stdout file during container execution (needed to prevent DoS)
var MaxStdoutReturnLength = 2 * datasize.KB
MaxStdoutReturnLength sets the max size for stdout string return into RunOutput (with truncation) from container execution (needed to prevent DoS)
Functions ¶
func ConvertToClientID ¶ added in v1.2.1
ConvertToClientID converts a public key to a client ID:
func DecodePublicKey ¶ added in v1.2.1
DecodePublicKey decodes a public key from a string:
func FindJobIDInTestOutput ¶
func FindJobIDInTestOutputLegacy ¶ added in v1.1.0
func InstallationID ¶ added in v1.5.0
func InstallationID() string
InstallationID is a convenience function that returns the installation ID using the DefaultGlobalConfig.
func IsDebugMode ¶ added in v1.5.0
func IsDebugMode() bool
IsDebugMode returns true if the environment variable DEBUG is set to true
func MustParseURL ¶ added in v0.3.25
func PathExists ¶
PathExists returns whether the given file or directory exists
func PublicKeyMatchesID ¶
PublicKeyMatchesID returns true if the given base64-encoded public key and the given client ID correspond to each other:
func ReverseList ¶
func SplitLines ¶
Types ¶
type CleanupManager ¶
type CleanupManager struct {
// contains filtered or unexported fields
}
CleanupManager provides utilities for ensuring that sub-goroutines can clean up their resources before the main goroutine exits. Can be used to register callbacks for long-running system processes.
func NewCleanupManager ¶
func NewCleanupManager() *CleanupManager
NewCleanupManager returns a new CleanupManager instance.
func (*CleanupManager) Cleanup ¶
func (cm *CleanupManager) Cleanup(ctx context.Context)
Cleanup runs all registered clean-up functions in sub-goroutines and waits for them all to complete before exiting.
func (*CleanupManager) RegisterCallback ¶
func (cm *CleanupManager) RegisterCallback(fn cleanUpWithoutContext)
RegisterCallback registers a clean-up function.
func (*CleanupManager) RegisterCallbackWithContext ¶
func (cm *CleanupManager) RegisterCallbackWithContext(fn cleanUpWithContext)
RegisterCallbackWithContext registers a clean-up function. The context passed is guaranteed not to be already canceled.
type FunctionWaiter ¶
type GlobalConfig ¶ added in v1.5.0
type GlobalConfig interface { // InstallationID returns the unique identifier for this installation, if available. InstallationID() string // ConfigDir returns the path to the configuration directory. ConfigDir() string }
GlobalConfig defines the interface for accessing global configuration settings. The interface is used to abstract the configuration directory and installation ID and allows for easy testing, such as testing migration logic.
var DefaultGlobalConfig GlobalConfig = &realGlobalConfig{}
DefaultGlobalConfig is the default implementation of GlobalConfig.
type MessageSigner ¶ added in v1.3.2
type MessageSigner struct {
// contains filtered or unexported fields
}
func NewMessageSigner ¶ added in v1.3.2
func NewMessageSigner(sk *rsa.PrivateKey) *MessageSigner
func (*MessageSigner) PublicKey ¶ added in v1.3.2
func (m *MessageSigner) PublicKey() *rsa.PublicKey
func (*MessageSigner) PublicKeyString ¶ added in v1.3.2
func (m *MessageSigner) PublicKeyString() string
PublicKeyString returns a base64-encoding of the user's public ID key: