Socket
Socket
Sign inDemoInstall

github.com/documize/glick

Package Overview
Dependencies
0
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    github.com/documize/glick

Package glick provides a simple plug-in environment. The central feature of glick is the Library which contains example types for the input and output of each API on the system. Each of these APIs can have a number of "actions" upon them, for example a file conversion API may have one action for each of the file formats to be convereted. Using the Run() method of glick.Library, a given API/Action combination runs the code in a function of Go type Plugin. Although it is easy to create your own plugins, there are three types built-in: Remote Procedure Calls (RPC), simple URL fetch (URL) and OS commands (CMD). A number of sub-packages simplify the use of third-party libraries when providing further types of plugin. The mapping of which plugin code to run occurs at three levels: 1) Intialisation and set-up code for the application will establish the glick.Library using glick.New(), then add API specifications using RegAPI(), it may also add the application's base plugins using RegPlugin(). 2) The base set-up can be extended and overloaded using a JSON format configuration description (probaly held in a file) by calling the Config() method of glick.Library. This configuration process is extensible, using the AddConfigurator() method - see the glick/glpie or glick/glkit sub-pakages for examples. 3) Which plugin to use can also be set-up or overloaded at runtime within Run(). Each call to a plugin includes a Context (as described in https://blog.golang.org/context). This context can contain for example user details, which could be matched against a database to see if that user should be directed to one plugin for a given action, rather than another. It could also be used to wrap every plugin call by a particular user with some other code, for example to log or meter activity.


Version published

Readme

Source

Versatile plugin framework for Go

This repository contains the "glick" plug-in framework, which is a work-in-progress.

Why "glick"? Well the framework is written in "go" and intended to be as easy to build with as lego bricks which "click" together, hence "glick".

The key features of Glick are:

  • Named APIs, described as Go types in and out of a plugin.
  • Different "actions" on that same API, but running different code.
  • Plugins can be configured using a simple JSON configuration file.
  • At runtime, the context of the call can be used to re-route it to different plugin code.

Plugin code can run:

  • within the application;
  • as a sub-process, either simple or structured as an RPC;
  • or remotely via: simple URL get, standard go RPC, via go-kit or using gRPC (with more to come).

For a more detailed overivew of the package see: doc.go

For a simple example see: examples_test.go

Dependencies

Besides the standard packages, "glick" relies on the Context of a request: https://golang.org/x/net/context and https://golang.org/x/net/context/ctxhttp

Additionally, "glick/glpie" provides an interface to Nate Finch's PIE package: https://github.com/natefinch/pie

The tests in "glick/glgrpc" provide example code to interface with gRPC, Go package at: https://google.golang.org/grpc

The package "glick/glkit" provides an interface to go-kit and alse requires: https://gopkg.in/logfmt.v0 and https://gopkg.in/stack.v1

Testing

In order to run the tests for the "glick/glpie" sub-package the server counterpart executables need to be built. "glick/glpie/_test/build_tests.sh" provides a bash script for doing this, it must be run from the directory it is in.

The code has only been tested on OSX & Ubuntu.

FAQs

Last updated on 03 May 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc