Documentation ¶
Index ¶
- Variables
- func CompareHashAndPassword(hashedPassword string, password string) bool
- func GenerateRandomToken(length int) (string, error)
- func HashPassword(pwd string) (string, error)
- type AbstractProvider
- type Bundle
- type BundleCommand
- type BundleDocker
- type BundleInfo
- type CommandEntry
- type CommandRequest
- type CommandResponse
- type DatabaseConfigs
- type DockerConfigs
- type GlobalConfigs
- type GortConfig
- type GortServerConfigs
- type Provider
- type SlackProvider
Constants ¶
This section is empty.
Variables ¶
var ( // ErrCryptoHash is returned by HashPassword and will wrap its // underlying error. ErrCryptoHash = errors.New("failed to generate password hash") // ErrCryptoIO is returned by GenerateRandomToken if it can't retrieve // random bytes from rand.Read() ErrCryptoIO = errors.New("failed to retrieve randomness") )
Functions ¶
func CompareHashAndPassword ¶
CompareHashAndPassword receives a plaintext password and its hash, and returns true if they match.
func GenerateRandomToken ¶
GenerateRandomToken generates a random character token.
func HashPassword ¶
HashPassword receives a plaintext password and returns its hashed equivalent.
Types ¶
type AbstractProvider ¶
type AbstractProvider struct { BotName string `yaml:"bot_name,omitempty"` Name string `yaml:"name,omitempty"` }
AbstractProvider is used to contain the general properties shared by all providers.
type Bundle ¶
type Bundle struct { GortBundleVersion int `yaml:"gort_bundle_version,omitempty" json:"gort_bundle_version,omitempty"` Name string `yaml:",omitempty" json:"name,omitempty"` Version string `yaml:",omitempty" json:"version,omitempty"` Enabled bool `yaml:",omitempty" json:"enabled"` Author string `yaml:",omitempty" json:"author,omitempty"` Homepage string `yaml:",omitempty" json:"homepage,omitempty"` Description string `yaml:",omitempty" json:"description,omitempty"` InstalledOn time.Time `yaml:"-" json:"installed_on,omitempty"` InstalledBy string `yaml:",omitempty" json:"installed_by,omitempty"` LongDescription string `yaml:"long_description,omitempty" json:"long_description,omitempty"` Docker BundleDocker `yaml:",omitempty" json:"docker,omitempty"` Permissions []string `yaml:",omitempty" json:"permissions,omitempty"` Commands map[string]*BundleCommand `yaml:",omitempty" json:"commands,omitempty"` Default bool `yaml:"-" json:"default,omitempty"` }
Bundle represents a bundle as defined in the "bundles" section of the config.
type BundleCommand ¶
type BundleCommand struct { Description string `yaml:",omitempty" json:"description,omitempty"` Executable string `yaml:",omitempty" json:"executable,omitempty"` Name string `yaml:"-" json:"-"` Rules []string `yaml:",omitempty" json:"rules,omitempty"` }
BundleCommand represents a bundle command, as defined in the "bundles/commands" section of the config.
type BundleDocker ¶
type BundleDocker struct { Image string `yaml:",omitempty" json:"image,omitempty"` Tag string `yaml:",omitempty" json:"tag,omitempty"` }
BundleDocker represents the "bundles/docker" subsection of the config doc
type BundleInfo ¶
BundleInfo wraps a minimal amount of data abount a bundle.
type CommandEntry ¶
type CommandEntry struct { Bundle Bundle Command BundleCommand }
CommandEntry conveniently wraps a bundle and one command within that bundle.
type CommandRequest ¶
type CommandRequest struct { CommandEntry Adapter string // The name of the adapter this request originated from. ChannelID string // The channel that the request originated in. UserID string // The ID of the user making this request. Parameters []string // Tokenized command parameters }
CommandRequest represents a user command request as triggered in (probably) a chat provider.
func (CommandRequest) CommandString ¶
func (r CommandRequest) CommandString() string
CommandString is a convenience method that outputs the normalized command string, more or less as the user typed it.
type CommandResponse ¶
type CommandResponse struct { Command CommandRequest Status int64 Title string // Command Error Output []string // Contents of the commands stdout. Error error }
CommandResponse is returned by a relay to indicate that a command has been executed. It includes the original CommandRequest, the command's exit status code, and the commands entire stdout as a slice of lines. Title can be used to build a user output message, and generally contains a short description of the result.
TODO Add a request ID that correcponds with the request, so that we can more directly link it back to its user and adapter of origin.
type DatabaseConfigs ¶
type DatabaseConfigs struct { Host string `yaml:"host,omitempty"` Port int `yaml:"port,omitempty"` User string `yaml:"user,omitempty"` Password string `yaml:"password,omitempty"` SSLEnabled bool `yaml:"ssl_enabled,omitempty"` PoolSize int `yaml:"pool_size,omitempty"` PoolTimeout int `yaml:"pool_timeout,omitempty"` QueryTimeout int `yaml:"query_timeout,omitempty"` }
DatabaseConfigs is the data wrapper for the "database" section.
type DockerConfigs ¶
type DockerConfigs struct {
DockerHost string `yaml:"host,omitempty"`
}
DockerConfigs is the data wrapper for the "docker" section. This will move into the relay config(s) eventually.
type GlobalConfigs ¶
type GlobalConfigs struct {
CommandTimeoutSeconds int `yaml:"command_timeout_seconds,omitempty"`
}
GlobalConfigs is the data wrapper for the "global" section
type GortConfig ¶
type GortConfig struct { GortServerConfigs GortServerConfigs `yaml:"gort,omitempty"` GlobalConfigs GlobalConfigs `yaml:"global,omitempty"` DatabaseConfigs DatabaseConfigs `yaml:"database,omitempty"` DockerConfigs DockerConfigs `yaml:"docker,omitempty"` SlackProviders []SlackProvider `yaml:"slack,omitempty"` BundleConfigs []Bundle `yaml:"bundles,omitempty"` }
GortConfig is the top-level configuration object
type GortServerConfigs ¶
type GortServerConfigs struct { AllowSelfRegistration bool `yaml:"allow_self_registration,omitempty"` APIAddress string `yaml:"api_address,omitempty"` APIURLBase string `yaml:"api_url_base,omitempty"` DevelopmentMode bool `yaml:"development_mode,omitempty"` EnableSpokenCommands bool `yaml:"enable_spoken_commands,omitempty"` }
GortServerConfigs is the data wrapper for the "gort" section.
type Provider ¶
type Provider interface{}
Provider is the general interface for all providers. Currently only Slack is supported, with HipChat coming in time.
type SlackProvider ¶
type SlackProvider struct { AbstractProvider `yaml:",inline"` APIToken string `yaml:"api_token,omitempty"` IconURL string `yaml:"icon_url,omitempty"` }
SlackProvider is the data wrapper for a Slack provider.