GithubHelp home page GithubHelp logo

yuedf / go-pluginserver Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kong/go-pluginserver

0.0 1.0 0.0 78 KB

Kong Go Plugin Server

License: Apache License 2.0

Go 84.03% Shell 15.14% Makefile 0.83%

go-pluginserver's Introduction

go-pluginserver

Runs Kong plugins written in Go. Implemented as a standalone MessagePack-RPC server.

There's no explicit state associated with the client connections, so the same plugins, instances and even events could be shared with several clients, or a single client can use more than one connection from a pool. For the same reason, plugin instances and events could survive client disconnections, if the client reconnects when necessary.

Pluginserver

Holds the running server status. Starts and stops with the server process.

RPC Methods:

  • plugin.SetPluginDir()
  • plugin.GetPluginInfo()

Plugin Instance

Holds a plugin config object, directly related to each configuration instance. The config object is defined by the plugin code, and exported fields (name starts with a caplital letter) are filled with configuration data and described in the schema. Any private field is ignored but preserved between events.

RPC Methods:

  • plugin.StartInstance()
  • plugin.InstanceStatus()
  • plugin.CloseInstance()

The StartInstance() method receives configuration data in a serialized format (currently JSON) in a binary string. If the configuration is modified externally, a new instance should be started and the old one closed.

Event

Handles a Kong event. The event instance lives during the whole callback/response cyle. Several events can share a single plugin instance concurrently, exercise care if mutating shared data.

RPC Methods:

  • plugin.HandleEvent()
  • plugin.Step()
  • plugin.StepError()
  • plugin.StepCredential()
  • plugin.StepRoute()
  • plugin.StepService()
  • plugin.StepConsumer()
  • plugin.StepMemoryStats()

To start an event, call plugin.HandleEvent() with an instance id and event name. The return data will include the event ID and either a "ret" string or callback request and parameters. If the callback response is a primitive type (number, string, simple dictionary) return it via the plugin.Step() method, including the event ID. To return an error, use plugin.StepError(). For other specific complex types, use the corresponding plugin.StepXXX() method.

go-pluginserver's People

Contributors

javierguerragiraldez avatar gszr avatar hishamhm avatar jumal avatar karuppiah7890 avatar melchor629 avatar locao avatar longquan0104 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.