srvcommon

package
v0.0.0-...-1f15dd0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2021 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package srvcommon contains various constants, interfaces and functions used by one or more server provider

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RandomString

func RandomString(xlen int) string

RandomString generates a string of xlen length from random alphabet runes

func RedirectWithState

func RedirectWithState(oauther OAuther, ctx *fiber.Ctx)

RedirectWithState sets a state cookie for OAuth and redirects the client

func RespondWithHTML

func RespondWithHTML(ctx *fiber.Ctx, html string)

RespondWithHTML takes a given fiber request context and returns a 200 OK status with the given html response body

Types

type CredentialProvider

type CredentialProvider interface {
	EnterCredentials() (string, map[string]string)
	ValidateCredentials(ctx *fiber.Ctx, session *session.Session) error
}

type OAuther

type OAuther interface {
	OAuth2() *oauth2.Config
}

type Provider

type Provider interface {
	OAuther
	SSHKeyProvider
	CredentialProvider
}

type Question

type Question struct {
	Options  *map[string]string
	Question string
	Validate func(input string) error
}

type SSHKeyProvider

type SSHKeyProvider interface {
	CreateSSHKey(token string, sshKey string) (interface{}, error)
	CreateServer(token string, sshKey interface{}) (*string, *string, error)
}

type Software

type Software interface {
	Name() string
	URL() string
	AdditionalQuestions() map[string]Question
	Prepare(ip string, domain string, provider string, questions map[string]string) error
	Execute(ip string, domain string, provider string, questions map[string]string) error
	Export(ip string, domain string, provider string, questions map[string]string) (map[string]string, error)
	Cleanup(ip string, domain string, provider string, questions map[string]string) error
}

Jump to

Keyboard shortcuts

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