8 // Protocol is an enum representing the types of protocols.
12 ProtocolInvalid Protocol = ""
13 ProtocolNetRPC Protocol = "netrpc"
14 ProtocolGRPC Protocol = "grpc"
17 // ServerProtocol is an interface that must be implemented for new plugin
18 // protocols to be servers.
19 type ServerProtocol interface {
20 // Init is called once to configure and initialize the protocol, but
21 // not start listening. This is the point at which all validation should
22 // be done and errors returned.
25 // Config is extra configuration to be outputted to stdout. This will
26 // be automatically base64 encoded to ensure it can be parsed properly.
27 // This can be an empty string if additional configuration is not needed.
30 // Serve is called to serve connections on the given listener. This should
31 // continue until the listener is closed.
35 // ClientProtocol is an interface that must be implemented for new plugin
36 // protocols to be clients.
37 type ClientProtocol interface {
40 // Dispense dispenses a new instance of the plugin with the given name.
41 Dispense(string) (interface{}, error)
43 // Ping checks that the client connection is still healthy.