Documentation ¶
Overview ¶
Package v1 contains generated types for google/protobuf/struct.proto.
The messages (i.e., Value, Struct, and ListValue) defined in struct.proto are used to represent arbitrary JSON. The Value message represents a JSON value, the Struct message represents a JSON object, and the ListValue message represents a JSON array. See https://json.org for more information.
The Value, Struct, and ListValue types have generated MarshalJSON and UnmarshalJSON methods such that they serialize JSON equivalent to what the messages themselves represent. Use of these types with the "google.golang.org/protobuf/encoding/protojson" package ensures that they will be serialized as their JSON equivalent.
Conversion to and from a Go interface ¶
The standard Go "encoding/json" package has functionality to serialize arbitrary types to a large degree. The Value.AsInterface, Struct.AsMap, and ListValue.AsSlice methods can convert the protobuf message representation into a form represented by interface{}, map[string]interface{}, and []interface{}. This form can be used with other packages that operate on such data structures and also directly with the standard json package.
In order to convert the interface{}, map[string]interface{}, and []interface{} forms back as Value, Struct, and ListValue messages, use the NewStruct, NewList, and NewValue constructor functions.
Example usage ¶
Consider the following example JSON object:
{ "firstName": "John", "lastName": "Smith", "isAlive": true, "age": 27, "address": { "streetAddress": "21 2nd Street", "city": "New York", "state": "NY", "postalCode": "10021-3100" }, "phoneNumbers": [ { "type": "home", "number": "212 555-1234" }, { "type": "office", "number": "646 555-4567" } ], "children": [], "spouse": null, "bytes": Uint8Array(new ArrayBuffer(16)) }
To construct a Value message representing the above JSON object:
m, err := v1.NewValue(map[string]interface{}{ "firstName": "John", "lastName": "Smith", "isAlive": true, "age": 27, "address": map[string]interface{}{ "streetAddress": "21 2nd Street", "city": "New York", "state": "NY", "postalCode": "10021-3100", }, "phoneNumbers": []interface{}{ map[string]interface{}{ "type": "home", "number": "212 555-1234", }, map[string]interface{}{ "type": "office", "number": "646 555-4567", }, }, "children": []interface{}{}, "spouse": nil, "bytes": []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, }) if err != nil { ... // handle error } ... // make use of m as a *v1.Value
Index ¶
- Constants
- Variables
- func GetPluginMap(pluginName string) map[string]goplugin.Plugin
- func GetPluginSetMap(plugins map[string]goplugin.Plugin) goplugin.PluginSet
- func RegisterGatewayDPluginServiceServer(s grpc.ServiceRegistrar, srv GatewayDPluginServiceServer)
- type BytesValue
- func (x *BytesValue) AsSlice() []interface{}
- func (*BytesValue) Descriptor() ([]byte, []int)deprecated
- func (x *BytesValue) GetValues() []*byte
- func (x *BytesValue) MarshalJSON() ([]byte, error)
- func (*BytesValue) ProtoMessage()
- func (x *BytesValue) ProtoReflect() protoreflect.Message
- func (x *BytesValue) Reset()
- func (x *BytesValue) String() string
- func (x *BytesValue) UnmarshalJSON(b []byte) error
- type GatewayDPluginServiceClient
- type GatewayDPluginServiceServer
- type HookName
- type ListValue
- func (x *ListValue) AsSlice() []interface{}
- func (*ListValue) Descriptor() ([]byte, []int)deprecated
- func (x *ListValue) GetValues() []*Value
- func (x *ListValue) MarshalJSON() ([]byte, error)
- func (*ListValue) ProtoMessage()
- func (x *ListValue) ProtoReflect() protoreflect.Message
- func (x *ListValue) Reset()
- func (x *ListValue) String() string
- func (x *ListValue) UnmarshalJSON(b []byte) error
- type NullValue
- type Plugin
- type PluginConfig
- func (*PluginConfig) Descriptor() ([]byte, []int)deprecated
- func (x *PluginConfig) GetAuthors() []string
- func (x *PluginConfig) GetCategories() []string
- func (x *PluginConfig) GetConfig() map[string]string
- func (x *PluginConfig) GetDescription() string
- func (x *PluginConfig) GetHooks() []HookName
- func (x *PluginConfig) GetId() *PluginID
- func (x *PluginConfig) GetLicense() string
- func (x *PluginConfig) GetProjectUrl() string
- func (x *PluginConfig) GetRequires() map[string]string
- func (x *PluginConfig) GetTags() []string
- func (*PluginConfig) ProtoMessage()
- func (x *PluginConfig) ProtoReflect() protoreflect.Message
- func (x *PluginConfig) Reset()
- func (x *PluginConfig) String() string
- type PluginID
- func (*PluginID) Descriptor() ([]byte, []int)deprecated
- func (x *PluginID) GetChecksum() string
- func (x *PluginID) GetName() string
- func (x *PluginID) GetRemoteUrl() string
- func (x *PluginID) GetVersion() string
- func (*PluginID) ProtoMessage()
- func (x *PluginID) ProtoReflect() protoreflect.Message
- func (x *PluginID) Reset()
- func (x *PluginID) String() string
- type Struct
- func (x *Struct) AsMap() map[string]interface{}
- func (*Struct) Descriptor() ([]byte, []int)deprecated
- func (x *Struct) GetFields() map[string]*Value
- func (x *Struct) MarshalJSON() ([]byte, error)
- func (*Struct) ProtoMessage()
- func (x *Struct) ProtoReflect() protoreflect.Message
- func (x *Struct) Reset()
- func (x *Struct) String() string
- func (x *Struct) UnmarshalJSON(b []byte) error
- type UnimplementedGatewayDPluginServiceServer
- func (UnimplementedGatewayDPluginServiceServer) GetPluginConfig(context.Context, *Struct) (*Struct, error)
- func (UnimplementedGatewayDPluginServiceServer) OnBooted(context.Context, *Struct) (*Struct, error)
- func (UnimplementedGatewayDPluginServiceServer) OnBooting(context.Context, *Struct) (*Struct, error)
- func (UnimplementedGatewayDPluginServiceServer) OnClosed(context.Context, *Struct) (*Struct, error)
- func (UnimplementedGatewayDPluginServiceServer) OnClosing(context.Context, *Struct) (*Struct, error)
- func (UnimplementedGatewayDPluginServiceServer) OnConfigLoaded(context.Context, *Struct) (*Struct, error)
- func (UnimplementedGatewayDPluginServiceServer) OnHook(context.Context, *Struct) (*Struct, error)
- func (UnimplementedGatewayDPluginServiceServer) OnNewClient(context.Context, *Struct) (*Struct, error)
- func (UnimplementedGatewayDPluginServiceServer) OnNewLogger(context.Context, *Struct) (*Struct, error)
- func (UnimplementedGatewayDPluginServiceServer) OnNewPool(context.Context, *Struct) (*Struct, error)
- func (UnimplementedGatewayDPluginServiceServer) OnNewProxy(context.Context, *Struct) (*Struct, error)
- func (UnimplementedGatewayDPluginServiceServer) OnNewServer(context.Context, *Struct) (*Struct, error)
- func (UnimplementedGatewayDPluginServiceServer) OnOpened(context.Context, *Struct) (*Struct, error)
- func (UnimplementedGatewayDPluginServiceServer) OnOpening(context.Context, *Struct) (*Struct, error)
- func (UnimplementedGatewayDPluginServiceServer) OnRun(context.Context, *Struct) (*Struct, error)
- func (UnimplementedGatewayDPluginServiceServer) OnShutdown(context.Context, *Struct) (*Struct, error)
- func (UnimplementedGatewayDPluginServiceServer) OnSignal(context.Context, *Struct) (*Struct, error)
- func (UnimplementedGatewayDPluginServiceServer) OnTick(context.Context, *Struct) (*Struct, error)
- func (UnimplementedGatewayDPluginServiceServer) OnTraffic(context.Context, *Struct) (*Struct, error)
- func (UnimplementedGatewayDPluginServiceServer) OnTrafficFromClient(context.Context, *Struct) (*Struct, error)
- func (UnimplementedGatewayDPluginServiceServer) OnTrafficFromServer(context.Context, *Struct) (*Struct, error)
- func (UnimplementedGatewayDPluginServiceServer) OnTrafficToClient(context.Context, *Struct) (*Struct, error)
- func (UnimplementedGatewayDPluginServiceServer) OnTrafficToServer(context.Context, *Struct) (*Struct, error)
- type UnsafeGatewayDPluginServiceServer
- type Value
- func (x *Value) AsInterface() interface{}
- func (*Value) Descriptor() ([]byte, []int)deprecated
- func (x *Value) GetBoolValue() bool
- func (x *Value) GetBytesValue() []byte
- func (m *Value) GetKind() isValue_Kind
- func (x *Value) GetListValue() *ListValue
- func (x *Value) GetNullValue() NullValue
- func (x *Value) GetNumberValue() float64
- func (x *Value) GetStringValue() string
- func (x *Value) GetStructValue() *Struct
- func (x *Value) MarshalJSON() ([]byte, error)
- func (*Value) ProtoMessage()
- func (x *Value) ProtoReflect() protoreflect.Message
- func (x *Value) Reset()
- func (x *Value) String() string
- func (x *Value) UnmarshalJSON(b []byte) error
- type Value_BoolValue
- type Value_BytesValue
- type Value_ListValue
- type Value_NullValue
- type Value_NumberValue
- type Value_StringValue
- type Value_StructValue
Constants ¶
const ( GatewayDPluginService_GetPluginConfig_FullMethodName = "/plugin.v1.GatewayDPluginService/GetPluginConfig" GatewayDPluginService_OnConfigLoaded_FullMethodName = "/plugin.v1.GatewayDPluginService/OnConfigLoaded" GatewayDPluginService_OnNewLogger_FullMethodName = "/plugin.v1.GatewayDPluginService/OnNewLogger" GatewayDPluginService_OnNewPool_FullMethodName = "/plugin.v1.GatewayDPluginService/OnNewPool" GatewayDPluginService_OnNewClient_FullMethodName = "/plugin.v1.GatewayDPluginService/OnNewClient" GatewayDPluginService_OnNewProxy_FullMethodName = "/plugin.v1.GatewayDPluginService/OnNewProxy" GatewayDPluginService_OnNewServer_FullMethodName = "/plugin.v1.GatewayDPluginService/OnNewServer" GatewayDPluginService_OnSignal_FullMethodName = "/plugin.v1.GatewayDPluginService/OnSignal" GatewayDPluginService_OnRun_FullMethodName = "/plugin.v1.GatewayDPluginService/OnRun" GatewayDPluginService_OnBooting_FullMethodName = "/plugin.v1.GatewayDPluginService/OnBooting" GatewayDPluginService_OnBooted_FullMethodName = "/plugin.v1.GatewayDPluginService/OnBooted" GatewayDPluginService_OnOpening_FullMethodName = "/plugin.v1.GatewayDPluginService/OnOpening" GatewayDPluginService_OnOpened_FullMethodName = "/plugin.v1.GatewayDPluginService/OnOpened" GatewayDPluginService_OnClosing_FullMethodName = "/plugin.v1.GatewayDPluginService/OnClosing" GatewayDPluginService_OnClosed_FullMethodName = "/plugin.v1.GatewayDPluginService/OnClosed" GatewayDPluginService_OnTraffic_FullMethodName = "/plugin.v1.GatewayDPluginService/OnTraffic" GatewayDPluginService_OnTrafficFromClient_FullMethodName = "/plugin.v1.GatewayDPluginService/OnTrafficFromClient" GatewayDPluginService_OnTrafficToServer_FullMethodName = "/plugin.v1.GatewayDPluginService/OnTrafficToServer" GatewayDPluginService_OnTrafficFromServer_FullMethodName = "/plugin.v1.GatewayDPluginService/OnTrafficFromServer" GatewayDPluginService_OnTrafficToClient_FullMethodName = "/plugin.v1.GatewayDPluginService/OnTrafficToClient" GatewayDPluginService_OnShutdown_FullMethodName = "/plugin.v1.GatewayDPluginService/OnShutdown" GatewayDPluginService_OnTick_FullMethodName = "/plugin.v1.GatewayDPluginService/OnTick" GatewayDPluginService_OnHook_FullMethodName = "/plugin.v1.GatewayDPluginService/OnHook" )
Variables ¶
var ( HookName_name = map[int32]string{ 0: "HOOK_NAME_UNSPECIFIED", 1: "HOOK_NAME_ON_CONFIG_LOADED", 2: "HOOK_NAME_ON_NEW_LOGGER", 3: "HOOK_NAME_ON_NEW_POOL", 4: "HOOK_NAME_ON_NEW_CLIENT", 5: "HOOK_NAME_ON_NEW_PROXY", 6: "HOOK_NAME_ON_NEW_SERVER", 7: "HOOK_NAME_ON_SIGNAL", 8: "HOOK_NAME_ON_RUN", 9: "HOOK_NAME_ON_BOOTING", 10: "HOOK_NAME_ON_BOOTED", 11: "HOOK_NAME_ON_OPENING", 12: "HOOK_NAME_ON_OPENED", 13: "HOOK_NAME_ON_CLOSING", 14: "HOOK_NAME_ON_CLOSED", 15: "HOOK_NAME_ON_TRAFFIC", 16: "HOOK_NAME_ON_TRAFFIC_FROM_CLIENT", 17: "HOOK_NAME_ON_TRAFFIC_TO_SERVER", 18: "HOOK_NAME_ON_TRAFFIC_FROM_SERVER", 19: "HOOK_NAME_ON_TRAFFIC_TO_CLIENT", 20: "HOOK_NAME_ON_SHUTDOWN", 21: "HOOK_NAME_ON_TICK", 22: "HOOK_NAME_ON_HOOK", } HookName_value = map[string]int32{ "HOOK_NAME_UNSPECIFIED": 0, "HOOK_NAME_ON_CONFIG_LOADED": 1, "HOOK_NAME_ON_NEW_LOGGER": 2, "HOOK_NAME_ON_NEW_POOL": 3, "HOOK_NAME_ON_NEW_CLIENT": 4, "HOOK_NAME_ON_NEW_PROXY": 5, "HOOK_NAME_ON_NEW_SERVER": 6, "HOOK_NAME_ON_SIGNAL": 7, "HOOK_NAME_ON_RUN": 8, "HOOK_NAME_ON_BOOTING": 9, "HOOK_NAME_ON_BOOTED": 10, "HOOK_NAME_ON_OPENING": 11, "HOOK_NAME_ON_OPENED": 12, "HOOK_NAME_ON_CLOSING": 13, "HOOK_NAME_ON_CLOSED": 14, "HOOK_NAME_ON_TRAFFIC": 15, "HOOK_NAME_ON_TRAFFIC_FROM_CLIENT": 16, "HOOK_NAME_ON_TRAFFIC_TO_SERVER": 17, "HOOK_NAME_ON_TRAFFIC_FROM_SERVER": 18, "HOOK_NAME_ON_TRAFFIC_TO_CLIENT": 19, "HOOK_NAME_ON_SHUTDOWN": 20, "HOOK_NAME_ON_TICK": 21, "HOOK_NAME_ON_HOOK": 22, } )
Enum value maps for HookName.
var ( NullValue_name = map[int32]string{ 0: "NULL_VALUE", } NullValue_value = map[string]int32{ "NULL_VALUE": 0, } )
Enum value maps for NullValue.
var File_plugin_v1_plugin_proto protoreflect.FileDescriptor
var File_plugin_v1_struct_proto protoreflect.FileDescriptor
var GatewayDPluginService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "plugin.v1.GatewayDPluginService", HandlerType: (*GatewayDPluginServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "GetPluginConfig", Handler: _GatewayDPluginService_GetPluginConfig_Handler, }, { MethodName: "OnConfigLoaded", Handler: _GatewayDPluginService_OnConfigLoaded_Handler, }, { MethodName: "OnNewLogger", Handler: _GatewayDPluginService_OnNewLogger_Handler, }, { MethodName: "OnNewPool", Handler: _GatewayDPluginService_OnNewPool_Handler, }, { MethodName: "OnNewClient", Handler: _GatewayDPluginService_OnNewClient_Handler, }, { MethodName: "OnNewProxy", Handler: _GatewayDPluginService_OnNewProxy_Handler, }, { MethodName: "OnNewServer", Handler: _GatewayDPluginService_OnNewServer_Handler, }, { MethodName: "OnSignal", Handler: _GatewayDPluginService_OnSignal_Handler, }, { MethodName: "OnRun", Handler: _GatewayDPluginService_OnRun_Handler, }, { MethodName: "OnBooting", Handler: _GatewayDPluginService_OnBooting_Handler, }, { MethodName: "OnBooted", Handler: _GatewayDPluginService_OnBooted_Handler, }, { MethodName: "OnOpening", Handler: _GatewayDPluginService_OnOpening_Handler, }, { MethodName: "OnOpened", Handler: _GatewayDPluginService_OnOpened_Handler, }, { MethodName: "OnClosing", Handler: _GatewayDPluginService_OnClosing_Handler, }, { MethodName: "OnClosed", Handler: _GatewayDPluginService_OnClosed_Handler, }, { MethodName: "OnTraffic", Handler: _GatewayDPluginService_OnTraffic_Handler, }, { MethodName: "OnTrafficFromClient", Handler: _GatewayDPluginService_OnTrafficFromClient_Handler, }, { MethodName: "OnTrafficToServer", Handler: _GatewayDPluginService_OnTrafficToServer_Handler, }, { MethodName: "OnTrafficFromServer", Handler: _GatewayDPluginService_OnTrafficFromServer_Handler, }, { MethodName: "OnTrafficToClient", Handler: _GatewayDPluginService_OnTrafficToClient_Handler, }, { MethodName: "OnShutdown", Handler: _GatewayDPluginService_OnShutdown_Handler, }, { MethodName: "OnTick", Handler: _GatewayDPluginService_OnTick_Handler, }, { MethodName: "OnHook", Handler: _GatewayDPluginService_OnHook_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "plugin/v1/plugin.proto", }
GatewayDPluginService_ServiceDesc is the grpc.ServiceDesc for GatewayDPluginService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var Handshake = goplugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "GATEWAYD_PLUGIN",
MagicCookieValue: "5712b87aa5d7e9f9e9ab643e6603181c5b796015cb1c09d6f5ada882bf2a1872",
}
Handshake must be used by all plugins to ensure that the plugin and host are compatible.
Functions ¶
func GetPluginMap ¶
GetPluginMap returns the plugin map for the plugin.
func GetPluginSetMap ¶ added in v0.0.3
GetPluginSetMap returns the PluginSet for the plugin.
func RegisterGatewayDPluginServiceServer ¶
func RegisterGatewayDPluginServiceServer(s grpc.ServiceRegistrar, srv GatewayDPluginServiceServer)
Types ¶
type BytesValue ¶ added in v0.1.1
type BytesValue struct { // Repeated field of dynamically typed values. Values []*byte `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` // contains filtered or unexported fields }
`BytesValue` is a wrapper around a repeated field of values.
The JSON representation for `BytesValue` is Uint8Array.
func NewBytes ¶ added in v0.1.1
func NewBytes(v []interface{}) (*BytesValue, error)
NewBytes constructs a BytesValue from a general-purpose Go slice. The slice elements are converted using NewBytes.
func (*BytesValue) AsSlice ¶ added in v0.1.1
func (x *BytesValue) AsSlice() []interface{}
AsSlice converts x to a general-purpose Go slice. The slice elements are converted by calling Value.AsInterface.
func (*BytesValue) Descriptor
deprecated
added in
v0.1.1
func (*BytesValue) Descriptor() ([]byte, []int)
Deprecated: Use ListValue.ProtoReflect.Descriptor instead.
func (*BytesValue) GetValues ¶ added in v0.1.1
func (x *BytesValue) GetValues() []*byte
func (*BytesValue) MarshalJSON ¶ added in v0.1.1
func (x *BytesValue) MarshalJSON() ([]byte, error)
func (*BytesValue) ProtoMessage ¶ added in v0.1.1
func (*BytesValue) ProtoMessage()
func (*BytesValue) ProtoReflect ¶ added in v0.1.1
func (x *BytesValue) ProtoReflect() protoreflect.Message
func (*BytesValue) Reset ¶ added in v0.1.1
func (x *BytesValue) Reset()
func (*BytesValue) String ¶ added in v0.1.1
func (x *BytesValue) String() string
func (*BytesValue) UnmarshalJSON ¶ added in v0.1.1
func (x *BytesValue) UnmarshalJSON(b []byte) error
type GatewayDPluginServiceClient ¶
type GatewayDPluginServiceClient interface { // GetPluginConfig returns the plugin config upon registration GetPluginConfig(ctx context.Context, in *Struct, opts ...grpc.CallOption) (*Struct, error) // OnConfigLoaded is called when the config is loaded from any config provider OnConfigLoaded(ctx context.Context, in *Struct, opts ...grpc.CallOption) (*Struct, error) // OnNewLogger is called when a new logger is created OnNewLogger(ctx context.Context, in *Struct, opts ...grpc.CallOption) (*Struct, error) // OnNewPool is called when a new pool is created OnNewPool(ctx context.Context, in *Struct, opts ...grpc.CallOption) (*Struct, error) // OnNewClient is called when a new client is created OnNewClient(ctx context.Context, in *Struct, opts ...grpc.CallOption) (*Struct, error) // OnNewProxy is called when a new proxy is created OnNewProxy(ctx context.Context, in *Struct, opts ...grpc.CallOption) (*Struct, error) // OnNewServer is called when a new server is created OnNewServer(ctx context.Context, in *Struct, opts ...grpc.CallOption) (*Struct, error) // OnSignal is called when an OS signal is received OnSignal(ctx context.Context, in *Struct, opts ...grpc.CallOption) (*Struct, error) // OnRun is called when the gatewayd server is running OnRun(ctx context.Context, in *Struct, opts ...grpc.CallOption) (*Struct, error) // OnBooting is called when the gatewayd server is booting OnBooting(ctx context.Context, in *Struct, opts ...grpc.CallOption) (*Struct, error) // OnBooted is called when the gatewayd server is booted OnBooted(ctx context.Context, in *Struct, opts ...grpc.CallOption) (*Struct, error) // OnOpening is called when the gatewayd server is opening OnOpening(ctx context.Context, in *Struct, opts ...grpc.CallOption) (*Struct, error) // OnOpened is called when the gatewayd server is opened OnOpened(ctx context.Context, in *Struct, opts ...grpc.CallOption) (*Struct, error) // OnClosing is called when the gatewayd server is closing OnClosing(ctx context.Context, in *Struct, opts ...grpc.CallOption) (*Struct, error) // OnClosed is called when the gatewayd server is closed OnClosed(ctx context.Context, in *Struct, opts ...grpc.CallOption) (*Struct, error) // OnTraffic is called when the gatewayd server received traffic from a client OnTraffic(ctx context.Context, in *Struct, opts ...grpc.CallOption) (*Struct, error) // OnTrafficFromClient is called when the gatewayd server is receiving traffic from a client OnTrafficFromClient(ctx context.Context, in *Struct, opts ...grpc.CallOption) (*Struct, error) // OnTrafficToServer is called when the gatewayd server is sending traffic to a server OnTrafficToServer(ctx context.Context, in *Struct, opts ...grpc.CallOption) (*Struct, error) // OnTrafficFromServer is called when the gatewayd server is receiving traffic from a server OnTrafficFromServer(ctx context.Context, in *Struct, opts ...grpc.CallOption) (*Struct, error) // OnTrafficToClient is called when the gatewayd server is sending traffic to a client OnTrafficToClient(ctx context.Context, in *Struct, opts ...grpc.CallOption) (*Struct, error) // OnShutdown is called when the gatewayd server is shutting down OnShutdown(ctx context.Context, in *Struct, opts ...grpc.CallOption) (*Struct, error) // OnTick is called when the gatewayd server is ticking OnTick(ctx context.Context, in *Struct, opts ...grpc.CallOption) (*Struct, error) // OnHook is called when the gatewayd server is calling a custom hook OnHook(ctx context.Context, in *Struct, opts ...grpc.CallOption) (*Struct, error) }
GatewayDPluginServiceClient is the client API for GatewayDPluginService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewGatewayDPluginServiceClient ¶
func NewGatewayDPluginServiceClient(cc grpc.ClientConnInterface) GatewayDPluginServiceClient
type GatewayDPluginServiceServer ¶
type GatewayDPluginServiceServer interface { // GetPluginConfig returns the plugin config upon registration GetPluginConfig(context.Context, *Struct) (*Struct, error) // OnConfigLoaded is called when the config is loaded from any config provider OnConfigLoaded(context.Context, *Struct) (*Struct, error) // OnNewLogger is called when a new logger is created OnNewLogger(context.Context, *Struct) (*Struct, error) // OnNewPool is called when a new pool is created OnNewPool(context.Context, *Struct) (*Struct, error) // OnNewClient is called when a new client is created OnNewClient(context.Context, *Struct) (*Struct, error) // OnNewProxy is called when a new proxy is created OnNewProxy(context.Context, *Struct) (*Struct, error) // OnNewServer is called when a new server is created OnNewServer(context.Context, *Struct) (*Struct, error) // OnSignal is called when an OS signal is received OnSignal(context.Context, *Struct) (*Struct, error) // OnRun is called when the gatewayd server is running OnRun(context.Context, *Struct) (*Struct, error) // OnBooting is called when the gatewayd server is booting OnBooting(context.Context, *Struct) (*Struct, error) // OnBooted is called when the gatewayd server is booted OnBooted(context.Context, *Struct) (*Struct, error) // OnOpening is called when the gatewayd server is opening OnOpening(context.Context, *Struct) (*Struct, error) // OnOpened is called when the gatewayd server is opened OnOpened(context.Context, *Struct) (*Struct, error) // OnClosing is called when the gatewayd server is closing OnClosing(context.Context, *Struct) (*Struct, error) // OnClosed is called when the gatewayd server is closed OnClosed(context.Context, *Struct) (*Struct, error) // OnTraffic is called when the gatewayd server received traffic from a client OnTraffic(context.Context, *Struct) (*Struct, error) // OnTrafficFromClient is called when the gatewayd server is receiving traffic from a client OnTrafficFromClient(context.Context, *Struct) (*Struct, error) // OnTrafficToServer is called when the gatewayd server is sending traffic to a server OnTrafficToServer(context.Context, *Struct) (*Struct, error) // OnTrafficFromServer is called when the gatewayd server is receiving traffic from a server OnTrafficFromServer(context.Context, *Struct) (*Struct, error) // OnTrafficToClient is called when the gatewayd server is sending traffic to a client OnTrafficToClient(context.Context, *Struct) (*Struct, error) // OnShutdown is called when the gatewayd server is shutting down OnShutdown(context.Context, *Struct) (*Struct, error) // OnTick is called when the gatewayd server is ticking OnTick(context.Context, *Struct) (*Struct, error) // OnHook is called when the gatewayd server is calling a custom hook OnHook(context.Context, *Struct) (*Struct, error) // contains filtered or unexported methods }
GatewayDPluginServiceServer is the server API for GatewayDPluginService service. All implementations must embed UnimplementedGatewayDPluginServiceServer for forward compatibility
type HookName ¶ added in v0.0.11
type HookName int32
const ( HookName_HOOK_NAME_UNSPECIFIED HookName = 0 HookName_HOOK_NAME_ON_CONFIG_LOADED HookName = 1 HookName_HOOK_NAME_ON_NEW_LOGGER HookName = 2 HookName_HOOK_NAME_ON_NEW_POOL HookName = 3 HookName_HOOK_NAME_ON_NEW_CLIENT HookName = 4 HookName_HOOK_NAME_ON_NEW_PROXY HookName = 5 HookName_HOOK_NAME_ON_NEW_SERVER HookName = 6 HookName_HOOK_NAME_ON_SIGNAL HookName = 7 HookName_HOOK_NAME_ON_RUN HookName = 8 HookName_HOOK_NAME_ON_BOOTING HookName = 9 HookName_HOOK_NAME_ON_BOOTED HookName = 10 HookName_HOOK_NAME_ON_OPENING HookName = 11 HookName_HOOK_NAME_ON_OPENED HookName = 12 HookName_HOOK_NAME_ON_CLOSING HookName = 13 HookName_HOOK_NAME_ON_CLOSED HookName = 14 HookName_HOOK_NAME_ON_TRAFFIC HookName = 15 HookName_HOOK_NAME_ON_TRAFFIC_FROM_CLIENT HookName = 16 HookName_HOOK_NAME_ON_TRAFFIC_TO_SERVER HookName = 17 HookName_HOOK_NAME_ON_TRAFFIC_FROM_SERVER HookName = 18 HookName_HOOK_NAME_ON_TRAFFIC_TO_CLIENT HookName = 19 HookName_HOOK_NAME_ON_SHUTDOWN HookName = 20 HookName_HOOK_NAME_ON_TICK HookName = 21 HookName_HOOK_NAME_ON_HOOK HookName = 22 )
func (HookName) Descriptor ¶ added in v0.0.11
func (HookName) Descriptor() protoreflect.EnumDescriptor
func (HookName) EnumDescriptor
deprecated
added in
v0.0.11
func (HookName) Number ¶ added in v0.0.11
func (x HookName) Number() protoreflect.EnumNumber
func (HookName) Type ¶ added in v0.0.11
func (HookName) Type() protoreflect.EnumType
type ListValue ¶ added in v0.1.1
type ListValue struct { // Repeated field of dynamically typed values. Values []*Value `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` // contains filtered or unexported fields }
`ListValue` is a wrapper around a repeated field of values.
The JSON representation for `ListValue` is JSON array.
func NewList ¶ added in v0.1.1
NewList constructs a ListValue from a general-purpose Go slice. The slice elements are converted using NewValue.
func (*ListValue) AsSlice ¶ added in v0.1.1
func (x *ListValue) AsSlice() []interface{}
AsSlice converts x to a general-purpose Go slice. The slice elements are converted by calling Value.AsInterface.
func (*ListValue) Descriptor
deprecated
added in
v0.1.1
func (*ListValue) MarshalJSON ¶ added in v0.1.1
func (*ListValue) ProtoMessage ¶ added in v0.1.1
func (*ListValue) ProtoMessage()
func (*ListValue) ProtoReflect ¶ added in v0.1.1
func (x *ListValue) ProtoReflect() protoreflect.Message
func (*ListValue) UnmarshalJSON ¶ added in v0.1.1
type NullValue ¶ added in v0.1.1
type NullValue int32
`NullValue` is a singleton enumeration to represent the null value for the `Value` type union.
The JSON representation for `NullValue` is JSON `null`.
const ( // Null value. NullValue_NULL_VALUE NullValue = 0 )
func (NullValue) Descriptor ¶ added in v0.1.1
func (NullValue) Descriptor() protoreflect.EnumDescriptor
func (NullValue) EnumDescriptor
deprecated
added in
v0.1.1
func (NullValue) Number ¶ added in v0.1.1
func (x NullValue) Number() protoreflect.EnumNumber
func (NullValue) Type ¶ added in v0.1.1
func (NullValue) Type() protoreflect.EnumType
type Plugin ¶
type Plugin struct { goplugin.GRPCPlugin goplugin.NetRPCUnsupportedPlugin Impl struct { GatewayDPluginServiceServer } }
Plugin is the interface that all plugins must implement.
func (*Plugin) GRPCClient ¶
func (p *Plugin) GRPCClient(ctx context.Context, b *goplugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
GRPCClient returns the plugin client.
func (*Plugin) GRPCServer ¶
GRPCServer registers the plugin with the gRPC server.
type PluginConfig ¶
type PluginConfig struct { Id *PluginID `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` Authors []string `protobuf:"bytes,3,rep,name=authors,proto3" json:"authors,omitempty"` License string `protobuf:"bytes,4,opt,name=license,proto3" json:"license,omitempty"` ProjectUrl string `protobuf:"bytes,5,opt,name=project_url,json=projectUrl,proto3" json:"project_url,omitempty"` // internal and external config options Config map[string]string `` /* 153-byte string literal not displayed */ // hooks it attaches to Hooks []HookName `protobuf:"varint,7,rep,packed,name=hooks,proto3,enum=plugin.v1.HookName" json:"hooks,omitempty"` // required plugins Requires map[string]string `` /* 157-byte string literal not displayed */ Tags []string `protobuf:"bytes,9,rep,name=tags,proto3" json:"tags,omitempty"` Categories []string `protobuf:"bytes,10,rep,name=categories,proto3" json:"categories,omitempty"` // contains filtered or unexported fields }
func (*PluginConfig) Descriptor
deprecated
func (*PluginConfig) Descriptor() ([]byte, []int)
Deprecated: Use PluginConfig.ProtoReflect.Descriptor instead.
func (*PluginConfig) GetAuthors ¶
func (x *PluginConfig) GetAuthors() []string
func (*PluginConfig) GetCategories ¶
func (x *PluginConfig) GetCategories() []string
func (*PluginConfig) GetConfig ¶
func (x *PluginConfig) GetConfig() map[string]string
func (*PluginConfig) GetDescription ¶
func (x *PluginConfig) GetDescription() string
func (*PluginConfig) GetHooks ¶
func (x *PluginConfig) GetHooks() []HookName
func (*PluginConfig) GetId ¶
func (x *PluginConfig) GetId() *PluginID
func (*PluginConfig) GetLicense ¶
func (x *PluginConfig) GetLicense() string
func (*PluginConfig) GetProjectUrl ¶
func (x *PluginConfig) GetProjectUrl() string
func (*PluginConfig) GetRequires ¶
func (x *PluginConfig) GetRequires() map[string]string
func (*PluginConfig) GetTags ¶
func (x *PluginConfig) GetTags() []string
func (*PluginConfig) ProtoMessage ¶
func (*PluginConfig) ProtoMessage()
func (*PluginConfig) ProtoReflect ¶
func (x *PluginConfig) ProtoReflect() protoreflect.Message
func (*PluginConfig) Reset ¶
func (x *PluginConfig) Reset()
func (*PluginConfig) String ¶
func (x *PluginConfig) String() string
type PluginID ¶
type PluginID struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` RemoteUrl string `protobuf:"bytes,3,opt,name=remote_url,json=remoteUrl,proto3" json:"remote_url,omitempty"` Checksum string `protobuf:"bytes,4,opt,name=checksum,proto3" json:"checksum,omitempty"` // contains filtered or unexported fields }
func (*PluginID) Descriptor
deprecated
func (*PluginID) GetChecksum ¶
func (*PluginID) GetRemoteUrl ¶
func (*PluginID) GetVersion ¶
func (*PluginID) ProtoMessage ¶
func (*PluginID) ProtoMessage()
func (*PluginID) ProtoReflect ¶
func (x *PluginID) ProtoReflect() protoreflect.Message
type Struct ¶ added in v0.1.1
type Struct struct { // Unordered map of dynamically typed values. Fields map[string]*Value `` /* 153-byte string literal not displayed */ // contains filtered or unexported fields }
`Struct` represents a structured data value, consisting of fields which map to dynamically typed values. In some languages, `Struct` might be supported by a native representation. For example, in scripting languages like JS a struct is represented as an object. The details of that representation are described together with the proto support for the language.
The JSON representation for `Struct` is JSON object plus the bytes type.
func NewStruct ¶ added in v0.1.1
NewStruct constructs a Struct from a general-purpose Go map. The map keys must be valid UTF-8. The map values are converted using NewValue.
func (*Struct) AsMap ¶ added in v0.1.1
AsMap converts x to a general-purpose Go map. The map values are converted by calling Value.AsInterface.
func (*Struct) Descriptor
deprecated
added in
v0.1.1
func (*Struct) MarshalJSON ¶ added in v0.1.1
func (*Struct) ProtoMessage ¶ added in v0.1.1
func (*Struct) ProtoMessage()
func (*Struct) ProtoReflect ¶ added in v0.1.1
func (x *Struct) ProtoReflect() protoreflect.Message
func (*Struct) UnmarshalJSON ¶ added in v0.1.1
type UnimplementedGatewayDPluginServiceServer ¶
type UnimplementedGatewayDPluginServiceServer struct { }
UnimplementedGatewayDPluginServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedGatewayDPluginServiceServer) GetPluginConfig ¶
func (UnimplementedGatewayDPluginServiceServer) OnConfigLoaded ¶
func (UnimplementedGatewayDPluginServiceServer) OnNewClient ¶
func (UnimplementedGatewayDPluginServiceServer) OnNewLogger ¶
func (UnimplementedGatewayDPluginServiceServer) OnNewProxy ¶
func (UnimplementedGatewayDPluginServiceServer) OnNewServer ¶
func (UnimplementedGatewayDPluginServiceServer) OnShutdown ¶
func (UnimplementedGatewayDPluginServiceServer) OnTrafficFromClient ¶
func (UnimplementedGatewayDPluginServiceServer) OnTrafficFromServer ¶
func (UnimplementedGatewayDPluginServiceServer) OnTrafficToClient ¶
func (UnimplementedGatewayDPluginServiceServer) OnTrafficToServer ¶
type UnsafeGatewayDPluginServiceServer ¶
type UnsafeGatewayDPluginServiceServer interface {
// contains filtered or unexported methods
}
UnsafeGatewayDPluginServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to GatewayDPluginServiceServer will result in compilation errors.
type Value ¶ added in v0.1.1
type Value struct { // The kind of value. // // Types that are assignable to Kind: // // *Value_NullValue // *Value_NumberValue // *Value_StringValue // *Value_BoolValue // *Value_StructValue // *Value_ListValue // *Value_BytesValue Kind isValue_Kind `protobuf_oneof:"kind"` // contains filtered or unexported fields }
`Value` represents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a list of values. A producer of value is expected to set one of these variants. Absence of any variant indicates an error.
The JSON representation for `Value` is JSON value.
func NewBoolValue ¶ added in v0.1.1
NewBoolValue constructs a new boolean Value.
func NewBytesValue ¶ added in v0.1.1
NewBytesValue constructs a new bytes Value.
func NewListValue ¶ added in v0.1.1
NewListValue constructs a new list Value.
func NewNullValue ¶ added in v0.1.1
func NewNullValue() *Value
NewNullValue constructs a new null Value.
func NewNumberValue ¶ added in v0.1.1
NewNumberValue constructs a new number Value.
func NewStringValue ¶ added in v0.1.1
NewStringValue constructs a new string Value.
func NewStructValue ¶ added in v0.1.1
NewStructValue constructs a new struct Value.
func NewValue ¶ added in v0.1.1
NewValue constructs a Value from a general-purpose Go interface.
╔════════════════════════╤════════════════════════════════════════════╗ ║ Go type │ Conversion ║ ╠════════════════════════╪════════════════════════════════════════════╣ ║ nil │ stored as NullValue ║ ║ bool │ stored as BoolValue ║ ║ int, int32, int64 │ stored as NumberValue ║ ║ uint, uint32, uint64 │ stored as NumberValue ║ ║ float32, float64 │ stored as NumberValue ║ ║ string │ stored as StringValue; must be valid UTF-8 ║ ║ []byte │ stored as BytesValue ║ ║ map[string]interface{} │ stored as StructValue ║ ║ []interface{} │ stored as ListValue ║ ╚════════════════════════╧════════════════════════════════════════════╝
When converting an int64 or uint64 to a NumberValue, numeric precision loss is possible since they are stored as a float64.
func (*Value) AsInterface ¶ added in v0.1.1
func (x *Value) AsInterface() interface{}
AsInterface converts x to a general-purpose Go interface.
Calling Value.MarshalJSON and "encoding/json".Marshal on this output produce semantically equivalent JSON (assuming no errors occur).
Floating-point values (i.e., "NaN", "Infinity", and "-Infinity") are converted as strings to remain compatible with MarshalJSON.
func (*Value) Descriptor
deprecated
added in
v0.1.1
func (*Value) GetBoolValue ¶ added in v0.1.1
func (*Value) GetBytesValue ¶ added in v0.1.1
func (*Value) GetListValue ¶ added in v0.1.1
func (*Value) GetNullValue ¶ added in v0.1.1
func (*Value) GetNumberValue ¶ added in v0.1.1
func (*Value) GetStringValue ¶ added in v0.1.1
func (*Value) GetStructValue ¶ added in v0.1.1
func (*Value) MarshalJSON ¶ added in v0.1.1
func (*Value) ProtoMessage ¶ added in v0.1.1
func (*Value) ProtoMessage()
func (*Value) ProtoReflect ¶ added in v0.1.1
func (x *Value) ProtoReflect() protoreflect.Message
func (*Value) UnmarshalJSON ¶ added in v0.1.1
type Value_BoolValue ¶ added in v0.1.1
type Value_BoolValue struct { // Represents a boolean value. BoolValue bool `protobuf:"varint,4,opt,name=bool_value,json=boolValue,proto3,oneof"` }
type Value_BytesValue ¶ added in v0.1.1
type Value_BytesValue struct { // Represents a bytes value. BytesValue []byte `protobuf:"bytes,7,opt,name=bytes_value,json=bytesValue,proto3,oneof"` }
type Value_ListValue ¶ added in v0.1.1
type Value_ListValue struct { // Represents a repeated `Value`. ListValue *ListValue `protobuf:"bytes,6,opt,name=list_value,json=listValue,proto3,oneof"` }
type Value_NullValue ¶ added in v0.1.1
type Value_NullValue struct { // Represents a null value. NullValue NullValue `protobuf:"varint,1,opt,name=null_value,json=nullValue,proto3,enum=plugin.v1.NullValue,oneof"` }
type Value_NumberValue ¶ added in v0.1.1
type Value_NumberValue struct { // Represents a double value. NumberValue float64 `protobuf:"fixed64,2,opt,name=number_value,json=numberValue,proto3,oneof"` }
type Value_StringValue ¶ added in v0.1.1
type Value_StringValue struct { // Represents a string value. StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,proto3,oneof"` }
type Value_StructValue ¶ added in v0.1.1
type Value_StructValue struct { // Represents a structured value. StructValue *Struct `protobuf:"bytes,5,opt,name=struct_value,json=structValue,proto3,oneof"` }