host

package
v1.0.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

README

pkg/host

Package: github.com/quadroops/goplugin/pkg/host

Overview

  • Setup hostname. Each of application/service using goplugin must have a unique hostname
  • Validate available plugins. This process will check all available plugins, and also check for their MD5Sum, should return a map of plugin name and their exec path

Behaviors

  • Setup hostname

  • Install. This process will automatically explore all available plugins based on given hostname and PluginConfig

    • Get a list of plugins
    • Check if exec path is exist
    • Get MD5Sum and compare it with PluginConfig
    • Create a map based on plugin's name and their exec path

Usages

import (
    "github.com/quadroops/goplugin/pkg/host"
    "github.com/quadroops/goplugin/pkg/host/driver"
)

h := host.New("hostname", config, driver.NewMD5Check())
installed, err := h.Install(h.Setup())

if err != nil {
    // error handling
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	Hostname string
	Config   *discover.PluginConfig
	// contains filtered or unexported fields
}

Builder used to create host metadata

func New

func New(hostname string, config *discover.PluginConfig, md5Checker IdentityChecker) *Builder

New used to create new instance of host

func (*Builder) Install

func (b *Builder) Install(plugins Plugins) (Host, error)

Install used to validate given available plugins, and return a Host a mapper between host and their plugins

func (*Builder) Setup

func (b *Builder) Setup() Plugins

Setup used to get available plugins based on hostname

type Host

type Host map[Name]Plugins

Host is a mapper between a host and their available plugins

type IdentityChecker

type IdentityChecker interface {
	Parse(source string) (string, error)
}

IdentityChecker used to check identity for security purpose By default, we will use md5 file checker to check plugin's md5 value

type Name

type Name string

Name used for host name

type PluginName

type PluginName string

PluginName used for plugin's name

type Plugins

type Plugins map[PluginName]*Registry

Plugins is a mapper a plugin and their metadata

type Registry

type Registry struct {
	ExecPath     string
	ExecArgs     []string
	ExecFile     string
	ExecTime     int
	MD5Sum       string
	ProtocolType string
}

Registry used for storing validated plugins

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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