daemon

package
v0.0.0-...-bfb2502 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2020 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TCPAddress

func TCPAddress(ip string, port int) *net.TCPAddr

TCPAddress -

func TCPAddressFromString

func TCPAddressFromString(addr string) (*net.TCPAddr, error)

TCPAddressFromString -

Types

type API

type API struct {
	sync.Mutex
	sync.Once
	// contains filtered or unexported fields
}

API ...

func NewAPIEngine

func NewAPIEngine(
	config *Config,
	core *Core,
	listener net.Listener,
	logOutput io.Writer,
	logWriter *view.LogWriter,
) *API

NewAPIEngine ...

func (*API) Shutdown

func (a *API) Shutdown()

Shutdown ...

type Command

type Command struct {
	Ui         cli.Ui
	ShutdownCh <-chan struct{}
	// contains filtered or unexported fields
}

Command ...

func (*Command) Help

func (c *Command) Help() string

Help ...

func (*Command) Run

func (c *Command) Run(args []string) int

Run ...

func (*Command) Synopsis

func (c *Command) Synopsis() string

Synopsis ...

type Config

type Config struct {
	EncryptorPath   string `mapstructure:"encryptor_path"`
	DecryptorPath   string `mapstructure:"decryptor_path"`
	APIAddr         string `mapstructure:"api_addr"`
	APIPassword     string `mapstructure:"api_password"`
	LogLevel        string `mapstructure:"log_level"`
	Protocol        int    `mapstructure:"protocol"`
	DevelopmentMode bool   `mapstructure:"development_mode"`
}

Config ...

func DecodeConfig

func DecodeConfig(r io.Reader) (*Config, error)

DecodeConfig ...

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig ...

func MergeConfig

func MergeConfig(a, b *Config) *Config

MergeConfig ...

func ReadConfigPaths

func ReadConfigPaths(paths []string) (*Config, error)

ReadConfigPaths reads the paths in the given order to load configurations.

type Core

type Core struct {
	// contains filtered or unexported fields
}

Core ...

func Create

func Create(coreConf *Config, conf *daemon.CoreConfig, logOutput io.Writer) (*Core, error)

Create ...

func (*Core) Shutdown

func (a *Core) Shutdown() error

Shutdown ...

func (*Core) ShutdownCh

func (a *Core) ShutdownCh() <-chan struct{}

ShutdownCh ...

func (*Core) Start

func (a *Core) Start() error

Start ...

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service ...

func (*Service) Decrypt

func (s *Service) Decrypt(r *http.Request, req *model.DecryptRequest, res *model.DecryptResponse) error

Decrypt json rpc2.0 call that parses variables and passes it to Decrypt Plugin. Sample query

jq -n \
  --arg source "/tmp/encrypted" \
  --arg destination "/tmp/decrypted" \
	 --arg nonce "e12ffdfa6cb6e56238935e32604cfa5538d3ad51a3542daa" \
  --arg key "63b76723eb3f9d4f4862b73ff7e39b93c4de129feb4885f1f3feb74dd456e3a5" \
  --arg id "2" \
  --arg method "Service.Decrypt" \
 '{"jsonrpc": "2.0", "method":$method,"params":{"source": $source, "destination":$destination, "nonce":$nonce, "key":$key},"id": $id}' | curl \
	-X POST  \
	--silent \
    --header "Authorization: 12445" \
    --header "Content-type: application/json" \
    --data @- \
    http://127.0.0.1:8081/rpc | jq -r

func (*Service) Encrypt

func (s *Service) Encrypt(r *http.Request, req *model.EncryptRequest, res *model.EncryptResponse) error

Encrypt json rpc2.0 call that pparses variables and passes it to Encrypt Plugin. Sample query

jq -n \
  --arg source "/tmp/plain" \
  --arg destination "/tmp/encrypted" \
  --arg key "63b76723eb3f9d4f4862b73ff7e39b93c4de129feb4885f1f3feb74dd456e3a5" \
  --arg id "1" \
  --arg method "Service.Encrypt" \
 '{"jsonrpc": "2.0", "method":$method,"params":{"source": $source, "destination":$destination,"key":$key},"id": $id}' | curl \
    -X POST  \
 	--silent \
    --header "Authorization: 12445" \
	--header "Content-type: application/json" \
    --data @- \
    http://127.0.0.1:8081/rpc  | jq -r

Jump to

Keyboard shortcuts

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