diff --git a/cmd/run.go b/cmd/run.go index 49edee4f..4c5e77dd 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -12,6 +12,7 @@ import ( "github.com/gatewayd-io/gatewayd/logging" "github.com/gatewayd-io/gatewayd/network" "github.com/gatewayd-io/gatewayd/plugin" + "github.com/gatewayd-io/gatewayd/plugin/hook" "github.com/gatewayd-io/gatewayd/pool" "github.com/knadh/koanf" "github.com/knadh/koanf/parsers/yaml" @@ -28,7 +29,7 @@ var ( ) var ( - hooksConfig = plugin.NewHookConfig() + hooksConfig = hook.NewHookConfig() DefaultLogger = logging.NewLogger( logging.LoggerConfig{ Level: zerolog.DebugLevel, @@ -108,7 +109,7 @@ var runCmd = &cobra.Command{ updatedGlobalConfig, err := hooksConfig.Run( context.Background(), globalConfig.All(), - plugin.OnConfigLoaded, + hook.OnConfigLoaded, hooksConfig.Verification) if err != nil { DefaultLogger.Error().Err(err).Msg("Failed to run OnConfigLoaded hooks") @@ -154,7 +155,7 @@ var runCmd = &cobra.Command{ } // TODO: Use a context with a timeout _, err = hooksConfig.Run( - context.Background(), data, plugin.OnNewLogger, hooksConfig.Verification) + context.Background(), data, hook.OnNewLogger, hooksConfig.Verification) if err != nil { logger.Error().Err(err).Msg("Failed to run OnNewLogger hooks") } @@ -185,7 +186,7 @@ var runCmd = &cobra.Command{ _, err := hooksConfig.Run( context.Background(), clientCfg, - plugin.OnNewClient, + hook.OnNewClient, hooksConfig.Verification) if err != nil { logger.Error().Err(err).Msg("Failed to run OnNewClient hooks") @@ -213,7 +214,7 @@ var runCmd = &cobra.Command{ _, err = hooksConfig.Run( context.Background(), map[string]interface{}{"size": poolSize}, - plugin.OnNewPool, + hook.OnNewPool, hooksConfig.Verification) if err != nil { logger.Error().Err(err).Msg("Failed to run OnNewPool hooks") @@ -240,7 +241,7 @@ var runCmd = &cobra.Command{ }, } _, err = hooksConfig.Run( - context.Background(), proxyCfg, plugin.OnNewProxy, hooksConfig.Verification) + context.Background(), proxyCfg, hook.OnNewProxy, hooksConfig.Verification) if err != nil { logger.Error().Err(err).Msg("Failed to run OnNewProxy hooks") } @@ -302,7 +303,7 @@ var runCmd = &cobra.Command{ "tcpNoDelay": gConfig.Server.TCPNoDelay, } _, err = hooksConfig.Run( - context.Background(), serverCfg, plugin.OnNewServer, hooksConfig.Verification) + context.Background(), serverCfg, hook.OnNewServer, hooksConfig.Verification) if err != nil { logger.Error().Err(err).Msg("Failed to run OnNewServer hooks") } @@ -320,7 +321,7 @@ var runCmd = &cobra.Command{ ) signalsCh := make(chan os.Signal, 1) signal.Notify(signalsCh, signals...) - go func(hooksConfig *plugin.HookConfig) { + go func(hooksConfig *hook.Config) { for sig := range signalsCh { for _, s := range signals { if sig != s { @@ -328,7 +329,7 @@ var runCmd = &cobra.Command{ _, err := hooksConfig.Run( context.Background(), map[string]interface{}{"signal": sig.String()}, - plugin.OnSignal, + hook.OnSignal, hooksConfig.Verification, ) if err != nil { diff --git a/errors/errors.go b/errors/errors.go index 4c791de0..a84fdb67 100644 --- a/errors/errors.go +++ b/errors/errors.go @@ -23,6 +23,7 @@ const ( ErrCodeCastFailed ErrCodeHookVerificationFailed ErrCodeHookReturnedError + ErrCodeHookTerminatedConnection ErrCodeFileNotFound ErrCodeFileOpenFailed ErrCodeFileReadFailed @@ -77,6 +78,8 @@ var ( ErrCodeHookVerificationFailed, "failed to verify hook", nil) ErrHookReturnedError = NewGatewayDError( ErrCodeHookReturnedError, "hook returned error", nil) + ErrHookTerminatedConnection = NewGatewayDError( + ErrCodeHookTerminatedConnection, "hook terminated connection", nil) ErrFileNotFound = NewGatewayDError( ErrCodeFileNotFound, "file not found", nil) diff --git a/gatewayd_plugins.yaml b/gatewayd_plugins.yaml index 79da93c9..09cdcf1e 100644 --- a/gatewayd_plugins.yaml +++ b/gatewayd_plugins.yaml @@ -23,4 +23,4 @@ plugins: - MAGIC_COOKIE_KEY=GATEWAYD_PLUGIN - MAGIC_COOKIE_VALUE=5712b87aa5d7e9f9e9ab643e6603181c5b796015cb1c09d6f5ada882bf2a1872 # Checksum hash to verify the binary before loading - checksum: 911cbab556bd3b14b60c088d786ae7c3ecf0a2aa2958406c3214ea64073cde36 + checksum: 477dcbb41a27ff4431a5a9bc50754ef8c5a477b62d45d43e3b801b121aa96651 diff --git a/logging/logger.go b/logging/logger.go index 2d1953a9..c3dd9c91 100644 --- a/logging/logger.go +++ b/logging/logger.go @@ -9,6 +9,7 @@ import ( "github.com/rs/zerolog" ) +// TODO: Remove this once we have a proper hooks package. // This is duplicated from the network package, because import cycles are not allowed. type ( Signature map[string]interface{} diff --git a/network/proxy.go b/network/proxy.go index 286a7153..d4070501 100644 --- a/network/proxy.go +++ b/network/proxy.go @@ -5,7 +5,7 @@ import ( "github.com/gatewayd-io/gatewayd/config" gerr "github.com/gatewayd-io/gatewayd/errors" - "github.com/gatewayd-io/gatewayd/plugin" + "github.com/gatewayd-io/gatewayd/plugin/hook" "github.com/gatewayd-io/gatewayd/pool" "github.com/panjf2000/gnet/v2" "github.com/rs/zerolog" @@ -24,7 +24,7 @@ type Proxy struct { availableConnections pool.IPool busyConnections pool.IPool logger zerolog.Logger - hookConfig *plugin.HookConfig + hookConfig *hook.Config Elastic bool ReuseElasticClients bool @@ -37,7 +37,7 @@ var _ IProxy = &Proxy{} // NewProxy creates a new proxy. func NewProxy( - p pool.IPool, hookConfig *plugin.HookConfig, + p pool.IPool, hookConfig *hook.Config, elastic, reuseElasticClients bool, clientConfig *config.Client, logger zerolog.Logger, ) *Proxy { @@ -164,13 +164,15 @@ func (pr *Proxy) Disconnect(gconn gnet.Conn) *gerr.GatewayDError { // PassThrough sends the data from the client to the server and vice versa. // -//nolint:funlen +// TODO: refactor this mess! My eye burns even looking at it. +// +//nolint:funlen,maintidx func (pr *Proxy) PassThrough(gconn gnet.Conn) *gerr.GatewayDError { // TODO: Handle bi-directional traffic // Currently the passthrough is a one-way street from the client to the server, that is, // the client can send data to the server and receive the response back, but the server // cannot take initiative and send data to the client. So, there should be another event-loop - // that listens for data from the server and sends it to the client + // that listens for data from the server and sends it to the client. var client *Client if pr.busyConnections.Get(gconn) == nil { @@ -184,64 +186,167 @@ func (pr *Proxy) PassThrough(gconn gnet.Conn) *gerr.GatewayDError { return gerr.ErrCastFailed } - // request contains the data from the client. - request, origErr := gconn.Next(-1) - if origErr != nil { - pr.logger.Error().Err(origErr).Msg("Error reading from client") + // receiveTrafficFromClient is a function that receives data from the client. + receiveTrafficFromClient := func() ([]byte, error) { + // request contains the data from the client. + request, err := gconn.Next(-1) + if err != nil { + pr.logger.Error().Err(err).Msg("Error reading from client") + } + pr.logger.Debug().Fields( + map[string]interface{}{ + "length": len(request), + "local": gconn.LocalAddr().String(), + "remote": gconn.RemoteAddr().String(), + }, + ).Msg("Received data from client") + + //nolint:wrapcheck + return request, err + } + + // sendTrafficToServer is a function that sends data to the server. + sendTrafficToServer := func(request []byte) (int, *gerr.GatewayDError) { + // Send the request to the server. + sent, err := client.Send(request) + if err != nil { + pr.logger.Error().Err(err).Msg("Error sending request to database") + } + pr.logger.Debug().Fields( + map[string]interface{}{ + "function": "proxy.passthrough", + "length": sent, + "local": client.Conn.LocalAddr().String(), + "remote": client.Conn.RemoteAddr().String(), + }, + ).Msg("Sent data to database") + + return sent, err } - pr.logger.Debug().Fields( - map[string]interface{}{ - "length": len(request), - "local": gconn.LocalAddr().String(), - "remote": gconn.RemoteAddr().String(), - }, - ).Msg("Received data from client") - // Run the OnIngressTraffic hooks. + // receiveTrafficFromServer is a function that receives data from the server. + receiveTrafficFromServer := func() (int, []byte, *gerr.GatewayDError) { + // Receive the response from the server. + received, response, err := client.Receive() + pr.logger.Debug().Fields( + map[string]interface{}{ + "function": "proxy.passthrough", + "length": received, + "local": client.Conn.LocalAddr().String(), + "remote": client.Conn.RemoteAddr().String(), + }, + ).Msg("Received data from database") + + return received, response, err + } + + // sendTrafficToClient is a function that sends data to the client. + sendTrafficToClient := func(response []byte, received int) *gerr.GatewayDError { + // Send the response to the client async. + origErr := gconn.AsyncWrite(response[:received], func(gconn gnet.Conn, err error) error { + pr.logger.Debug().Fields( + map[string]interface{}{ + "function": "proxy.passthrough", + "length": received, + "local": gconn.LocalAddr().String(), + "remote": gconn.RemoteAddr().String(), + }, + ).Msg("Sent data to client") + return err + }) + if origErr != nil { + pr.logger.Error().Err(origErr).Msg("Error writing to client") + return gerr.ErrServerSendFailed.Wrap(origErr) + } + + return nil + } + + // shouldTerminate is a function that retrieves the terminate field from the hook result. + // Only the OnTrafficFromClient hook will terminate the connection. + shouldTerminate := func(result map[string]interface{}) bool { + // If the hook wants to terminate the connection, do it. + if result != nil { + if terminate, ok := result["terminate"].(bool); ok && terminate { + pr.logger.Debug().Str("function", "proxy.passthrough").Msg("Terminating connection") + return true + } + } + + return false + } + + // getPluginModifiedRequest is a function that retrieves the modified request + // from the hook result. + getPluginModifiedRequest := func(result map[string]interface{}) []byte { + // If the hook modified the request, use the modified request. + //nolint:gocritic + if modRequest, errMsg, convErr := extractFieldValue(result, "request"); errMsg != "" { + pr.logger.Error().Str("error", errMsg).Msg("Error in hook") + } else if convErr != nil { + pr.logger.Error().Err(convErr).Msg("Error in data conversion") + } else if modRequest != nil { + return modRequest + } + + return nil + } + + // getPluginModifiedResponse is a function that retrieves the modified response + // from the hook result. + getPluginModifiedResponse := func(result map[string]interface{}) ([]byte, int) { + // If the hook returns a response, use it instead of the original response. + //nolint:gocritic + if modResponse, errMsg, convErr := extractFieldValue(result, "response"); errMsg != "" { + pr.logger.Error().Str("error", errMsg).Msg("Error in hook") + } else if convErr != nil { + pr.logger.Error().Err(convErr).Msg("Error in data conversion") + } else if modResponse != nil { + return modResponse, len(modResponse) + } + + return nil, 0 + } + + // Receive the request from the client. + request, origErr := receiveTrafficFromClient() + + // Run the OnTrafficFromClient hooks. result, err := pr.hookConfig.Run( context.Background(), trafficData(gconn, client, "request", request, origErr), - plugin.OnIngressTraffic, + hook.OnTrafficFromClient, pr.hookConfig.Verification) if err != nil { pr.logger.Error().Err(err).Msg("Error running hook") } - // If the hook modified the request, use the modified request. - modRequest, errMsg, convErr := extractFieldValue(result, "request") - if errMsg != "" { - pr.logger.Error().Str("error", errMsg).Msg("Error in hook") - } - if convErr != nil { - pr.logger.Error().Err(convErr).Msg("Error in data conversion") + // If the hook wants to terminate the connection, do it. + if shouldTerminate(result) { + if modResponse, modReceived := getPluginModifiedResponse(result); modResponse != nil { + return sendTrafficToClient(modResponse, modReceived) + } + return gerr.ErrHookTerminatedConnection } - if modRequest != nil { + // If the hook modified the request, use the modified request. + if modRequest := getPluginModifiedRequest(result); modRequest != nil { request = modRequest } // Send the request to the server. - sent, err := client.Send(request) + _, err = sendTrafficToServer(request) + + // Run the OnTrafficToServer hooks. + _, err = pr.hookConfig.Run( + context.Background(), + trafficData(gconn, client, "request", request, err), + hook.OnTrafficToServer, + pr.hookConfig.Verification) if err != nil { - pr.logger.Error().Err(err).Msg("Error sending request to database") + pr.logger.Error().Err(err).Msg("Error running hook") } - pr.logger.Debug().Fields( - map[string]interface{}{ - "function": "proxy.passthrough", - "length": sent, - "local": client.Conn.LocalAddr().String(), - "remote": client.Conn.RemoteAddr().String(), - }, - ).Msg("Sent data to database") // Receive the response from the server. - received, response, err := client.Receive() - pr.logger.Debug().Fields( - map[string]interface{}{ - "function": "proxy.passthrough", - "length": received, - "local": client.Conn.LocalAddr().String(), - "remote": client.Conn.RemoteAddr().String(), - }, - ).Msg("Received data from database") + received, response, err := receiveTrafficFromServer() // The connection to the server is closed, so we MUST reconnect, // otherwise the client will be stuck. @@ -273,46 +378,23 @@ func (pr *Proxy) PassThrough(gconn gnet.Conn) *gerr.GatewayDError { return err } - // Run the OnEgressTraffic hooks. + // Run the OnTrafficFromServer hooks. result, err = pr.hookConfig.Run( context.Background(), trafficData(gconn, client, "response", response[:received], err), - plugin.OnEgressTraffic, + hook.OnTrafficFromServer, pr.hookConfig.Verification) if err != nil { pr.logger.Error().Err(err).Msg("Error running hook") } - // If the hook returns a response, use it instead of the original response. - modResponse, errMsg, convErr := extractFieldValue(result, "response") - if errMsg != "" { - pr.logger.Error().Str("error", errMsg).Msg("Error in hook") - } - if convErr != nil { - pr.logger.Error().Err(convErr).Msg("Error in data conversion") - } - if modResponse != nil { + // If the hook modified the response, use the modified response. + if modResponse, modReceived := getPluginModifiedResponse(result); modResponse != nil { response = modResponse - received = len(modResponse) - } - - // Send the response to the client async. - origErr = gconn.AsyncWrite(response[:received], func(gconn gnet.Conn, err error) error { - pr.logger.Debug().Fields( - map[string]interface{}{ - "function": "proxy.passthrough", - "length": received, - "local": gconn.LocalAddr().String(), - "remote": gconn.RemoteAddr().String(), - }, - ).Msg("Sent data to client") - return err - }) - if origErr != nil { - pr.logger.Error().Err(err).Msg("Error writing to client") - return gerr.ErrServerSendFailed.Wrap(err) + received = modReceived } - return nil + // Send the response to the client. + return sendTrafficToClient(response, received) } // IsHealty checks if the pool is exhausted or the client is disconnected. diff --git a/network/proxy_test.go b/network/proxy_test.go index 043fe7c0..639a1649 100644 --- a/network/proxy_test.go +++ b/network/proxy_test.go @@ -6,7 +6,7 @@ import ( embeddedpostgres "github.com/fergusstrange/embedded-postgres" "github.com/gatewayd-io/gatewayd/config" "github.com/gatewayd-io/gatewayd/logging" - "github.com/gatewayd-io/gatewayd/plugin" + "github.com/gatewayd-io/gatewayd/plugin/hook" "github.com/gatewayd-io/gatewayd/pool" "github.com/rs/zerolog" "github.com/stretchr/testify/assert" @@ -52,7 +52,7 @@ func TestNewProxy(t *testing.T) { assert.Nil(t, err) // Create a proxy with a fixed buffer pool - proxy := NewProxy(pool, plugin.NewHookConfig(), false, false, nil, logger) + proxy := NewProxy(pool, hook.NewHookConfig(), false, false, nil, logger) assert.NotNil(t, proxy) assert.Equal(t, 0, proxy.busyConnections.Size(), "Proxy should have no connected clients") @@ -81,7 +81,7 @@ func TestNewProxyElastic(t *testing.T) { pool := pool.NewPool(config.EmptyPoolCapacity) // Create a proxy with an elastic buffer pool - proxy := NewProxy(pool, plugin.NewHookConfig(), true, false, &config.Client{ + proxy := NewProxy(pool, hook.NewHookConfig(), true, false, &config.Client{ Network: "tcp", Address: "localhost:5432", ReceiveBufferSize: config.DefaultBufferSize, diff --git a/network/server.go b/network/server.go index b3b2d950..fdbb1d37 100644 --- a/network/server.go +++ b/network/server.go @@ -10,7 +10,7 @@ import ( "github.com/gatewayd-io/gatewayd/config" gerr "github.com/gatewayd-io/gatewayd/errors" - "github.com/gatewayd-io/gatewayd/plugin" + "github.com/gatewayd-io/gatewayd/plugin/hook" "github.com/panjf2000/gnet/v2" "github.com/rs/zerolog" ) @@ -20,7 +20,7 @@ type Server struct { engine gnet.Engine proxy IProxy logger zerolog.Logger - hooksConfig *plugin.HookConfig + hooksConfig *hook.Config Network string // tcp/udp/unix Address string @@ -41,7 +41,7 @@ func (s *Server) OnBoot(engine gnet.Engine) gnet.Action { _, err := s.hooksConfig.Run( context.Background(), map[string]interface{}{"status": fmt.Sprint(s.Status)}, - plugin.OnBooting, + hook.OnBooting, s.hooksConfig.Verification) if err != nil { s.logger.Error().Err(err).Msg("Failed to run OnBooting hook") @@ -56,7 +56,7 @@ func (s *Server) OnBoot(engine gnet.Engine) gnet.Action { _, err = s.hooksConfig.Run( context.Background(), map[string]interface{}{"status": fmt.Sprint(s.Status)}, - plugin.OnBooted, + hook.OnBooted, s.hooksConfig.Verification) if err != nil { s.logger.Error().Err(err).Msg("Failed to run OnBooted hook") @@ -81,7 +81,7 @@ func (s *Server) OnOpen(gconn gnet.Conn) ([]byte, gnet.Action) { }, } _, err := s.hooksConfig.Run( - context.Background(), onOpeningData, plugin.OnOpening, s.hooksConfig.Verification) + context.Background(), onOpeningData, hook.OnOpening, s.hooksConfig.Verification) if err != nil { s.logger.Error().Err(err).Msg("Failed to run OnOpening hook") } @@ -122,7 +122,7 @@ func (s *Server) OnOpen(gconn gnet.Conn) ([]byte, gnet.Action) { }, } _, err = s.hooksConfig.Run( - context.Background(), onOpenedData, plugin.OnOpened, s.hooksConfig.Verification) + context.Background(), onOpenedData, hook.OnOpened, s.hooksConfig.Verification) if err != nil { s.logger.Error().Err(err).Msg("Failed to run OnOpened hook") } @@ -149,7 +149,7 @@ func (s *Server) OnClose(gconn gnet.Conn, err error) gnet.Action { data["error"] = err.Error() } _, gatewaydErr := s.hooksConfig.Run( - context.Background(), data, plugin.OnClosing, s.hooksConfig.Verification) + context.Background(), data, hook.OnClosing, s.hooksConfig.Verification) if gatewaydErr != nil { s.logger.Error().Err(gatewaydErr).Msg("Failed to run OnClosing hook") } @@ -180,7 +180,7 @@ func (s *Server) OnClose(gconn gnet.Conn, err error) gnet.Action { data["error"] = err.Error() } _, gatewaydErr = s.hooksConfig.Run( - context.Background(), data, plugin.OnClosed, s.hooksConfig.Verification) + context.Background(), data, hook.OnClosed, s.hooksConfig.Verification) if gatewaydErr != nil { s.logger.Error().Err(gatewaydErr).Msg("Failed to run OnClosed hook") } @@ -199,7 +199,7 @@ func (s *Server) OnTraffic(gconn gnet.Conn) gnet.Action { }, } _, err := s.hooksConfig.Run( - context.Background(), onTrafficData, plugin.OnTraffic, s.hooksConfig.Verification) + context.Background(), onTrafficData, hook.OnTraffic, s.hooksConfig.Verification) if err != nil { s.logger.Error().Err(err).Msg("Failed to run OnTraffic hook") } @@ -215,6 +215,7 @@ func (s *Server) OnTraffic(gconn gnet.Conn) gnet.Action { errors.Is(err, gerr.ErrClientNotConnected), errors.Is(err, gerr.ErrClientSendFailed), errors.Is(err, gerr.ErrClientReceiveFailed), + errors.Is(err, gerr.ErrHookTerminatedConnection), errors.Is(err.Unwrap(), io.EOF): return gnet.Close } @@ -233,7 +234,7 @@ func (s *Server) OnShutdown(engine gnet.Engine) { _, err := s.hooksConfig.Run( context.Background(), map[string]interface{}{"connections": s.engine.CountConnections()}, - plugin.OnShutdown, + hook.OnShutdown, s.hooksConfig.Verification) if err != nil { s.logger.Error().Err(err).Msg("Failed to run OnShutdown hook") @@ -256,7 +257,7 @@ func (s *Server) OnTick() (time.Duration, gnet.Action) { _, err := s.hooksConfig.Run( context.Background(), map[string]interface{}{"connections": s.engine.CountConnections()}, - plugin.OnTick, + hook.OnTick, s.hooksConfig.Verification) if err != nil { s.logger.Error().Err(err).Msg("Failed to run OnTick hook") @@ -284,7 +285,7 @@ func (s *Server) Run() error { onRunData["error"] = err.OriginalError.Error() } result, err := s.hooksConfig.Run( - context.Background(), onRunData, plugin.OnRun, s.hooksConfig.Verification) + context.Background(), onRunData, hook.OnRun, s.hooksConfig.Verification) if err != nil { s.logger.Error().Err(err).Msg("Failed to run the hook") } @@ -333,7 +334,7 @@ func NewServer( options []gnet.Option, proxy IProxy, logger zerolog.Logger, - hooksConfig *plugin.HookConfig, + hooksConfig *hook.Config, ) *Server { // Create the server. server := Server{ diff --git a/network/server_test.go b/network/server_test.go index 535db499..a72f4dd7 100644 --- a/network/server_test.go +++ b/network/server_test.go @@ -9,7 +9,7 @@ import ( embeddedpostgres "github.com/fergusstrange/embedded-postgres" "github.com/gatewayd-io/gatewayd/config" "github.com/gatewayd-io/gatewayd/logging" - "github.com/gatewayd-io/gatewayd/plugin" + "github.com/gatewayd-io/gatewayd/plugin/hook" "github.com/gatewayd-io/gatewayd/pool" "github.com/panjf2000/gnet/v2" "github.com/rs/zerolog" @@ -39,9 +39,9 @@ func TestRunServer(t *testing.T) { logger := logging.NewLogger(cfg) - hooksConfig := plugin.NewHookConfig() + hooksConfig := hook.NewHookConfig() - onIngressTraffic := func( + onTrafficFromClient := func( ctx context.Context, params *structpb.Struct, opts ...grpc.CallOption, @@ -67,9 +67,9 @@ func TestRunServer(t *testing.T) { assert.Empty(t, paramsMap["error"]) return params, nil } - hooksConfig.Add(plugin.OnIngressTraffic, 1, onIngressTraffic) + hooksConfig.Add(hook.OnTrafficFromClient, 1, onTrafficFromClient) - onEgressTraffic := func( + onTrafficFromServer := func( ctx context.Context, params *structpb.Struct, opts ...grpc.CallOption, @@ -92,7 +92,7 @@ func TestRunServer(t *testing.T) { assert.Empty(t, paramsMap["error"]) return params, nil } - hooksConfig.Add(plugin.OnEgressTraffic, 1, onEgressTraffic) + hooksConfig.Add(hook.OnTrafficFromServer, 1, onTrafficFromServer) clientConfig := config.Client{ Network: "tcp", diff --git a/plugin/hook/constants.go b/plugin/hook/constants.go new file mode 100644 index 00000000..b9c4e3e6 --- /dev/null +++ b/plugin/hook/constants.go @@ -0,0 +1,28 @@ +package hook + +const ( + // Run command hooks (cmd/run.go). + OnConfigLoaded Type = "onConfigLoaded" + OnNewLogger Type = "onNewLogger" + OnNewPool Type = "onNewPool" + OnNewProxy Type = "onNewProxy" + OnNewServer Type = "onNewServer" + OnSignal Type = "onSignal" + // Server hooks (network/server.go). + OnRun Type = "onRun" + OnBooting Type = "onBooting" + OnBooted Type = "onBooted" + OnOpening Type = "onOpening" + OnOpened Type = "onOpened" + OnClosing Type = "onClosing" + OnClosed Type = "onClosed" + OnTraffic Type = "onTraffic" + OnTrafficFromClient Type = "onTrafficFromClient" + OnTrafficToServer Type = "onTrafficToServer" + OnTrafficFromServer Type = "onTrafficFromServer" + OnTrafficToClient Type = "onTrafficToClient" + OnShutdown Type = "onShutdown" + OnTick Type = "onTick" + // Pool hooks (network/pool.go). + OnNewClient Type = "onNewClient" +) diff --git a/plugin/hooks.go b/plugin/hook/hooks.go similarity index 70% rename from plugin/hooks.go rename to plugin/hook/hooks.go index d5301dfb..20784cf8 100644 --- a/plugin/hooks.go +++ b/plugin/hook/hooks.go @@ -1,4 +1,4 @@ -package plugin +package hook import ( "context" @@ -6,67 +6,34 @@ import ( "github.com/gatewayd-io/gatewayd/config" gerr "github.com/gatewayd-io/gatewayd/errors" + "github.com/gatewayd-io/gatewayd/plugin/utils" "github.com/rs/zerolog" "google.golang.org/grpc" "google.golang.org/protobuf/types/known/structpb" ) -type ( - // Priority is the priority of a hook. - // Smaller values are executed first (higher priority). - Priority uint - HookType string - HookDef func( - context.Context, *structpb.Struct, ...grpc.CallOption) (*structpb.Struct, error) -) - -const ( - // Run command hooks (cmd/run.go). - OnConfigLoaded HookType = "onConfigLoaded" - OnNewLogger HookType = "onNewLogger" - OnNewPool HookType = "onNewPool" - OnNewProxy HookType = "onNewProxy" - OnNewServer HookType = "onNewServer" - OnSignal HookType = "onSignal" - // Server hooks (network/server.go). - OnRun HookType = "onRun" - OnBooting HookType = "onBooting" - OnBooted HookType = "onBooted" - OnOpening HookType = "onOpening" - OnOpened HookType = "onOpened" - OnClosing HookType = "onClosing" - OnClosed HookType = "onClosed" - OnTraffic HookType = "onTraffic" - OnIngressTraffic HookType = "onIngressTraffic" - OnEgressTraffic HookType = "onEgressTraffic" - OnShutdown HookType = "onShutdown" - OnTick HookType = "onTick" - // Pool hooks (network/pool.go). - OnNewClient HookType = "onNewClient" -) - -type HookConfig struct { - hooks map[HookType]map[Priority]HookDef +type Config struct { + hooks map[Type]map[Priority]FunctionType Logger zerolog.Logger Verification config.Policy } -// NewHookConfig returns a new HookConfig. -func NewHookConfig() *HookConfig { - return &HookConfig{ - hooks: map[HookType]map[Priority]HookDef{}, +// NewHookConfig returns a new Config. +func NewHookConfig() *Config { + return &Config{ + hooks: map[Type]map[Priority]FunctionType{}, } } // Hooks returns the hooks. -func (h *HookConfig) Hooks() map[HookType]map[Priority]HookDef { +func (h *Config) Hooks() map[Type]map[Priority]FunctionType { return h.hooks } // Add adds a hook with a priority to the hooks map. -func (h *HookConfig) Add(hookType HookType, prio Priority, hook HookDef) { +func (h *Config) Add(hookType Type, prio Priority, hookFunc FunctionType) { if len(h.hooks[hookType]) == 0 { - h.hooks[hookType] = map[Priority]HookDef{prio: hook} + h.hooks[hookType] = map[Priority]FunctionType{prio: hookFunc} } else { if _, ok := h.hooks[hookType][prio]; ok { h.Logger.Warn().Fields( @@ -76,12 +43,12 @@ func (h *HookConfig) Add(hookType HookType, prio Priority, hook HookDef) { }, ).Msg("Hook is replaced") } - h.hooks[hookType][prio] = hook + h.hooks[hookType][prio] = hookFunc } } // Get returns the hooks of a specific type. -func (h *HookConfig) Get(hookType HookType) map[Priority]HookDef { +func (h *Config) Get(hookType Type) map[Priority]FunctionType { return h.hooks[hookType] } @@ -95,14 +62,14 @@ func (h *HookConfig) Get(hookType HookType) map[Priority]HookDef { // to Remove, the hook is removed from the list of hooks on the first error. If the // verification mode is set to Ignore, the error is ignored and the execution continues. // If the verification mode is set to PassDown, the extra keys/values in the result -// are passed down to the next hook. The verification mode is set to PassDown by default. +// are passed down to the next The verification mode is set to PassDown by default. // The opts are passed to the hooks as well to allow them to use the grpc.CallOption. // //nolint:funlen -func (h *HookConfig) Run( +func (h *Config) Run( ctx context.Context, args map[string]interface{}, - hookType HookType, + hookType Type, verification config.Policy, opts ...grpc.CallOption, ) (map[string]interface{}, *gerr.GatewayDError) { @@ -115,7 +82,7 @@ func (h *HookConfig) Run( defer cancel() // Cast custom fields to their primitive types, like time.Duration to float64. - args = CastToPrimitiveTypes(args) + args = utils.CastToPrimitiveTypes(args) // Create structpb.Struct from args. var params *structpb.Struct @@ -153,7 +120,7 @@ func (h *HookConfig) Run( // and that the hook does not return any unexpected values. // If the verification mode is non-strict (permissive), let the plugin pass // extra keys/values to the next plugin in chain. - if Verify(params, result) || verification == config.PassDown { + if utils.Verify(params, result) || verification == config.PassDown { // Update the last return value with the current result returnVal = result continue @@ -162,7 +129,7 @@ func (h *HookConfig) Run( // At this point, the hook returned an invalid value, so we need to handle it. // The result of the current hook will be ignored, regardless of the policy. switch verification { - // Ignore the result of this plugin, log an error and execute the next hook. + // Ignore the result of this plugin, log an error and execute the next case config.Ignore: h.Logger.Error().Err(err).Fields( map[string]interface{}{ @@ -173,7 +140,7 @@ func (h *HookConfig) Run( if idx == 0 { returnVal = params } - // Abort execution of the plugins, log the error and return the result of the last hook. + // Abort execution of the plugins, log the error and return the result of the last case config.Abort: h.Logger.Error().Err(err).Fields( map[string]interface{}{ @@ -185,7 +152,7 @@ func (h *HookConfig) Run( return args, nil } return returnVal.AsMap(), nil - // Remove the hook from the registry, log the error and execute the next hook. + // Remove the hook from the registry, log the error and execute the next case config.Remove: h.Logger.Error().Err(err).Fields( map[string]interface{}{ diff --git a/plugin/hooks_test.go b/plugin/hook/hooks_test.go similarity index 99% rename from plugin/hooks_test.go rename to plugin/hook/hooks_test.go index 65149c67..61ff4891 100644 --- a/plugin/hooks_test.go +++ b/plugin/hook/hooks_test.go @@ -1,4 +1,4 @@ -package plugin +package hook import ( "context" @@ -87,7 +87,7 @@ func Test_HookConfig_Run(t *testing.T) { // Test_HookConfig_Run_PassDown tests the Run function with the PassDown option. func Test_HookConfig_Run_PassDown(t *testing.T) { hooks := NewHookConfig() - // The result of the hook will be nil and will be passed down to the next hook. + // The result of the hook will be nil and will be passed down to the next hooks.Add(OnNewLogger, 0, func( ctx context.Context, args *structpb.Struct, @@ -123,7 +123,7 @@ func Test_HookConfig_Run_PassDown(t *testing.T) { // Test_HookConfig_Run_PassDown_2 tests the Run function with the PassDown option. func Test_HookConfig_Run_PassDown_2(t *testing.T) { hooks := NewHookConfig() - // The result of the hook will be nil and will be passed down to the next hook. + // The result of the hook will be nil and will be passed down to the next hooks.Add(OnNewLogger, 0, func( ctx context.Context, args *structpb.Struct, @@ -220,7 +220,7 @@ func Test_HookConfig_Run_Abort(t *testing.T) { assert.Nil(t, err) return output, nil }) - // The first hook returns nil, and it aborts the execution of the rest of the hook. + // The first hook returns nil, and it aborts the execution of the rest of the result, err := hooks.Run( context.Background(), map[string]interface{}{}, OnNewLogger, config.Abort) assert.Nil(t, err) diff --git a/plugin/hook/types.go b/plugin/hook/types.go new file mode 100644 index 00000000..c32e0467 --- /dev/null +++ b/plugin/hook/types.go @@ -0,0 +1,17 @@ +package hook + +import ( + "context" + + "google.golang.org/grpc" + "google.golang.org/protobuf/types/known/structpb" +) + +type ( + // Priority is the priority of a hook. + // Smaller values are executed first (higher priority). + Priority uint + Type string + FunctionType func( + context.Context, *structpb.Struct, ...grpc.CallOption) (*structpb.Struct, error) +) diff --git a/plugin/plugin.go b/plugin/plugin.go index 97a78906..2ae76915 100644 --- a/plugin/plugin.go +++ b/plugin/plugin.go @@ -4,6 +4,7 @@ import ( "net" gerr "github.com/gatewayd-io/gatewayd/errors" + "github.com/gatewayd-io/gatewayd/plugin/hook" pluginV1 "github.com/gatewayd-io/gatewayd/plugin/v1" goplugin "github.com/hashicorp/go-plugin" ) @@ -39,8 +40,8 @@ type Plugin struct { // internal and external config options Config map[string]string // hooks it attaches to - Hooks []HookType - Priority Priority + Hooks []hook.Type + Priority hook.Priority // required plugins to be loaded before this one // Built-in plugins are always loaded first Requires []Identifier diff --git a/plugin/plugin_registry.go b/plugin/plugin_registry.go index 4e5afce2..8dbe4e0a 100644 --- a/plugin/plugin_registry.go +++ b/plugin/plugin_registry.go @@ -7,6 +7,8 @@ import ( "github.com/gatewayd-io/gatewayd/config" gerr "github.com/gatewayd-io/gatewayd/errors" "github.com/gatewayd-io/gatewayd/logging" + "github.com/gatewayd-io/gatewayd/plugin/hook" + "github.com/gatewayd-io/gatewayd/plugin/utils" pluginV1 "github.com/gatewayd-io/gatewayd/plugin/v1" "github.com/gatewayd-io/gatewayd/pool" goplugin "github.com/hashicorp/go-plugin" @@ -27,14 +29,14 @@ type IPluginRegistry interface { type PluginRegistry struct { //nolint:golint,revive plugins pool.IPool - hooksConfig *HookConfig + hooksConfig *hook.Config CompatPolicy config.CompatPolicy } var _ IPluginRegistry = &PluginRegistry{} // NewRegistry creates a new plugin registry. -func NewRegistry(hooksConfig *HookConfig) *PluginRegistry { +func NewRegistry(hooksConfig *hook.Config) *PluginRegistry { return &PluginRegistry{ plugins: pool.NewPool(config.EmptyPoolCapacity), hooksConfig: hooksConfig, @@ -174,7 +176,7 @@ func (reg *PluginRegistry) LoadPlugins(plugins []config.Plugin) { // Verify the checksum. // TODO: Load the plugin from a remote location if the checksum didn't match? - if sum, err := sha256sum(plugin.LocalPath); err != nil { + if sum, err := utils.SHA256SUM(plugin.LocalPath); err != nil { reg.hooksConfig.Logger.Debug().Err(err).Msg("Failed to calculate checksum") continue } else if sum != plugin.ID.Checksum { @@ -191,7 +193,7 @@ func (reg *PluginRegistry) LoadPlugins(plugins []config.Plugin) { // in the config file. Built-in plugins are loaded first, followed by user-defined // plugins. Built-in plugins have a priority of 0 to 999, and user-defined plugins // have a priority of 1000 or greater. - plugin.Priority = Priority(config.PluginPriorityStart + uint(priority)) + plugin.Priority = hook.Priority(config.PluginPriorityStart + uint(priority)) logAdapter := logging.NewHcLogAdapter(®.hooksConfig.Logger, config.LoggerName) @@ -199,7 +201,7 @@ func (reg *PluginRegistry) LoadPlugins(plugins []config.Plugin) { &goplugin.ClientConfig{ HandshakeConfig: pluginV1.Handshake, Plugins: pluginV1.GetPluginMap(plugin.ID.Name), - Cmd: NewCommand(plugin.LocalPath, plugin.Args, plugin.Env), + Cmd: utils.NewCommand(plugin.LocalPath, plugin.Args, plugin.Env), AllowedProtocols: []goplugin.Protocol{ goplugin.ProtocolGRPC, }, @@ -326,52 +328,57 @@ func (reg *PluginRegistry) RegisterHooks(id Identifier) { return } - for _, hook := range pluginImpl.Hooks { - var hookFunc HookDef - switch hook { - case OnConfigLoaded: + for _, hookType := range pluginImpl.Hooks { + var hookFunc hook.FunctionType + switch hookType { + case hook.OnConfigLoaded: hookFunc = pluginV1.OnConfigLoaded - case OnNewLogger: + case hook.OnNewLogger: hookFunc = pluginV1.OnNewLogger - case OnNewPool: + case hook.OnNewPool: hookFunc = pluginV1.OnNewPool - case OnNewProxy: + case hook.OnNewProxy: hookFunc = pluginV1.OnNewProxy - case OnNewServer: + case hook.OnNewServer: hookFunc = pluginV1.OnNewServer - case OnSignal: + case hook.OnSignal: hookFunc = pluginV1.OnSignal - case OnRun: + case hook.OnRun: hookFunc = pluginV1.OnRun - case OnBooting: + case hook.OnBooting: hookFunc = pluginV1.OnBooting - case OnBooted: + case hook.OnBooted: hookFunc = pluginV1.OnBooted - case OnOpening: + case hook.OnOpening: hookFunc = pluginV1.OnOpening - case OnOpened: + case hook.OnOpened: hookFunc = pluginV1.OnOpened - case OnClosing: + case hook.OnClosing: hookFunc = pluginV1.OnClosing - case OnClosed: + case hook.OnClosed: hookFunc = pluginV1.OnClosed - case OnTraffic: + case hook.OnTraffic: hookFunc = pluginV1.OnTraffic - case OnIngressTraffic: - hookFunc = pluginV1.OnIngressTraffic - case OnEgressTraffic: - hookFunc = pluginV1.OnEgressTraffic - case OnShutdown: + case hook.OnTrafficFromClient: + hookFunc = pluginV1.OnTrafficFromClient + case hook.OnTrafficToServer: + hookFunc = pluginV1.OnTrafficToServer + case hook.OnTrafficFromServer: + hookFunc = pluginV1.OnTrafficFromServer + case hook.OnTrafficToClient: + hookFunc = pluginV1.OnTrafficToClient + case hook.OnShutdown: hookFunc = pluginV1.OnShutdown - case OnTick: + case hook.OnTick: hookFunc = pluginV1.OnTick - case OnNewClient: + case hook.OnNewClient: hookFunc = pluginV1.OnNewClient default: - reg.hooksConfig.Logger.Warn().Str("hook", string(hook)).Msg("Unknown hook type") + reg.hooksConfig.Logger.Warn().Str("hook", string(hookType)).Msg( + "Unknown hook, skipping") continue } - reg.hooksConfig.Logger.Debug().Str("hook", string(hook)).Msg("Registering hook") - reg.hooksConfig.Add(hook, pluginImpl.Priority, hookFunc) + reg.hooksConfig.Logger.Debug().Str("hook", string(hookType)).Msg("Registering hook") + reg.hooksConfig.Add(hookType, pluginImpl.Priority, hookFunc) } } diff --git a/plugin/plugin_registry_test.go b/plugin/plugin_registry_test.go index bfc48f7f..c1aaa7b1 100644 --- a/plugin/plugin_registry_test.go +++ b/plugin/plugin_registry_test.go @@ -3,12 +3,13 @@ package plugin import ( "testing" + "github.com/gatewayd-io/gatewayd/plugin/hook" "github.com/stretchr/testify/assert" ) // TestPluginRegistry tests the PluginRegistry. func TestPluginRegistry(t *testing.T) { - hooksConfig := NewHookConfig() + hooksConfig := hook.NewHookConfig() assert.NotNil(t, hooksConfig) reg := NewRegistry(hooksConfig) assert.NotNil(t, reg) diff --git a/plugin/utils.go b/plugin/utils/functions.go similarity index 93% rename from plugin/utils.go rename to plugin/utils/functions.go index 61ea2d89..bf06f57c 100644 --- a/plugin/utils.go +++ b/plugin/utils/functions.go @@ -1,4 +1,4 @@ -package plugin +package utils import ( "bufio" @@ -17,10 +17,10 @@ import ( "google.golang.org/protobuf/types/known/structpb" ) -// sha256sum returns the sha256 checksum of a file. +// SHA256SUM returns the sha256 checksum of a file. // Ref: https://github.com/codingsince1985/checksum // A little copying is better than a little dependency. -func sha256sum(filename string) (string, *gerr.GatewayDError) { +func SHA256SUM(filename string) (string, *gerr.GatewayDError) { if info, err := os.Stat(filename); err != nil || info.IsDir() { return "", gerr.ErrFileNotFound.Wrap(err) } diff --git a/plugin/utils_test.go b/plugin/utils/functions_test.go similarity index 94% rename from plugin/utils_test.go rename to plugin/utils/functions_test.go index 2bd3f58c..6d9578f1 100644 --- a/plugin/utils_test.go +++ b/plugin/utils/functions_test.go @@ -1,4 +1,4 @@ -package plugin +package utils import ( "testing" @@ -9,7 +9,7 @@ import ( // Test_sha256sum tests the sha256sum function. func Test_sha256sum(t *testing.T) { - checksum, err := sha256sum("../LICENSE") + checksum, err := SHA256SUM("../../LICENSE") assert.Nil(t, err) assert.Equal(t, "8486a10c4393cee1c25392769ddd3b2d6c242d6ec7928e1414efff7dfb2f07ef", @@ -19,7 +19,7 @@ func Test_sha256sum(t *testing.T) { // Test_sha256sum_fail tests the sha256sum function with a file that does not exist. func Test_sha256sum_fail(t *testing.T) { - _, err := sha256sum("not_a_file") + _, err := SHA256SUM("not_a_file") assert.NotNil(t, err) } diff --git a/plugin/v1/plugin.pb.go b/plugin/v1/plugin.pb.go index e8e83776..e7c71a4a 100644 --- a/plugin/v1/plugin.pb.go +++ b/plugin/v1/plugin.pb.go @@ -21,93 +21,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -type Version struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Major uint64 `protobuf:"varint,1,opt,name=major,proto3" json:"major,omitempty"` - Minor uint64 `protobuf:"varint,2,opt,name=minor,proto3" json:"minor,omitempty"` - Patch uint64 `protobuf:"varint,3,opt,name=patch,proto3" json:"patch,omitempty"` - Pre string `protobuf:"bytes,4,opt,name=pre,proto3" json:"pre,omitempty"` - Metadata string `protobuf:"bytes,5,opt,name=metadata,proto3" json:"metadata,omitempty"` - Original string `protobuf:"bytes,6,opt,name=original,proto3" json:"original,omitempty"` -} - -func (x *Version) Reset() { - *x = Version{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_v1_plugin_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Version) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Version) ProtoMessage() {} - -func (x *Version) ProtoReflect() protoreflect.Message { - mi := &file_plugin_v1_plugin_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Version.ProtoReflect.Descriptor instead. -func (*Version) Descriptor() ([]byte, []int) { - return file_plugin_v1_plugin_proto_rawDescGZIP(), []int{0} -} - -func (x *Version) GetMajor() uint64 { - if x != nil { - return x.Major - } - return 0 -} - -func (x *Version) GetMinor() uint64 { - if x != nil { - return x.Minor - } - return 0 -} - -func (x *Version) GetPatch() uint64 { - if x != nil { - return x.Patch - } - return 0 -} - -func (x *Version) GetPre() string { - if x != nil { - return x.Pre - } - return "" -} - -func (x *Version) GetMetadata() string { - if x != nil { - return x.Metadata - } - return "" -} - -func (x *Version) GetOriginal() string { - if x != nil { - return x.Original - } - return "" -} - type PluginID struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -122,7 +35,7 @@ type PluginID struct { func (x *PluginID) Reset() { *x = PluginID{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_v1_plugin_proto_msgTypes[1] + mi := &file_plugin_v1_plugin_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -135,7 +48,7 @@ func (x *PluginID) String() string { func (*PluginID) ProtoMessage() {} func (x *PluginID) ProtoReflect() protoreflect.Message { - mi := &file_plugin_v1_plugin_proto_msgTypes[1] + mi := &file_plugin_v1_plugin_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -148,7 +61,7 @@ func (x *PluginID) ProtoReflect() protoreflect.Message { // Deprecated: Use PluginID.ProtoReflect.Descriptor instead. func (*PluginID) Descriptor() ([]byte, []int) { - return file_plugin_v1_plugin_proto_rawDescGZIP(), []int{1} + return file_plugin_v1_plugin_proto_rawDescGZIP(), []int{0} } func (x *PluginID) GetName() string { @@ -202,7 +115,7 @@ type PluginConfig struct { func (x *PluginConfig) Reset() { *x = PluginConfig{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_v1_plugin_proto_msgTypes[2] + mi := &file_plugin_v1_plugin_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -215,7 +128,7 @@ func (x *PluginConfig) String() string { func (*PluginConfig) ProtoMessage() {} func (x *PluginConfig) ProtoReflect() protoreflect.Message { - mi := &file_plugin_v1_plugin_proto_msgTypes[2] + mi := &file_plugin_v1_plugin_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -228,7 +141,7 @@ func (x *PluginConfig) ProtoReflect() protoreflect.Message { // Deprecated: Use PluginConfig.ProtoReflect.Descriptor instead. func (*PluginConfig) Descriptor() ([]byte, []int) { - return file_plugin_v1_plugin_proto_rawDescGZIP(), []int{2} + return file_plugin_v1_plugin_proto_rawDescGZIP(), []int{1} } func (x *PluginConfig) GetId() *PluginID { @@ -308,140 +221,140 @@ var file_plugin_v1_plugin_proto_rawDesc = []byte{ 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x22, 0x95, 0x01, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, - 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x6d, 0x61, - 0x6a, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x61, 0x74, - 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x12, - 0x10, 0x0a, 0x03, 0x70, 0x72, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x70, 0x72, - 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1a, 0x0a, - 0x08, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x22, 0x73, 0x0a, 0x08, 0x50, 0x6c, 0x75, - 0x67, 0x69, 0x6e, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x75, 0x72, - 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x55, - 0x72, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x22, 0xec, - 0x03, 0x0a, 0x0c, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, - 0x23, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x6c, - 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x49, 0x44, - 0x52, 0x02, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, - 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x73, - 0x12, 0x18, 0x0a, 0x07, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x72, - 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x55, 0x72, 0x6c, 0x12, 0x3b, 0x0a, 0x06, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x70, 0x6c, - 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x68, 0x6f, 0x6f, 0x6b, - 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x68, 0x6f, 0x6f, 0x6b, 0x73, 0x12, 0x41, - 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x25, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x6c, 0x75, - 0x67, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, - 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, - 0x73, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, - 0x69, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x61, 0x74, 0x65, 0x67, - 0x6f, 0x72, 0x69, 0x65, 0x73, 0x1a, 0x39, 0x0a, 0x0b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x45, - 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, - 0x1a, 0x3b, 0x0a, 0x0d, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, - 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x32, 0x98, 0x0a, - 0x0a, 0x15, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x44, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x43, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x50, 0x6c, - 0x75, 0x67, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x17, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, - 0x75, 0x63, 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x42, 0x0a, 0x0e, - 0x4f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x4c, 0x6f, 0x61, 0x64, 0x65, 0x64, 0x12, 0x17, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x6f, 0x22, 0x73, 0x0a, 0x08, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x49, 0x44, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x72, + 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x68, + 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x68, + 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x22, 0xec, 0x03, 0x0a, 0x0c, 0x50, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x23, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x2e, + 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x49, 0x44, 0x52, 0x02, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x0b, + 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, + 0x0a, 0x07, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x07, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6c, 0x69, 0x63, 0x65, + 0x6e, 0x73, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6c, 0x69, 0x63, 0x65, 0x6e, + 0x73, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x75, 0x72, + 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, + 0x55, 0x72, 0x6c, 0x12, 0x3b, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x06, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x2e, + 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x12, 0x14, 0x0a, 0x05, 0x68, 0x6f, 0x6f, 0x6b, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x05, 0x68, 0x6f, 0x6f, 0x6b, 0x73, 0x12, 0x41, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, + 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, + 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x1e, 0x0a, + 0x0a, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x0a, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x1a, 0x39, 0x0a, + 0x0b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, + 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3b, 0x0a, 0x0d, 0x52, 0x65, 0x71, 0x75, + 0x69, 0x72, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x3a, 0x02, 0x38, 0x01, 0x32, 0xad, 0x0b, 0x0a, 0x15, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x44, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, + 0x43, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x12, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, + 0x72, 0x75, 0x63, 0x74, 0x12, 0x42, 0x0a, 0x0e, 0x4f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x4c, 0x6f, 0x61, 0x64, 0x65, 0x64, 0x12, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x1a, + 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x3f, 0x0a, 0x0b, 0x4f, 0x6e, 0x4e, 0x65, + 0x77, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x12, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, - 0x12, 0x3f, 0x0a, 0x0b, 0x4f, 0x6e, 0x4e, 0x65, 0x77, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x12, + 0x1a, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x3d, 0x0a, 0x09, 0x4f, 0x6e, 0x4e, + 0x65, 0x77, 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, - 0x74, 0x12, 0x3d, 0x0a, 0x09, 0x4f, 0x6e, 0x4e, 0x65, 0x77, 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x17, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x3e, 0x0a, 0x0a, 0x4f, 0x6e, 0x4e, 0x65, + 0x77, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x12, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x1a, + 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x3f, 0x0a, 0x0b, 0x4f, 0x6e, 0x4e, 0x65, + 0x77, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, - 0x12, 0x3e, 0x0a, 0x0a, 0x4f, 0x6e, 0x4e, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x12, 0x17, + 0x1a, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x3c, 0x0a, 0x08, 0x4f, 0x6e, 0x53, + 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x12, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, - 0x12, 0x3f, 0x0a, 0x0b, 0x4f, 0x6e, 0x4e, 0x65, 0x77, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, + 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x39, 0x0a, 0x05, 0x4f, 0x6e, 0x52, 0x75, 0x6e, + 0x12, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, + 0x63, 0x74, 0x12, 0x3d, 0x0a, 0x09, 0x4f, 0x6e, 0x42, 0x6f, 0x6f, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, - 0x74, 0x12, 0x3c, 0x0a, 0x08, 0x4f, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x12, 0x17, 0x2e, + 0x74, 0x12, 0x3c, 0x0a, 0x08, 0x4f, 0x6e, 0x42, 0x6f, 0x6f, 0x74, 0x65, 0x64, 0x12, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, - 0x39, 0x0a, 0x05, 0x4f, 0x6e, 0x52, 0x75, 0x6e, 0x12, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, - 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x3d, 0x0a, 0x09, 0x4f, 0x6e, - 0x42, 0x6f, 0x6f, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x3d, 0x0a, 0x09, 0x4f, 0x6e, 0x4f, 0x70, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x12, 0x17, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, + 0x74, 0x72, 0x75, 0x63, 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x3c, + 0x0a, 0x08, 0x4f, 0x6e, 0x4f, 0x70, 0x65, 0x6e, 0x65, 0x64, 0x12, 0x17, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, + 0x75, 0x63, 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x3d, 0x0a, 0x09, + 0x4f, 0x6e, 0x43, 0x6c, 0x6f, 0x73, 0x69, 0x6e, 0x67, 0x12, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, + 0x63, 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x3c, 0x0a, 0x08, 0x4f, + 0x6e, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x3c, 0x0a, 0x08, 0x4f, 0x6e, 0x42, - 0x6f, 0x6f, 0x74, 0x65, 0x64, 0x12, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x1a, 0x17, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x3d, 0x0a, 0x09, 0x4f, 0x6e, 0x4f, 0x70, 0x65, - 0x6e, 0x69, 0x6e, 0x67, 0x12, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x1a, 0x17, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x3c, 0x0a, 0x08, 0x4f, 0x6e, 0x4f, 0x70, 0x65, 0x6e, - 0x65, 0x64, 0x12, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, - 0x72, 0x75, 0x63, 0x74, 0x12, 0x3d, 0x0a, 0x09, 0x4f, 0x6e, 0x43, 0x6c, 0x6f, 0x73, 0x69, 0x6e, - 0x67, 0x12, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, - 0x75, 0x63, 0x74, 0x12, 0x3c, 0x0a, 0x08, 0x4f, 0x6e, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, + 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x3d, 0x0a, 0x09, 0x4f, 0x6e, 0x54, + 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x12, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x1a, + 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x47, 0x0a, 0x13, 0x4f, 0x6e, 0x54, 0x72, + 0x61, 0x66, 0x66, 0x69, 0x63, 0x46, 0x72, 0x6f, 0x6d, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, - 0x74, 0x12, 0x3d, 0x0a, 0x09, 0x4f, 0x6e, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x12, 0x17, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, - 0x12, 0x44, 0x0a, 0x10, 0x4f, 0x6e, 0x49, 0x6e, 0x67, 0x72, 0x65, 0x73, 0x73, 0x54, 0x72, 0x61, - 0x66, 0x66, 0x69, 0x63, 0x12, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x1a, 0x17, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x43, 0x0a, 0x0f, 0x4f, 0x6e, 0x45, 0x67, 0x72, 0x65, - 0x73, 0x73, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x12, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, - 0x63, 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x3e, 0x0a, 0x0a, 0x4f, - 0x6e, 0x53, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x12, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, - 0x63, 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x3a, 0x0a, 0x06, 0x4f, - 0x6e, 0x54, 0x69, 0x63, 0x6b, 0x12, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x1a, 0x17, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x3f, 0x0a, 0x0b, 0x4f, 0x6e, 0x4e, 0x65, 0x77, + 0x74, 0x12, 0x45, 0x0a, 0x11, 0x4f, 0x6e, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x54, 0x6f, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x1a, + 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x47, 0x0a, 0x13, 0x4f, 0x6e, 0x54, 0x72, + 0x61, 0x66, 0x66, 0x69, 0x63, 0x46, 0x72, 0x6f, 0x6d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, + 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, + 0x74, 0x12, 0x45, 0x0a, 0x11, 0x4f, 0x6e, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x54, 0x6f, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x42, 0x39, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x64, 0x2d, - 0x69, 0x6f, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x64, 0x2f, 0x70, 0x6c, 0x75, 0x67, - 0x69, 0x6e, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, - 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x3e, 0x0a, 0x0a, 0x4f, 0x6e, 0x53, 0x68, + 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x12, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x1a, + 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x3a, 0x0a, 0x06, 0x4f, 0x6e, 0x54, 0x69, + 0x63, 0x6b, 0x12, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, + 0x72, 0x75, 0x63, 0x74, 0x12, 0x3f, 0x0a, 0x0b, 0x4f, 0x6e, 0x4e, 0x65, 0x77, 0x43, 0x6c, 0x69, + 0x65, 0x6e, 0x74, 0x12, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x1a, 0x17, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, + 0x74, 0x72, 0x75, 0x63, 0x74, 0x42, 0x39, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x64, 0x2d, 0x69, 0x6f, 0x2f, + 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x64, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2f, + 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2f, 0x76, 0x31, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -456,61 +369,64 @@ func file_plugin_v1_plugin_proto_rawDescGZIP() []byte { return file_plugin_v1_plugin_proto_rawDescData } -var file_plugin_v1_plugin_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_plugin_v1_plugin_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_plugin_v1_plugin_proto_goTypes = []interface{}{ - (*Version)(nil), // 0: plugin.v1.Version - (*PluginID)(nil), // 1: plugin.v1.PluginID - (*PluginConfig)(nil), // 2: plugin.v1.PluginConfig - nil, // 3: plugin.v1.PluginConfig.ConfigEntry - nil, // 4: plugin.v1.PluginConfig.RequiresEntry - (*structpb.Struct)(nil), // 5: google.protobuf.Struct + (*PluginID)(nil), // 0: plugin.v1.PluginID + (*PluginConfig)(nil), // 1: plugin.v1.PluginConfig + nil, // 2: plugin.v1.PluginConfig.ConfigEntry + nil, // 3: plugin.v1.PluginConfig.RequiresEntry + (*structpb.Struct)(nil), // 4: google.protobuf.Struct } var file_plugin_v1_plugin_proto_depIdxs = []int32{ - 1, // 0: plugin.v1.PluginConfig.id:type_name -> plugin.v1.PluginID - 3, // 1: plugin.v1.PluginConfig.config:type_name -> plugin.v1.PluginConfig.ConfigEntry - 4, // 2: plugin.v1.PluginConfig.requires:type_name -> plugin.v1.PluginConfig.RequiresEntry - 5, // 3: plugin.v1.GatewayDPluginService.GetPluginConfig:input_type -> google.protobuf.Struct - 5, // 4: plugin.v1.GatewayDPluginService.OnConfigLoaded:input_type -> google.protobuf.Struct - 5, // 5: plugin.v1.GatewayDPluginService.OnNewLogger:input_type -> google.protobuf.Struct - 5, // 6: plugin.v1.GatewayDPluginService.OnNewPool:input_type -> google.protobuf.Struct - 5, // 7: plugin.v1.GatewayDPluginService.OnNewProxy:input_type -> google.protobuf.Struct - 5, // 8: plugin.v1.GatewayDPluginService.OnNewServer:input_type -> google.protobuf.Struct - 5, // 9: plugin.v1.GatewayDPluginService.OnSignal:input_type -> google.protobuf.Struct - 5, // 10: plugin.v1.GatewayDPluginService.OnRun:input_type -> google.protobuf.Struct - 5, // 11: plugin.v1.GatewayDPluginService.OnBooting:input_type -> google.protobuf.Struct - 5, // 12: plugin.v1.GatewayDPluginService.OnBooted:input_type -> google.protobuf.Struct - 5, // 13: plugin.v1.GatewayDPluginService.OnOpening:input_type -> google.protobuf.Struct - 5, // 14: plugin.v1.GatewayDPluginService.OnOpened:input_type -> google.protobuf.Struct - 5, // 15: plugin.v1.GatewayDPluginService.OnClosing:input_type -> google.protobuf.Struct - 5, // 16: plugin.v1.GatewayDPluginService.OnClosed:input_type -> google.protobuf.Struct - 5, // 17: plugin.v1.GatewayDPluginService.OnTraffic:input_type -> google.protobuf.Struct - 5, // 18: plugin.v1.GatewayDPluginService.OnIngressTraffic:input_type -> google.protobuf.Struct - 5, // 19: plugin.v1.GatewayDPluginService.OnEgressTraffic:input_type -> google.protobuf.Struct - 5, // 20: plugin.v1.GatewayDPluginService.OnShutdown:input_type -> google.protobuf.Struct - 5, // 21: plugin.v1.GatewayDPluginService.OnTick:input_type -> google.protobuf.Struct - 5, // 22: plugin.v1.GatewayDPluginService.OnNewClient:input_type -> google.protobuf.Struct - 5, // 23: plugin.v1.GatewayDPluginService.GetPluginConfig:output_type -> google.protobuf.Struct - 5, // 24: plugin.v1.GatewayDPluginService.OnConfigLoaded:output_type -> google.protobuf.Struct - 5, // 25: plugin.v1.GatewayDPluginService.OnNewLogger:output_type -> google.protobuf.Struct - 5, // 26: plugin.v1.GatewayDPluginService.OnNewPool:output_type -> google.protobuf.Struct - 5, // 27: plugin.v1.GatewayDPluginService.OnNewProxy:output_type -> google.protobuf.Struct - 5, // 28: plugin.v1.GatewayDPluginService.OnNewServer:output_type -> google.protobuf.Struct - 5, // 29: plugin.v1.GatewayDPluginService.OnSignal:output_type -> google.protobuf.Struct - 5, // 30: plugin.v1.GatewayDPluginService.OnRun:output_type -> google.protobuf.Struct - 5, // 31: plugin.v1.GatewayDPluginService.OnBooting:output_type -> google.protobuf.Struct - 5, // 32: plugin.v1.GatewayDPluginService.OnBooted:output_type -> google.protobuf.Struct - 5, // 33: plugin.v1.GatewayDPluginService.OnOpening:output_type -> google.protobuf.Struct - 5, // 34: plugin.v1.GatewayDPluginService.OnOpened:output_type -> google.protobuf.Struct - 5, // 35: plugin.v1.GatewayDPluginService.OnClosing:output_type -> google.protobuf.Struct - 5, // 36: plugin.v1.GatewayDPluginService.OnClosed:output_type -> google.protobuf.Struct - 5, // 37: plugin.v1.GatewayDPluginService.OnTraffic:output_type -> google.protobuf.Struct - 5, // 38: plugin.v1.GatewayDPluginService.OnIngressTraffic:output_type -> google.protobuf.Struct - 5, // 39: plugin.v1.GatewayDPluginService.OnEgressTraffic:output_type -> google.protobuf.Struct - 5, // 40: plugin.v1.GatewayDPluginService.OnShutdown:output_type -> google.protobuf.Struct - 5, // 41: plugin.v1.GatewayDPluginService.OnTick:output_type -> google.protobuf.Struct - 5, // 42: plugin.v1.GatewayDPluginService.OnNewClient:output_type -> google.protobuf.Struct - 23, // [23:43] is the sub-list for method output_type - 3, // [3:23] is the sub-list for method input_type + 0, // 0: plugin.v1.PluginConfig.id:type_name -> plugin.v1.PluginID + 2, // 1: plugin.v1.PluginConfig.config:type_name -> plugin.v1.PluginConfig.ConfigEntry + 3, // 2: plugin.v1.PluginConfig.requires:type_name -> plugin.v1.PluginConfig.RequiresEntry + 4, // 3: plugin.v1.GatewayDPluginService.GetPluginConfig:input_type -> google.protobuf.Struct + 4, // 4: plugin.v1.GatewayDPluginService.OnConfigLoaded:input_type -> google.protobuf.Struct + 4, // 5: plugin.v1.GatewayDPluginService.OnNewLogger:input_type -> google.protobuf.Struct + 4, // 6: plugin.v1.GatewayDPluginService.OnNewPool:input_type -> google.protobuf.Struct + 4, // 7: plugin.v1.GatewayDPluginService.OnNewProxy:input_type -> google.protobuf.Struct + 4, // 8: plugin.v1.GatewayDPluginService.OnNewServer:input_type -> google.protobuf.Struct + 4, // 9: plugin.v1.GatewayDPluginService.OnSignal:input_type -> google.protobuf.Struct + 4, // 10: plugin.v1.GatewayDPluginService.OnRun:input_type -> google.protobuf.Struct + 4, // 11: plugin.v1.GatewayDPluginService.OnBooting:input_type -> google.protobuf.Struct + 4, // 12: plugin.v1.GatewayDPluginService.OnBooted:input_type -> google.protobuf.Struct + 4, // 13: plugin.v1.GatewayDPluginService.OnOpening:input_type -> google.protobuf.Struct + 4, // 14: plugin.v1.GatewayDPluginService.OnOpened:input_type -> google.protobuf.Struct + 4, // 15: plugin.v1.GatewayDPluginService.OnClosing:input_type -> google.protobuf.Struct + 4, // 16: plugin.v1.GatewayDPluginService.OnClosed:input_type -> google.protobuf.Struct + 4, // 17: plugin.v1.GatewayDPluginService.OnTraffic:input_type -> google.protobuf.Struct + 4, // 18: plugin.v1.GatewayDPluginService.OnTrafficFromClient:input_type -> google.protobuf.Struct + 4, // 19: plugin.v1.GatewayDPluginService.OnTrafficToServer:input_type -> google.protobuf.Struct + 4, // 20: plugin.v1.GatewayDPluginService.OnTrafficFromServer:input_type -> google.protobuf.Struct + 4, // 21: plugin.v1.GatewayDPluginService.OnTrafficToClient:input_type -> google.protobuf.Struct + 4, // 22: plugin.v1.GatewayDPluginService.OnShutdown:input_type -> google.protobuf.Struct + 4, // 23: plugin.v1.GatewayDPluginService.OnTick:input_type -> google.protobuf.Struct + 4, // 24: plugin.v1.GatewayDPluginService.OnNewClient:input_type -> google.protobuf.Struct + 4, // 25: plugin.v1.GatewayDPluginService.GetPluginConfig:output_type -> google.protobuf.Struct + 4, // 26: plugin.v1.GatewayDPluginService.OnConfigLoaded:output_type -> google.protobuf.Struct + 4, // 27: plugin.v1.GatewayDPluginService.OnNewLogger:output_type -> google.protobuf.Struct + 4, // 28: plugin.v1.GatewayDPluginService.OnNewPool:output_type -> google.protobuf.Struct + 4, // 29: plugin.v1.GatewayDPluginService.OnNewProxy:output_type -> google.protobuf.Struct + 4, // 30: plugin.v1.GatewayDPluginService.OnNewServer:output_type -> google.protobuf.Struct + 4, // 31: plugin.v1.GatewayDPluginService.OnSignal:output_type -> google.protobuf.Struct + 4, // 32: plugin.v1.GatewayDPluginService.OnRun:output_type -> google.protobuf.Struct + 4, // 33: plugin.v1.GatewayDPluginService.OnBooting:output_type -> google.protobuf.Struct + 4, // 34: plugin.v1.GatewayDPluginService.OnBooted:output_type -> google.protobuf.Struct + 4, // 35: plugin.v1.GatewayDPluginService.OnOpening:output_type -> google.protobuf.Struct + 4, // 36: plugin.v1.GatewayDPluginService.OnOpened:output_type -> google.protobuf.Struct + 4, // 37: plugin.v1.GatewayDPluginService.OnClosing:output_type -> google.protobuf.Struct + 4, // 38: plugin.v1.GatewayDPluginService.OnClosed:output_type -> google.protobuf.Struct + 4, // 39: plugin.v1.GatewayDPluginService.OnTraffic:output_type -> google.protobuf.Struct + 4, // 40: plugin.v1.GatewayDPluginService.OnTrafficFromClient:output_type -> google.protobuf.Struct + 4, // 41: plugin.v1.GatewayDPluginService.OnTrafficToServer:output_type -> google.protobuf.Struct + 4, // 42: plugin.v1.GatewayDPluginService.OnTrafficFromServer:output_type -> google.protobuf.Struct + 4, // 43: plugin.v1.GatewayDPluginService.OnTrafficToClient:output_type -> google.protobuf.Struct + 4, // 44: plugin.v1.GatewayDPluginService.OnShutdown:output_type -> google.protobuf.Struct + 4, // 45: plugin.v1.GatewayDPluginService.OnTick:output_type -> google.protobuf.Struct + 4, // 46: plugin.v1.GatewayDPluginService.OnNewClient:output_type -> google.protobuf.Struct + 25, // [25:47] is the sub-list for method output_type + 3, // [3:25] is the sub-list for method input_type 3, // [3:3] is the sub-list for extension type_name 3, // [3:3] is the sub-list for extension extendee 0, // [0:3] is the sub-list for field type_name @@ -523,18 +439,6 @@ func file_plugin_v1_plugin_proto_init() { } if !protoimpl.UnsafeEnabled { file_plugin_v1_plugin_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Version); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_v1_plugin_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PluginID); i { case 0: return &v.state @@ -546,7 +450,7 @@ func file_plugin_v1_plugin_proto_init() { return nil } } - file_plugin_v1_plugin_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_plugin_v1_plugin_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PluginConfig); i { case 0: return &v.state @@ -565,7 +469,7 @@ func file_plugin_v1_plugin_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_plugin_v1_plugin_proto_rawDesc, NumEnums: 0, - NumMessages: 5, + NumMessages: 4, NumExtensions: 0, NumServices: 1, }, diff --git a/plugin/v1/plugin.proto b/plugin/v1/plugin.proto index cef887e0..5c370b62 100644 --- a/plugin/v1/plugin.proto +++ b/plugin/v1/plugin.proto @@ -25,22 +25,15 @@ service GatewayDPluginService { rpc OnClosing (google.protobuf.Struct) returns (google.protobuf.Struct); rpc OnClosed (google.protobuf.Struct) returns (google.protobuf.Struct); rpc OnTraffic (google.protobuf.Struct) returns (google.protobuf.Struct); - rpc OnIngressTraffic (google.protobuf.Struct) returns (google.protobuf.Struct); - rpc OnEgressTraffic (google.protobuf.Struct) returns (google.protobuf.Struct); + rpc OnTrafficFromClient (google.protobuf.Struct) returns (google.protobuf.Struct); + rpc OnTrafficToServer (google.protobuf.Struct) returns (google.protobuf.Struct); + rpc OnTrafficFromServer (google.protobuf.Struct) returns (google.protobuf.Struct); + rpc OnTrafficToClient (google.protobuf.Struct) returns (google.protobuf.Struct); rpc OnShutdown (google.protobuf.Struct) returns (google.protobuf.Struct); rpc OnTick (google.protobuf.Struct) returns (google.protobuf.Struct); rpc OnNewClient (google.protobuf.Struct) returns (google.protobuf.Struct); } -message Version { - uint64 major = 1; - uint64 minor = 2; - uint64 patch = 3; - string pre = 4; - string metadata = 5; - string original = 6; -} - message PluginID { string name = 1; string version = 2; diff --git a/plugin/v1/plugin_grpc.pb.go b/plugin/v1/plugin_grpc.pb.go index 3c1487ed..1a21da26 100644 --- a/plugin/v1/plugin_grpc.pb.go +++ b/plugin/v1/plugin_grpc.pb.go @@ -40,8 +40,10 @@ type GatewayDPluginServiceClient interface { OnClosing(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error) OnClosed(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error) OnTraffic(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error) - OnIngressTraffic(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error) - OnEgressTraffic(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error) + OnTrafficFromClient(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error) + OnTrafficToServer(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error) + OnTrafficFromServer(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error) + OnTrafficToClient(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error) OnShutdown(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error) OnTick(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error) OnNewClient(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error) @@ -190,18 +192,36 @@ func (c *gatewayDPluginServiceClient) OnTraffic(ctx context.Context, in *structp return out, nil } -func (c *gatewayDPluginServiceClient) OnIngressTraffic(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error) { +func (c *gatewayDPluginServiceClient) OnTrafficFromClient(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error) { out := new(structpb.Struct) - err := c.cc.Invoke(ctx, "/plugin.v1.GatewayDPluginService/OnIngressTraffic", in, out, opts...) + err := c.cc.Invoke(ctx, "/plugin.v1.GatewayDPluginService/OnTrafficFromClient", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *gatewayDPluginServiceClient) OnEgressTraffic(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error) { +func (c *gatewayDPluginServiceClient) OnTrafficToServer(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error) { out := new(structpb.Struct) - err := c.cc.Invoke(ctx, "/plugin.v1.GatewayDPluginService/OnEgressTraffic", in, out, opts...) + err := c.cc.Invoke(ctx, "/plugin.v1.GatewayDPluginService/OnTrafficToServer", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *gatewayDPluginServiceClient) OnTrafficFromServer(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error) { + out := new(structpb.Struct) + err := c.cc.Invoke(ctx, "/plugin.v1.GatewayDPluginService/OnTrafficFromServer", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *gatewayDPluginServiceClient) OnTrafficToClient(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error) { + out := new(structpb.Struct) + err := c.cc.Invoke(ctx, "/plugin.v1.GatewayDPluginService/OnTrafficToClient", in, out, opts...) if err != nil { return nil, err } @@ -256,8 +276,10 @@ type GatewayDPluginServiceServer interface { OnClosing(context.Context, *structpb.Struct) (*structpb.Struct, error) OnClosed(context.Context, *structpb.Struct) (*structpb.Struct, error) OnTraffic(context.Context, *structpb.Struct) (*structpb.Struct, error) - OnIngressTraffic(context.Context, *structpb.Struct) (*structpb.Struct, error) - OnEgressTraffic(context.Context, *structpb.Struct) (*structpb.Struct, error) + OnTrafficFromClient(context.Context, *structpb.Struct) (*structpb.Struct, error) + OnTrafficToServer(context.Context, *structpb.Struct) (*structpb.Struct, error) + OnTrafficFromServer(context.Context, *structpb.Struct) (*structpb.Struct, error) + OnTrafficToClient(context.Context, *structpb.Struct) (*structpb.Struct, error) OnShutdown(context.Context, *structpb.Struct) (*structpb.Struct, error) OnTick(context.Context, *structpb.Struct) (*structpb.Struct, error) OnNewClient(context.Context, *structpb.Struct) (*structpb.Struct, error) @@ -313,11 +335,17 @@ func (UnimplementedGatewayDPluginServiceServer) OnClosed(context.Context, *struc func (UnimplementedGatewayDPluginServiceServer) OnTraffic(context.Context, *structpb.Struct) (*structpb.Struct, error) { return nil, status.Errorf(codes.Unimplemented, "method OnTraffic not implemented") } -func (UnimplementedGatewayDPluginServiceServer) OnIngressTraffic(context.Context, *structpb.Struct) (*structpb.Struct, error) { - return nil, status.Errorf(codes.Unimplemented, "method OnIngressTraffic not implemented") +func (UnimplementedGatewayDPluginServiceServer) OnTrafficFromClient(context.Context, *structpb.Struct) (*structpb.Struct, error) { + return nil, status.Errorf(codes.Unimplemented, "method OnTrafficFromClient not implemented") +} +func (UnimplementedGatewayDPluginServiceServer) OnTrafficToServer(context.Context, *structpb.Struct) (*structpb.Struct, error) { + return nil, status.Errorf(codes.Unimplemented, "method OnTrafficToServer not implemented") } -func (UnimplementedGatewayDPluginServiceServer) OnEgressTraffic(context.Context, *structpb.Struct) (*structpb.Struct, error) { - return nil, status.Errorf(codes.Unimplemented, "method OnEgressTraffic not implemented") +func (UnimplementedGatewayDPluginServiceServer) OnTrafficFromServer(context.Context, *structpb.Struct) (*structpb.Struct, error) { + return nil, status.Errorf(codes.Unimplemented, "method OnTrafficFromServer not implemented") +} +func (UnimplementedGatewayDPluginServiceServer) OnTrafficToClient(context.Context, *structpb.Struct) (*structpb.Struct, error) { + return nil, status.Errorf(codes.Unimplemented, "method OnTrafficToClient not implemented") } func (UnimplementedGatewayDPluginServiceServer) OnShutdown(context.Context, *structpb.Struct) (*structpb.Struct, error) { return nil, status.Errorf(codes.Unimplemented, "method OnShutdown not implemented") @@ -611,38 +639,74 @@ func _GatewayDPluginService_OnTraffic_Handler(srv interface{}, ctx context.Conte return interceptor(ctx, in, info, handler) } -func _GatewayDPluginService_OnIngressTraffic_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _GatewayDPluginService_OnTrafficFromClient_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(structpb.Struct) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GatewayDPluginServiceServer).OnTrafficFromClient(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/plugin.v1.GatewayDPluginService/OnTrafficFromClient", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GatewayDPluginServiceServer).OnTrafficFromClient(ctx, req.(*structpb.Struct)) + } + return interceptor(ctx, in, info, handler) +} + +func _GatewayDPluginService_OnTrafficToServer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(structpb.Struct) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GatewayDPluginServiceServer).OnTrafficToServer(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/plugin.v1.GatewayDPluginService/OnTrafficToServer", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GatewayDPluginServiceServer).OnTrafficToServer(ctx, req.(*structpb.Struct)) + } + return interceptor(ctx, in, info, handler) +} + +func _GatewayDPluginService_OnTrafficFromServer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(structpb.Struct) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(GatewayDPluginServiceServer).OnIngressTraffic(ctx, in) + return srv.(GatewayDPluginServiceServer).OnTrafficFromServer(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/plugin.v1.GatewayDPluginService/OnIngressTraffic", + FullMethod: "/plugin.v1.GatewayDPluginService/OnTrafficFromServer", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(GatewayDPluginServiceServer).OnIngressTraffic(ctx, req.(*structpb.Struct)) + return srv.(GatewayDPluginServiceServer).OnTrafficFromServer(ctx, req.(*structpb.Struct)) } return interceptor(ctx, in, info, handler) } -func _GatewayDPluginService_OnEgressTraffic_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _GatewayDPluginService_OnTrafficToClient_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(structpb.Struct) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(GatewayDPluginServiceServer).OnEgressTraffic(ctx, in) + return srv.(GatewayDPluginServiceServer).OnTrafficToClient(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/plugin.v1.GatewayDPluginService/OnEgressTraffic", + FullMethod: "/plugin.v1.GatewayDPluginService/OnTrafficToClient", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(GatewayDPluginServiceServer).OnEgressTraffic(ctx, req.(*structpb.Struct)) + return srv.(GatewayDPluginServiceServer).OnTrafficToClient(ctx, req.(*structpb.Struct)) } return interceptor(ctx, in, info, handler) } @@ -769,12 +833,20 @@ var GatewayDPluginService_ServiceDesc = grpc.ServiceDesc{ Handler: _GatewayDPluginService_OnTraffic_Handler, }, { - MethodName: "OnIngressTraffic", - Handler: _GatewayDPluginService_OnIngressTraffic_Handler, + MethodName: "OnTrafficFromClient", + Handler: _GatewayDPluginService_OnTrafficFromClient_Handler, + }, + { + MethodName: "OnTrafficToServer", + Handler: _GatewayDPluginService_OnTrafficToServer_Handler, + }, + { + MethodName: "OnTrafficFromServer", + Handler: _GatewayDPluginService_OnTrafficFromServer_Handler, }, { - MethodName: "OnEgressTraffic", - Handler: _GatewayDPluginService_OnEgressTraffic_Handler, + MethodName: "OnTrafficToClient", + Handler: _GatewayDPluginService_OnTrafficToClient_Handler, }, { MethodName: "OnShutdown",