From a04730db4bb231e84adc731d26cf0279f6a1b695 Mon Sep 17 00:00:00 2001 From: Javier Date: Tue, 13 Apr 2021 10:59:02 -0500 Subject: [PATCH] Feat/pbserver (#59) * Protobuf-based plugin RPC --- bridge/bridge.go | 220 +- bridge/bridge_test.go | 63 +- bridge/bridgetest/bridgetest.go | 107 + client/client.go | 87 +- client/client_test.go | 94 +- ctx/ctx.go | 43 +- ctx/ctx_test.go | 52 +- go.mod | 4 +- go.sum | 83 +- ip/ip.go | 20 +- ip/ip_test.go | 29 +- log/log.go | 75 +- log/log_test.go | 77 +- nginx/nginx.go | 46 +- nginx/nginx_test.go | 87 +- node/node.go | 51 +- node/node_test.go | 75 +- pdk.go | 30 +- request/request.go | 57 +- request/request_test.go | 200 +- response/response.go | 63 +- response/response_test.go | 96 +- router/router.go | 61 +- router/router_test.go | 57 +- server/event.go | 89 +- server/instance.go | 4 +- .../kong_plugin_protocol/pluginsocket.pb.go | 3815 +++++++++++++++++ server/os.go | 101 + server/pbserver.go | 212 + server/rpc.go | 18 +- server/server.go | 144 - service/request/request.go | 55 +- service/request/request_test.go | 105 +- service/response/response.go | 25 +- service/response/response_test.go | 70 +- service/service.go | 17 +- service/service_test.go | 30 +- 37 files changed, 5457 insertions(+), 1005 deletions(-) create mode 100644 bridge/bridgetest/bridgetest.go create mode 100644 server/kong_plugin_protocol/pluginsocket.pb.go create mode 100644 server/os.go create mode 100644 server/pbserver.go delete mode 100644 server/server.go diff --git a/bridge/bridge.go b/bridge/bridge.go index dfd54f7..b19ee3a 100644 --- a/bridge/bridge.go +++ b/bridge/bridge.go @@ -4,11 +4,19 @@ Used internally for the RPC protocol. package bridge import ( + "encoding/binary" "errors" + "io" + "log" + "net" + + "github.com/Kong/go-pdk/server/kong_plugin_protocol" + "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/types/known/structpb" ) type PdkBridge struct { - ch chan interface{} + conn net.Conn } type StepData struct { @@ -16,134 +24,154 @@ type StepData struct { Args []interface{} } -func New(ch chan interface{}) PdkBridge { - return PdkBridge{ch: ch} +func New(conn net.Conn) PdkBridge { + return PdkBridge{ + conn: conn, + } } -func (b PdkBridge) Ask(method string, args ...interface{}) (interface{}, error) { - b.ch <- StepData{method, args} +func readPbFrame(conn net.Conn) (data []byte, err error) { + var len uint32 + err = binary.Read(conn, binary.LittleEndian, &len) + if err != nil { + return + } - reply := <-b.ch + data = make([]byte, len) + if data == nil { + return nil, errors.New("no memory") + } - err, ok := reply.(error) - if ok { + _, err = io.ReadFull(conn, data) + if err != nil { return nil, err } - return reply, nil -} - -func (b PdkBridge) AskClose(method string, args ...interface{}) { - b.ch <- StepData{ method, args } - close(b.ch) + return } -func (b PdkBridge) AskInt(method string, args ...interface{}) (i int, err error) { - val, err := b.Ask(method, args...) +func writePbFrame(conn net.Conn, data []byte) (err error) { + var len uint32 = uint32(len(data)) + err = binary.Write(conn, binary.LittleEndian, len) if err != nil { return } - if val == nil { - err = errors.New("null response") - return - } - switch val := val.(type) { - case int: - i = int(val) - case int8: - i = int(val) - case int16: - i = int(val) - case int32: - i = int(val) - case int64: - i = int(val) - case uint: - i = int(val) - case uint8: - i = int(val) - case uint16: - i = int(val) - case uint32: - i = int(val) - case uint64: - i = int(val) - default: - err = ReturnTypeError("integer") + if len > 0 { + _, err = conn.Write(data) } + return } -func (b PdkBridge) AskFloat(method string, args ...interface{}) (f float64, err error) { - val, err := b.Ask(method, args...) - if err != nil { - return +func WrapString(s string) *kong_plugin_protocol.String { + return &kong_plugin_protocol.String{V: s} +} + +func WrapHeaders(h map[string][]string) (*structpb.Struct, error) { + h2 := make(map[string]interface{}, len(h)) + for k, v := range h { + l := make([]interface{}, len(v)) + for i, v2 := range v { + l[i] = v2 + } + h2[k] = l } - if val == nil { - err = errors.New("null response") - return + + st, err := structpb.NewStruct(h2) + if err != nil { + return nil, err } - switch val := val.(type) { - case int: - f = float64(val) - case int8: - f = float64(val) - case int16: - f = float64(val) - case int32: - f = float64(val) - case int64: - f = float64(val) - case uint: - f = float64(val) - case uint8: - f = float64(val) - case uint16: - f = float64(val) - case uint32: - f = float64(val) - case uint64: - f = float64(val) - case float32: - f = float64(val) - case float64: - f = float64(val) - default: - err = ReturnTypeError("float") + return st, nil +} + +func UnwrapHeaders(st *structpb.Struct) map[string][]string { + m := st.AsMap() + m2 := make(map[string][]string) + for k, v := range m { + switch v2 := v.(type) { + case string: + m2[k] = []string{v2} + case []string: + m2[k] = v2 + case []interface{}: + m2[k] = make([]string, len(v2)) + for i, v3 := range v2 { + if s, ok := v3.(string); ok { + m2[k][i] = s + } + } + default: + log.Printf("unexpected type %T on header %s:%v", v2, k, v2) + } } - return + + return m2 } -func (b PdkBridge) AskString(method string, args ...interface{}) (s string, err error) { - val, err := b.Ask(method, args...) +func (b PdkBridge) Ask(method string, args proto.Message, out proto.Message) error { + err := writePbFrame(b.conn, []byte(method)) if err != nil { - return + return err } - if val == nil { - err = errors.New("null response") - return + + var args_d []byte + + if args != nil { + args_d, err = proto.Marshal(args) + if err != nil { + return err + } } - var ok bool - if s, ok = val.(string); !ok { - err = ReturnTypeError("string") + err = writePbFrame(b.conn, args_d) + if err != nil { + return err } - return -} -func (b PdkBridge) AskMap(method string, args ...interface{}) (m map[string][]string, err error) { - val, err := b.Ask(method, args...) + out_d, err := readPbFrame(b.conn) if err != nil { - return + return err } - var ok bool - if m, ok = val.(map[string][]string); !ok { - err = ReturnTypeError("map[string][]string") + if out != nil { + err = proto.Unmarshal(out_d, out) } - return + + return err +} + +func (b PdkBridge) AskString(method string, args proto.Message) (string, error) { + out := new(kong_plugin_protocol.String) + err := b.Ask(method, args, out) + return out.V, err +} + +func (b PdkBridge) AskInt(method string, args proto.Message) (int, error) { + out := new(kong_plugin_protocol.Int) + err := b.Ask(method, args, out) + return int(out.V), err +} + +func (b PdkBridge) AskNumber(method string, args proto.Message) (float64, error) { + out := new(kong_plugin_protocol.Number) + err := b.Ask(method, args, out) + return out.V, err +} + +func (b PdkBridge) AskValue(method string, args proto.Message) (interface{}, error) { + out := new(structpb.Value) + err := b.Ask(method, args, out) + if err != nil { + return nil, err + } + + return out.AsInterface(), nil +} + +func (b PdkBridge) Close() error { + return b.conn.Close() } func ReturnTypeError(expected string) error { diff --git a/bridge/bridge_test.go b/bridge/bridge_test.go index ff04b88..45a2a72 100644 --- a/bridge/bridge_test.go +++ b/bridge/bridge_test.go @@ -3,43 +3,38 @@ package bridge import ( "testing" - "github.com/Kong/go-pdk/entities" - "github.com/stretchr/testify/assert" + "github.com/Kong/go-pdk/bridge/bridgetest" + "github.com/Kong/go-pdk/server/kong_plugin_protocol" ) -var ch chan interface{} -var bridge PdkBridge -func init() { - ch = make(chan interface{}) - bridge = New(ch) +func TestAsk(t *testing.T) { + b := New(bridgetest.Mock(t, []bridgetest.MockStep{ + {"foo.bar", WrapString("first"), WrapString("resp")}, + })) + + + out := new(kong_plugin_protocol.String) + err := b.Ask("foo.bar", WrapString("first"), out) + if err != nil { + t.Fatalf("got this: %s", err) + } + if out.V != "resp" { + t.Fatalf("no 'resp': %v", out.V) + } + b.Close() } -func TestAsk(t *testing.T) { - go func() { - bridge.Ask("foo.bar", 1, 2, 3, 1.23, false) - }() - - call := <-ch - ch <- "" - - assert.Equal(t, call, StepData{ - Method: "foo.bar", - Args: []interface{}{1, 2, 3, 1.23, false}, - }) - - go func() { - n := "gs" - bridge.Ask("foo.bar", entities.Consumer{Username: n}) - }() - - call = <-ch - ch <- "" - - n := "gs" - consumer := []interface{}{entities.Consumer{Username: n}} - assert.Equal(t, StepData{ - Method: "foo.bar", - Args: consumer, - }, call) +func TestAskString(t *testing.T) { + b := New(bridgetest.Mock(t, []bridgetest.MockStep{ + {"foo.bar", WrapString("first"), WrapString("resp")}, + })) + + ret, err := b.AskString("foo.bar", WrapString("first")) + if err != nil { + t.Fatalf("got this: %s", err) + } + if ret != "resp" { + t.Fatalf("no 'resp': %v", ret) + } } diff --git a/bridge/bridgetest/bridgetest.go b/bridge/bridgetest/bridgetest.go new file mode 100644 index 0000000..b428676 --- /dev/null +++ b/bridge/bridgetest/bridgetest.go @@ -0,0 +1,107 @@ +package bridgetest + +import ( + "bytes" + "encoding/binary" + "errors" + "io" + "net" + "testing" + + "github.com/golang/protobuf/proto" +) + +type MockStep struct { + Method string + Args proto.Message + Ret proto.Message +} + +func readPbFrame(conn net.Conn) (data []byte, err error) { + var len uint32 + err = binary.Read(conn, binary.LittleEndian, &len) + if err != nil { + return + } + + data = make([]byte, len) + if data == nil { + return nil, errors.New("no memory") + } + + _, err = io.ReadFull(conn, data) + if err != nil { + return nil, err + } + + return +} + +func writePbFrame(conn net.Conn, data []byte) (err error) { + var len uint32 = uint32(len(data)) + err = binary.Write(conn, binary.LittleEndian, len) + if err != nil { + return + } + + if len > 0 { + _, err = conn.Write(data) + } + + return +} + +func Mock(t *testing.T, s []MockStep) net.Conn { + conA, conB := net.Pipe() + + go func() { + for i, stp := range s { + d, err := readPbFrame(conB) + if err != nil { + t.Errorf("step %d readPbFrame(method): %s", i, err) + break + } + if !bytes.Equal([]byte(stp.Method), d) { + t.Errorf("step %d, expected method %v, found %v", i, []byte(stp.Method), d) + break + } + + d, err = readPbFrame(conB) + if err != nil { + t.Errorf("step %d, readPbFrame(args): %s", i, err) + break + } + + if stp.Args != nil { + args_d, err := proto.Marshal(stp.Args) + if err != nil { + t.Errorf("step %d, Marshal(args): %s", i, err) + break + } + + if !bytes.Equal(args_d, d) { + t.Errorf("step %d, expected %v(%v), received %v", i, stp.Args, args_d, d) + break + } + } + + if stp.Ret != nil { + ret_enc, err := proto.Marshal(stp.Ret) + if err != nil { + t.Errorf("step %d, Marshal(ret): %s", i, err) + break + } + + err = writePbFrame(conB, ret_enc) + if err != nil { + t.Errorf("step %d, writePbFrame(ret): %s", i, err) + break + } + } else { + writePbFrame(conB, []byte{}) + } + } + conB.Close() + }() + return conA +} diff --git a/client/client.go b/client/client.go index 1845bc3..a19ccca 100644 --- a/client/client.go +++ b/client/client.go @@ -7,7 +7,7 @@ connecting to Kong in the context of a given request. package client import ( - "fmt" + "github.com/Kong/go-pdk/server/kong_plugin_protocol" "github.com/Kong/go-pdk/bridge" "github.com/Kong/go-pdk/entities" @@ -18,35 +18,17 @@ type Client struct { bridge.PdkBridge } -func checkConsumer(v interface{}) (consumer entities.Consumer, err error) { - consumer, ok := v.(entities.Consumer) - if !ok { - err = bridge.ReturnTypeError("Consumer Entity") - } - return -} - type AuthenticatedCredential struct { Id string `json:"id"` ConsumerId string `json:"consumer_id"` } -// Called by the plugin server at initialization. -func New(ch chan interface{}) Client { - return Client{bridge.New(ch)} -} - // kong.Client.GetIp() returns the remote address of the client making the request. // This will always return the address of the client directly connecting to Kong. // That is, in cases when a load balancer is in front of Kong, this function will // return the load balancer’s address, and not that of the downstream client. func (c Client) GetIp() (ip string, err error) { - ip_v, err := c.Ask(`kong.client.get_ip`) - var ok bool - if ip, ok = ip_v.(string); !ok { - err = bridge.ReturnTypeError("string") - } - return + return c.AskString(`kong.client.get_ip`, nil) } // kong.Client.GetForwardedIp() returns the remote address of the client making the request. @@ -58,7 +40,7 @@ func (c Client) GetIp() (ip string, err error) { // - real_ip_header // - real_ip_recursive func (c Client) GetForwardedIp() (string, error) { - return c.AskString(`kong.client.get_forwarded_ip`) + return c.AskString(`kong.client.get_forwarded_ip`, nil) } // kong.Client.GetPort() returns the remote port of the client making the request. @@ -66,7 +48,7 @@ func (c Client) GetForwardedIp() (string, error) { // That is, in cases when a load balancer is in front of Kong, this function // will return load balancer’s port, and not that of the downstream client. func (c Client) GetPort() (int, error) { - return c.AskInt(`kong.client.get_port`) + return c.AskInt(`kong.client.get_port`, nil) } // kong.Client.GetForwardedPort() returns the remote port of the client making the request. @@ -78,22 +60,21 @@ func (c Client) GetPort() (int, error) { // - real_ip_header // - real_ip_recursive func (c Client) GetForwardedPort() (int, error) { - return c.AskInt(`kong.client.get_forwarded_port`) + return c.AskInt(`kong.client.get_forwarded_port`, nil) } // kong.Client.GetCredential() returns the credentials of the currently authenticated consumer. // If not set yet, it returns nil. func (c Client) GetCredential() (cred AuthenticatedCredential, err error) { - var val interface{} - val, err = c.Ask(`kong.client.get_credential`) + out := new(kong_plugin_protocol.AuthenticatedCredential) + err = c.Ask(`kong.client.get_credential`, nil, out) if err != nil { return } - var ok bool - fmt.Println(val) - if cred, ok = val.(AuthenticatedCredential); !ok { - err = bridge.ReturnTypeError("AuthenticatedCredential") + cred = AuthenticatedCredential{ + Id: out.Id, + ConsumerId: out.ConsumerId, } return } @@ -101,32 +82,63 @@ func (c Client) GetCredential() (cred AuthenticatedCredential, err error) { // kong.Client.LoadConsumer() returns the consumer from the datastore (or cache). // Will look up the consumer by id, and optionally will do a second search by name. func (c Client) LoadConsumer(consumer_id string, by_username bool) (consumer entities.Consumer, err error) { - var reply interface{} - reply, err = c.Ask(`kong.client.load_consumer`, consumer_id, by_username) + arg := &kong_plugin_protocol.ConsumerSpec{ + Id: consumer_id, + ByUsername: by_username, + } + out := new(kong_plugin_protocol.Consumer) + err = c.Ask(`kong.client.load_consumer`, arg, out) if err != nil { return } - return checkConsumer(reply) + consumer = entities.Consumer{ + Id: out.Id, + CreatedAt: int(out.CreatedAt), + Username: out.Username, + CustomId: out.CustomId, + Tags: out.Tags, + } + return } // kong.Client.GetConsumer() returns the consumer entity of the currently authenticated consumer. // If not set yet, it returns nil. func (c Client) GetConsumer() (consumer entities.Consumer, err error) { - var reply interface{} - reply, err = c.Ask(`kong.client.get_consumer`) + out := new(kong_plugin_protocol.Consumer) + err = c.Ask(`kong.client.get_consumer`, nil, out) if err != nil { return } - return checkConsumer(reply) + consumer = entities.Consumer{ + Id: out.Id, + CreatedAt: int(out.CreatedAt), + Username: out.Username, + CustomId: out.CustomId, + Tags: out.Tags, + } + return } // kong.Client.Authenticate() sets the authenticated consumer and/or credential // for the current request. While both consumer and credential can be nil, // it is required that at least one of them exists. Otherwise this function will throw an error. func (c Client) Authenticate(consumer *entities.Consumer, credential *AuthenticatedCredential) error { - _, err := c.Ask(`kong.client.authenticate`, consumer, credential) + arg := &kong_plugin_protocol.AuthenticateArgs{ + Consumer: &kong_plugin_protocol.Consumer{ + Id: consumer.Id, + CreatedAt: int64(consumer.CreatedAt), + Username: consumer.Username, + CustomId: consumer.CustomId, + Tags: consumer.Tags, + }, + Credential: &kong_plugin_protocol.AuthenticatedCredential{ + Id: credential.Id, + ConsumerId: credential.ConsumerId, + }, + } + err := c.Ask(`kong.client.authenticate`, arg, nil) return err } @@ -134,5 +146,6 @@ func (c Client) Authenticate(consumer *entities.Consumer, credential *Authentica // ("http", "https", "tcp" or "tls"), or nil, if no route has been matched, // which can happen when dealing with erroneous requests. func (c Client) GetProtocol(allow_terminated bool) (string, error) { - return c.AskString(`kong.client.get_protocol`, allow_terminated) + arg := &kong_plugin_protocol.Bool{V: allow_terminated} + return c.AskString(`kong.client.get_protocol`, arg) } diff --git a/client/client_test.go b/client/client_test.go index a3d5754..d7dc0c8 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -4,74 +4,79 @@ import ( "testing" "github.com/Kong/go-pdk/bridge" + "github.com/Kong/go-pdk/bridge/bridgetest" "github.com/Kong/go-pdk/entities" + "github.com/Kong/go-pdk/server/kong_plugin_protocol" "github.com/stretchr/testify/assert" ) -var client Client -var ch chan interface{} - -func init() { - ch = make(chan interface{}) - client = New(ch) -} - -func getBack(f func()) interface{} { - go f() - d := <-ch - ch <- nil - - return d -} - -func getStrValue(f func(res chan string), val string) string { - res := make(chan string) - go f(res) - _ = <-ch - ch <- val - return <-res -} - -func getIntValue(f func(res chan int), val int) int { - res := make(chan int) - go f(res) - _ = <-ch - ch <- val - return <-res +func mockClient(t *testing.T, s []bridgetest.MockStep) Client { + return Client{bridge.New(bridgetest.Mock(t, s))} } func TestGetIp(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.client.get_ip"}, getBack(func() { client.GetIp() })) - assert.Equal(t, "foo", getStrValue(func(res chan string) { r, _ := client.GetIp(); res <- r }, "foo")) - assert.Equal(t, "", getStrValue(func(res chan string) { r, _ := client.GetIp(); res <- r }, "")) + c := mockClient(t, []bridgetest.MockStep{ + {"kong.client.get_ip", nil, bridge.WrapString("10.10.10.1")}, + }) + + resp, err := c.GetIp() + assert.NoError(t, err) + assert.Equal(t, resp, "10.10.10.1") } func TestGetForwardedIp(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.client.get_forwarded_ip"}, getBack(func() { client.GetForwardedIp() })) - assert.Equal(t, "foo", getStrValue(func(res chan string) { r, _ := client.GetForwardedIp(); res <- r }, "foo")) - assert.Equal(t, "", getStrValue(func(res chan string) { r, _ := client.GetForwardedIp(); res <- r }, "")) + c := mockClient(t, []bridgetest.MockStep{ + {"kong.client.get_forwarded_ip", nil, bridge.WrapString("10.10.10.1")}, + }) + + resp, err := c.GetForwardedIp() + assert.NoError(t, err) + assert.Equal(t, resp, "10.10.10.1") } func TestGetPort(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.client.get_port"}, getBack(func() { client.GetPort() })) - assert.Equal(t, 42, getIntValue(func(res chan int) { r, _ := client.GetPort(); res <- r }, 42)) - assert.Equal(t, 0, getIntValue(func(res chan int) { r, _ := client.GetPort(); res <- r }, 0)) + c := mockClient(t, []bridgetest.MockStep{ + {"kong.client.get_port", nil, &kong_plugin_protocol.Int{V: 443}}, + }) + resp, err := c.GetPort() + assert.NoError(t, err) + assert.Equal(t, 443, resp) } func TestGetForwardedPort(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.client.get_forwarded_port"}, getBack(func() { client.GetForwardedPort() })) - assert.Equal(t, 42, getIntValue(func(res chan int) { r, _ := client.GetForwardedPort(); res <- r }, 42)) - assert.Equal(t, 0, getIntValue(func(res chan int) { r, _ := client.GetForwardedPort(); res <- r }, 0)) + c := mockClient(t, []bridgetest.MockStep{ + {"kong.client.get_forwarded_port", nil, &kong_plugin_protocol.Int{V: 80}}, + }) + resp, err := c.GetForwardedPort() + assert.NoError(t, err) + assert.Equal(t, 80, resp) } func TestGetCredential(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.client.get_credential"}, getBack(func() { client.GetCredential() })) + c := mockClient(t, []bridgetest.MockStep{ + {"kong.client.get_credential", nil, + &kong_plugin_protocol.AuthenticatedCredential{Id: "000:00", ConsumerId: "000:01"}, + }, + }) + + resp, err := c.GetCredential() + assert.NoError(t, err) + assert.Equal(t, AuthenticatedCredential{Id: "000:00", ConsumerId: "000:01"}, resp) } func TestLoadConsumer(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.client.load_consumer", Args: []interface{}{"foo", true}}, getBack(func() { client.LoadConsumer("foo", true) })) + c := mockClient(t, []bridgetest.MockStep{ + {"kong.client.load_consumer", + &kong_plugin_protocol.ConsumerSpec{Id: "001", ByUsername: false}, + &kong_plugin_protocol.Consumer{Id: "001", Username: "Jon Doe"}, + }, + }) + resp, err := c.LoadConsumer("001", false) + assert.NoError(t, err) + assert.Equal(t, entities.Consumer{Id: "001", Username: "Jon Doe"}, resp) } +/* func TestGetConsumer(t *testing.T) { assert.Equal(t, bridge.StepData{Method: "kong.client.get_consumer"}, getBack(func() { client.GetConsumer() })) } @@ -86,3 +91,4 @@ func TestGetProtocol(t *testing.T) { assert.Equal(t, bridge.StepData{Method: "kong.client.get_protocol", Args: []interface{}{true}}, getBack(func() { client.GetProtocol(true) })) assert.Equal(t, bridge.StepData{Method: "kong.client.get_protocol", Args: []interface{}{false}}, getBack(func() { client.GetProtocol(false) })) } +*/ diff --git a/ctx/ctx.go b/ctx/ctx.go index ed6902f..61ba133 100644 --- a/ctx/ctx.go +++ b/ctx/ctx.go @@ -32,6 +32,8 @@ package ctx import ( "github.com/Kong/go-pdk/bridge" + "github.com/Kong/go-pdk/server/kong_plugin_protocol" + "google.golang.org/protobuf/types/known/structpb" ) // Holds this module's functions. Accessible as `kong.Ctx` @@ -39,34 +41,49 @@ type Ctx struct { bridge.PdkBridge } -// Called by the plugin server at initialization. -func New(ch chan interface{}) Ctx { - return Ctx{bridge.New(ch)} -} - // kong.Ctx.SetShared() sets a value in the `kong.ctx.shared` request context table. func (c Ctx) SetShared(k string, value interface{}) error { - _, err := c.Ask(`kong.ctx.shared.set`, k, value) + v, err := structpb.NewValue(value) + if err != nil { + return err + } + + return c.Ask(`kong.ctx.shared.set`, &kong_plugin_protocol.KV{K: k, V: v}, nil) return err } // kong.Ctx.GetSharedAny() returns a value from the `kong.ctx.shared` request context table. func (c Ctx) GetSharedAny(k string) (interface{}, error) { - return c.Ask(`kong.ctx.shared.get`, k) + return c.AskValue(`kong.ctx.shared.get`, bridge.WrapString(k)) } // kong.Ctx.GetSharedString() returns a string value from the `kong.ctx.shared` request context table. func (c Ctx) GetSharedString(k string) (string, error) { - return c.AskString(`kong.ctx.shared.get`, k) + v, err := c.GetSharedAny(k) + if err != nil { + return "", err + } + + s, ok := v.(string) + if ok { + return s, nil + } + + return "", bridge.ReturnTypeError("string") } // kong.Ctx.GetSharedFloat() returns a float value from the `kong.ctx.shared` request context table. func (c Ctx) GetSharedFloat(k string) (float64, error) { - return c.AskFloat(`kong.ctx.shared.get`, k) -} + v, err := c.GetSharedAny(k) + if err != nil { + return 0, err + } + + f, ok := v.(float64) + if ok { + return f, nil + } -// kong.Ctx.GetSharedInt() returns an integer value from the `kong.ctx.shared` request context table. -func (c Ctx) GetSharedInt(k string) (int, error) { - return c.AskInt(`kong.ctx.shared.get`, k) + return 0, bridge.ReturnTypeError("number") } diff --git a/ctx/ctx_test.go b/ctx/ctx_test.go index e8bbb4e..0122b00 100644 --- a/ctx/ctx_test.go +++ b/ctx/ctx_test.go @@ -4,37 +4,53 @@ import ( "testing" "github.com/Kong/go-pdk/bridge" + "github.com/Kong/go-pdk/bridge/bridgetest" + "github.com/Kong/go-pdk/server/kong_plugin_protocol" "github.com/stretchr/testify/assert" + "google.golang.org/protobuf/types/known/structpb" ) -var ctx Ctx -var ch chan interface{} - -func init() { - ch = make(chan interface{}) - ctx = New(ch) -} - -func getBack(f func()) interface{} { - go f() - d := <-ch - ch <- nil - - return d +func mockCtx(t *testing.T, s []bridgetest.MockStep) Ctx { + return Ctx{bridge.New(bridgetest.Mock(t, s))} } func TestSetShared(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.ctx.shared.set", Args: []interface{}{"key", "value"}}, getBack(func() { ctx.SetShared("key", "value") })) + ctx := mockCtx(t, []bridgetest.MockStep{ + {"kong.ctx.shared.set", &kong_plugin_protocol.KV{K: "key", V: structpb.NewStringValue("value")}, nil}, + }) + + assert.NoError(t, ctx.SetShared("key", "value")) } func TestGetSharedAny(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.ctx.shared.get", Args: []interface{}{"key"}}, getBack(func() { ctx.GetSharedAny("key") })) + v, err := structpb.NewValue(67) + assert.NoError(t, err) + + ctx := mockCtx(t, []bridgetest.MockStep{ + {"kong.ctx.shared.get", bridge.WrapString("key"), v}, + }) + + val, err := ctx.GetSharedAny("key") + assert.NoError(t, err) + assert.Equal(t, 67.0, val) } func TestGetSharedString(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.ctx.shared.get", Args: []interface{}{"key"}}, getBack(func() { ctx.GetSharedString("key") })) + ctx := mockCtx(t, []bridgetest.MockStep{ + {"kong.ctx.shared.get", bridge.WrapString("key"), structpb.NewStringValue("value")}, + }) + + val, err := ctx.GetSharedString("key") + assert.NoError(t, err) + assert.Equal(t, "value", val) } func TestGetSharedFloat(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.ctx.shared.get", Args: []interface{}{"key"}}, getBack(func() { ctx.GetSharedFloat("key") })) + ctx := mockCtx(t, []bridgetest.MockStep{ + {"kong.ctx.shared.get", bridge.WrapString("key"), structpb.NewNumberValue(2.74)}, + }) + + val, err := ctx.GetSharedFloat("key") + assert.NoError(t, err) + assert.Equal(t, 2.74, val) } diff --git a/go.mod b/go.mod index 550be4e..9956561 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,8 @@ module github.com/Kong/go-pdk go 1.13 require ( - github.com/stretchr/testify v1.4.0 + github.com/golang/protobuf v1.4.3 + github.com/stretchr/testify v1.5.1 github.com/ugorji/go/codec v1.2.1 + google.golang.org/protobuf v1.25.0 ) diff --git a/go.sum b/go.sum index d77e028..b362230 100644 --- a/go.sum +++ b/go.sum @@ -1,15 +1,94 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/ugorji/go v1.2.1 h1:dz+JxTe7GZQdErTo7SREc1jQj/hFP1k7jyIAwODoW+k= github.com/ugorji/go v1.2.1/go.mod h1:cSVypSfTLm2o9fKxXvQgn3rMmkPXovcWor6Qn5tbFmI= github.com/ugorji/go/codec v1.2.1 h1:/TRfW3XKkvWvmAYyCUaQlhoCDGjcvNR8xVVA/l5p/jQ= github.com/ugorji/go/codec v1.2.1/go.mod h1:s/WxCRi46t8rA+fowL40EnmD7ec0XhR7ZypxeBNdzsM= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.36.0 h1:o1bcQ6imQMIOpdrO3SWf2z5RV72WbDwdXuK0MDlc8As= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/ip/ip.go b/ip/ip.go index 94f736f..119ce05 100644 --- a/ip/ip.go +++ b/ip/ip.go @@ -14,7 +14,7 @@ package ip import ( "github.com/Kong/go-pdk/bridge" - // "strconv" + "github.com/Kong/go-pdk/server/kong_plugin_protocol" ) // Holds this module's functions. Accessible as `kong.Ip` @@ -22,23 +22,15 @@ type Ip struct { bridge.PdkBridge } -// called by the pluginserver at initialization. -func New(ch chan interface{}) Ip { - return Ip{bridge.New(ch)} -} - // Depending on the trusted_ips configuration property, this function // will return whether a given ip is trusted or not. // Both ipv4 and ipv6 are supported. -func (ip Ip) IsTrusted(address string) (is_trusted bool, err error) { - reply, err := ip.Ask(`kong.ip.is_trusted`, address) +func (ip Ip) IsTrusted(address string) (bool, error) { + out := new(kong_plugin_protocol.Bool) + err := ip.Ask(`kong.ip.is_trusted`, bridge.WrapString(address), out) if err != nil { - return + return false, err } - var ok bool - if is_trusted, ok = reply.(bool); !ok { - err = bridge.ReturnTypeError("boolean") - } - return + return out.V, nil } diff --git a/ip/ip_test.go b/ip/ip_test.go index 59cc171..0c6e50f 100644 --- a/ip/ip_test.go +++ b/ip/ip_test.go @@ -4,26 +4,23 @@ import ( "testing" "github.com/Kong/go-pdk/bridge" + "github.com/Kong/go-pdk/bridge/bridgetest" + "github.com/Kong/go-pdk/server/kong_plugin_protocol" "github.com/stretchr/testify/assert" ) -var ip Ip -var ch chan interface{} - -func init() { - ch = make(chan interface{}) - ip = New(ch) -} +func TestIsTrusted(t *testing.T) { + ip := Ip{bridge.New(bridgetest.Mock(t, []bridgetest.MockStep{ + {"kong.ip.is_trusted", bridge.WrapString("1.1.1.1"), &kong_plugin_protocol.Bool{V: true}}, + {"kong.ip.is_trusted", bridge.WrapString("1.0.0.1"), &kong_plugin_protocol.Bool{V: false}}, + }))} -func getBack(f func()) interface{} { - go f() - d := <-ch - ch <- nil + ret, err := ip.IsTrusted("1.1.1.1") + assert.NoError(t, err) + assert.True(t, ret) - return d + ret, err = ip.IsTrusted("1.0.0.1") + assert.NoError(t, err) + assert.False(t, ret) } -func TestIsTrusted(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.ip.is_trusted", Args: []interface{}{"1.1.1.1"}}, getBack(func() { ip.IsTrusted("1.1.1.1") })) - assert.Equal(t, bridge.StepData{Method: "kong.ip.is_trusted", Args: []interface{}{"1.0.0.1"}}, getBack(func() { ip.IsTrusted("1.0.0.1") })) -} diff --git a/log/log.go b/log/log.go index 387aee1..2c412de 100644 --- a/log/log.go +++ b/log/log.go @@ -5,6 +5,7 @@ package log import ( "github.com/Kong/go-pdk/bridge" + "google.golang.org/protobuf/types/known/structpb" ) // Holds this module's functions. Accessible as `kong.Log` @@ -12,68 +13,64 @@ type Log struct { bridge.PdkBridge } -// Called by the plugin server at initialization. -func New(ch chan interface{}) Log { - return Log{bridge.New(ch)} +func (r Log) doLog(method string, args []interface{}) error { + l, err := structpb.NewList(args) + if err != nil { + return err + } + + return r.Ask(method, l, nil) } func (r Log) Alert(args ...interface{}) error { - _, err := r.Ask(`kong.log.alert`, args...) - return err + return r.doLog(`kong.log.alert`, args) } func (r Log) Crit(args ...interface{}) error { - _, err := r.Ask(`kong.log.crit`, args...) - return err + return r.doLog(`kong.log.crit`, args) } func (r Log) Err(args ...interface{}) error { - _, err := r.Ask(`kong.log.err`, args...) - return err + return r.doLog(`kong.log.err`, args) } func (r Log) Warn(args ...interface{}) error { - _, err := r.Ask(`kong.log.warn`, args...) - return err + return r.doLog(`kong.log.warn`, args) } func (r Log) Notice(args ...interface{}) error { - _, err := r.Ask(`kong.log.notice`, args...) - return err + return r.doLog(`kong.log.notice`, args) } func (r Log) Info(args ...interface{}) error { - _, err := r.Ask(`kong.log.info`, args...) - return err + return r.doLog(`kong.log.info`, args) } func (r Log) Debug(args ...interface{}) error { - _, err := r.Ask(`kong.log.debug`, args...) - return err -} - -var ( - modeSet = map[string]string{ "mode": "set" } - modeAdd = map[string]string{ "mode": "add" } - modeReplace = map[string]string{ "mode": "replace" } -) - -func (r Log) SetSerializeValue(key string, v interface{}) error { - _, err := r.Ask(`kong.log.set_serialize_value`, key, v, modeSet) - return err -} - -func (r Log) SetSerializeValueAdd(key string, v interface{}) error { - _, err := r.Ask(`kong.log.set_serialize_value`, key, v, modeAdd) - return err -} - -func (r Log) SetSerializeValueReplace(key string, v interface{}) error { - _, err := r.Ask(`kong.log.set_serialize_value`, key, v, modeReplace) - return err + return r.doLog(`kong.log.debug`, args) } +// var ( +// modeSet = map[string]string{ "mode": "set" } +// modeAdd = map[string]string{ "mode": "add" } +// modeReplace = map[string]string{ "mode": "replace" } +// ) +// +// func (r Log) SetSerializeValue(key string, v interface{}) error { +// _, err := r.Ask(`kong.log.set_serialize_value`, key, v, modeSet) +// return err +// } +// +// func (r Log) SetSerializeValueAdd(key string, v interface{}) error { +// _, err := r.Ask(`kong.log.set_serialize_value`, key, v, modeAdd) +// return err +// } +// +// func (r Log) SetSerializeValueReplace(key string, v interface{}) error { +// _, err := r.Ask(`kong.log.set_serialize_value`, key, v, modeReplace) +// return err +// } func (r Log) Serialize() (s string, err error) { - return r.AskString(`kong.log.serialize`) + return r.AskString(`kong.log.serialize`, nil) } diff --git a/log/log_test.go b/log/log_test.go index 93882c2..c444be3 100644 --- a/log/log_test.go +++ b/log/log_test.go @@ -4,61 +4,44 @@ import ( "testing" "github.com/Kong/go-pdk/bridge" + "github.com/Kong/go-pdk/bridge/bridgetest" "github.com/stretchr/testify/assert" + "google.golang.org/protobuf/types/known/structpb" ) -var log Log -var ch chan interface{} - -func init() { - ch = make(chan interface{}) - log = New(ch) +func mockLog(t *testing.T, s []bridgetest.MockStep) Log { + return Log{bridge.New(bridgetest.Mock(t, s))} } -func getBack(f func()) interface{} { - go f() - d := <-ch - ch <- nil +func TestMessages(t *testing.T) { + v, err := structpb.NewList([]interface{}{"Alo"}) + assert.NoError(t, err) - return d -} + log := mockLog(t, []bridgetest.MockStep{ + {"kong.log.alert", v, nil}, + {"kong.log.crit", v, nil}, + {"kong.log.err", v, nil}, + {"kong.log.warn", v, nil}, + {"kong.log.notice", v, nil}, + {"kong.log.info", v, nil}, + {"kong.log.debug", v, nil}, + }) -func getStrValue(f func(res chan string), val string) string { - res := make(chan string) - go f(res) - _ = <-ch - ch <- val - return <-res -} - -func TestAlert(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.log.alert", Args: []interface{}{"Alo"}}, getBack(func() { log.Alert("Alo") })) -} - -func TestCrit(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.log.crit", Args: []interface{}{"Alo"}}, getBack(func() { log.Crit("Alo") })) -} - -func TestErr(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.log.err", Args: []interface{}{"Alo"}}, getBack(func() { log.Err("Alo") })) -} - -func TestWarn(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.log.warn", Args: []interface{}{"Alo"}}, getBack(func() { log.Warn("Alo") })) -} - -func TestNotice(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.log.notice", Args: []interface{}{"Alo"}}, getBack(func() { log.Notice("Alo") })) -} - -func TestInfo(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.log.info", Args: []interface{}{"Alo"}}, getBack(func() { log.Info("Alo") })) -} - -func TestDebug(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.log.debug", Args: []interface{}{"Alo"}}, getBack(func() { log.Debug("Alo") })) + assert.NoError(t, log.Alert("Alo")) + assert.NoError(t, log.Crit("Alo")) + assert.NoError(t, log.Err("Alo")) + assert.NoError(t, log.Warn("Alo")) + assert.NoError(t, log.Notice("Alo")) + assert.NoError(t, log.Info("Alo")) + assert.NoError(t, log.Debug("Alo")) } func TestSerialize(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.log.serialize"}, getBack(func() { log.Serialize() })) + log := mockLog(t, []bridgetest.MockStep{ + {"kong.log.serialize", nil, bridge.WrapString("{data...}")}, + }) + + ret, err := log.Serialize() + assert.NoError(t, err) + assert.Equal(t, "{data...}", ret) } diff --git a/nginx/nginx.go b/nginx/nginx.go index 61e63cd..ccd3fa5 100644 --- a/nginx/nginx.go +++ b/nginx/nginx.go @@ -5,6 +5,8 @@ package nginx import ( "github.com/Kong/go-pdk/bridge" + "github.com/Kong/go-pdk/server/kong_plugin_protocol" + "google.golang.org/protobuf/types/known/structpb" ) // Holds this module's functions. Accessible as `kong.Nginx` @@ -12,54 +14,68 @@ type Nginx struct { bridge.PdkBridge } -// Called by the plugin server at initialization. -func New(ch chan interface{}) Nginx { - return Nginx{bridge.New(ch)} -} - // kong.Nginx.GetVar() returns an Nginx variable. Equivalent to `ngx.var[k]` func (n Nginx) GetVar(k string) (string, error) { - return n.AskString(`kong.nginx.get_var`, k) + return n.AskString(`kong.nginx.get_var`, bridge.WrapString(k)) } func (n Nginx) GetTLS1VersionStr() (string, error) { - return n.AskString(`kong.nginx.get_tls1_version_str`) + return n.AskString(`kong.nginx.get_tls1_version_str`, nil) } // kong.Nginx.SetCtx() sets a value in the `ngx.ctx` request context table. func (n Nginx) SetCtx(k string, v interface{}) error { - _, err := n.Ask(`kong.nginx.set_ctx`, k, v) - return err + v2, err := structpb.NewValue(v) + if err != nil { + return err + } + arg := kong_plugin_protocol.KV{ + K: k, + V: v2, + } + return n.Ask(`kong.nginx.set_ctx`, &arg, nil) } // kong.Nginx.GetCtxAny() returns a value from the `ngx.ctx` request context table. func (n Nginx) GetCtxAny(k string) (interface{}, error) { - return n.Ask(`kong.nginx.get_ctx`, k) + return n.AskValue(`kong.nginx.get_ctx`, bridge.WrapString(k)) } // kong.Nginx.GetCtxString() returns a string value from the `ngx.ctx` request context table. func (n Nginx) GetCtxString(k string) (string, error) { - return n.AskString(`kong.nginx.get_ctx`, k) + out := new(structpb.Value) + if err := n.Ask(`kong.nginx.get_ctx`, bridge.WrapString(k), out); err != nil { + return "", err + } + return out.GetStringValue(), nil } // kong.Nginx.GetCtxFloat() returns a float value from the `ngx.ctx` request context table. func (n Nginx) GetCtxFloat(k string) (float64, error) { - return n.AskFloat(`kong.nginx.get_ctx`, k) + out := new(structpb.Value) + if err := n.Ask(`kong.nginx.get_ctx`, bridge.WrapString(k), out); err != nil { + return 0, err + } + return out.GetNumberValue(), nil } // kong.Nginx.GetCtxInt() returns an integer value from the `ngx.ctx` request context table. func (n Nginx) GetCtxInt(k string) (int, error) { - return n.AskInt(`kong.nginx.get_ctx`, k) + out := new(structpb.Value) + if err := n.Ask(`kong.nginx.get_ctx`, bridge.WrapString(k), out); err != nil { + return 0, err + } + return int(out.GetNumberValue()), nil } // kong.Nginx.ReqStartTime() returns the curent request's start time // as a floating-point number of seconds. Equivalent to `ngx.req.start_time()` func (n Nginx) ReqStartTime() (float64, error) { - return n.AskFloat(`kong.nginx.req_start_time`) + return n.AskNumber(`kong.nginx.req_start_time`, nil) } // kong.Nginx.GetSubsystem() returns the current Nginx subsystem // this function is called from: “http” or “stream”. func (n Nginx) GetSubsystem() (string, error) { - return n.AskString(`kong.nginx.get_subsystem`) + return n.AskString(`kong.nginx.get_subsystem`, nil) } diff --git a/nginx/nginx_test.go b/nginx/nginx_test.go index f5f6294..ad84bbf 100644 --- a/nginx/nginx_test.go +++ b/nginx/nginx_test.go @@ -4,49 +4,80 @@ import ( "testing" "github.com/Kong/go-pdk/bridge" + "github.com/Kong/go-pdk/bridge/bridgetest" + "github.com/Kong/go-pdk/server/kong_plugin_protocol" "github.com/stretchr/testify/assert" + "google.golang.org/protobuf/types/known/structpb" ) -var nginx Nginx -var ch chan interface{} - -func init() { - ch = make(chan interface{}) - nginx = New(ch) -} - -func getBack(f func()) interface{} { - go f() - d := <-ch - ch <- nil - - return d +func mockNginx(t *testing.T, s []bridgetest.MockStep) Nginx { + return Nginx{bridge.New(bridgetest.Mock(t, s))} } func TestGetVar(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.nginx.get_var", Args: []interface{}{"foo"}}, getBack(func() { nginx.GetVar("foo") })) + nginx := mockNginx(t, []bridgetest.MockStep{ + {"kong.nginx.get_var", bridge.WrapString("foo"), bridge.WrapString("bar")}, + }) + + ret, err := nginx.GetVar("foo") + assert.NoError(t, err) + assert.Equal(t, "bar", ret) } func TestGetTLS1VersionStr(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.nginx.get_tls1_version_str"}, getBack(func() { nginx.GetTLS1VersionStr() })) -} + nginx := mockNginx(t, []bridgetest.MockStep{ + {"kong.nginx.get_tls1_version_str", nil, bridge.WrapString("1.19")}, + }) -func TestSetCtx(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.nginx.set_ctx", Args: []interface{}{"key", 123}}, getBack(func() { nginx.SetCtx("key", 123) })) + ret, err := nginx.GetTLS1VersionStr() + assert.NoError(t, err) + assert.Equal(t, "1.19", ret) } -func TestGetCtxAny(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.nginx.get_ctx", Args: []interface{}{"foo"}}, getBack(func() { nginx.GetCtxAny("foo") })) -} +func TestCtx(t *testing.T) { + nginx := mockNginx(t, []bridgetest.MockStep{ + {"kong.nginx.set_ctx", &kong_plugin_protocol.KV{K: "key", V: structpb.NewStringValue("value")}, nil}, + {"kong.nginx.get_ctx", bridge.WrapString("key"), structpb.NewStringValue("value")}, + {"kong.nginx.get_ctx", bridge.WrapString("key_s"), structpb.NewStringValue("value")}, + {"kong.nginx.get_ctx", bridge.WrapString("key_n"), structpb.NewNumberValue(15.75)}, + {"kong.nginx.get_ctx", bridge.WrapString("key_i"), structpb.NewNumberValue(15)}, + }) -func TestGetCtxString(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.nginx.get_ctx", Args: []interface{}{"foo"}}, getBack(func() { nginx.GetCtxString("foo") })) -} + assert.NoError(t, nginx.SetCtx("key", "value")) -func TestGetCtxFloat(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.nginx.get_ctx", Args: []interface{}{"foo"}}, getBack(func() { nginx.GetCtxFloat("foo") })) + ret, err := nginx.GetCtxAny("key") + assert.NoError(t, err) + assert.Equal(t, "value", ret) + + ret_s, err := nginx.GetCtxString("key_s") + assert.NoError(t, err) + assert.Equal(t, "value", ret_s) + + ret_n, err := nginx.GetCtxFloat("key_n") + assert.NoError(t, err) + assert.Equal(t, 15.75, ret_n) + + ret_i, err := nginx.GetCtxInt("key_i") + assert.NoError(t, err) + assert.Equal(t, 15, ret_i) } func TestReqStartTime(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.nginx.get_ctx", Args: []interface{}{"foo"}}, getBack(func() { nginx.GetCtxFloat("foo") })) + nginx := mockNginx(t, []bridgetest.MockStep{ + {"kong.nginx.req_start_time", nil, &kong_plugin_protocol.Number{V: 1617060050.0}}, + }) + + ret, err := nginx.ReqStartTime() + assert.NoError(t, err) + assert.Equal(t, 1617060050.0, ret) +} + +func TestGetSubsystem(t *testing.T) { + nginx := mockNginx(t, []bridgetest.MockStep{ + {"kong.nginx.get_subsystem", nil, bridge.WrapString("http")}, + }) + + ret, err := nginx.GetSubsystem() + assert.NoError(t, err) + assert.Equal(t, "http", ret) } diff --git a/node/node.go b/node/node.go index e1282f4..fa77465 100644 --- a/node/node.go +++ b/node/node.go @@ -5,6 +5,7 @@ package node import ( "github.com/Kong/go-pdk/bridge" + "github.com/Kong/go-pdk/server/kong_plugin_protocol" ) // Holds this module's functions. Accessible as `kong.Node` @@ -12,44 +13,52 @@ type Node struct { bridge.PdkBridge } +type workerLuaVmStats struct { + HttpAllocatedGc int64 `json:"http_allocated_gc"` + Pid int64 `json:"pid"` +} + type MemoryStats struct { LuaSharedDicts struct { Kong struct { - AllocatedSlabs int `json:"allocated_slabs"` - Capacity int `json:"capacity"` + AllocatedSlabs int64 `json:"allocated_slabs"` + Capacity int64 `json:"capacity"` } `json:"kong"` KongDbCache struct { - AllocatedSlabs int `json:"allocated_slabs"` - Capacity int `json:"capacity"` + AllocatedSlabs int64 `json:"allocated_slabs"` + Capacity int64 `json:"capacity"` } `json:"kong_db_cache"` } `json:"lua_shared_dicts"` - WorkersLuaVms []struct { - HttpAllocatedGc int `json:"http_allocated_gc"` - Pid int `json:"pid"` - } `json:"workers_lua_vms"` -} - -// Called by the plugin server at initialization. -func New(ch chan interface{}) Node { - return Node{bridge.New(ch)} + WorkersLuaVms []workerLuaVmStats `json:"workers_lua_vms"` } // kong.Node.GetId() returns the v4 UUID used by this node to describe itself. func (n Node) GetId() (string, error) { - return n.AskString(`kong.node.get_id`) + return n.AskString(`kong.node.get_id`, nil) } // kong.Node.GetMemoryStats() returns memory usage statistics about this node. -func (n Node) GetMemoryStats() (ms MemoryStats, err error) { - val, err := n.Ask(`kong.node.get_memory_stats`) +func (n Node) GetMemoryStats() (MemoryStats, error) { + out := new(kong_plugin_protocol.MemoryStats) + err := n.Ask(`kong.node.get_memory_stats`, nil, out) if err != nil { - return + return MemoryStats{}, err } - var ok bool - if ms, ok = val.(MemoryStats); !ok { - err = bridge.ReturnTypeError("MemoryStats") + ms := MemoryStats{} + ms.LuaSharedDicts.Kong.AllocatedSlabs = out.LuaSharedDicts.Kong.AllocatedSlabs + ms.LuaSharedDicts.Kong.Capacity = out.LuaSharedDicts.Kong.Capacity + ms.LuaSharedDicts.KongDbCache.AllocatedSlabs = out.LuaSharedDicts.KongDbCache.AllocatedSlabs + ms.LuaSharedDicts.KongDbCache.Capacity = out.LuaSharedDicts.KongDbCache.Capacity + + ms.WorkersLuaVms = make([]workerLuaVmStats, len(out.WorkersLuaVms)) + for i, wlv := range out.WorkersLuaVms { + ms.WorkersLuaVms[i] = workerLuaVmStats{ + HttpAllocatedGc: wlv.HttpAllocatedGc, + Pid: wlv.Pid, + } } - return + + return ms, nil } diff --git a/node/node_test.go b/node/node_test.go index a4739d4..1c5afb2 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -4,29 +4,72 @@ import ( "testing" "github.com/Kong/go-pdk/bridge" + "github.com/Kong/go-pdk/bridge/bridgetest" + "github.com/Kong/go-pdk/server/kong_plugin_protocol" "github.com/stretchr/testify/assert" ) -var node Node -var ch chan interface{} - -func init() { - ch = make(chan interface{}) - node = New(ch) -} - -func getBack(f func()) interface{} { - go f() - d := <-ch - ch <- nil - - return d +func mockNode(t *testing.T, s []bridgetest.MockStep) Node { + return Node{bridge.New(bridgetest.Mock(t, s))} } func TestGetId(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.node.get_id"}, getBack(func() { node.GetId() })) + node := mockNode(t, []bridgetest.MockStep{ + {"kong.node.get_id", nil, bridge.WrapString("001:002:0003")}, + }) + + ret, err := node.GetId() + assert.NoError(t, err) + assert.Equal(t, "001:002:0003", ret) } func TestGetMemoryStats(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.node.get_memory_stats"}, getBack(func() { node.GetMemoryStats() })) + node := mockNode(t, []bridgetest.MockStep{ + {"kong.node.get_memory_stats", nil, + &kong_plugin_protocol.MemoryStats{ + LuaSharedDicts: &kong_plugin_protocol.MemoryStats_LuaSharedDicts{ + Kong: &kong_plugin_protocol.MemoryStats_LuaSharedDicts_DictStats{ + AllocatedSlabs: 1027, + Capacity: 4423543, + }, + KongDbCache: &kong_plugin_protocol.MemoryStats_LuaSharedDicts_DictStats{ + AllocatedSlabs: 4093, + Capacity: 3424875, + }, + }, + WorkersLuaVms: []*kong_plugin_protocol.MemoryStats_WorkerLuaVm{ + {HttpAllocatedGc: 123456, Pid: 543}, + {HttpAllocatedGc: 345678, Pid: 876}, + }, + }, + }, + }) + + ret, err := node.GetMemoryStats() + assert.NoError(t, err) + assert.Equal(t, MemoryStats{ + LuaSharedDicts: struct { + Kong struct { + AllocatedSlabs int64 "json:\"allocated_slabs\"" + Capacity int64 "json:\"capacity\"" + } "json:\"kong\"" + KongDbCache struct { + AllocatedSlabs int64 "json:\"allocated_slabs\"" + Capacity int64 "json:\"capacity\"" + } "json:\"kong_db_cache\"" + }{ + Kong: struct { + AllocatedSlabs int64 "json:\"allocated_slabs\"" + Capacity int64 "json:\"capacity\"" + }{AllocatedSlabs: 1027, Capacity: 4423543}, + KongDbCache: struct { + AllocatedSlabs int64 "json:\"allocated_slabs\"" + Capacity int64 "json:\"capacity\"" + }{AllocatedSlabs: 4093, Capacity: 3424875}, + }, + WorkersLuaVms: []workerLuaVmStats{ + workerLuaVmStats{HttpAllocatedGc: 123456, Pid: 543}, + workerLuaVmStats{HttpAllocatedGc: 345678, Pid: 876}, + }, + }, ret) } diff --git a/pdk.go b/pdk.go index 2316c06..5eb24b7 100644 --- a/pdk.go +++ b/pdk.go @@ -16,6 +16,9 @@ For example, to get the client's IP address, you'd use `kong.Client.GetIp()`. package pdk import ( + "net" + + "github.com/Kong/go-pdk/bridge" "github.com/Kong/go-pdk/client" "github.com/Kong/go-pdk/ctx" "github.com/Kong/go-pdk/ip" @@ -47,19 +50,20 @@ type PDK struct { } // Init initialize go pdk. Called by the pluginserver at initialization. -func Init(ch chan interface{}) *PDK { +func Init(conn net.Conn) *PDK { + b := bridge.New(conn) return &PDK{ - Client: client.New(ch), - Ctx: ctx.New(ch), - Log: log.New(ch), - Nginx: nginx.New(ch), - Request: request.New(ch), - Response: response.New(ch), - Router: router.New(ch), - IP: ip.New(ch), - Node: node.New(ch), - Service: service.New(ch), - ServiceRequest: service_request.New(ch), - ServiceResponse: service_response.New(ch), + Client: client.Client{b}, + Ctx: ctx.Ctx{b}, + Log: log.Log{b}, + Nginx: nginx.Nginx{b}, + Request: request.Request{b}, + Response: response.Response{b}, + Router: router.Router{b}, + IP: ip.Ip{b}, + Node: node.Node{b}, + Service: service.Service{b}, + ServiceRequest: service_request.Request{b}, + ServiceResponse: service_response.Response{b}, } } diff --git a/request/request.go b/request/request.go index a227f5e..845b851 100644 --- a/request/request.go +++ b/request/request.go @@ -7,6 +7,8 @@ package request import ( "github.com/Kong/go-pdk/bridge" + "github.com/Kong/go-pdk/server/kong_plugin_protocol" + "google.golang.org/protobuf/types/known/structpb" ) // Holds this module's functions. Accessible as `kong.Request` @@ -14,27 +16,22 @@ type Request struct { bridge.PdkBridge } -// Called by the plugin server at initialization. -func New(ch chan interface{}) Request { - return Request{bridge.New(ch)} -} - // kong.Request.GetScheme() returns the scheme component of the request’s URL. // The returned value is normalized to lower-case form. func (r Request) GetScheme() (s string, err error) { - return r.AskString(`kong.request.get_scheme`) + return r.AskString(`kong.request.get_scheme`, nil) } // kong.Request.GetHost() returns the host component of the request’s URL, // or the value of the “Host” header. The returned value is normalized // to lower-case form. func (r Request) GetHost() (host string, err error) { - return r.AskString(`kong.request.get_host`) + return r.AskString(`kong.request.get_host`, nil) } // kong.Request.GetPort() returns the port component of the request’s URL. func (r Request) GetPort() (int, error) { - return r.AskInt(`kong.request.get_port`) + return r.AskInt(`kong.request.get_port`, nil) } // kong.Request.GetForwardedScheme() returns the scheme component @@ -51,7 +48,7 @@ func (r Request) GetPort() (int, error) { // Note: support for the Forwarded HTTP Extension (RFC 7239) is not offered yet // since it is not supported by ngx_http_realip_module. func (r Request) GetForwardedScheme() (s string, err error) { - return r.AskString(`kong.request.get_forwarded_scheme`) + return r.AskString(`kong.request.get_forwarded_scheme`, nil) } // kong.Request.GetForwardedHost() returns the host component of the request’s URL @@ -69,7 +66,7 @@ func (r Request) GetForwardedScheme() (s string, err error) { // Note: we do not currently offer support for Forwarded HTTP Extension (RFC 7239) // since it is not supported by ngx_http_realip_module. func (r Request) GetForwardedHost() (host string, err error) { - return r.AskString(`kong.request.get_forwarded_host`) + return r.AskString(`kong.request.get_forwarded_host`, nil) } // kong.Request.GetForwardedPort() returns the port component of the request’s URL, @@ -85,39 +82,39 @@ func (r Request) GetForwardedHost() (host string, err error) { // Note: we do not currently offer support for Forwarded HTTP Extension (RFC 7239) // since it is not supported by ngx_http_realip_module. func (r Request) GetForwardedPort() (int, error) { - return r.AskInt(`kong.request.get_forwarded_port`) + return r.AskInt(`kong.request.get_forwarded_port`, nil) } // kong.Request.GetHttpVersion() returns the HTTP version // used by the client in the request, returning values // such as "1"", "1.1", "2.0", or nil for unrecognized values. func (r Request) GetHttpVersion() (version float64, err error) { - return r.AskFloat(`kong.request.get_http_version`) + return r.AskNumber(`kong.request.get_http_version`, nil) } // kong.Request.GetMethod() returns the HTTP method of the request. // The value is normalized to upper-case. func (r Request) GetMethod() (m string, err error) { - return r.AskString(`kong.request.get_method`) + return r.AskString(`kong.request.get_method`, nil) } // kong.Request.GetPath() returns the path component of the request’s URL. // It is not normalized in any way and does not include the querystring. func (r Request) GetPath() (string, error) { - return r.AskString(`kong.request.get_path`) + return r.AskString(`kong.request.get_path`, nil) } // kong.Request.GetPathWithQuery() returns the path, including // the querystring if any. No transformations/normalizations are done. func (r Request) GetPathWithQuery() (string, error) { - return r.AskString(`kong.request.get_path_with_query`) + return r.AskString(`kong.request.get_path_with_query`, nil) } // kong.Request.GetRawQuery() returns the query component of the request’s URL. // It is not normalized in any way (not even URL-decoding of special characters) // and does not include the leading ? character. func (r Request) GetRawQuery() (string, error) { - return r.AskString(`kong.request.get_raw_query`) + return r.AskString(`kong.request.get_raw_query`, nil) } // kong.Request.GetQueryArg() returns the value of the specified argument, @@ -129,7 +126,7 @@ func (r Request) GetRawQuery() (string, error) { // If an argument with the same name is present multiple times in the querystring, // this function will return the value of the first occurrence. func (r Request) GetQueryArg(k string) (string, error) { - return r.AskString(`kong.request.get_query_arg`, k) + return r.AskString(`kong.request.get_query_arg`, bridge.WrapString(k)) } // kong.Request.GetQuery() returns a map of query arguments @@ -147,10 +144,17 @@ func (r Request) GetQueryArg(k string) (string, error) { // default limit of 100 arguments. func (r Request) GetQuery(max_args int) (map[string][]string, error) { if max_args == -1 { - return r.AskMap("kong.request.get_query") + max_args = 100 + } + + arg := kong_plugin_protocol.Int{V: int32(max_args)} + out := new(structpb.Struct) + err := r.Ask("kong.request.get_query", &arg, out) + if err != nil { + return nil, err } - return r.AskMap("kong.request.get_query", max_args) + return bridge.UnwrapHeaders(out), nil } // kong.Request.GetHeader() returns the value of the specified request header. @@ -164,7 +168,7 @@ func (r Request) GetQuery(max_args int) (map[string][]string, error) { // and dashes (-) can be written as underscores (_); that is, the header // X-Custom-Header can also be retrieved as x_custom_header. func (r Request) GetHeader(k string) (string, error) { - return r.AskString(`kong.request.get_header`, k) + return r.AskString(`kong.request.get_header`, bridge.WrapString(k)) } // kong.Request.GetHeaders() returns a map holding the request headers. @@ -179,10 +183,17 @@ func (r Request) GetHeader(k string) (string, error) { // default limit of 100 headers. func (r Request) GetHeaders(max_headers int) (map[string][]string, error) { if max_headers == -1 { - return r.AskMap(`kong.request.get_headers`) + max_headers = 100 + } + + arg := kong_plugin_protocol.Int{V: int32(max_headers)} + out := new(structpb.Struct) + err := r.Ask("kong.request.get_headers", &arg, out) + if err != nil { + return nil, err } - return r.AskMap(`kong.request.get_headers`, max_headers) + return bridge.UnwrapHeaders(out), nil } // kong.Request.GetRawBody() returns the plain request body. @@ -193,7 +204,7 @@ func (r Request) GetHeaders(max_headers int) (map[string][]string, error) { // (set by client_body_buffer_size), this function will fail // and return an error message explaining this limitation. func (r Request) GetRawBody() (string, error) { - return r.AskString(`kong.request.get_raw_body`) + return r.AskString(`kong.request.get_raw_body`, nil) } // TODO get_body diff --git a/request/request_test.go b/request/request_test.go index df8c4ba..d725484 100644 --- a/request/request_test.go +++ b/request/request_test.go @@ -4,93 +4,121 @@ import ( "testing" "github.com/Kong/go-pdk/bridge" + "github.com/Kong/go-pdk/bridge/bridgetest" + "github.com/Kong/go-pdk/server/kong_plugin_protocol" "github.com/stretchr/testify/assert" ) -var request Request -var ch chan interface{} - -func init() { - ch = make(chan interface{}) - request = New(ch) -} - -func getBack(f func()) interface{} { - go f() - d := <-ch - ch <- nil - - return d -} - -func getStrValue(f func(res chan string), val string) string { - res := make(chan string) - go f(res) - _ = <-ch - ch <- val - return <-res -} - -func TestGetScheme(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.request.get_scheme"}, getBack(func() { request.GetScheme() })) -} - -func TestGetHost(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.request.get_host"}, getBack(func() { request.GetHost() })) -} - -func TestGetPort(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.request.get_port"}, getBack(func() { request.GetPort() })) -} - -func TestGetForwardedScheme(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.request.get_scheme"}, getBack(func() { request.GetScheme() })) -} - -func TestGetForwardedHost(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.request.get_forwarded_host"}, getBack(func() { request.GetForwardedHost() })) -} - -func TestGetForwardedPort(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.request.get_forwarded_port"}, getBack(func() { request.GetForwardedPort() })) -} - -func TestGetHttpVersion(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.request.get_http_version"}, getBack(func() { request.GetHttpVersion() })) -} - -func TestGetMethod(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.request.get_method"}, getBack(func() { request.GetMethod() })) -} - -func TestGetPath(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.request.get_path"}, getBack(func() { request.GetPath() })) -} - -func TestGetPathWithQuery(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.request.get_path_with_query"}, getBack(func() { request.GetPathWithQuery() })) -} - -func TestGetRawQuery(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.request.get_raw_query"}, getBack(func() { request.GetRawQuery() })) -} - -func TestGetQueryArg(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.request.get_query_arg", Args: []interface{}{"foo"}}, getBack(func() { request.GetQueryArg("foo") })) -} - -func TestGetQuery(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.request.get_query", Args: []interface{}{1}}, getBack(func() { request.GetQuery(1) })) -} - -func TestGetHeader(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.request.get_header", Args: []interface{}{"foo"}}, getBack(func() { request.GetHeader("foo") })) -} - -func TestGetHeaders(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.request.get_headers", Args: []interface{}{1}}, getBack(func() { request.GetHeaders(1) })) -} - -func TestGetRawBody(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.request.get_raw_body"}, getBack(func() { request.GetRawBody() })) +func mockRequest(t *testing.T, s []bridgetest.MockStep) Request { + return Request{bridge.New(bridgetest.Mock(t, s))} +} + +func TestGetInfos(t *testing.T) { + + q, err := bridge.WrapHeaders(map[string][]string{ + "ref": []string{"wayback"}, + "trail": []string{"faint"}, + }) + assert.NoError(t, err) + + h, err := bridge.WrapHeaders(map[string][]string{ + "Host": []string{"example.com"}, + "X-Two-Things": []string{"first", "second"}, + }) + assert.NoError(t, err) + + body := `GET / HTTP/1.1 +Host: example.com +Accept: * + +this is the content` + + request := mockRequest(t, []bridgetest.MockStep{ + {"kong.request.get_scheme", nil, bridge.WrapString("https")}, + {"kong.request.get_host", nil, bridge.WrapString("example.com")}, + {"kong.request.get_port", nil, &kong_plugin_protocol.Int{V: 443}}, + {"kong.request.get_forwarded_scheme", nil, bridge.WrapString("https")}, + {"kong.request.get_forwarded_host", nil, bridge.WrapString("example.com")}, + {"kong.request.get_forwarded_port", nil, &kong_plugin_protocol.Int{V: 443}}, + {"kong.request.get_http_version", nil, &kong_plugin_protocol.Number{V: 2.1}}, + {"kong.request.get_method", nil, bridge.WrapString("HEADER")}, + {"kong.request.get_path", nil, bridge.WrapString("/login/orout")}, + {"kong.request.get_path_with_query", nil, bridge.WrapString("/login/orout?ref=wayback")}, + {"kong.request.get_raw_query", nil, bridge.WrapString("ref=wayback&trail=faint")}, + {"kong.request.get_query_arg", bridge.WrapString("ref"), bridge.WrapString("wayback")}, + {"kong.request.get_query", &kong_plugin_protocol.Int{V: 30}, q}, + {"kong.request.get_header", bridge.WrapString("Host"), bridge.WrapString("example.com")}, + {"kong.request.get_headers", &kong_plugin_protocol.Int{V: 30}, h}, + {"kong.request.get_raw_body", nil, bridge.WrapString(body)}, + }) + + ret, err := request.GetScheme() + assert.NoError(t, err) + assert.Equal(t, "https", ret) + + ret, err = request.GetHost() + assert.NoError(t, err) + assert.Equal(t, "example.com", ret) + + ret_i, err := request.GetPort() + assert.NoError(t, err) + assert.Equal(t, 443, ret_i) + + ret, err = request.GetForwardedScheme() + assert.NoError(t, err) + assert.Equal(t, "https", ret) + + ret, err = request.GetForwardedHost() + assert.NoError(t, err) + assert.Equal(t, "example.com", ret) + + ret_i, err = request.GetForwardedPort() + assert.NoError(t, err) + assert.Equal(t, 443, ret_i) + + ret_f, err := request.GetHttpVersion() + assert.NoError(t, err) + assert.Equal(t, 2.1, ret_f) + + ret, err = request.GetMethod() + assert.NoError(t, err) + assert.Equal(t, "HEADER", ret) + + ret, err = request.GetPath() + assert.NoError(t, err) + assert.Equal(t, "/login/orout", ret) + + ret, err = request.GetPathWithQuery() + assert.NoError(t, err) + assert.Equal(t, "/login/orout?ref=wayback", ret) + + ret, err = request.GetRawQuery() + assert.NoError(t, err) + assert.Equal(t, "ref=wayback&trail=faint", ret) + + ret, err = request.GetQueryArg("ref") + assert.NoError(t, err) + assert.Equal(t, "wayback", ret) + + ret_q, err := request.GetQuery(30) + assert.NoError(t, err) + assert.Equal(t, map[string][]string{ + "ref": []string{"wayback"}, + "trail": []string{"faint"}, + }, ret_q) + + ret, err = request.GetHeader("Host") + assert.NoError(t, err) + assert.Equal(t, "example.com", ret) + + ret_q, err = request.GetHeaders(30) + assert.NoError(t, err) + assert.Equal(t, map[string][]string{ + "Host": []string{"example.com"}, + "X-Two-Things": []string{"first", "second"}, + }, ret_q) + + ret, err = request.GetRawBody() + assert.NoError(t, err) + assert.Equal(t, body, ret) } diff --git a/response/response.go b/response/response.go index e182033..b7f2c8e 100644 --- a/response/response.go +++ b/response/response.go @@ -13,6 +13,8 @@ package response import ( "github.com/Kong/go-pdk/bridge" + "github.com/Kong/go-pdk/server/kong_plugin_protocol" + "google.golang.org/protobuf/types/known/structpb" ) // Holds this module's functions. Accessible as `kong.Response` @@ -20,11 +22,6 @@ type Response struct { bridge.PdkBridge } -// Called by the plugin server at initialization. -func New(ch chan interface{}) Response { - return Response{bridge.New(ch)} -} - // kong.Response.GetStatus() returns the HTTP status code // currently set for the downstream response (as an integer). // @@ -36,7 +33,7 @@ func New(ch chan interface{}) Response { // by Kong itself (i.e. via kong.Response.Exit()), the return value // will be returned as-is. func (r Response) GetStatus() (int, error) { - return r.AskInt(`kong.response.get_status`) + return r.AskInt(`kong.response.get_status`, nil) } // kong.Response.GetHeader() returns the value of the specified @@ -55,7 +52,7 @@ func (r Response) GetStatus() (int, error) { // as underscores (_); that is, the header X-Custom-Header // can also be retrieved as x_custom_header. func (r Response) GetHeader(name string) (string, error) { - return r.AskString(`kong.response.get_header`, name) + return r.AskString(`kong.response.get_header`, bridge.WrapString(name)) } // kong.Response.GetHeaders() returns a map holding the response headers. @@ -79,10 +76,17 @@ func (r Response) GetHeader(name string) (string, error) { // default limit of 100 arguments. func (r Response) GetHeaders(max_headers int) (res map[string][]string, err error) { if max_headers == -1 { - return r.AskMap(`kong.response.get_headers`) + max_headers = 100 } - return r.AskMap(`kong.response.get_headers`, max_headers) + arg := kong_plugin_protocol.Int{V: int32(max_headers)} + out := new(structpb.Struct) + err = r.Ask(`kong.response.get_headers`, &arg, out) + if err != nil { + return nil, err + } + + return bridge.UnwrapHeaders(out), nil } // kong.Response.GetSource() helps determining where the current response @@ -102,7 +106,7 @@ func (r Response) GetHeaders(max_headers int) (res map[string][]string, err erro // - “service” is returned when the response was originated by // successfully contacting the proxied Service. func (r Response) GetSource() (string, error) { - return r.AskString(`kong.response.get_source`) + return r.AskString(`kong.response.get_source`, nil) } // kong.Response.SetStatus() allows changing the downstream response @@ -111,7 +115,8 @@ func (r Response) GetSource() (string, error) { // This function should be used in the header_filter phase, // as Kong is preparing headers to be sent back to the client. func (r Response) SetStatus(status int) error { - _, err := r.Ask(`kong.response.set_status`, status) + arg := kong_plugin_protocol.Int{V: int32(status)} + err := r.Ask(`kong.response.set_status`, &arg, nil) return err } @@ -121,7 +126,11 @@ func (r Response) SetStatus(status int) error { // This function should be used in the header_filter phase, // as Kong is preparing headers to be sent back to the client. func (r Response) SetHeader(k string, v string) error { - _, err := r.Ask(`kong.response.set_header`, k, v) + arg := kong_plugin_protocol.KV{ + K: k, + V: structpb.NewStringValue(v), + } + err := r.Ask(`kong.response.set_header`, &arg, nil) return err } @@ -135,7 +144,11 @@ func (r Response) SetHeader(k string, v string) error { // This function should be used in the header_filter phase, // as Kong is preparing headers to be sent back to the client. func (r Response) AddHeader(k string, v string) error { - _, err := r.Ask(`kong.response.add_header`, k, v) + arg := kong_plugin_protocol.KV{ + K: k, + V: structpb.NewStringValue(v), + } + err := r.Ask(`kong.response.add_header`, &arg, nil) return err } @@ -145,7 +158,7 @@ func (r Response) AddHeader(k string, v string) error { // This function should be used in the header_filter phase, // as Kong is preparing headers to be sent back to the client. func (r Response) ClearHeader(k string) error { - _, err := r.Ask(`kong.response.clear_header`, k) + err := r.Ask(`kong.response.clear_header`, bridge.WrapString(k), nil) return err } @@ -165,7 +178,12 @@ func (r Response) ClearHeader(k string) error { // This function overrides any existing header bearing the same name // as those specified in the headers argument. Other headers remain unchanged. func (r Response) SetHeaders(headers map[string][]string) error { - _, err := r.Ask(`kong.response.set_headers`, headers) + arg, err := bridge.WrapHeaders(headers) + if err != nil { + return err + } + + err = r.Ask(`kong.response.set_headers`, arg, nil) return err } @@ -203,11 +221,22 @@ func (r Response) SetHeaders(headers map[string][]string) error { // Content-Length header in the produced response for convenience. func (r Response) Exit(status int, body string, headers map[string][]string) { - r.AskClose(`kong.response.exit`, status, body, headers) + h, _ := bridge.WrapHeaders(headers) + arg := kong_plugin_protocol.ExitArgs{ + Status: int32(status), + Body: body, + Headers: h, + } + r.Ask(`kong.response.exit`, &arg, nil) + r.Close() } // kong.Response.ExitStatus() terminates current processing just like kong.Response.Exit() // without setting the body or headers. func (r Response) ExitStatus(status int) { - r.AskClose(`kong.response.exit`, status) + arg := kong_plugin_protocol.ExitArgs{ + Status: int32(status), + } + r.Ask(`kong.response.exit`, &arg, nil) + r.Close() } diff --git a/response/response_test.go b/response/response_test.go index b0311d5..4d5fb9c 100644 --- a/response/response_test.go +++ b/response/response_test.go @@ -4,54 +4,56 @@ import ( "testing" "github.com/Kong/go-pdk/bridge" + "github.com/Kong/go-pdk/bridge/bridgetest" + "github.com/Kong/go-pdk/server/kong_plugin_protocol" "github.com/stretchr/testify/assert" + "google.golang.org/protobuf/types/known/structpb" ) -var response Response -var ch chan interface{} - -func init() { - ch = make(chan interface{}) - response = New(ch) -} - -func getBack(f func()) interface{} { - go f() - d := <-ch - ch <- nil - - return d -} - -func TestGetStatus(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.response.get_status"}, getBack(func() { response.GetStatus() })) -} - -func TestGetHeaders(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.response.get_headers", Args: []interface{}{1}}, getBack(func() { response.GetHeaders(1) })) -} - -func TestGetSource(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.response.get_source"}, getBack(func() { response.GetSource() })) -} - -func TestSetStatus(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.response.get_status"}, getBack(func() { response.GetStatus() })) -} - -func TestSetHeader(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.response.set_header", Args: []interface{}{"foo", "bar"}}, getBack(func() { response.SetHeader("foo", "bar") })) -} - -func TestAddHeader(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.response.add_header", Args: []interface{}{"foo", "bar"}}, getBack(func() { response.AddHeader("foo", "bar") })) -} - -func TestClearHeader(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.response.clear_header", Args: []interface{}{"foo"}}, getBack(func() { response.ClearHeader("foo") })) -} - -func TestSetHeaders(t *testing.T) { - var m map[string][]string = nil - assert.Equal(t, bridge.StepData{Method: "kong.response.set_headers", Args: []interface{}{m}}, getBack(func() { response.SetHeaders(nil) })) +func mockResponse(t *testing.T, s []bridgetest.MockStep) Response { + return Response{bridge.New(bridgetest.Mock(t, s))} +} + +func TestResponse(t *testing.T) { + h, err := bridge.WrapHeaders(map[string][]string{ + "Host": []string{"example.com"}, + "X-Two-Things": []string{"first", "second"}, + }) + assert.NoError(t, err) + + response := mockResponse(t, []bridgetest.MockStep{ + {"kong.response.get_status", nil, &kong_plugin_protocol.Int{V: 404}}, + {"kong.response.get_headers", &kong_plugin_protocol.Int{V: 30}, h}, + {"kong.response.get_source", nil, bridge.WrapString("service")}, + {"kong.response.set_status", &kong_plugin_protocol.Int{V: 201}, nil}, + {"kong.response.set_header", &kong_plugin_protocol.KV{K: "key", V: structpb.NewStringValue("value")}, nil}, + {"kong.response.add_header", &kong_plugin_protocol.KV{K: "key", V: structpb.NewStringValue("value")}, nil}, + {"kong.response.clear_header", bridge.WrapString("key"), nil}, + {"kong.response.set_headers", nil, nil}, + }) + + res_n, err := response.GetStatus() + assert.NoError(t, err) + assert.Equal(t, 404, res_n) + + res_h, err := response.GetHeaders(30) + assert.NoError(t, err) + assert.Equal(t, map[string][]string{ + "Host": []string{"example.com"}, + "X-Two-Things": []string{"first", "second"}, + }, res_h) + + res_s, err := response.GetSource() + assert.NoError(t, err) + assert.Equal(t, "service", res_s) + + assert.NoError(t, response.SetStatus(201)) + + assert.NoError(t, response.SetHeader("key", "value")) + assert.NoError(t, response.AddHeader("key", "value")) + assert.NoError(t, response.ClearHeader("key")) + assert.NoError(t, response.SetHeaders(map[string][]string{ + "Host": []string{"example.com"}, + "X-Two-Things": []string{"first", "second"}, + })) } diff --git a/router/router.go b/router/router.go index 0670bf2..3bf8b1c 100644 --- a/router/router.go +++ b/router/router.go @@ -8,6 +8,7 @@ package router import ( "github.com/Kong/go-pdk/bridge" "github.com/Kong/go-pdk/entities" + "github.com/Kong/go-pdk/server/kong_plugin_protocol" ) // Holds this module's functions. Accessible as `kong.Router` @@ -15,37 +16,67 @@ type Router struct { bridge.PdkBridge } -// Called by the plugin server at initialization. -func New(ch chan interface{}) Router { - return Router{bridge.New(ch)} -} - // kong.Router.GetRoute() returns the current route entity. // The request was matched against this route. func (c Router) GetRoute() (route entities.Route, err error) { - reply, err := c.Ask(`kong.router.get_route`) + out := new(kong_plugin_protocol.Route) + err = c.Ask(`kong.router.get_route`, nil, out) if err != nil { return } - var ok bool - if route, ok = reply.(entities.Route); !ok { - err = bridge.ReturnTypeError("entities.Route") + serviceId := "" + if out.Service != nil { + serviceId = out.Service.Id + } + + route = entities.Route{ + Id: out.Id, + CreatedAt: int(out.CreatedAt), + UpdatedAt: int(out.UpdatedAt), + Name: out.Name, + Protocols: out.Protocols, + Methods: out.Methods, + Hosts: out.Hosts, + Paths: out.Paths, + Headers: out.Headers, + HTTPSRedirectStatusCode: int(out.HttpsRedirectStatusCode), + RegexPriority: int(out.RegexPriority), + StripPath: out.StripPath, + PreserveHost: out.PreserveHost, + SNIs: out.Snis, + Sources: out.Sources, + Destinations: out.Destinations, + Tags: out.Tags, + Service: entities.ServiceKey{Id: serviceId}, } return } -// kong.Router.GetService() returns the current service entity. -// The request will be targetted to this upstream service. +// // kong.Router.GetService() returns the current service entity. +// // The request will be targetted to this upstream service. func (c Router) GetService() (service entities.Service, err error) { - val, err := c.Ask(`kong.router.get_service`) + out := new(kong_plugin_protocol.Service) + err = c.Ask(`kong.router.get_service`, nil, out) if err != nil { return } - var ok bool - if service, ok = val.(entities.Service); !ok { - err = bridge.ReturnTypeError("entities.Service") + service = entities.Service{ + Id: out.Id, + CreatedAt: int(out.CreatedAt), + UpdatedAt: int(out.UpdatedAt), + Name: out.Name, + Retries: int(out.Retries), + Protocol: out.Protocol, + Host: out.Host, + Port: int(out.Port), + Path: out.Path, + ConnectTimeout: int(out.ConnectTimeout), + WriteTimeout: int(out.WriteTimeout), + ReadTimeout: int(out.ReadTimeout), + Tags: out.Tags, +// ClientCertificate: entities.CertificateKey{Id: out.ClientCertificate.Id}, } return } diff --git a/router/router_test.go b/router/router_test.go index dc366f0..14e06e6 100644 --- a/router/router_test.go +++ b/router/router_test.go @@ -3,30 +3,45 @@ package router import ( "testing" + "github.com/Kong/go-pdk/entities" "github.com/Kong/go-pdk/bridge" + "github.com/Kong/go-pdk/bridge/bridgetest" + "github.com/Kong/go-pdk/server/kong_plugin_protocol" "github.com/stretchr/testify/assert" ) -var router Router -var ch chan interface{} -func init() { - ch = make(chan interface{}) - router = New(ch) -} - -func getBack(f func()) interface{} { - go f() - d := <-ch - ch <- nil - - return d -} - -func TestGetRoute(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.router.get_route"}, getBack(func() { router.GetRoute() })) -} - -func TestGetService(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.router.get_service"}, getBack(func() { router.GetService() })) +func TestRouter(t *testing.T) { + router := Router{bridge.New(bridgetest.Mock(t, []bridgetest.MockStep{ + {"kong.router.get_route", nil, &kong_plugin_protocol.Route{ + Id: "001:002", + Name: "route_66", + Protocols: []string{"http", "tcp"}, + Paths: []string{"/v0/left", "/v1/this"}, + }}, + {"kong.router.get_service", nil, &kong_plugin_protocol.Service{ + Id: "003:004", + Name: "self_service", + Protocol: "http", + Path: "/v0/left", + }}, + }))} + + ret_r, err := router.GetRoute() + assert.NoError(t, err) + assert.Equal(t, entities.Route{ + Id: "001:002", + Name: "route_66", + Protocols: []string{"http", "tcp"}, + Paths: []string{"/v0/left", "/v1/this"}, + }, ret_r) + + ret_s, err := router.GetService() + assert.NoError(t, err) + assert.Equal(t, entities.Service{ + Id: "003:004", + Name: "self_service", + Protocol: "http", + Path: "/v0/left", + }, ret_s) } diff --git a/server/event.go b/server/event.go index 6a1b7d0..91b1f81 100644 --- a/server/event.go +++ b/server/event.go @@ -3,7 +3,6 @@ package server import ( "fmt" "github.com/Kong/go-pdk" - "time" ) // Incoming data for a new event. @@ -36,50 +35,50 @@ func (rh *rpcHandler) addEvent(event *eventData) { // mutated or holds references to mutable data. // // RPC exported method -func (rh *rpcHandler) HandleEvent(in StartEventData, out *StepData) error { - rh.lock.RLock() - instance, ok := rh.instances[in.InstanceId] - rh.lock.RUnlock() - if !ok { - return fmt.Errorf("no plugin instance %d", in.InstanceId) - } - - h, ok := instance.handlers[in.EventName] - if !ok { - return fmt.Errorf("undefined method %s", in.EventName) - } - - ipc := make(chan interface{}) - - event := eventData{ - instance: instance, - ipc: ipc, - pdk: pdk.Init(ipc), - } - - rh.addEvent(&event) - - //log.Printf("Will launch goroutine for key %d / operation %s\n", key, op) - go func() { - _ = <-ipc - h(event.pdk) - - func() { - defer func() { recover() }() - ipc <- "ret" - }() - - rh.lock.Lock() - defer rh.lock.Unlock() - event.instance.lastEventTime = time.Now() - delete(rh.events, event.id) - }() - - ipc <- "run" // kickstart the handler - - *out = StepData{EventId: event.id, Data: <-ipc} - return nil -} +// func (rh *rpcHandler) HandleEvent(in StartEventData, out *StepData) error { +// rh.lock.RLock() +// instance, ok := rh.instances[in.InstanceId] +// rh.lock.RUnlock() +// if !ok { +// return fmt.Errorf("no plugin instance %d", in.InstanceId) +// } +// +// h, ok := instance.handlers[in.EventName] +// if !ok { +// return fmt.Errorf("undefined method %s", in.EventName) +// } +// +// ipc := make(chan interface{}) +// +// event := eventData{ +// instance: instance, +// ipc: ipc, +// pdk: pdk.Init(ipc), +// } +// +// rh.addEvent(&event) +// +// //log.Printf("Will launch goroutine for key %d / operation %s\n", key, op) +// go func() { +// _ = <-ipc +// h(event.pdk) +// +// func() { +// defer func() { recover() }() +// ipc <- "ret" +// }() +// +// rh.lock.Lock() +// defer rh.lock.Unlock() +// event.instance.lastEventTime = time.Now() +// delete(rh.events, event.id) +// }() +// +// ipc <- "run" // kickstart the handler +// +// *out = StepData{EventId: event.id, Data: <-ipc} +// return nil +// } // A callback's response/request. type StepData struct { diff --git a/server/instance.go b/server/instance.go index 5968c1f..e7ece07 100644 --- a/server/instance.go +++ b/server/instance.go @@ -81,6 +81,8 @@ func (rh *rpcHandler) StartInstance(config PluginConfig, status *InstanceStatus) handlers: getHandlers(instanceConfig), } +// log.Printf("instance: %v", instance) + rh.addInstance(&instance) *status = InstanceStatus{ @@ -90,7 +92,7 @@ func (rh *rpcHandler) StartInstance(config PluginConfig, status *InstanceStatus) StartTime: instance.startTime.Unix(), } - log.Printf("Started instance %#v:%v", config.Name, instance.id) +// log.Printf("Started instance %#v:%v", config.Name, instance.id) return nil } diff --git a/server/kong_plugin_protocol/pluginsocket.pb.go b/server/kong_plugin_protocol/pluginsocket.pb.go new file mode 100644 index 0000000..0b05a8e --- /dev/null +++ b/server/kong_plugin_protocol/pluginsocket.pb.go @@ -0,0 +1,3815 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.6.1 +// source: pluginsocket.proto + +package kong_plugin_protocol + +import ( + proto "github.com/golang/protobuf/proto" + descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" + empty "github.com/golang/protobuf/ptypes/empty" + _struct "github.com/golang/protobuf/ptypes/struct" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +type CmdGetPluginNames struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *CmdGetPluginNames) Reset() { + *x = CmdGetPluginNames{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CmdGetPluginNames) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CmdGetPluginNames) ProtoMessage() {} + +func (x *CmdGetPluginNames) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_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 CmdGetPluginNames.ProtoReflect.Descriptor instead. +func (*CmdGetPluginNames) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{0} +} + +type CmdGetPluginInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *CmdGetPluginInfo) Reset() { + *x = CmdGetPluginInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CmdGetPluginInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CmdGetPluginInfo) ProtoMessage() {} + +func (x *CmdGetPluginInfo) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_proto_msgTypes[1] + 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 CmdGetPluginInfo.ProtoReflect.Descriptor instead. +func (*CmdGetPluginInfo) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{1} +} + +func (x *CmdGetPluginInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type CmdStartInstance struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Config []byte `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"` +} + +func (x *CmdStartInstance) Reset() { + *x = CmdStartInstance{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CmdStartInstance) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CmdStartInstance) ProtoMessage() {} + +func (x *CmdStartInstance) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_proto_msgTypes[2] + 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 CmdStartInstance.ProtoReflect.Descriptor instead. +func (*CmdStartInstance) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{2} +} + +func (x *CmdStartInstance) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CmdStartInstance) GetConfig() []byte { + if x != nil { + return x.Config + } + return nil +} + +type CmdGetInstanceStatus struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + InstanceId int32 `protobuf:"varint,1,opt,name=instance_id,json=instanceId,proto3" json:"instance_id,omitempty"` +} + +func (x *CmdGetInstanceStatus) Reset() { + *x = CmdGetInstanceStatus{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CmdGetInstanceStatus) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CmdGetInstanceStatus) ProtoMessage() {} + +func (x *CmdGetInstanceStatus) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_proto_msgTypes[3] + 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 CmdGetInstanceStatus.ProtoReflect.Descriptor instead. +func (*CmdGetInstanceStatus) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{3} +} + +func (x *CmdGetInstanceStatus) GetInstanceId() int32 { + if x != nil { + return x.InstanceId + } + return 0 +} + +type CmdCloseInstance struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + InstanceId int32 `protobuf:"varint,1,opt,name=instance_id,json=instanceId,proto3" json:"instance_id,omitempty"` +} + +func (x *CmdCloseInstance) Reset() { + *x = CmdCloseInstance{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CmdCloseInstance) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CmdCloseInstance) ProtoMessage() {} + +func (x *CmdCloseInstance) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_proto_msgTypes[4] + 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 CmdCloseInstance.ProtoReflect.Descriptor instead. +func (*CmdCloseInstance) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{4} +} + +func (x *CmdCloseInstance) GetInstanceId() int32 { + if x != nil { + return x.InstanceId + } + return 0 +} + +type CmdHandleEvent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + InstanceId int32 `protobuf:"varint,1,opt,name=instance_id,json=instanceId,proto3" json:"instance_id,omitempty"` + EventName string `protobuf:"bytes,2,opt,name=event_name,json=eventName,proto3" json:"event_name,omitempty"` +} + +func (x *CmdHandleEvent) Reset() { + *x = CmdHandleEvent{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CmdHandleEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CmdHandleEvent) ProtoMessage() {} + +func (x *CmdHandleEvent) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_proto_msgTypes[5] + 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 CmdHandleEvent.ProtoReflect.Descriptor instead. +func (*CmdHandleEvent) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{5} +} + +func (x *CmdHandleEvent) GetInstanceId() int32 { + if x != nil { + return x.InstanceId + } + return 0 +} + +func (x *CmdHandleEvent) GetEventName() string { + if x != nil { + return x.EventName + } + return "" +} + +type RpcCall struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Sequence int64 `protobuf:"varint,1,opt,name=sequence,proto3" json:"sequence,omitempty"` + // Types that are assignable to Call: + // *RpcCall_CmdGetPluginNames + // *RpcCall_CmdGetPluginInfo + // *RpcCall_CmdStartInstance + // *RpcCall_CmdGetInstanceStatus + // *RpcCall_CmdCloseInstance + // *RpcCall_CmdHandleEvent + Call isRpcCall_Call `protobuf_oneof:"call"` +} + +func (x *RpcCall) Reset() { + *x = RpcCall{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RpcCall) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RpcCall) ProtoMessage() {} + +func (x *RpcCall) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_proto_msgTypes[6] + 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 RpcCall.ProtoReflect.Descriptor instead. +func (*RpcCall) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{6} +} + +func (x *RpcCall) GetSequence() int64 { + if x != nil { + return x.Sequence + } + return 0 +} + +func (m *RpcCall) GetCall() isRpcCall_Call { + if m != nil { + return m.Call + } + return nil +} + +func (x *RpcCall) GetCmdGetPluginNames() *CmdGetPluginNames { + if x, ok := x.GetCall().(*RpcCall_CmdGetPluginNames); ok { + return x.CmdGetPluginNames + } + return nil +} + +func (x *RpcCall) GetCmdGetPluginInfo() *CmdGetPluginInfo { + if x, ok := x.GetCall().(*RpcCall_CmdGetPluginInfo); ok { + return x.CmdGetPluginInfo + } + return nil +} + +func (x *RpcCall) GetCmdStartInstance() *CmdStartInstance { + if x, ok := x.GetCall().(*RpcCall_CmdStartInstance); ok { + return x.CmdStartInstance + } + return nil +} + +func (x *RpcCall) GetCmdGetInstanceStatus() *CmdGetInstanceStatus { + if x, ok := x.GetCall().(*RpcCall_CmdGetInstanceStatus); ok { + return x.CmdGetInstanceStatus + } + return nil +} + +func (x *RpcCall) GetCmdCloseInstance() *CmdCloseInstance { + if x, ok := x.GetCall().(*RpcCall_CmdCloseInstance); ok { + return x.CmdCloseInstance + } + return nil +} + +func (x *RpcCall) GetCmdHandleEvent() *CmdHandleEvent { + if x, ok := x.GetCall().(*RpcCall_CmdHandleEvent); ok { + return x.CmdHandleEvent + } + return nil +} + +type isRpcCall_Call interface { + isRpcCall_Call() +} + +type RpcCall_CmdGetPluginNames struct { + CmdGetPluginNames *CmdGetPluginNames `protobuf:"bytes,31,opt,name=cmd_get_plugin_names,json=cmdGetPluginNames,proto3,oneof"` +} + +type RpcCall_CmdGetPluginInfo struct { + CmdGetPluginInfo *CmdGetPluginInfo `protobuf:"bytes,32,opt,name=cmd_get_plugin_info,json=cmdGetPluginInfo,proto3,oneof"` +} + +type RpcCall_CmdStartInstance struct { + CmdStartInstance *CmdStartInstance `protobuf:"bytes,33,opt,name=cmd_start_instance,json=cmdStartInstance,proto3,oneof"` +} + +type RpcCall_CmdGetInstanceStatus struct { + CmdGetInstanceStatus *CmdGetInstanceStatus `protobuf:"bytes,34,opt,name=cmd_get_instance_status,json=cmdGetInstanceStatus,proto3,oneof"` +} + +type RpcCall_CmdCloseInstance struct { + CmdCloseInstance *CmdCloseInstance `protobuf:"bytes,35,opt,name=cmd_close_instance,json=cmdCloseInstance,proto3,oneof"` +} + +type RpcCall_CmdHandleEvent struct { + CmdHandleEvent *CmdHandleEvent `protobuf:"bytes,36,opt,name=cmd_handle_event,json=cmdHandleEvent,proto3,oneof"` +} + +func (*RpcCall_CmdGetPluginNames) isRpcCall_Call() {} + +func (*RpcCall_CmdGetPluginInfo) isRpcCall_Call() {} + +func (*RpcCall_CmdStartInstance) isRpcCall_Call() {} + +func (*RpcCall_CmdGetInstanceStatus) isRpcCall_Call() {} + +func (*RpcCall_CmdCloseInstance) isRpcCall_Call() {} + +func (*RpcCall_CmdHandleEvent) isRpcCall_Call() {} + +type PluginNames struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Names []string `protobuf:"bytes,1,rep,name=names,proto3" json:"names,omitempty"` +} + +func (x *PluginNames) Reset() { + *x = PluginNames{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PluginNames) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PluginNames) ProtoMessage() {} + +func (x *PluginNames) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_proto_msgTypes[7] + 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 PluginNames.ProtoReflect.Descriptor instead. +func (*PluginNames) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{7} +} + +func (x *PluginNames) GetNames() []string { + if x != nil { + return x.Names + } + return nil +} + +type PluginInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + UpdatedAt int64 `protobuf:"varint,2,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` + LoadedAt int64 `protobuf:"varint,3,opt,name=loaded_at,json=loadedAt,proto3" json:"loaded_at,omitempty"` + Phases []string `protobuf:"bytes,4,rep,name=phases,proto3" json:"phases,omitempty"` + Version string `protobuf:"bytes,5,opt,name=version,proto3" json:"version,omitempty"` + Priority int32 `protobuf:"varint,6,opt,name=priority,proto3" json:"priority,omitempty"` + Schema string `protobuf:"bytes,7,opt,name=schema,proto3" json:"schema,omitempty"` +} + +func (x *PluginInfo) Reset() { + *x = PluginInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PluginInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PluginInfo) ProtoMessage() {} + +func (x *PluginInfo) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_proto_msgTypes[8] + 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 PluginInfo.ProtoReflect.Descriptor instead. +func (*PluginInfo) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{8} +} + +func (x *PluginInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *PluginInfo) GetUpdatedAt() int64 { + if x != nil { + return x.UpdatedAt + } + return 0 +} + +func (x *PluginInfo) GetLoadedAt() int64 { + if x != nil { + return x.LoadedAt + } + return 0 +} + +func (x *PluginInfo) GetPhases() []string { + if x != nil { + return x.Phases + } + return nil +} + +func (x *PluginInfo) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *PluginInfo) GetPriority() int32 { + if x != nil { + return x.Priority + } + return 0 +} + +func (x *PluginInfo) GetSchema() string { + if x != nil { + return x.Schema + } + return "" +} + +type InstanceStatus struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + InstanceId int32 `protobuf:"varint,2,opt,name=instance_id,json=instanceId,proto3" json:"instance_id,omitempty"` + Config *_struct.Value `protobuf:"bytes,3,opt,name=config,proto3" json:"config,omitempty"` + StartedAt int64 `protobuf:"varint,4,opt,name=started_at,json=startedAt,proto3" json:"started_at,omitempty"` +} + +func (x *InstanceStatus) Reset() { + *x = InstanceStatus{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InstanceStatus) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InstanceStatus) ProtoMessage() {} + +func (x *InstanceStatus) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_proto_msgTypes[9] + 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 InstanceStatus.ProtoReflect.Descriptor instead. +func (*InstanceStatus) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{9} +} + +func (x *InstanceStatus) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *InstanceStatus) GetInstanceId() int32 { + if x != nil { + return x.InstanceId + } + return 0 +} + +func (x *InstanceStatus) GetConfig() *_struct.Value { + if x != nil { + return x.Config + } + return nil +} + +func (x *InstanceStatus) GetStartedAt() int64 { + if x != nil { + return x.StartedAt + } + return 0 +} + +type RpcReturn struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Sequence int64 `protobuf:"varint,1,opt,name=sequence,proto3" json:"sequence,omitempty"` + // Types that are assignable to Return: + // *RpcReturn_PluginNames + // *RpcReturn_PluginInfo + // *RpcReturn_InstanceStatus + Return isRpcReturn_Return `protobuf_oneof:"return"` +} + +func (x *RpcReturn) Reset() { + *x = RpcReturn{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RpcReturn) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RpcReturn) ProtoMessage() {} + +func (x *RpcReturn) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_proto_msgTypes[10] + 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 RpcReturn.ProtoReflect.Descriptor instead. +func (*RpcReturn) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{10} +} + +func (x *RpcReturn) GetSequence() int64 { + if x != nil { + return x.Sequence + } + return 0 +} + +func (m *RpcReturn) GetReturn() isRpcReturn_Return { + if m != nil { + return m.Return + } + return nil +} + +func (x *RpcReturn) GetPluginNames() *PluginNames { + if x, ok := x.GetReturn().(*RpcReturn_PluginNames); ok { + return x.PluginNames + } + return nil +} + +func (x *RpcReturn) GetPluginInfo() *PluginInfo { + if x, ok := x.GetReturn().(*RpcReturn_PluginInfo); ok { + return x.PluginInfo + } + return nil +} + +func (x *RpcReturn) GetInstanceStatus() *InstanceStatus { + if x, ok := x.GetReturn().(*RpcReturn_InstanceStatus); ok { + return x.InstanceStatus + } + return nil +} + +type isRpcReturn_Return interface { + isRpcReturn_Return() +} + +type RpcReturn_PluginNames struct { + PluginNames *PluginNames `protobuf:"bytes,31,opt,name=plugin_names,json=pluginNames,proto3,oneof"` +} + +type RpcReturn_PluginInfo struct { + PluginInfo *PluginInfo `protobuf:"bytes,32,opt,name=plugin_info,json=pluginInfo,proto3,oneof"` +} + +type RpcReturn_InstanceStatus struct { + InstanceStatus *InstanceStatus `protobuf:"bytes,33,opt,name=instance_status,json=instanceStatus,proto3,oneof"` +} + +func (*RpcReturn_PluginNames) isRpcReturn_Return() {} + +func (*RpcReturn_PluginInfo) isRpcReturn_Return() {} + +func (*RpcReturn_InstanceStatus) isRpcReturn_Return() {} + +type KV struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + K string `protobuf:"bytes,1,opt,name=k,proto3" json:"k,omitempty"` + V *_struct.Value `protobuf:"bytes,2,opt,name=v,proto3" json:"v,omitempty"` +} + +func (x *KV) Reset() { + *x = KV{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KV) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KV) ProtoMessage() {} + +func (x *KV) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_proto_msgTypes[11] + 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 KV.ProtoReflect.Descriptor instead. +func (*KV) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{11} +} + +func (x *KV) GetK() string { + if x != nil { + return x.K + } + return "" +} + +func (x *KV) GetV() *_struct.Value { + if x != nil { + return x.V + } + return nil +} + +type Bool struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + V bool `protobuf:"varint,1,opt,name=v,proto3" json:"v,omitempty"` +} + +func (x *Bool) Reset() { + *x = Bool{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Bool) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Bool) ProtoMessage() {} + +func (x *Bool) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_proto_msgTypes[12] + 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 Bool.ProtoReflect.Descriptor instead. +func (*Bool) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{12} +} + +func (x *Bool) GetV() bool { + if x != nil { + return x.V + } + return false +} + +type Int struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + V int32 `protobuf:"varint,1,opt,name=v,proto3" json:"v,omitempty"` +} + +func (x *Int) Reset() { + *x = Int{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Int) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Int) ProtoMessage() {} + +func (x *Int) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_proto_msgTypes[13] + 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 Int.ProtoReflect.Descriptor instead. +func (*Int) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{13} +} + +func (x *Int) GetV() int32 { + if x != nil { + return x.V + } + return 0 +} + +type Number struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + V float64 `protobuf:"fixed64,1,opt,name=v,proto3" json:"v,omitempty"` +} + +func (x *Number) Reset() { + *x = Number{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Number) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Number) ProtoMessage() {} + +func (x *Number) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_proto_msgTypes[14] + 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 Number.ProtoReflect.Descriptor instead. +func (*Number) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{14} +} + +func (x *Number) GetV() float64 { + if x != nil { + return x.V + } + return 0 +} + +type String struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + V string `protobuf:"bytes,1,opt,name=v,proto3" json:"v,omitempty"` +} + +func (x *String) Reset() { + *x = String{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *String) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*String) ProtoMessage() {} + +func (x *String) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_proto_msgTypes[15] + 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 String.ProtoReflect.Descriptor instead. +func (*String) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{15} +} + +func (x *String) GetV() string { + if x != nil { + return x.V + } + return "" +} + +type ExitArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Status int32 `protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"` + Body string `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"` + Headers *_struct.Struct `protobuf:"bytes,3,opt,name=headers,proto3" json:"headers,omitempty"` +} + +func (x *ExitArgs) Reset() { + *x = ExitArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExitArgs) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExitArgs) ProtoMessage() {} + +func (x *ExitArgs) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_proto_msgTypes[16] + 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 ExitArgs.ProtoReflect.Descriptor instead. +func (*ExitArgs) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{16} +} + +func (x *ExitArgs) GetStatus() int32 { + if x != nil { + return x.Status + } + return 0 +} + +func (x *ExitArgs) GetBody() string { + if x != nil { + return x.Body + } + return "" +} + +func (x *ExitArgs) GetHeaders() *_struct.Struct { + if x != nil { + return x.Headers + } + return nil +} + +type ServiceKey struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *ServiceKey) Reset() { + *x = ServiceKey{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ServiceKey) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServiceKey) ProtoMessage() {} + +func (x *ServiceKey) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_proto_msgTypes[17] + 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 ServiceKey.ProtoReflect.Descriptor instead. +func (*ServiceKey) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{17} +} + +func (x *ServiceKey) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type CertificateKey struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *CertificateKey) Reset() { + *x = CertificateKey{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CertificateKey) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CertificateKey) ProtoMessage() {} + +func (x *CertificateKey) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_proto_msgTypes[18] + 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 CertificateKey.ProtoReflect.Descriptor instead. +func (*CertificateKey) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{18} +} + +func (x *CertificateKey) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type Route struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + CreatedAt int64 `protobuf:"varint,2,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + UpdatedAt int64 `protobuf:"varint,3,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` + Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` + Protocols []string `protobuf:"bytes,5,rep,name=protocols,proto3" json:"protocols,omitempty"` + Methods []string `protobuf:"bytes,6,rep,name=methods,proto3" json:"methods,omitempty"` + Hosts []string `protobuf:"bytes,7,rep,name=hosts,proto3" json:"hosts,omitempty"` + Paths []string `protobuf:"bytes,8,rep,name=paths,proto3" json:"paths,omitempty"` + Headers []string `protobuf:"bytes,9,rep,name=headers,proto3" json:"headers,omitempty"` + HttpsRedirectStatusCode int32 `protobuf:"varint,10,opt,name=https_redirect_status_code,json=httpsRedirectStatusCode,proto3" json:"https_redirect_status_code,omitempty"` + RegexPriority int32 `protobuf:"varint,11,opt,name=regex_priority,json=regexPriority,proto3" json:"regex_priority,omitempty"` + StripPath bool `protobuf:"varint,12,opt,name=strip_path,json=stripPath,proto3" json:"strip_path,omitempty"` + PreserveHost bool `protobuf:"varint,13,opt,name=preserve_host,json=preserveHost,proto3" json:"preserve_host,omitempty"` + Snis []string `protobuf:"bytes,14,rep,name=snis,proto3" json:"snis,omitempty"` + Sources []string `protobuf:"bytes,15,rep,name=sources,proto3" json:"sources,omitempty"` + Destinations []string `protobuf:"bytes,16,rep,name=destinations,proto3" json:"destinations,omitempty"` + Tags []string `protobuf:"bytes,17,rep,name=tags,proto3" json:"tags,omitempty"` + Service *ServiceKey `protobuf:"bytes,18,opt,name=service,proto3" json:"service,omitempty"` +} + +func (x *Route) Reset() { + *x = Route{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Route) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Route) ProtoMessage() {} + +func (x *Route) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_proto_msgTypes[19] + 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 Route.ProtoReflect.Descriptor instead. +func (*Route) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{19} +} + +func (x *Route) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Route) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +func (x *Route) GetUpdatedAt() int64 { + if x != nil { + return x.UpdatedAt + } + return 0 +} + +func (x *Route) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Route) GetProtocols() []string { + if x != nil { + return x.Protocols + } + return nil +} + +func (x *Route) GetMethods() []string { + if x != nil { + return x.Methods + } + return nil +} + +func (x *Route) GetHosts() []string { + if x != nil { + return x.Hosts + } + return nil +} + +func (x *Route) GetPaths() []string { + if x != nil { + return x.Paths + } + return nil +} + +func (x *Route) GetHeaders() []string { + if x != nil { + return x.Headers + } + return nil +} + +func (x *Route) GetHttpsRedirectStatusCode() int32 { + if x != nil { + return x.HttpsRedirectStatusCode + } + return 0 +} + +func (x *Route) GetRegexPriority() int32 { + if x != nil { + return x.RegexPriority + } + return 0 +} + +func (x *Route) GetStripPath() bool { + if x != nil { + return x.StripPath + } + return false +} + +func (x *Route) GetPreserveHost() bool { + if x != nil { + return x.PreserveHost + } + return false +} + +func (x *Route) GetSnis() []string { + if x != nil { + return x.Snis + } + return nil +} + +func (x *Route) GetSources() []string { + if x != nil { + return x.Sources + } + return nil +} + +func (x *Route) GetDestinations() []string { + if x != nil { + return x.Destinations + } + return nil +} + +func (x *Route) GetTags() []string { + if x != nil { + return x.Tags + } + return nil +} + +func (x *Route) GetService() *ServiceKey { + if x != nil { + return x.Service + } + return nil +} + +type Service struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + CreatedAt int64 `protobuf:"varint,2,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + UpdatedAt int64 `protobuf:"varint,3,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` + Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` + Retries int32 `protobuf:"varint,5,opt,name=retries,proto3" json:"retries,omitempty"` + Protocol string `protobuf:"bytes,6,opt,name=protocol,proto3" json:"protocol,omitempty"` + Host string `protobuf:"bytes,7,opt,name=host,proto3" json:"host,omitempty"` + Port int32 `protobuf:"varint,8,opt,name=port,proto3" json:"port,omitempty"` + Path string `protobuf:"bytes,9,opt,name=path,proto3" json:"path,omitempty"` + ConnectTimeout int32 `protobuf:"varint,10,opt,name=connect_timeout,json=connectTimeout,proto3" json:"connect_timeout,omitempty"` + WriteTimeout int32 `protobuf:"varint,11,opt,name=write_timeout,json=writeTimeout,proto3" json:"write_timeout,omitempty"` + ReadTimeout int32 `protobuf:"varint,12,opt,name=read_timeout,json=readTimeout,proto3" json:"read_timeout,omitempty"` + Tags []string `protobuf:"bytes,13,rep,name=tags,proto3" json:"tags,omitempty"` + ClientCertificate *CertificateKey `protobuf:"bytes,14,opt,name=client_certificate,json=clientCertificate,proto3" json:"client_certificate,omitempty"` +} + +func (x *Service) Reset() { + *x = Service{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Service) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Service) ProtoMessage() {} + +func (x *Service) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_proto_msgTypes[20] + 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 Service.ProtoReflect.Descriptor instead. +func (*Service) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{20} +} + +func (x *Service) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Service) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +func (x *Service) GetUpdatedAt() int64 { + if x != nil { + return x.UpdatedAt + } + return 0 +} + +func (x *Service) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Service) GetRetries() int32 { + if x != nil { + return x.Retries + } + return 0 +} + +func (x *Service) GetProtocol() string { + if x != nil { + return x.Protocol + } + return "" +} + +func (x *Service) GetHost() string { + if x != nil { + return x.Host + } + return "" +} + +func (x *Service) GetPort() int32 { + if x != nil { + return x.Port + } + return 0 +} + +func (x *Service) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *Service) GetConnectTimeout() int32 { + if x != nil { + return x.ConnectTimeout + } + return 0 +} + +func (x *Service) GetWriteTimeout() int32 { + if x != nil { + return x.WriteTimeout + } + return 0 +} + +func (x *Service) GetReadTimeout() int32 { + if x != nil { + return x.ReadTimeout + } + return 0 +} + +func (x *Service) GetTags() []string { + if x != nil { + return x.Tags + } + return nil +} + +func (x *Service) GetClientCertificate() *CertificateKey { + if x != nil { + return x.ClientCertificate + } + return nil +} + +type Target struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` + Port int32 `protobuf:"varint,2,opt,name=port,proto3" json:"port,omitempty"` +} + +func (x *Target) Reset() { + *x = Target{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Target) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Target) ProtoMessage() {} + +func (x *Target) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_proto_msgTypes[21] + 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 Target.ProtoReflect.Descriptor instead. +func (*Target) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{21} +} + +func (x *Target) GetHost() string { + if x != nil { + return x.Host + } + return "" +} + +func (x *Target) GetPort() int32 { + if x != nil { + return x.Port + } + return 0 +} + +type ConsumerSpec struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + ByUsername bool `protobuf:"varint,2,opt,name=by_username,json=byUsername,proto3" json:"by_username,omitempty"` +} + +func (x *ConsumerSpec) Reset() { + *x = ConsumerSpec{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConsumerSpec) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConsumerSpec) ProtoMessage() {} + +func (x *ConsumerSpec) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_proto_msgTypes[22] + 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 ConsumerSpec.ProtoReflect.Descriptor instead. +func (*ConsumerSpec) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{22} +} + +func (x *ConsumerSpec) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *ConsumerSpec) GetByUsername() bool { + if x != nil { + return x.ByUsername + } + return false +} + +type Consumer struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + CreatedAt int64 `protobuf:"varint,2,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + Username string `protobuf:"bytes,3,opt,name=username,proto3" json:"username,omitempty"` + CustomId string `protobuf:"bytes,4,opt,name=custom_id,json=customId,proto3" json:"custom_id,omitempty"` + Tags []string `protobuf:"bytes,5,rep,name=tags,proto3" json:"tags,omitempty"` +} + +func (x *Consumer) Reset() { + *x = Consumer{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Consumer) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Consumer) ProtoMessage() {} + +func (x *Consumer) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_proto_msgTypes[23] + 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 Consumer.ProtoReflect.Descriptor instead. +func (*Consumer) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{23} +} + +func (x *Consumer) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Consumer) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +func (x *Consumer) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *Consumer) GetCustomId() string { + if x != nil { + return x.CustomId + } + return "" +} + +func (x *Consumer) GetTags() []string { + if x != nil { + return x.Tags + } + return nil +} + +type AuthenticatedCredential struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + ConsumerId string `protobuf:"bytes,2,opt,name=consumer_id,json=consumerId,proto3" json:"consumer_id,omitempty"` +} + +func (x *AuthenticatedCredential) Reset() { + *x = AuthenticatedCredential{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AuthenticatedCredential) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthenticatedCredential) ProtoMessage() {} + +func (x *AuthenticatedCredential) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_proto_msgTypes[24] + 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 AuthenticatedCredential.ProtoReflect.Descriptor instead. +func (*AuthenticatedCredential) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{24} +} + +func (x *AuthenticatedCredential) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *AuthenticatedCredential) GetConsumerId() string { + if x != nil { + return x.ConsumerId + } + return "" +} + +type AuthenticateArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Consumer *Consumer `protobuf:"bytes,1,opt,name=consumer,proto3" json:"consumer,omitempty"` + Credential *AuthenticatedCredential `protobuf:"bytes,2,opt,name=credential,proto3" json:"credential,omitempty"` +} + +func (x *AuthenticateArgs) Reset() { + *x = AuthenticateArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AuthenticateArgs) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthenticateArgs) ProtoMessage() {} + +func (x *AuthenticateArgs) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_proto_msgTypes[25] + 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 AuthenticateArgs.ProtoReflect.Descriptor instead. +func (*AuthenticateArgs) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{25} +} + +func (x *AuthenticateArgs) GetConsumer() *Consumer { + if x != nil { + return x.Consumer + } + return nil +} + +func (x *AuthenticateArgs) GetCredential() *AuthenticatedCredential { + if x != nil { + return x.Credential + } + return nil +} + +type MemoryStats struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + LuaSharedDicts *MemoryStats_LuaSharedDicts `protobuf:"bytes,1,opt,name=lua_shared_dicts,json=luaSharedDicts,proto3" json:"lua_shared_dicts,omitempty"` + WorkersLuaVms []*MemoryStats_WorkerLuaVm `protobuf:"bytes,2,rep,name=workers_lua_vms,json=workersLuaVms,proto3" json:"workers_lua_vms,omitempty"` +} + +func (x *MemoryStats) Reset() { + *x = MemoryStats{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MemoryStats) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemoryStats) ProtoMessage() {} + +func (x *MemoryStats) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_proto_msgTypes[26] + 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 MemoryStats.ProtoReflect.Descriptor instead. +func (*MemoryStats) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{26} +} + +func (x *MemoryStats) GetLuaSharedDicts() *MemoryStats_LuaSharedDicts { + if x != nil { + return x.LuaSharedDicts + } + return nil +} + +func (x *MemoryStats) GetWorkersLuaVms() []*MemoryStats_WorkerLuaVm { + if x != nil { + return x.WorkersLuaVms + } + return nil +} + +type StringMap struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + M map[string]string `protobuf:"bytes,1,rep,name=m,proto3" json:"m,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *StringMap) Reset() { + *x = StringMap{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StringMap) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StringMap) ProtoMessage() {} + +func (x *StringMap) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_proto_msgTypes[27] + 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 StringMap.ProtoReflect.Descriptor instead. +func (*StringMap) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{27} +} + +func (x *StringMap) GetM() map[string]string { + if x != nil { + return x.M + } + return nil +} + +type PdkArg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Data: + // *PdkArg_B + // *PdkArg_I + // *PdkArg_F + // *PdkArg_S + // *PdkArg_M + // *PdkArg_Error + // *PdkArg_Credential + // *PdkArg_Route + // *PdkArg_Service + // *PdkArg_Consumer + // *PdkArg_MemoryStats + Data isPdkArg_Data `protobuf_oneof:"data"` +} + +func (x *PdkArg) Reset() { + *x = PdkArg{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PdkArg) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PdkArg) ProtoMessage() {} + +func (x *PdkArg) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_proto_msgTypes[28] + 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 PdkArg.ProtoReflect.Descriptor instead. +func (*PdkArg) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{28} +} + +func (m *PdkArg) GetData() isPdkArg_Data { + if m != nil { + return m.Data + } + return nil +} + +func (x *PdkArg) GetB() bool { + if x, ok := x.GetData().(*PdkArg_B); ok { + return x.B + } + return false +} + +func (x *PdkArg) GetI() int64 { + if x, ok := x.GetData().(*PdkArg_I); ok { + return x.I + } + return 0 +} + +func (x *PdkArg) GetF() float64 { + if x, ok := x.GetData().(*PdkArg_F); ok { + return x.F + } + return 0 +} + +func (x *PdkArg) GetS() string { + if x, ok := x.GetData().(*PdkArg_S); ok { + return x.S + } + return "" +} + +func (x *PdkArg) GetM() *StringMap { + if x, ok := x.GetData().(*PdkArg_M); ok { + return x.M + } + return nil +} + +func (x *PdkArg) GetError() string { + if x, ok := x.GetData().(*PdkArg_Error); ok { + return x.Error + } + return "" +} + +func (x *PdkArg) GetCredential() *AuthenticatedCredential { + if x, ok := x.GetData().(*PdkArg_Credential); ok { + return x.Credential + } + return nil +} + +func (x *PdkArg) GetRoute() *Route { + if x, ok := x.GetData().(*PdkArg_Route); ok { + return x.Route + } + return nil +} + +func (x *PdkArg) GetService() *Service { + if x, ok := x.GetData().(*PdkArg_Service); ok { + return x.Service + } + return nil +} + +func (x *PdkArg) GetConsumer() *Consumer { + if x, ok := x.GetData().(*PdkArg_Consumer); ok { + return x.Consumer + } + return nil +} + +func (x *PdkArg) GetMemoryStats() *MemoryStats { + if x, ok := x.GetData().(*PdkArg_MemoryStats); ok { + return x.MemoryStats + } + return nil +} + +type isPdkArg_Data interface { + isPdkArg_Data() +} + +type PdkArg_B struct { + B bool `protobuf:"varint,31,opt,name=b,proto3,oneof"` +} + +type PdkArg_I struct { + I int64 `protobuf:"varint,32,opt,name=i,proto3,oneof"` +} + +type PdkArg_F struct { + F float64 `protobuf:"fixed64,33,opt,name=f,proto3,oneof"` +} + +type PdkArg_S struct { + S string `protobuf:"bytes,34,opt,name=s,proto3,oneof"` +} + +type PdkArg_M struct { + M *StringMap `protobuf:"bytes,35,opt,name=m,proto3,oneof"` +} + +type PdkArg_Error struct { + Error string `protobuf:"bytes,36,opt,name=error,proto3,oneof"` +} + +type PdkArg_Credential struct { + Credential *AuthenticatedCredential `protobuf:"bytes,40,opt,name=credential,proto3,oneof"` +} + +type PdkArg_Route struct { + Route *Route `protobuf:"bytes,41,opt,name=route,proto3,oneof"` +} + +type PdkArg_Service struct { + Service *Service `protobuf:"bytes,42,opt,name=service,proto3,oneof"` +} + +type PdkArg_Consumer struct { + Consumer *Consumer `protobuf:"bytes,43,opt,name=consumer,proto3,oneof"` +} + +type PdkArg_MemoryStats struct { + MemoryStats *MemoryStats `protobuf:"bytes,44,opt,name=memory_stats,json=memoryStats,proto3,oneof"` +} + +func (*PdkArg_B) isPdkArg_Data() {} + +func (*PdkArg_I) isPdkArg_Data() {} + +func (*PdkArg_F) isPdkArg_Data() {} + +func (*PdkArg_S) isPdkArg_Data() {} + +func (*PdkArg_M) isPdkArg_Data() {} + +func (*PdkArg_Error) isPdkArg_Data() {} + +func (*PdkArg_Credential) isPdkArg_Data() {} + +func (*PdkArg_Route) isPdkArg_Data() {} + +func (*PdkArg_Service) isPdkArg_Data() {} + +func (*PdkArg_Consumer) isPdkArg_Data() {} + +func (*PdkArg_MemoryStats) isPdkArg_Data() {} + +type PdkCall struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Sequence int64 `protobuf:"varint,1,opt,name=sequence,proto3" json:"sequence,omitempty"` + EventId int64 `protobuf:"varint,2,opt,name=event_id,json=eventId,proto3" json:"event_id,omitempty"` + Cmd string `protobuf:"bytes,3,opt,name=cmd,proto3" json:"cmd,omitempty"` + Args []*PdkArg `protobuf:"bytes,31,rep,name=args,proto3" json:"args,omitempty"` +} + +func (x *PdkCall) Reset() { + *x = PdkCall{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PdkCall) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PdkCall) ProtoMessage() {} + +func (x *PdkCall) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_proto_msgTypes[29] + 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 PdkCall.ProtoReflect.Descriptor instead. +func (*PdkCall) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{29} +} + +func (x *PdkCall) GetSequence() int64 { + if x != nil { + return x.Sequence + } + return 0 +} + +func (x *PdkCall) GetEventId() int64 { + if x != nil { + return x.EventId + } + return 0 +} + +func (x *PdkCall) GetCmd() string { + if x != nil { + return x.Cmd + } + return "" +} + +func (x *PdkCall) GetArgs() []*PdkArg { + if x != nil { + return x.Args + } + return nil +} + +type PdkReturn struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Sequence int64 `protobuf:"varint,1,opt,name=sequence,proto3" json:"sequence,omitempty"` + EventId int64 `protobuf:"varint,2,opt,name=event_id,json=eventId,proto3" json:"event_id,omitempty"` + Cmd string `protobuf:"bytes,3,opt,name=cmd,proto3" json:"cmd,omitempty"` + Arg *PdkArg `protobuf:"bytes,31,opt,name=arg,proto3" json:"arg,omitempty"` +} + +func (x *PdkReturn) Reset() { + *x = PdkReturn{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PdkReturn) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PdkReturn) ProtoMessage() {} + +func (x *PdkReturn) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_proto_msgTypes[30] + 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 PdkReturn.ProtoReflect.Descriptor instead. +func (*PdkReturn) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{30} +} + +func (x *PdkReturn) GetSequence() int64 { + if x != nil { + return x.Sequence + } + return 0 +} + +func (x *PdkReturn) GetEventId() int64 { + if x != nil { + return x.EventId + } + return 0 +} + +func (x *PdkReturn) GetCmd() string { + if x != nil { + return x.Cmd + } + return "" +} + +func (x *PdkReturn) GetArg() *PdkArg { + if x != nil { + return x.Arg + } + return nil +} + +type MemoryStats_LuaSharedDicts struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Kong *MemoryStats_LuaSharedDicts_DictStats `protobuf:"bytes,1,opt,name=kong,proto3" json:"kong,omitempty"` + KongDbCache *MemoryStats_LuaSharedDicts_DictStats `protobuf:"bytes,2,opt,name=kong_db_cache,json=kongDbCache,proto3" json:"kong_db_cache,omitempty"` +} + +func (x *MemoryStats_LuaSharedDicts) Reset() { + *x = MemoryStats_LuaSharedDicts{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MemoryStats_LuaSharedDicts) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemoryStats_LuaSharedDicts) ProtoMessage() {} + +func (x *MemoryStats_LuaSharedDicts) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_proto_msgTypes[31] + 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 MemoryStats_LuaSharedDicts.ProtoReflect.Descriptor instead. +func (*MemoryStats_LuaSharedDicts) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{26, 0} +} + +func (x *MemoryStats_LuaSharedDicts) GetKong() *MemoryStats_LuaSharedDicts_DictStats { + if x != nil { + return x.Kong + } + return nil +} + +func (x *MemoryStats_LuaSharedDicts) GetKongDbCache() *MemoryStats_LuaSharedDicts_DictStats { + if x != nil { + return x.KongDbCache + } + return nil +} + +type MemoryStats_WorkerLuaVm struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + HttpAllocatedGc int64 `protobuf:"varint,1,opt,name=http_allocated_gc,json=httpAllocatedGc,proto3" json:"http_allocated_gc,omitempty"` + Pid int64 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"` +} + +func (x *MemoryStats_WorkerLuaVm) Reset() { + *x = MemoryStats_WorkerLuaVm{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MemoryStats_WorkerLuaVm) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemoryStats_WorkerLuaVm) ProtoMessage() {} + +func (x *MemoryStats_WorkerLuaVm) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_proto_msgTypes[32] + 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 MemoryStats_WorkerLuaVm.ProtoReflect.Descriptor instead. +func (*MemoryStats_WorkerLuaVm) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{26, 1} +} + +func (x *MemoryStats_WorkerLuaVm) GetHttpAllocatedGc() int64 { + if x != nil { + return x.HttpAllocatedGc + } + return 0 +} + +func (x *MemoryStats_WorkerLuaVm) GetPid() int64 { + if x != nil { + return x.Pid + } + return 0 +} + +type MemoryStats_LuaSharedDicts_DictStats struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AllocatedSlabs int64 `protobuf:"varint,1,opt,name=allocated_slabs,json=allocatedSlabs,proto3" json:"allocated_slabs,omitempty"` + Capacity int64 `protobuf:"varint,2,opt,name=capacity,proto3" json:"capacity,omitempty"` +} + +func (x *MemoryStats_LuaSharedDicts_DictStats) Reset() { + *x = MemoryStats_LuaSharedDicts_DictStats{} + if protoimpl.UnsafeEnabled { + mi := &file_pluginsocket_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MemoryStats_LuaSharedDicts_DictStats) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemoryStats_LuaSharedDicts_DictStats) ProtoMessage() {} + +func (x *MemoryStats_LuaSharedDicts_DictStats) ProtoReflect() protoreflect.Message { + mi := &file_pluginsocket_proto_msgTypes[33] + 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 MemoryStats_LuaSharedDicts_DictStats.ProtoReflect.Descriptor instead. +func (*MemoryStats_LuaSharedDicts_DictStats) Descriptor() ([]byte, []int) { + return file_pluginsocket_proto_rawDescGZIP(), []int{26, 0, 0} +} + +func (x *MemoryStats_LuaSharedDicts_DictStats) GetAllocatedSlabs() int64 { + if x != nil { + return x.AllocatedSlabs + } + return 0 +} + +func (x *MemoryStats_LuaSharedDicts_DictStats) GetCapacity() int64 { + if x != nil { + return x.Capacity + } + return 0 +} + +var file_pluginsocket_proto_extTypes = []protoimpl.ExtensionInfo{ + { + ExtendedType: (*descriptor.MethodOptions)(nil), + ExtensionType: (*string)(nil), + Field: 50007, + Name: "kong_plugin_protocol.MethodName", + Tag: "bytes,50007,opt,name=MethodName", + Filename: "pluginsocket.proto", + }, +} + +// Extension fields to descriptor.MethodOptions. +var ( + // optional string MethodName = 50007; + E_MethodName = &file_pluginsocket_proto_extTypes[0] +) + +var File_pluginsocket_proto protoreflect.FileDescriptor + +var file_pluginsocket_proto_rawDesc = []byte{ + 0x0a, 0x12, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, + 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 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, 0x13, 0x0a, 0x11, 0x43, 0x6d, 0x64, 0x47, 0x65, + 0x74, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x22, 0x26, 0x0a, 0x10, + 0x43, 0x6d, 0x64, 0x47, 0x65, 0x74, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x3e, 0x0a, 0x10, 0x43, 0x6d, 0x64, 0x53, 0x74, 0x61, 0x72, 0x74, + 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, + 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x63, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x22, 0x37, 0x0a, 0x14, 0x43, 0x6d, 0x64, 0x47, 0x65, 0x74, 0x49, 0x6e, + 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1f, 0x0a, 0x0b, + 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x22, 0x33, 0x0a, + 0x10, 0x43, 0x6d, 0x64, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, + 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, + 0x49, 0x64, 0x22, 0x50, 0x0a, 0x0e, 0x43, 0x6d, 0x64, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, + 0x6e, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x65, 0x76, 0x65, 0x6e, 0x74, + 0x4e, 0x61, 0x6d, 0x65, 0x22, 0xc9, 0x04, 0x0a, 0x07, 0x52, 0x70, 0x63, 0x43, 0x61, 0x6c, 0x6c, + 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x5a, 0x0a, 0x14, + 0x63, 0x6d, 0x64, 0x5f, 0x67, 0x65, 0x74, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x73, 0x18, 0x1f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6b, 0x6f, 0x6e, + 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, + 0x6c, 0x2e, 0x43, 0x6d, 0x64, 0x47, 0x65, 0x74, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x4e, 0x61, + 0x6d, 0x65, 0x73, 0x48, 0x00, 0x52, 0x11, 0x63, 0x6d, 0x64, 0x47, 0x65, 0x74, 0x50, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x57, 0x0a, 0x13, 0x63, 0x6d, 0x64, 0x5f, + 0x67, 0x65, 0x74, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, + 0x20, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x43, 0x6d, 0x64, + 0x47, 0x65, 0x74, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, + 0x10, 0x63, 0x6d, 0x64, 0x47, 0x65, 0x74, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x49, 0x6e, 0x66, + 0x6f, 0x12, 0x56, 0x0a, 0x12, 0x63, 0x6d, 0x64, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x69, + 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x21, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, + 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x43, 0x6d, 0x64, 0x53, 0x74, 0x61, 0x72, 0x74, 0x49, 0x6e, 0x73, + 0x74, 0x61, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52, 0x10, 0x63, 0x6d, 0x64, 0x53, 0x74, 0x61, 0x72, + 0x74, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x63, 0x0a, 0x17, 0x63, 0x6d, 0x64, + 0x5f, 0x67, 0x65, 0x74, 0x5f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x73, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x18, 0x22, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6b, 0x6f, 0x6e, + 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, + 0x6c, 0x2e, 0x43, 0x6d, 0x64, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x48, 0x00, 0x52, 0x14, 0x63, 0x6d, 0x64, 0x47, 0x65, 0x74, + 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x56, + 0x0a, 0x12, 0x63, 0x6d, 0x64, 0x5f, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x5f, 0x69, 0x6e, 0x73, 0x74, + 0x61, 0x6e, 0x63, 0x65, 0x18, 0x23, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6b, 0x6f, 0x6e, + 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, + 0x6c, 0x2e, 0x43, 0x6d, 0x64, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, + 0x63, 0x65, 0x48, 0x00, 0x52, 0x10, 0x63, 0x6d, 0x64, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x49, 0x6e, + 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x50, 0x0a, 0x10, 0x63, 0x6d, 0x64, 0x5f, 0x68, 0x61, + 0x6e, 0x64, 0x6c, 0x65, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x18, 0x24, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x24, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x43, 0x6d, 0x64, 0x48, 0x61, 0x6e, 0x64, 0x6c, + 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x0e, 0x63, 0x6d, 0x64, 0x48, 0x61, 0x6e, + 0x64, 0x6c, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x06, 0x0a, 0x04, 0x63, 0x61, 0x6c, 0x6c, + 0x22, 0x23, 0x0a, 0x0b, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x12, + 0x14, 0x0a, 0x05, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, + 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x22, 0xc2, 0x01, 0x0a, 0x0a, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x75, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x6f, 0x61, 0x64, 0x65, + 0x64, 0x5f, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6c, 0x6f, 0x61, 0x64, + 0x65, 0x64, 0x41, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x68, 0x61, 0x73, 0x65, 0x73, 0x18, 0x04, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x70, 0x68, 0x61, 0x73, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, + 0x74, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, + 0x74, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x07, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x22, 0x94, 0x01, 0x0a, 0x0e, 0x49, + 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x69, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, + 0x49, 0x64, 0x12, 0x2e, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x41, + 0x74, 0x22, 0x8f, 0x02, 0x0a, 0x09, 0x52, 0x70, 0x63, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x12, + 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x46, 0x0a, 0x0c, 0x70, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x1f, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x21, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x4e, + 0x61, 0x6d, 0x65, 0x73, 0x48, 0x00, 0x52, 0x0b, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x4e, 0x61, + 0x6d, 0x65, 0x73, 0x12, 0x43, 0x0a, 0x0b, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x69, 0x6e, + 0x66, 0x6f, 0x18, 0x20, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, + 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, + 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x0a, 0x70, 0x6c, + 0x75, 0x67, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x4f, 0x0a, 0x0f, 0x69, 0x6e, 0x73, 0x74, + 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x21, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x24, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, + 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x48, 0x00, 0x52, 0x0e, 0x69, 0x6e, 0x73, 0x74, 0x61, + 0x6e, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x08, 0x0a, 0x06, 0x72, 0x65, 0x74, + 0x75, 0x72, 0x6e, 0x22, 0x38, 0x0a, 0x02, 0x4b, 0x56, 0x12, 0x0c, 0x0a, 0x01, 0x6b, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x6b, 0x12, 0x24, 0x0a, 0x01, 0x76, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x01, 0x76, 0x22, 0x14, 0x0a, + 0x04, 0x42, 0x6f, 0x6f, 0x6c, 0x12, 0x0c, 0x0a, 0x01, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x01, 0x76, 0x22, 0x13, 0x0a, 0x03, 0x49, 0x6e, 0x74, 0x12, 0x0c, 0x0a, 0x01, 0x76, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x76, 0x22, 0x16, 0x0a, 0x06, 0x4e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x12, 0x0c, 0x0a, 0x01, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x01, 0x76, + 0x22, 0x16, 0x0a, 0x06, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x0c, 0x0a, 0x01, 0x76, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x76, 0x22, 0x69, 0x0a, 0x08, 0x45, 0x78, 0x69, 0x74, + 0x41, 0x72, 0x67, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, + 0x62, 0x6f, 0x64, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, + 0x12, 0x31, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x73, 0x22, 0x1c, 0x0a, 0x0a, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4b, 0x65, + 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, + 0x64, 0x22, 0x20, 0x0a, 0x0e, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, + 0x4b, 0x65, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x02, 0x69, 0x64, 0x22, 0xb1, 0x04, 0x0a, 0x05, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1d, 0x0a, + 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1d, 0x0a, 0x0a, + 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x1c, 0x0a, 0x09, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x73, 0x18, 0x05, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x73, 0x12, 0x18, 0x0a, + 0x07, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, + 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x68, 0x6f, 0x73, 0x74, 0x73, + 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x12, 0x14, 0x0a, + 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x70, 0x61, + 0x74, 0x68, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x09, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x3b, 0x0a, + 0x1a, 0x68, 0x74, 0x74, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x5f, + 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x17, 0x68, 0x74, 0x74, 0x70, 0x73, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, + 0x67, 0x65, 0x78, 0x5f, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x0b, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x0d, 0x72, 0x65, 0x67, 0x65, 0x78, 0x50, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, + 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x72, 0x69, 0x70, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, + 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x73, 0x74, 0x72, 0x69, 0x70, 0x50, 0x61, 0x74, 0x68, + 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5f, 0x68, 0x6f, 0x73, + 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x70, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x48, 0x6f, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x6e, 0x69, 0x73, 0x18, 0x0e, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x04, 0x73, 0x6e, 0x69, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x73, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x18, 0x10, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x65, 0x73, 0x74, 0x69, + 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, + 0x11, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x3a, 0x0a, 0x07, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x12, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6b, + 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x07, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x22, 0xb7, 0x03, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, + 0x41, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, + 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x74, 0x72, 0x69, 0x65, 0x73, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x65, 0x74, 0x72, 0x69, 0x65, 0x73, 0x12, + 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x68, + 0x6f, 0x73, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, + 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, + 0x6f, 0x72, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x09, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x27, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x0e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, + 0x12, 0x23, 0x0a, 0x0d, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, + 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x77, 0x72, 0x69, 0x74, 0x65, 0x54, 0x69, + 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x74, 0x69, + 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x72, 0x65, 0x61, + 0x64, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, + 0x18, 0x0d, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x53, 0x0a, 0x12, + 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, + 0x74, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, + 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, + 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x11, + 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, + 0x65, 0x22, 0x30, 0x0a, 0x06, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x68, + 0x6f, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, + 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, + 0x6f, 0x72, 0x74, 0x22, 0x3f, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x53, + 0x70, 0x65, 0x63, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x79, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x62, 0x79, 0x55, 0x73, 0x65, 0x72, + 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x86, 0x01, 0x0a, 0x08, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, + 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, + 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, + 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, + 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, + 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x22, 0x4a, 0x0a, + 0x17, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x43, 0x72, + 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x6f, 0x6e, 0x73, + 0x75, 0x6d, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, + 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x49, 0x64, 0x22, 0x9d, 0x01, 0x0a, 0x10, 0x41, 0x75, + 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x12, 0x3a, + 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1e, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, + 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x12, 0x4d, 0x0a, 0x0a, 0x63, 0x72, + 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, + 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, + 0x74, 0x65, 0x64, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x52, 0x0a, 0x63, + 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0xa2, 0x04, 0x0a, 0x0b, 0x4d, 0x65, + 0x6d, 0x6f, 0x72, 0x79, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x5a, 0x0a, 0x10, 0x6c, 0x75, 0x61, + 0x5f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x5f, 0x64, 0x69, 0x63, 0x74, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x72, + 0x79, 0x53, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x4c, 0x75, 0x61, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, + 0x44, 0x69, 0x63, 0x74, 0x73, 0x52, 0x0e, 0x6c, 0x75, 0x61, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, + 0x44, 0x69, 0x63, 0x74, 0x73, 0x12, 0x55, 0x0a, 0x0f, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x73, + 0x5f, 0x6c, 0x75, 0x61, 0x5f, 0x76, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, + 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x53, 0x74, 0x61, 0x74, + 0x73, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x4c, 0x75, 0x61, 0x56, 0x6d, 0x52, 0x0d, 0x77, + 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x73, 0x4c, 0x75, 0x61, 0x56, 0x6d, 0x73, 0x1a, 0x92, 0x02, 0x0a, + 0x0e, 0x4c, 0x75, 0x61, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x44, 0x69, 0x63, 0x74, 0x73, 0x12, + 0x4e, 0x0a, 0x04, 0x6b, 0x6f, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3a, 0x2e, + 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x53, 0x74, 0x61, 0x74, 0x73, + 0x2e, 0x4c, 0x75, 0x61, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x44, 0x69, 0x63, 0x74, 0x73, 0x2e, + 0x44, 0x69, 0x63, 0x74, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x04, 0x6b, 0x6f, 0x6e, 0x67, 0x12, + 0x5e, 0x0a, 0x0d, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x64, 0x62, 0x5f, 0x63, 0x61, 0x63, 0x68, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3a, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, + 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x4d, 0x65, + 0x6d, 0x6f, 0x72, 0x79, 0x53, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x4c, 0x75, 0x61, 0x53, 0x68, 0x61, + 0x72, 0x65, 0x64, 0x44, 0x69, 0x63, 0x74, 0x73, 0x2e, 0x44, 0x69, 0x63, 0x74, 0x53, 0x74, 0x61, + 0x74, 0x73, 0x52, 0x0b, 0x6b, 0x6f, 0x6e, 0x67, 0x44, 0x62, 0x43, 0x61, 0x63, 0x68, 0x65, 0x1a, + 0x50, 0x0a, 0x09, 0x44, 0x69, 0x63, 0x74, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x27, 0x0a, 0x0f, + 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x6c, 0x61, 0x62, 0x73, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x65, 0x64, + 0x53, 0x6c, 0x61, 0x62, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, + 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, + 0x79, 0x1a, 0x4b, 0x0a, 0x0b, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x4c, 0x75, 0x61, 0x56, 0x6d, + 0x12, 0x2a, 0x0a, 0x11, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, + 0x65, 0x64, 0x5f, 0x67, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x68, 0x74, 0x74, + 0x70, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x65, 0x64, 0x47, 0x63, 0x12, 0x10, 0x0a, 0x03, + 0x70, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x70, 0x69, 0x64, 0x22, 0x77, + 0x0a, 0x09, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x70, 0x12, 0x34, 0x0a, 0x01, 0x6d, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, + 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x74, + 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x70, 0x2e, 0x4d, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x01, + 0x6d, 0x1a, 0x34, 0x0a, 0x06, 0x4d, 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, 0x22, 0xe0, 0x03, 0x0a, 0x06, 0x50, 0x64, 0x6b, 0x41, + 0x72, 0x67, 0x12, 0x0e, 0x0a, 0x01, 0x62, 0x18, 0x1f, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, + 0x01, 0x62, 0x12, 0x0e, 0x0a, 0x01, 0x69, 0x18, 0x20, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, + 0x01, 0x69, 0x12, 0x0e, 0x0a, 0x01, 0x66, 0x18, 0x21, 0x20, 0x01, 0x28, 0x01, 0x48, 0x00, 0x52, + 0x01, 0x66, 0x12, 0x0e, 0x0a, 0x01, 0x73, 0x18, 0x22, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, + 0x01, 0x73, 0x12, 0x2f, 0x0a, 0x01, 0x6d, 0x18, 0x23, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, + 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x70, 0x48, 0x00, + 0x52, 0x01, 0x6d, 0x12, 0x16, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x24, 0x20, 0x01, + 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x4f, 0x0a, 0x0a, 0x63, + 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x18, 0x28, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x2d, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, + 0x61, 0x74, 0x65, 0x64, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x48, 0x00, + 0x52, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x12, 0x33, 0x0a, 0x05, + 0x72, 0x6f, 0x75, 0x74, 0x65, 0x18, 0x29, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6b, 0x6f, + 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, + 0x6f, 0x6c, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x48, 0x00, 0x52, 0x05, 0x72, 0x6f, 0x75, 0x74, + 0x65, 0x12, 0x39, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x2a, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x48, 0x00, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3c, 0x0a, 0x08, + 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x18, 0x2b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, + 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x48, 0x00, + 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x12, 0x46, 0x0a, 0x0c, 0x6d, 0x65, + 0x6d, 0x6f, 0x72, 0x79, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x73, 0x18, 0x2c, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x21, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x53, 0x74, + 0x61, 0x74, 0x73, 0x48, 0x00, 0x52, 0x0b, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x53, 0x74, 0x61, + 0x74, 0x73, 0x42, 0x06, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x84, 0x01, 0x0a, 0x07, 0x50, + 0x64, 0x6b, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, + 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, + 0x63, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x10, 0x0a, + 0x03, 0x63, 0x6d, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, 0x6d, 0x64, 0x12, + 0x30, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x1f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, + 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x50, 0x64, 0x6b, 0x41, 0x72, 0x67, 0x52, 0x04, 0x61, 0x72, 0x67, + 0x73, 0x22, 0x84, 0x01, 0x0a, 0x09, 0x50, 0x64, 0x6b, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x12, + 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x65, + 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x65, + 0x76, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x6d, 0x64, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, 0x6d, 0x64, 0x12, 0x2e, 0x0a, 0x03, 0x61, 0x72, 0x67, 0x18, + 0x1f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x50, 0x64, 0x6b, + 0x41, 0x72, 0x67, 0x52, 0x03, 0x61, 0x72, 0x67, 0x32, 0xfd, 0x2b, 0x0a, 0x04, 0x4b, 0x6f, 0x6e, + 0x67, 0x12, 0x44, 0x0a, 0x0c, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x47, 0x65, 0x74, 0x49, + 0x70, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, + 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, + 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x4d, 0x0a, 0x15, 0x43, 0x6c, 0x69, 0x65, 0x6e, + 0x74, 0x5f, 0x47, 0x65, 0x74, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x64, 0x49, 0x70, + 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, + 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, + 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x43, 0x0a, 0x0e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, + 0x5f, 0x47, 0x65, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, + 0x1a, 0x19, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x49, 0x6e, 0x74, 0x12, 0x4c, 0x0a, 0x17, 0x43, + 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x47, 0x65, 0x74, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, + 0x65, 0x64, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x19, + 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x49, 0x6e, 0x74, 0x12, 0x5d, 0x0a, 0x14, 0x43, 0x6c, 0x69, + 0x65, 0x6e, 0x74, 0x5f, 0x47, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, + 0x6c, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x2d, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, + 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, + 0x2e, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x43, 0x72, + 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x12, 0x59, 0x0a, 0x13, 0x43, 0x6c, 0x69, 0x65, + 0x6e, 0x74, 0x5f, 0x4c, 0x6f, 0x61, 0x64, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x12, + 0x22, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x53, + 0x70, 0x65, 0x63, 0x1a, 0x1e, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x75, + 0x6d, 0x65, 0x72, 0x12, 0x4c, 0x0a, 0x12, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x47, 0x65, + 0x74, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, + 0x79, 0x1a, 0x1e, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, + 0x72, 0x12, 0x55, 0x0a, 0x13, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x41, 0x75, 0x74, 0x68, + 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x26, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, + 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, + 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, + 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x4e, 0x0a, 0x12, 0x43, 0x6c, 0x69, 0x65, + 0x6e, 0x74, 0x5f, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x1a, + 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x1a, 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, + 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, + 0x6c, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x5a, 0x0a, 0x0d, 0x43, 0x74, 0x78, 0x5f, + 0x53, 0x65, 0x74, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x12, 0x18, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, + 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, + 0x2e, 0x4b, 0x56, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x17, 0xba, 0xb5, 0x18, + 0x13, 0x6b, 0x6f, 0x6e, 0x67, 0x2e, 0x63, 0x74, 0x78, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, + 0x2e, 0x73, 0x65, 0x74, 0x12, 0x5e, 0x0a, 0x0d, 0x43, 0x74, 0x78, 0x5f, 0x47, 0x65, 0x74, 0x53, + 0x68, 0x61, 0x72, 0x65, 0x64, 0x12, 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x17, 0xba, 0xb5, 0x18, + 0x13, 0x6b, 0x6f, 0x6e, 0x67, 0x2e, 0x63, 0x74, 0x78, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, + 0x2e, 0x67, 0x65, 0x74, 0x12, 0x48, 0x0a, 0x0c, 0x49, 0x70, 0x5f, 0x49, 0x73, 0x54, 0x72, 0x75, + 0x73, 0x74, 0x65, 0x64, 0x12, 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, + 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x74, 0x72, 0x69, + 0x6e, 0x67, 0x1a, 0x1a, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x12, 0x3f, + 0x0a, 0x09, 0x4c, 0x6f, 0x67, 0x5f, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x12, 0x1a, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, + 0x3e, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x5f, 0x43, 0x72, 0x69, 0x74, 0x12, 0x1a, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, + 0x3d, 0x0a, 0x07, 0x4c, 0x6f, 0x67, 0x5f, 0x45, 0x72, 0x72, 0x12, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x3e, + 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x5f, 0x57, 0x61, 0x72, 0x6e, 0x12, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x40, + 0x0a, 0x0a, 0x4c, 0x6f, 0x67, 0x5f, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x12, 0x1a, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4c, + 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, + 0x12, 0x3e, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x5f, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1a, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4c, + 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, + 0x12, 0x3f, 0x0a, 0x09, 0x4c, 0x6f, 0x67, 0x5f, 0x44, 0x65, 0x62, 0x75, 0x67, 0x12, 0x1a, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, + 0x79, 0x12, 0x49, 0x0a, 0x15, 0x4c, 0x6f, 0x67, 0x5f, 0x53, 0x65, 0x74, 0x53, 0x65, 0x72, 0x69, + 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x18, 0x2e, 0x6b, 0x6f, 0x6e, + 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, + 0x6c, 0x2e, 0x4b, 0x56, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x45, 0x0a, 0x0d, + 0x4c, 0x6f, 0x67, 0x5f, 0x53, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x12, 0x16, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x12, 0x4a, 0x0a, 0x0c, 0x4e, 0x67, 0x69, 0x6e, 0x78, 0x5f, 0x47, 0x65, 0x74, + 0x56, 0x61, 0x72, 0x12, 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x1a, 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, + 0x4f, 0x0a, 0x17, 0x4e, 0x67, 0x69, 0x6e, 0x78, 0x5f, 0x47, 0x65, 0x74, 0x54, 0x6c, 0x73, 0x31, + 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x72, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, + 0x74, 0x79, 0x1a, 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, + 0x12, 0x46, 0x0a, 0x0c, 0x4e, 0x67, 0x69, 0x6e, 0x78, 0x5f, 0x53, 0x65, 0x74, 0x43, 0x74, 0x78, + 0x12, 0x18, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x4b, 0x56, 0x1a, 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, + 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, + 0x6c, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x44, 0x0a, 0x0c, 0x4e, 0x67, 0x69, 0x6e, + 0x78, 0x5f, 0x47, 0x65, 0x74, 0x43, 0x74, 0x78, 0x12, 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, + 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, + 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x4a, + 0x0a, 0x12, 0x4e, 0x67, 0x69, 0x6e, 0x78, 0x5f, 0x52, 0x65, 0x71, 0x53, 0x74, 0x61, 0x72, 0x74, + 0x54, 0x69, 0x6d, 0x65, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1c, 0x2e, 0x6b, + 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x63, 0x6f, 0x6c, 0x2e, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x4a, 0x0a, 0x12, 0x4e, 0x67, + 0x69, 0x6e, 0x78, 0x5f, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, + 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, + 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, + 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x42, 0x0a, 0x0a, 0x4e, 0x6f, 0x64, 0x65, 0x5f, 0x47, + 0x65, 0x74, 0x49, 0x64, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1c, 0x2e, 0x6b, + 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x50, 0x0a, 0x13, 0x4e, 0x6f, + 0x64, 0x65, 0x5f, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x53, 0x74, 0x61, 0x74, + 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x21, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, + 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, + 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x49, 0x0a, 0x11, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x47, 0x65, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, + 0x65, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, + 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, + 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x47, 0x0a, 0x0f, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x5f, 0x47, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, + 0x74, 0x79, 0x1a, 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, + 0x12, 0x44, 0x0a, 0x0f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x47, 0x65, 0x74, 0x50, + 0x6f, 0x72, 0x74, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x19, 0x2e, 0x6b, 0x6f, + 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, + 0x6f, 0x6c, 0x2e, 0x49, 0x6e, 0x74, 0x12, 0x52, 0x0a, 0x1a, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x5f, 0x47, 0x65, 0x74, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x64, 0x53, 0x63, + 0x68, 0x65, 0x6d, 0x65, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1c, 0x2e, 0x6b, + 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x50, 0x0a, 0x18, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x47, 0x65, 0x74, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, + 0x65, 0x64, 0x48, 0x6f, 0x73, 0x74, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1c, + 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x4d, 0x0a, 0x18, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x47, 0x65, 0x74, 0x46, 0x6f, 0x72, 0x77, 0x61, + 0x72, 0x64, 0x65, 0x64, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, + 0x1a, 0x19, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x49, 0x6e, 0x74, 0x12, 0x4e, 0x0a, 0x16, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x47, 0x65, 0x74, 0x48, 0x74, 0x74, 0x70, 0x56, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1c, 0x2e, + 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x49, 0x0a, 0x11, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, + 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, + 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, + 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x47, 0x0a, 0x0f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x5f, 0x47, 0x65, 0x74, 0x50, 0x61, 0x74, 0x68, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, + 0x79, 0x1a, 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, + 0x50, 0x0a, 0x18, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x47, 0x65, 0x74, 0x50, 0x61, + 0x74, 0x68, 0x57, 0x69, 0x74, 0x68, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x16, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x1a, 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x12, 0x4b, 0x0a, 0x13, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x47, 0x65, 0x74, + 0x52, 0x61, 0x77, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, + 0x1a, 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x51, + 0x0a, 0x13, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x47, 0x65, 0x74, 0x51, 0x75, 0x65, + 0x72, 0x79, 0x41, 0x72, 0x67, 0x12, 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x1a, 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x12, 0x46, 0x0a, 0x10, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x47, 0x65, 0x74, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x19, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x49, 0x6e, 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, 0x4f, 0x0a, 0x11, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x5f, 0x47, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x1c, + 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x1a, 0x1c, 0x2e, 0x6b, + 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x48, 0x0a, 0x12, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x47, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, + 0x12, 0x19, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x49, 0x6e, 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, 0x4a, 0x0a, 0x12, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, + 0x47, 0x65, 0x74, 0x52, 0x61, 0x77, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, + 0x74, 0x79, 0x1a, 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, + 0x12, 0x47, 0x0a, 0x12, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x47, 0x65, 0x74, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x19, + 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x49, 0x6e, 0x74, 0x12, 0x50, 0x0a, 0x12, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x47, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, + 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x1a, 0x1c, 0x2e, + 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x49, 0x0a, 0x13, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x47, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x73, 0x12, 0x19, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x49, 0x6e, 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, 0x4a, 0x0a, 0x12, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x5f, 0x47, 0x65, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x16, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, + 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, + 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x74, 0x72, 0x69, + 0x6e, 0x67, 0x12, 0x47, 0x0a, 0x12, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x53, + 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x19, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, + 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, + 0x49, 0x6e, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x46, 0x0a, 0x12, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x53, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x12, 0x18, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x4b, 0x56, 0x1a, 0x16, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x12, 0x46, 0x0a, 0x12, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, + 0x41, 0x64, 0x64, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x18, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, + 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, + 0x2e, 0x4b, 0x56, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x4c, 0x0a, 0x14, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x12, 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x46, 0x0a, 0x13, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x53, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, + 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, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, + 0x79, 0x12, 0x47, 0x0a, 0x0d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x45, 0x78, + 0x69, 0x74, 0x12, 0x1e, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x45, 0x78, 0x69, 0x74, 0x41, 0x72, + 0x67, 0x73, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x46, 0x0a, 0x0f, 0x52, 0x6f, + 0x75, 0x74, 0x65, 0x72, 0x5f, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x16, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1b, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x52, 0x6f, 0x75, + 0x74, 0x65, 0x12, 0x4a, 0x0a, 0x11, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x47, 0x65, 0x74, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, + 0x1d, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4b, + 0x0a, 0x13, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x53, 0x65, 0x74, 0x55, 0x70, 0x73, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x49, 0x0a, 0x11, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x53, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x12, 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x1a, 0x16, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x51, 0x0a, 0x19, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x5f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x53, 0x65, 0x74, 0x53, 0x63, 0x68, + 0x65, 0x6d, 0x65, 0x12, 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x4f, 0x0a, 0x17, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x5f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x53, 0x65, 0x74, + 0x50, 0x61, 0x74, 0x68, 0x12, 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, + 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x74, 0x72, 0x69, + 0x6e, 0x67, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x53, 0x0a, 0x1b, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x53, 0x65, + 0x74, 0x52, 0x61, 0x77, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, + 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, + 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, + 0x51, 0x0a, 0x19, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x5f, 0x53, 0x65, 0x74, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x1c, 0x2e, 0x6b, + 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, + 0x74, 0x79, 0x12, 0x4b, 0x0a, 0x18, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x53, 0x65, 0x74, 0x51, 0x75, 0x65, 0x72, 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, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, + 0x4d, 0x0a, 0x19, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x5f, 0x53, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x18, 0x2e, 0x6b, + 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x63, 0x6f, 0x6c, 0x2e, 0x4b, 0x56, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x4d, + 0x0a, 0x19, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x5f, 0x41, 0x64, 0x64, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x18, 0x2e, 0x6b, 0x6f, + 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, + 0x6f, 0x6c, 0x2e, 0x4b, 0x56, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x53, 0x0a, + 0x1b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x5f, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x1c, 0x2e, 0x6b, + 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, + 0x74, 0x79, 0x12, 0x4d, 0x0a, 0x1a, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x53, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, + 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, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, + 0x79, 0x12, 0x52, 0x0a, 0x1a, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x5f, 0x53, 0x65, 0x74, 0x52, 0x61, 0x77, 0x42, 0x6f, 0x64, 0x79, 0x12, + 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x1a, 0x16, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x4f, 0x0a, 0x1a, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x5f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x19, 0x2e, 0x6b, 0x6f, + 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, + 0x6f, 0x6c, 0x2e, 0x49, 0x6e, 0x74, 0x12, 0x58, 0x0a, 0x1a, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x5f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x47, 0x65, 0x74, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x12, 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, + 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x74, 0x72, 0x69, + 0x6e, 0x67, 0x1a, 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, + 0x12, 0x51, 0x0a, 0x1b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x47, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, + 0x19, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x49, 0x6e, 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, 0x53, 0x0a, 0x1b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x47, 0x65, 0x74, 0x52, 0x61, 0x77, 0x42, 0x6f, + 0x64, 0x79, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1c, 0x2e, 0x6b, 0x6f, 0x6e, + 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, + 0x6c, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3a, 0x40, 0x0a, 0x0a, 0x4d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xd7, 0x86, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, + 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x42, 0x18, 0x5a, 0x16, 0x2e, 0x2f, + 0x6b, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x63, 0x6f, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_pluginsocket_proto_rawDescOnce sync.Once + file_pluginsocket_proto_rawDescData = file_pluginsocket_proto_rawDesc +) + +func file_pluginsocket_proto_rawDescGZIP() []byte { + file_pluginsocket_proto_rawDescOnce.Do(func() { + file_pluginsocket_proto_rawDescData = protoimpl.X.CompressGZIP(file_pluginsocket_proto_rawDescData) + }) + return file_pluginsocket_proto_rawDescData +} + +var file_pluginsocket_proto_msgTypes = make([]protoimpl.MessageInfo, 35) +var file_pluginsocket_proto_goTypes = []interface{}{ + (*CmdGetPluginNames)(nil), // 0: kong_plugin_protocol.CmdGetPluginNames + (*CmdGetPluginInfo)(nil), // 1: kong_plugin_protocol.CmdGetPluginInfo + (*CmdStartInstance)(nil), // 2: kong_plugin_protocol.CmdStartInstance + (*CmdGetInstanceStatus)(nil), // 3: kong_plugin_protocol.CmdGetInstanceStatus + (*CmdCloseInstance)(nil), // 4: kong_plugin_protocol.CmdCloseInstance + (*CmdHandleEvent)(nil), // 5: kong_plugin_protocol.CmdHandleEvent + (*RpcCall)(nil), // 6: kong_plugin_protocol.RpcCall + (*PluginNames)(nil), // 7: kong_plugin_protocol.PluginNames + (*PluginInfo)(nil), // 8: kong_plugin_protocol.PluginInfo + (*InstanceStatus)(nil), // 9: kong_plugin_protocol.InstanceStatus + (*RpcReturn)(nil), // 10: kong_plugin_protocol.RpcReturn + (*KV)(nil), // 11: kong_plugin_protocol.KV + (*Bool)(nil), // 12: kong_plugin_protocol.Bool + (*Int)(nil), // 13: kong_plugin_protocol.Int + (*Number)(nil), // 14: kong_plugin_protocol.Number + (*String)(nil), // 15: kong_plugin_protocol.String + (*ExitArgs)(nil), // 16: kong_plugin_protocol.ExitArgs + (*ServiceKey)(nil), // 17: kong_plugin_protocol.ServiceKey + (*CertificateKey)(nil), // 18: kong_plugin_protocol.CertificateKey + (*Route)(nil), // 19: kong_plugin_protocol.Route + (*Service)(nil), // 20: kong_plugin_protocol.Service + (*Target)(nil), // 21: kong_plugin_protocol.Target + (*ConsumerSpec)(nil), // 22: kong_plugin_protocol.ConsumerSpec + (*Consumer)(nil), // 23: kong_plugin_protocol.Consumer + (*AuthenticatedCredential)(nil), // 24: kong_plugin_protocol.AuthenticatedCredential + (*AuthenticateArgs)(nil), // 25: kong_plugin_protocol.AuthenticateArgs + (*MemoryStats)(nil), // 26: kong_plugin_protocol.MemoryStats + (*StringMap)(nil), // 27: kong_plugin_protocol.StringMap + (*PdkArg)(nil), // 28: kong_plugin_protocol.PdkArg + (*PdkCall)(nil), // 29: kong_plugin_protocol.PdkCall + (*PdkReturn)(nil), // 30: kong_plugin_protocol.PdkReturn + (*MemoryStats_LuaSharedDicts)(nil), // 31: kong_plugin_protocol.MemoryStats.LuaSharedDicts + (*MemoryStats_WorkerLuaVm)(nil), // 32: kong_plugin_protocol.MemoryStats.WorkerLuaVm + (*MemoryStats_LuaSharedDicts_DictStats)(nil), // 33: kong_plugin_protocol.MemoryStats.LuaSharedDicts.DictStats + nil, // 34: kong_plugin_protocol.StringMap.MEntry + (*_struct.Value)(nil), // 35: google.protobuf.Value + (*_struct.Struct)(nil), // 36: google.protobuf.Struct + (*descriptor.MethodOptions)(nil), // 37: google.protobuf.MethodOptions + (*empty.Empty)(nil), // 38: google.protobuf.Empty + (*_struct.ListValue)(nil), // 39: google.protobuf.ListValue +} +var file_pluginsocket_proto_depIdxs = []int32{ + 0, // 0: kong_plugin_protocol.RpcCall.cmd_get_plugin_names:type_name -> kong_plugin_protocol.CmdGetPluginNames + 1, // 1: kong_plugin_protocol.RpcCall.cmd_get_plugin_info:type_name -> kong_plugin_protocol.CmdGetPluginInfo + 2, // 2: kong_plugin_protocol.RpcCall.cmd_start_instance:type_name -> kong_plugin_protocol.CmdStartInstance + 3, // 3: kong_plugin_protocol.RpcCall.cmd_get_instance_status:type_name -> kong_plugin_protocol.CmdGetInstanceStatus + 4, // 4: kong_plugin_protocol.RpcCall.cmd_close_instance:type_name -> kong_plugin_protocol.CmdCloseInstance + 5, // 5: kong_plugin_protocol.RpcCall.cmd_handle_event:type_name -> kong_plugin_protocol.CmdHandleEvent + 35, // 6: kong_plugin_protocol.InstanceStatus.config:type_name -> google.protobuf.Value + 7, // 7: kong_plugin_protocol.RpcReturn.plugin_names:type_name -> kong_plugin_protocol.PluginNames + 8, // 8: kong_plugin_protocol.RpcReturn.plugin_info:type_name -> kong_plugin_protocol.PluginInfo + 9, // 9: kong_plugin_protocol.RpcReturn.instance_status:type_name -> kong_plugin_protocol.InstanceStatus + 35, // 10: kong_plugin_protocol.KV.v:type_name -> google.protobuf.Value + 36, // 11: kong_plugin_protocol.ExitArgs.headers:type_name -> google.protobuf.Struct + 17, // 12: kong_plugin_protocol.Route.service:type_name -> kong_plugin_protocol.ServiceKey + 18, // 13: kong_plugin_protocol.Service.client_certificate:type_name -> kong_plugin_protocol.CertificateKey + 23, // 14: kong_plugin_protocol.AuthenticateArgs.consumer:type_name -> kong_plugin_protocol.Consumer + 24, // 15: kong_plugin_protocol.AuthenticateArgs.credential:type_name -> kong_plugin_protocol.AuthenticatedCredential + 31, // 16: kong_plugin_protocol.MemoryStats.lua_shared_dicts:type_name -> kong_plugin_protocol.MemoryStats.LuaSharedDicts + 32, // 17: kong_plugin_protocol.MemoryStats.workers_lua_vms:type_name -> kong_plugin_protocol.MemoryStats.WorkerLuaVm + 34, // 18: kong_plugin_protocol.StringMap.m:type_name -> kong_plugin_protocol.StringMap.MEntry + 27, // 19: kong_plugin_protocol.PdkArg.m:type_name -> kong_plugin_protocol.StringMap + 24, // 20: kong_plugin_protocol.PdkArg.credential:type_name -> kong_plugin_protocol.AuthenticatedCredential + 19, // 21: kong_plugin_protocol.PdkArg.route:type_name -> kong_plugin_protocol.Route + 20, // 22: kong_plugin_protocol.PdkArg.service:type_name -> kong_plugin_protocol.Service + 23, // 23: kong_plugin_protocol.PdkArg.consumer:type_name -> kong_plugin_protocol.Consumer + 26, // 24: kong_plugin_protocol.PdkArg.memory_stats:type_name -> kong_plugin_protocol.MemoryStats + 28, // 25: kong_plugin_protocol.PdkCall.args:type_name -> kong_plugin_protocol.PdkArg + 28, // 26: kong_plugin_protocol.PdkReturn.arg:type_name -> kong_plugin_protocol.PdkArg + 33, // 27: kong_plugin_protocol.MemoryStats.LuaSharedDicts.kong:type_name -> kong_plugin_protocol.MemoryStats.LuaSharedDicts.DictStats + 33, // 28: kong_plugin_protocol.MemoryStats.LuaSharedDicts.kong_db_cache:type_name -> kong_plugin_protocol.MemoryStats.LuaSharedDicts.DictStats + 37, // 29: kong_plugin_protocol.MethodName:extendee -> google.protobuf.MethodOptions + 38, // 30: kong_plugin_protocol.Kong.Client_GetIp:input_type -> google.protobuf.Empty + 38, // 31: kong_plugin_protocol.Kong.Client_GetForwardedIp:input_type -> google.protobuf.Empty + 38, // 32: kong_plugin_protocol.Kong.Client_GetPort:input_type -> google.protobuf.Empty + 38, // 33: kong_plugin_protocol.Kong.Client_GetForwardedPort:input_type -> google.protobuf.Empty + 38, // 34: kong_plugin_protocol.Kong.Client_GetCredential:input_type -> google.protobuf.Empty + 22, // 35: kong_plugin_protocol.Kong.Client_LoadConsumer:input_type -> kong_plugin_protocol.ConsumerSpec + 38, // 36: kong_plugin_protocol.Kong.Client_GetConsumer:input_type -> google.protobuf.Empty + 25, // 37: kong_plugin_protocol.Kong.Client_Authenticate:input_type -> kong_plugin_protocol.AuthenticateArgs + 12, // 38: kong_plugin_protocol.Kong.Client_GetProtocol:input_type -> kong_plugin_protocol.Bool + 11, // 39: kong_plugin_protocol.Kong.Ctx_SetShared:input_type -> kong_plugin_protocol.KV + 15, // 40: kong_plugin_protocol.Kong.Ctx_GetShared:input_type -> kong_plugin_protocol.String + 15, // 41: kong_plugin_protocol.Kong.Ip_IsTrusted:input_type -> kong_plugin_protocol.String + 39, // 42: kong_plugin_protocol.Kong.Log_Alert:input_type -> google.protobuf.ListValue + 39, // 43: kong_plugin_protocol.Kong.Log_Crit:input_type -> google.protobuf.ListValue + 39, // 44: kong_plugin_protocol.Kong.Log_Err:input_type -> google.protobuf.ListValue + 39, // 45: kong_plugin_protocol.Kong.Log_Warn:input_type -> google.protobuf.ListValue + 39, // 46: kong_plugin_protocol.Kong.Log_Notice:input_type -> google.protobuf.ListValue + 39, // 47: kong_plugin_protocol.Kong.Log_Info:input_type -> google.protobuf.ListValue + 39, // 48: kong_plugin_protocol.Kong.Log_Debug:input_type -> google.protobuf.ListValue + 11, // 49: kong_plugin_protocol.Kong.Log_SetSerializeValue:input_type -> kong_plugin_protocol.KV + 38, // 50: kong_plugin_protocol.Kong.Log_Serialize:input_type -> google.protobuf.Empty + 15, // 51: kong_plugin_protocol.Kong.Nginx_GetVar:input_type -> kong_plugin_protocol.String + 38, // 52: kong_plugin_protocol.Kong.Nginx_GetTls1VersionStr:input_type -> google.protobuf.Empty + 11, // 53: kong_plugin_protocol.Kong.Nginx_SetCtx:input_type -> kong_plugin_protocol.KV + 15, // 54: kong_plugin_protocol.Kong.Nginx_GetCtx:input_type -> kong_plugin_protocol.String + 38, // 55: kong_plugin_protocol.Kong.Nginx_ReqStartTime:input_type -> google.protobuf.Empty + 38, // 56: kong_plugin_protocol.Kong.Nginx_GetSubsystem:input_type -> google.protobuf.Empty + 38, // 57: kong_plugin_protocol.Kong.Node_GetId:input_type -> google.protobuf.Empty + 38, // 58: kong_plugin_protocol.Kong.Node_GetMemoryStats:input_type -> google.protobuf.Empty + 38, // 59: kong_plugin_protocol.Kong.Request_GetScheme:input_type -> google.protobuf.Empty + 38, // 60: kong_plugin_protocol.Kong.Request_GetHost:input_type -> google.protobuf.Empty + 38, // 61: kong_plugin_protocol.Kong.Request_GetPort:input_type -> google.protobuf.Empty + 38, // 62: kong_plugin_protocol.Kong.Request_GetForwardedScheme:input_type -> google.protobuf.Empty + 38, // 63: kong_plugin_protocol.Kong.Request_GetForwardedHost:input_type -> google.protobuf.Empty + 38, // 64: kong_plugin_protocol.Kong.Request_GetForwardedPort:input_type -> google.protobuf.Empty + 38, // 65: kong_plugin_protocol.Kong.Request_GetHttpVersion:input_type -> google.protobuf.Empty + 38, // 66: kong_plugin_protocol.Kong.Request_GetMethod:input_type -> google.protobuf.Empty + 38, // 67: kong_plugin_protocol.Kong.Request_GetPath:input_type -> google.protobuf.Empty + 38, // 68: kong_plugin_protocol.Kong.Request_GetPathWithQuery:input_type -> google.protobuf.Empty + 38, // 69: kong_plugin_protocol.Kong.Request_GetRawQuery:input_type -> google.protobuf.Empty + 15, // 70: kong_plugin_protocol.Kong.Request_GetQueryArg:input_type -> kong_plugin_protocol.String + 13, // 71: kong_plugin_protocol.Kong.Request_GetQuery:input_type -> kong_plugin_protocol.Int + 15, // 72: kong_plugin_protocol.Kong.Request_GetHeader:input_type -> kong_plugin_protocol.String + 13, // 73: kong_plugin_protocol.Kong.Request_GetHeaders:input_type -> kong_plugin_protocol.Int + 38, // 74: kong_plugin_protocol.Kong.Request_GetRawBody:input_type -> google.protobuf.Empty + 38, // 75: kong_plugin_protocol.Kong.Response_GetStatus:input_type -> google.protobuf.Empty + 15, // 76: kong_plugin_protocol.Kong.Response_GetHeader:input_type -> kong_plugin_protocol.String + 13, // 77: kong_plugin_protocol.Kong.Response_GetHeaders:input_type -> kong_plugin_protocol.Int + 38, // 78: kong_plugin_protocol.Kong.Response_GetSource:input_type -> google.protobuf.Empty + 13, // 79: kong_plugin_protocol.Kong.Response_SetStatus:input_type -> kong_plugin_protocol.Int + 11, // 80: kong_plugin_protocol.Kong.Response_SetHeader:input_type -> kong_plugin_protocol.KV + 11, // 81: kong_plugin_protocol.Kong.Response_AddHeader:input_type -> kong_plugin_protocol.KV + 15, // 82: kong_plugin_protocol.Kong.Response_ClearHeader:input_type -> kong_plugin_protocol.String + 36, // 83: kong_plugin_protocol.Kong.Response_SetHeaders:input_type -> google.protobuf.Struct + 16, // 84: kong_plugin_protocol.Kong.Response_Exit:input_type -> kong_plugin_protocol.ExitArgs + 38, // 85: kong_plugin_protocol.Kong.Router_GetRoute:input_type -> google.protobuf.Empty + 38, // 86: kong_plugin_protocol.Kong.Router_GetService:input_type -> google.protobuf.Empty + 15, // 87: kong_plugin_protocol.Kong.Service_SetUpstream:input_type -> kong_plugin_protocol.String + 21, // 88: kong_plugin_protocol.Kong.Service_SetTarget:input_type -> kong_plugin_protocol.Target + 15, // 89: kong_plugin_protocol.Kong.Service_Request_SetScheme:input_type -> kong_plugin_protocol.String + 15, // 90: kong_plugin_protocol.Kong.Service_Request_SetPath:input_type -> kong_plugin_protocol.String + 15, // 91: kong_plugin_protocol.Kong.Service_Request_SetRawQuery:input_type -> kong_plugin_protocol.String + 15, // 92: kong_plugin_protocol.Kong.Service_Request_SetMethod:input_type -> kong_plugin_protocol.String + 36, // 93: kong_plugin_protocol.Kong.Service_Request_SetQuery:input_type -> google.protobuf.Struct + 11, // 94: kong_plugin_protocol.Kong.Service_Request_SetHeader:input_type -> kong_plugin_protocol.KV + 11, // 95: kong_plugin_protocol.Kong.Service_Request_AddHeader:input_type -> kong_plugin_protocol.KV + 15, // 96: kong_plugin_protocol.Kong.Service_Request_ClearHeader:input_type -> kong_plugin_protocol.String + 36, // 97: kong_plugin_protocol.Kong.Service_Request_SetHeaders:input_type -> google.protobuf.Struct + 15, // 98: kong_plugin_protocol.Kong.Service_Request_SetRawBody:input_type -> kong_plugin_protocol.String + 38, // 99: kong_plugin_protocol.Kong.Service_Response_GetStatus:input_type -> google.protobuf.Empty + 15, // 100: kong_plugin_protocol.Kong.Service_Response_GetHeader:input_type -> kong_plugin_protocol.String + 13, // 101: kong_plugin_protocol.Kong.Service_Response_GetHeaders:input_type -> kong_plugin_protocol.Int + 38, // 102: kong_plugin_protocol.Kong.Service_Response_GetRawBody:input_type -> google.protobuf.Empty + 15, // 103: kong_plugin_protocol.Kong.Client_GetIp:output_type -> kong_plugin_protocol.String + 15, // 104: kong_plugin_protocol.Kong.Client_GetForwardedIp:output_type -> kong_plugin_protocol.String + 13, // 105: kong_plugin_protocol.Kong.Client_GetPort:output_type -> kong_plugin_protocol.Int + 13, // 106: kong_plugin_protocol.Kong.Client_GetForwardedPort:output_type -> kong_plugin_protocol.Int + 24, // 107: kong_plugin_protocol.Kong.Client_GetCredential:output_type -> kong_plugin_protocol.AuthenticatedCredential + 23, // 108: kong_plugin_protocol.Kong.Client_LoadConsumer:output_type -> kong_plugin_protocol.Consumer + 23, // 109: kong_plugin_protocol.Kong.Client_GetConsumer:output_type -> kong_plugin_protocol.Consumer + 38, // 110: kong_plugin_protocol.Kong.Client_Authenticate:output_type -> google.protobuf.Empty + 15, // 111: kong_plugin_protocol.Kong.Client_GetProtocol:output_type -> kong_plugin_protocol.String + 38, // 112: kong_plugin_protocol.Kong.Ctx_SetShared:output_type -> google.protobuf.Empty + 35, // 113: kong_plugin_protocol.Kong.Ctx_GetShared:output_type -> google.protobuf.Value + 12, // 114: kong_plugin_protocol.Kong.Ip_IsTrusted:output_type -> kong_plugin_protocol.Bool + 38, // 115: kong_plugin_protocol.Kong.Log_Alert:output_type -> google.protobuf.Empty + 38, // 116: kong_plugin_protocol.Kong.Log_Crit:output_type -> google.protobuf.Empty + 38, // 117: kong_plugin_protocol.Kong.Log_Err:output_type -> google.protobuf.Empty + 38, // 118: kong_plugin_protocol.Kong.Log_Warn:output_type -> google.protobuf.Empty + 38, // 119: kong_plugin_protocol.Kong.Log_Notice:output_type -> google.protobuf.Empty + 38, // 120: kong_plugin_protocol.Kong.Log_Info:output_type -> google.protobuf.Empty + 38, // 121: kong_plugin_protocol.Kong.Log_Debug:output_type -> google.protobuf.Empty + 38, // 122: kong_plugin_protocol.Kong.Log_SetSerializeValue:output_type -> google.protobuf.Empty + 15, // 123: kong_plugin_protocol.Kong.Log_Serialize:output_type -> kong_plugin_protocol.String + 15, // 124: kong_plugin_protocol.Kong.Nginx_GetVar:output_type -> kong_plugin_protocol.String + 15, // 125: kong_plugin_protocol.Kong.Nginx_GetTls1VersionStr:output_type -> kong_plugin_protocol.String + 15, // 126: kong_plugin_protocol.Kong.Nginx_SetCtx:output_type -> kong_plugin_protocol.String + 35, // 127: kong_plugin_protocol.Kong.Nginx_GetCtx:output_type -> google.protobuf.Value + 14, // 128: kong_plugin_protocol.Kong.Nginx_ReqStartTime:output_type -> kong_plugin_protocol.Number + 15, // 129: kong_plugin_protocol.Kong.Nginx_GetSubsystem:output_type -> kong_plugin_protocol.String + 15, // 130: kong_plugin_protocol.Kong.Node_GetId:output_type -> kong_plugin_protocol.String + 26, // 131: kong_plugin_protocol.Kong.Node_GetMemoryStats:output_type -> kong_plugin_protocol.MemoryStats + 15, // 132: kong_plugin_protocol.Kong.Request_GetScheme:output_type -> kong_plugin_protocol.String + 15, // 133: kong_plugin_protocol.Kong.Request_GetHost:output_type -> kong_plugin_protocol.String + 13, // 134: kong_plugin_protocol.Kong.Request_GetPort:output_type -> kong_plugin_protocol.Int + 15, // 135: kong_plugin_protocol.Kong.Request_GetForwardedScheme:output_type -> kong_plugin_protocol.String + 15, // 136: kong_plugin_protocol.Kong.Request_GetForwardedHost:output_type -> kong_plugin_protocol.String + 13, // 137: kong_plugin_protocol.Kong.Request_GetForwardedPort:output_type -> kong_plugin_protocol.Int + 14, // 138: kong_plugin_protocol.Kong.Request_GetHttpVersion:output_type -> kong_plugin_protocol.Number + 15, // 139: kong_plugin_protocol.Kong.Request_GetMethod:output_type -> kong_plugin_protocol.String + 15, // 140: kong_plugin_protocol.Kong.Request_GetPath:output_type -> kong_plugin_protocol.String + 15, // 141: kong_plugin_protocol.Kong.Request_GetPathWithQuery:output_type -> kong_plugin_protocol.String + 15, // 142: kong_plugin_protocol.Kong.Request_GetRawQuery:output_type -> kong_plugin_protocol.String + 15, // 143: kong_plugin_protocol.Kong.Request_GetQueryArg:output_type -> kong_plugin_protocol.String + 36, // 144: kong_plugin_protocol.Kong.Request_GetQuery:output_type -> google.protobuf.Struct + 15, // 145: kong_plugin_protocol.Kong.Request_GetHeader:output_type -> kong_plugin_protocol.String + 36, // 146: kong_plugin_protocol.Kong.Request_GetHeaders:output_type -> google.protobuf.Struct + 15, // 147: kong_plugin_protocol.Kong.Request_GetRawBody:output_type -> kong_plugin_protocol.String + 13, // 148: kong_plugin_protocol.Kong.Response_GetStatus:output_type -> kong_plugin_protocol.Int + 15, // 149: kong_plugin_protocol.Kong.Response_GetHeader:output_type -> kong_plugin_protocol.String + 36, // 150: kong_plugin_protocol.Kong.Response_GetHeaders:output_type -> google.protobuf.Struct + 15, // 151: kong_plugin_protocol.Kong.Response_GetSource:output_type -> kong_plugin_protocol.String + 38, // 152: kong_plugin_protocol.Kong.Response_SetStatus:output_type -> google.protobuf.Empty + 38, // 153: kong_plugin_protocol.Kong.Response_SetHeader:output_type -> google.protobuf.Empty + 38, // 154: kong_plugin_protocol.Kong.Response_AddHeader:output_type -> google.protobuf.Empty + 38, // 155: kong_plugin_protocol.Kong.Response_ClearHeader:output_type -> google.protobuf.Empty + 38, // 156: kong_plugin_protocol.Kong.Response_SetHeaders:output_type -> google.protobuf.Empty + 38, // 157: kong_plugin_protocol.Kong.Response_Exit:output_type -> google.protobuf.Empty + 19, // 158: kong_plugin_protocol.Kong.Router_GetRoute:output_type -> kong_plugin_protocol.Route + 20, // 159: kong_plugin_protocol.Kong.Router_GetService:output_type -> kong_plugin_protocol.Service + 38, // 160: kong_plugin_protocol.Kong.Service_SetUpstream:output_type -> google.protobuf.Empty + 38, // 161: kong_plugin_protocol.Kong.Service_SetTarget:output_type -> google.protobuf.Empty + 38, // 162: kong_plugin_protocol.Kong.Service_Request_SetScheme:output_type -> google.protobuf.Empty + 38, // 163: kong_plugin_protocol.Kong.Service_Request_SetPath:output_type -> google.protobuf.Empty + 38, // 164: kong_plugin_protocol.Kong.Service_Request_SetRawQuery:output_type -> google.protobuf.Empty + 38, // 165: kong_plugin_protocol.Kong.Service_Request_SetMethod:output_type -> google.protobuf.Empty + 38, // 166: kong_plugin_protocol.Kong.Service_Request_SetQuery:output_type -> google.protobuf.Empty + 38, // 167: kong_plugin_protocol.Kong.Service_Request_SetHeader:output_type -> google.protobuf.Empty + 38, // 168: kong_plugin_protocol.Kong.Service_Request_AddHeader:output_type -> google.protobuf.Empty + 38, // 169: kong_plugin_protocol.Kong.Service_Request_ClearHeader:output_type -> google.protobuf.Empty + 38, // 170: kong_plugin_protocol.Kong.Service_Request_SetHeaders:output_type -> google.protobuf.Empty + 38, // 171: kong_plugin_protocol.Kong.Service_Request_SetRawBody:output_type -> google.protobuf.Empty + 13, // 172: kong_plugin_protocol.Kong.Service_Response_GetStatus:output_type -> kong_plugin_protocol.Int + 15, // 173: kong_plugin_protocol.Kong.Service_Response_GetHeader:output_type -> kong_plugin_protocol.String + 36, // 174: kong_plugin_protocol.Kong.Service_Response_GetHeaders:output_type -> google.protobuf.Struct + 15, // 175: kong_plugin_protocol.Kong.Service_Response_GetRawBody:output_type -> kong_plugin_protocol.String + 103, // [103:176] is the sub-list for method output_type + 30, // [30:103] is the sub-list for method input_type + 30, // [30:30] is the sub-list for extension type_name + 29, // [29:30] is the sub-list for extension extendee + 0, // [0:29] is the sub-list for field type_name +} + +func init() { file_pluginsocket_proto_init() } +func file_pluginsocket_proto_init() { + if File_pluginsocket_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_pluginsocket_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CmdGetPluginNames); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pluginsocket_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CmdGetPluginInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pluginsocket_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CmdStartInstance); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pluginsocket_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CmdGetInstanceStatus); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pluginsocket_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CmdCloseInstance); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pluginsocket_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CmdHandleEvent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pluginsocket_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RpcCall); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pluginsocket_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PluginNames); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pluginsocket_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PluginInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pluginsocket_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InstanceStatus); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pluginsocket_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RpcReturn); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pluginsocket_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KV); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pluginsocket_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Bool); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pluginsocket_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Int); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pluginsocket_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Number); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pluginsocket_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*String); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pluginsocket_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ExitArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pluginsocket_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ServiceKey); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pluginsocket_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CertificateKey); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pluginsocket_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Route); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pluginsocket_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Service); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pluginsocket_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Target); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pluginsocket_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ConsumerSpec); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pluginsocket_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Consumer); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pluginsocket_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AuthenticatedCredential); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pluginsocket_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AuthenticateArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pluginsocket_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MemoryStats); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pluginsocket_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StringMap); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pluginsocket_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PdkArg); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pluginsocket_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PdkCall); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pluginsocket_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PdkReturn); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pluginsocket_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MemoryStats_LuaSharedDicts); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pluginsocket_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MemoryStats_WorkerLuaVm); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pluginsocket_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MemoryStats_LuaSharedDicts_DictStats); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_pluginsocket_proto_msgTypes[6].OneofWrappers = []interface{}{ + (*RpcCall_CmdGetPluginNames)(nil), + (*RpcCall_CmdGetPluginInfo)(nil), + (*RpcCall_CmdStartInstance)(nil), + (*RpcCall_CmdGetInstanceStatus)(nil), + (*RpcCall_CmdCloseInstance)(nil), + (*RpcCall_CmdHandleEvent)(nil), + } + file_pluginsocket_proto_msgTypes[10].OneofWrappers = []interface{}{ + (*RpcReturn_PluginNames)(nil), + (*RpcReturn_PluginInfo)(nil), + (*RpcReturn_InstanceStatus)(nil), + } + file_pluginsocket_proto_msgTypes[28].OneofWrappers = []interface{}{ + (*PdkArg_B)(nil), + (*PdkArg_I)(nil), + (*PdkArg_F)(nil), + (*PdkArg_S)(nil), + (*PdkArg_M)(nil), + (*PdkArg_Error)(nil), + (*PdkArg_Credential)(nil), + (*PdkArg_Route)(nil), + (*PdkArg_Service)(nil), + (*PdkArg_Consumer)(nil), + (*PdkArg_MemoryStats)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_pluginsocket_proto_rawDesc, + NumEnums: 0, + NumMessages: 35, + NumExtensions: 1, + NumServices: 1, + }, + GoTypes: file_pluginsocket_proto_goTypes, + DependencyIndexes: file_pluginsocket_proto_depIdxs, + MessageInfos: file_pluginsocket_proto_msgTypes, + ExtensionInfos: file_pluginsocket_proto_extTypes, + }.Build() + File_pluginsocket_proto = out.File + file_pluginsocket_proto_rawDesc = nil + file_pluginsocket_proto_goTypes = nil + file_pluginsocket_proto_depIdxs = nil +} diff --git a/server/os.go b/server/os.go new file mode 100644 index 0000000..190679d --- /dev/null +++ b/server/os.go @@ -0,0 +1,101 @@ +package server + +import ( + "flag" + "log" + "net" + "os" + "path" + + "github.com/ugorji/go/codec" +) + +var ( + kongPrefix = flag.String("kong-prefix", "/usr/local/kong", "Kong prefix path (specified by the -p argument commonly used in the kong cli)") + dump = flag.Bool("dump", false, "Dump info about plugins") + help = flag.Bool("help", false, "Show usage info") +) + +func init() { + flag.Parse() + + if *help { + flag.Usage() + os.Exit(2) + } +} + +func getName() (name string, err error) { + execPath, err := os.Executable() + if err != nil { + return + } + + name = path.Base(execPath) + return +} + +func getSocketPath() (pth string, err error) { + name, err := getName() + if err != nil { + return + } + + pth = path.Join(*kongPrefix, name+".socket") + return +} + +func openSocket() (listener net.Listener, err error) { + socketPath, err := getSocketPath() + if err != nil { + return + } + + err = os.Remove(socketPath) + if err != nil && !os.IsNotExist(err) { + log.Printf(`removing "%s": %s`, socketPath, err) + return + } + + listener, err = net.Listen("unix", socketPath) + if err != nil { + log.Printf(`listen("%s"): %s`, socketPath, err) + return + } + + log.Printf("Listening on socket: %s", socketPath) + return +} + +type serverInfo struct { + Protocol string + SocketPath string + Plugins []pluginInfo +} + +func dumpInfo(rh rpcHandler) { + info, err := rh.getInfo() + if err != nil { + log.Printf("getting plugin info: %s", err) + return + } + + socketPath, err := getSocketPath() + if err != nil { + log.Printf("getting Socket path: %s", err) + return + } + + var handle codec.JsonHandle + enc := codec.NewEncoder(os.Stdout, &handle) + err = enc.Encode(serverInfo{ + Protocol: "ProtoBuf:1", + SocketPath: socketPath, + Plugins: []pluginInfo{info}, + }) + if err != nil { + log.Printf("encoding plugin info: %s", err) + } + os.Stdout.WriteString("\n") +} + diff --git a/server/pbserver.go b/server/pbserver.go new file mode 100644 index 0000000..73b28c0 --- /dev/null +++ b/server/pbserver.go @@ -0,0 +1,212 @@ +package server + +import ( + "encoding/binary" + "errors" + "fmt" + "io" + "log" + "net" + + "github.com/Kong/go-pdk" + "github.com/Kong/go-pdk/server/kong_plugin_protocol" + "github.com/golang/protobuf/proto" +) + +func servePb(conn net.Conn, rh *rpcHandler) (err error) { + for { + d, err := readPbFrame(conn) + if err != nil { + break + } + + rd, err := codecPb(rh, conn, d) + if err != nil { + break + } + + err = writePbFrame(conn, rd) + if err != nil { + break + } + } + + conn.Close() + if err != nil { + log.Print(err) + } + + return +} + +func readPbFrame(conn net.Conn) (data []byte, err error) { + var len uint32 + err = binary.Read(conn, binary.LittleEndian, &len) + if err != nil { + return + } + + data = make([]byte, len) + if data == nil { + return nil, errors.New("no memory") + } + + _, err = io.ReadFull(conn, data) + if err != nil { + return nil, err + } + + return +} + +func writePbFrame(conn net.Conn, data []byte) (err error) { + var len uint32 = uint32(len(data)) + err = binary.Write(conn, binary.LittleEndian, len) + if err != nil { + return + } + + _, err = conn.Write(data) + + return +} + +func codecPb(rh *rpcHandler, conn net.Conn, data []byte) (retData []byte, err error) { + var m kong_plugin_protocol.RpcCall + err = proto.Unmarshal(data, &m) + if err != nil { + return + } + + rm, err := handlePbCmd(rh, conn, m) + if err != nil { + return + } + + if rm != nil { + retData, err = proto.Marshal(rm) + } + + return +} + +func pbInstanceStatus(status InstanceStatus) *kong_plugin_protocol.RpcReturn_InstanceStatus { + return &kong_plugin_protocol.RpcReturn_InstanceStatus{ + InstanceStatus: &kong_plugin_protocol.InstanceStatus{ + Name: status.Name, + InstanceId: int32(status.Id), + StartedAt: status.StartTime, + }, + } +} + +func handlePbCmd(rh *rpcHandler, conn net.Conn, m kong_plugin_protocol.RpcCall) (rm *kong_plugin_protocol.RpcReturn, err error) { + switch c := m.Call.(type) { + case *kong_plugin_protocol.RpcCall_CmdGetPluginNames: + // log.Printf("GetPluginNames: %v", c) + + case *kong_plugin_protocol.RpcCall_CmdGetPluginInfo: + // log.Printf("GetPluginInfo: %v", c) + + case *kong_plugin_protocol.RpcCall_CmdStartInstance: + config := PluginConfig{ + Name: c.CmdStartInstance.Name, + Config: c.CmdStartInstance.Config, + } + var status InstanceStatus + err = rh.StartInstance(config, &status) + if err != nil { + return + } + + rm = &kong_plugin_protocol.RpcReturn{ + Sequence: m.Sequence, + Return: pbInstanceStatus(status), + } + + case *kong_plugin_protocol.RpcCall_CmdGetInstanceStatus: + var status InstanceStatus + err = rh.InstanceStatus(int(c.CmdGetInstanceStatus.InstanceId), &status) + if err != nil { + return + } + + rm = &kong_plugin_protocol.RpcReturn{ + Sequence: m.Sequence, + Return: pbInstanceStatus(status), + } + + case *kong_plugin_protocol.RpcCall_CmdCloseInstance: + var status InstanceStatus + err = rh.CloseInstance(int(c.CmdCloseInstance.InstanceId), &status) + if err != nil { + return + } + + rm = &kong_plugin_protocol.RpcReturn{ + Sequence: m.Sequence, + Return: pbInstanceStatus(status), + } + + case *kong_plugin_protocol.RpcCall_CmdHandleEvent: + err = handlePbEvent(rh, conn, c.CmdHandleEvent) + rm = &kong_plugin_protocol.RpcReturn{ + Sequence: m.Sequence, + } + + default: + err = fmt.Errorf("RPC call has unexpected type %T", c) + } + + return +} + +func handlePbEvent(rh *rpcHandler, conn net.Conn, e *kong_plugin_protocol.CmdHandleEvent) error { + rh.lock.RLock() + instance, ok := rh.instances[int(e.InstanceId)] + rh.lock.RUnlock() + if !ok { + return fmt.Errorf("no plugin instance %d", e.InstanceId) + } + + h, ok := instance.handlers[e.EventName] + if !ok { + return fmt.Errorf("undefined method %s", e.EventName) + } + + pdk := pdk.Init(conn) + + h(pdk) + writePbFrame(conn, []byte{}) + + return nil +} + +// Start the embedded plugin server, ProtoBuf version. +// Handles CLI flags, and returns immediately if appropriate. +// Otherwise, returns only if the server is stopped. +func StartServer(constructor func() interface{}, version string, priority int) error { + rh := newRpcHandler(constructor, version, priority) + + if *dump { + dumpInfo(*rh) + return nil + } + + listener, err := openSocket() + if err != nil { + return err + } + defer listener.Close() + + for { + conn, err := listener.Accept() + if err != nil { + log.Fatal(err) + } + + go servePb(conn, rh) + } + + return nil +} diff --git a/server/rpc.go b/server/rpc.go index 78bac2e..8fc3514 100644 --- a/server/rpc.go +++ b/server/rpc.go @@ -9,10 +9,10 @@ import ( ) type rpcHandler struct { - constructor func() interface{} - configType reflect.Type - version string // version number - priority int // priority info + constructor func() interface{} + configType reflect.Type + version string // version number + priority int // priority info lock sync.RWMutex instances map[int]*instanceData nextInstanceId int @@ -63,10 +63,10 @@ func newRpcHandler(constructor func() interface{}, version string, priority int) return &rpcHandler{ constructor: constructor, configType: reflect.TypeOf(constructor()), - version: version, - priority: priority, - instances: map[int]*instanceData{}, - events: map[int]*eventData{}, + version: version, + priority: priority, + instances: map[int]*instanceData{}, + events: map[int]*eventData{}, } } @@ -166,7 +166,7 @@ func (rh rpcHandler) getInfo() (info pluginInfo, err error) { {"config": getSchemaDict(rh.configType)}, }, }, - Version: rh.version, + Version: rh.version, Priority: rh.priority, } diff --git a/server/server.go b/server/server.go deleted file mode 100644 index 298a74d..0000000 --- a/server/server.go +++ /dev/null @@ -1,144 +0,0 @@ -/* -Package Kong/go-pdk/server implements an embedded plugin server. - -To use, add a main() function: - - func main () { - server.StartServer(New, Version, Priority) - } - -and compile as an executable with the standard `go build` command. -*/ -package server - -import ( - "flag" - "github.com/ugorji/go/codec" - "log" - "net" - "net/rpc" - "os" - "path" - "reflect" -) - -var ( - kongPrefix = flag.String("kong-prefix", "/usr/local/kong", "Kong prefix path (specified by the -p argument commonly used in the kong cli)") - dump = flag.Bool("dump", false, "Dump info about plugins") - help = flag.Bool("help", false, "Show usage info") -) - -func init() { - flag.Parse() - - if *help { - flag.Usage() - os.Exit(2) - } -} - - -func getName() (name string, err error) { - execPath, err := os.Executable() - if err != nil { - return - } - - name = path.Base(execPath) - return -} - -func getSocketPath() (pth string, err error) { - name, err := getName() - if err != nil { - return - } - - pth = path.Join(*kongPrefix, name + ".socket") - return -} - -func openSocket() (listener net.Listener, err error) { - socketPath, err := getSocketPath() - if err != nil { - return - } - - err = os.Remove(socketPath) - if err != nil && !os.IsNotExist(err) { - log.Printf(`removing "%s": %s`, socketPath, err) - return - } - - listener, err = net.Listen("unix", socketPath) - if err != nil { - log.Printf(`listen("%s"): %s`, socketPath, err) - return - } - - log.Printf("Listening on socket: %s", socketPath) - return -} - -func runServer(listener net.Listener) { - var handle codec.MsgpackHandle - handle.ReaderBufferSize = 4096 - handle.WriterBufferSize = 4096 - handle.RawToString = true - handle.MapType = reflect.TypeOf(map[string]interface{}(nil)) - - for { - conn, err := listener.Accept() - if err != nil { - return - } - - enc := codec.NewEncoder(conn, &handle) - _ = enc.Encode([]interface{}{2, "serverPid", os.Getpid()}) - - rpcCodec := codec.MsgpackSpecRpc.ServerCodec(conn, &handle) - go rpc.ServeCodec(rpcCodec) - } -} - -func dumpInfo(rh rpcHandler) { - info, err := rh.getInfo() - if err != nil { - log.Printf("getting plugin info: %s", err) - return - } - - var handle codec.JsonHandle - enc := codec.NewEncoder(os.Stdout, &handle) - err = enc.Encode([1]pluginInfo{ info }) - if err != nil { - log.Printf("encoding plugin info: %s", err) - } - os.Stdout.WriteString("\n") -} - -// Start the embedded plugin server -// Handles CLI flags, and returns immediately if appropriate. -// Otherwise, returns only if the server is stopped. -func StartServer(constructor func() interface{}, version string, priority int) error { - rh := newRpcHandler(constructor, version, priority) - - if *dump { - dumpInfo(*rh) - return nil - } - - listener, err := openSocket() - if err != nil { - return err - } - - err = rpc.RegisterName("plugin", rh) - if err != nil { - return err - } - - runServer(listener) - - return nil -} diff --git a/service/request/request.go b/service/request/request.go index d778b3b..30f4bd4 100644 --- a/service/request/request.go +++ b/service/request/request.go @@ -5,6 +5,8 @@ package request import ( "github.com/Kong/go-pdk/bridge" + "github.com/Kong/go-pdk/server/kong_plugin_protocol" + "google.golang.org/protobuf/types/known/structpb" ) // Holds this module's functions. Accessible as `kong.ServiceRequest` @@ -13,24 +15,22 @@ type Request struct { } // Called by the plugin server at initialization. -func New(ch chan interface{}) Request { - return Request{bridge.New(ch)} -} +// func New(ch chan interface{}) Request { +// return Request{bridge.New(ch)} +// } // kong.ServiceRequest.SetScheme() sets the protocol to use // when proxying the request to the Service. // Supported values are "http" or "https". func (r Request) SetScheme(scheme string) error { - _, err := r.Ask(`kong.service.request.set_scheme`, scheme) - return err + return r.Ask(`kong.service.request.set_scheme`, bridge.WrapString(scheme), nil) } // kong.ServiceRequest.SetPath() sets the path component // for the request to the service. It is not normalized // in any way and should not include the querystring. func (r Request) SetPath(path string) error { - _, err := r.Ask(`kong.service.request.set_path`, path) - return err + return r.Ask(`kong.service.request.set_path`, bridge.WrapString(path), nil) } // kong.ServiceRequest.SetRawQuery() sets the querystring @@ -40,8 +40,7 @@ func (r Request) SetPath(path string) error { // For a higher-level function to set the query string from a ???? of arguments, // see kong.ServiceRequest.SetQuery(). func (r Request) SetRawQuery(query string) error { - _, err := r.Ask(`kong.service.request.set_raw_query`, query) - return err + return r.Ask(`kong.service.request.set_raw_query`, bridge.WrapString(query), nil) } // kong.ServiceRequest.SetMethod() sets the HTTP method @@ -51,8 +50,7 @@ func (r Request) SetRawQuery(query string) error { // "DELETE", "OPTIONS", "MKCOL", "COPY", "MOVE", "PROPFIND", // "PROPPATCH", "LOCK", "UNLOCK", "PATCH", "TRACE". func (r Request) SetMethod(method string) error { - _, err := r.Ask(`kong.service.request.set_method`, method) - return err + return r.Ask(`kong.service.request.set_method`, bridge.WrapString(method), nil) } // kong.ServiceRequest.SetQuery() sets the querystring of the request to the Service. @@ -68,8 +66,12 @@ func (r Request) SetMethod(method string) error { // If further control of the querystring generation is needed, a raw querystring // can be given as a string with kong.ServiceRequest.SetRawQuery(). func (r Request) SetQuery(query map[string][]string) error { - _, err := r.Ask(`kong.service.request.set_query`, query) - return err + arg, err := bridge.WrapHeaders(query) + if err != nil { + return err + } + + return r.Ask(`kong.service.request.set_query`, arg, nil) } // kong.ServiceRequest.SetHeader() sets a header in the request @@ -79,8 +81,11 @@ func (r Request) SetQuery(query map[string][]string) error { // If the header argument is "host" (case-insensitive), then this // will also set the SNI of the request to the Service. func (r Request) SetHeader(name string, value string) error { - _, err := r.Ask(`kong.service.request.set_header`, name, value) - return err + arg := kong_plugin_protocol.KV{ + K: name, + V: structpb.NewStringValue(value), + } + return r.Ask(`kong.service.request.set_header`, &arg, nil) } // kong.ServiceRequest.AddHeader() adds a request header with the given value @@ -89,15 +94,17 @@ func (r Request) SetHeader(name string, value string) error { // Instead, several occurences of the header will be present in the request. // The order in which headers are added is retained. func (r Request) AddHeader(name string, value string) error { - _, err := r.Ask(`kong.service.request.add_header`, name, value) - return err + arg := kong_plugin_protocol.KV{ + K: name, + V: structpb.NewStringValue(value), + } + return r.Ask(`kong.service.request.add_header`, &arg, nil) } // kong.ServiceRequest.ClearHeader() removes all occurrences // of the specified header in the request to the Service. func (r Request) ClearHeader(name string) error { - _, err := r.Ask(`kong.service.request.clear_header`, name) - return err + return r.Ask(`kong.service.request.clear_header`, bridge.WrapString(name), nil) } // kong.ServiceRequest.SetHeaders() sets the headers of the request @@ -114,8 +121,11 @@ func (r Request) ClearHeader(name string) error { // If the "Host" header is set (case-insensitive), then this is will also set // the SNI of the request to the Service. func (r Request) SetHeaders(headers map[string][]string) error { - _, err := r.Ask(`kong.service.request.set_headers`, headers) - return err + arg, err := bridge.WrapHeaders(headers) + if err != nil { + return err + } + return r.Ask(`kong.service.request.set_headers`, arg, nil) } // kong.ServiceRequest SetRawBody() sets the body of the request to the Service. @@ -127,8 +137,7 @@ func (r Request) SetHeaders(headers map[string][]string) error { // For a higher-level function to set the body based on the request content type, // see kong.ServiceRequest.SetBody(). func (r Request) SetRawBody(body string) error { - _, err := r.Ask(`kong.service.request.set_raw_body`, body) - return err + return r.Ask(`kong.service.request.set_raw_body`, bridge.WrapString(body), nil) } // TODO set_body diff --git a/service/request/request_test.go b/service/request/request_test.go index 3e4d961..a3cb37b 100644 --- a/service/request/request_test.go +++ b/service/request/request_test.go @@ -4,62 +4,59 @@ import ( "testing" "github.com/Kong/go-pdk/bridge" + "github.com/Kong/go-pdk/bridge/bridgetest" + "github.com/Kong/go-pdk/server/kong_plugin_protocol" "github.com/stretchr/testify/assert" + "google.golang.org/protobuf/types/known/structpb" ) -var request Request -var ch chan interface{} +func TestServRequest(t *testing.T) { +// q, err := bridge.WrapHeaders(map[string][]string{ +// "ref": []string{"wayback"}, +// "trail": []string{"faint"}, +// }) +// assert.NoError(t, err) +// +// h, err := bridge.WrapHeaders(map[string][]string{ +// "Host": []string{"example.com"}, +// "X-Two-Things": []string{"first", "second"}, +// }) +// assert.NoError(t, err) + + body := `GET / HTTP/1.1 +Host: example.com +Accept: * + +this is the content` + + request := Request{bridge.New(bridgetest.Mock(t, []bridgetest.MockStep{ + {"kong.service.request.set_scheme", bridge.WrapString("https"), nil}, + {"kong.service.request.set_path", bridge.WrapString("/login/orout"), nil}, + {"kong.service.request.set_raw_query", bridge.WrapString("ref=wayback&trail=faint"), nil}, + {"kong.service.request.set_method", bridge.WrapString("POST"), nil}, +// {"kong.service.request.set_query", q, nil}, + {"kong.service.request.set_header", &kong_plugin_protocol.KV{K: "Host", V: structpb.NewStringValue("example.com")}, nil}, + {"kong.service.request.add_header", &kong_plugin_protocol.KV{K: "Host", V: structpb.NewStringValue("example.com")}, nil}, + {"kong.service.request.clear_header", bridge.WrapString("CORS"), nil}, +// {"kong.service.request.set_headers", bridge.WrapString(""), nil}, + {"kong.service.request.set_raw_body", bridge.WrapString(body), nil}, + }))} + + assert.NoError(t, request.SetScheme("https")) + assert.NoError(t, request.SetPath("/login/orout")) + assert.NoError(t, request.SetRawQuery("ref=wayback&trail=faint")) + assert.NoError(t, request.SetMethod("POST")) +// assert.NoError(t, request.SetQuery(map[string][]string{ +// "ref": []string{"wayback"}, +// "trail": []string{"faint"}, +// })) + assert.NoError(t, request.SetHeader("Host", "example.com")) + assert.NoError(t, request.AddHeader("Host", "example.com")) + assert.NoError(t, request.ClearHeader("CORS")) +// assert.NoError(t, request.SetHeaders(map[string][]string{ +// "Host": []string{"example.com"}, +// "X-Two-Things": []string{"first", "second"}, +// })) + assert.NoError(t, request.SetRawBody(body)) -func init() { - ch = make(chan interface{}) - request = New(ch) -} - -func getBack(f func()) interface{} { - go f() - d := <-ch - ch <- nil - - return d -} - -func TestSetScheme(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.service.request.set_scheme", Args: []interface{}{"http"}}, getBack(func() { request.SetScheme("http") })) -} - -func TestSetPath(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.service.request.set_path", Args: []interface{}{"/foo"}}, getBack(func() { request.SetPath("/foo") })) -} - -func TestSetRawQuery(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.service.request.set_raw_query", Args: []interface{}{"name=foo"}}, getBack(func() { request.SetRawQuery("name=foo") })) -} - -func TestSetMethod(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.service.request.set_method", Args: []interface{}{"GET"}}, getBack(func() { request.SetMethod("GET") })) -} - -func TestSetQuery(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.service.request.set_query", Args: []interface{}{map[string][]string{"foo": {"bar"}}}}, getBack(func() { request.SetQuery(map[string][]string{"foo": {"bar"}}) })) -} - -func TestSetHeader(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.service.request.set_header", Args: []interface{}{"foo", "bar"}}, getBack(func() { request.SetHeader("foo", "bar") })) -} - -func TestAddHeader(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.service.request.add_header", Args: []interface{}{"foo", "bar"}}, getBack(func() { request.AddHeader("foo", "bar") })) -} - -func TestClearHeader(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.service.request.clear_header", Args: []interface{}{"foo"}}, getBack(func() { request.ClearHeader("foo") })) -} - -func TestSetHeaders(t *testing.T) { - var h map[string][]string = nil - assert.Equal(t, bridge.StepData{Method: "kong.service.request.set_headers", Args: []interface{}{h}}, getBack(func() { request.SetHeaders(nil) })) -} - -func TestSetRawBody(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.service.request.set_raw_body", Args: []interface{}{"foo"}}, getBack(func() { request.SetRawBody("foo") })) } diff --git a/service/response/response.go b/service/response/response.go index 1f14720..8bad12e 100644 --- a/service/response/response.go +++ b/service/response/response.go @@ -4,6 +4,8 @@ Manipulation of the response from the Service. package response import ( + "github.com/Kong/go-pdk/server/kong_plugin_protocol" + "google.golang.org/protobuf/types/known/structpb" "github.com/Kong/go-pdk/bridge" ) @@ -13,14 +15,14 @@ type Response struct { } // Called by the plugin server at initialization. -func New(ch chan interface{}) Response { - return Response{bridge.New(ch)} -} +// func New(ch chan interface{}) Response { +// return Response{bridge.New(ch)} +// } // kong.ServiceResponse.GetStatus() returns the HTTP status code // of the response from the Service as an integer. func (r Response) GetStatus() (i int, err error) { - return r.AskInt(`kong.service.response.get_status`) + return r.AskInt(`kong.service.response.get_status`, nil) } // kong.ServiceResponse.GetHeaders() returns a map holding the headers @@ -42,10 +44,17 @@ func (r Response) GetStatus() (i int, err error) { // default limit of 100 arguments. func (r Response) GetHeaders(max_headers int) (map[string][]string, error) { if max_headers == -1 { - return r.AskMap(`kong.service.response.get_headers`) + max_headers = 100 + } + + arg := kong_plugin_protocol.Int{ V: int32(max_headers) } + out := new(structpb.Struct) + err := r.Ask(`kong.service.response.get_headers`, &arg, out) + if err != nil { + return nil, err } - return r.AskMap(`kong.service.response.get_headers`, max_headers) + return bridge.UnwrapHeaders(out), nil } // kong.ServiceResponse.GetHeader() returns the value of the specified response header. @@ -54,11 +63,11 @@ func (r Response) GetHeaders(max_headers int) (map[string][]string, error) { // if it was present in the response from the Service // (ignoring headers added by Kong itself). func (r Response) GetHeader(name string) (string, error) { - return r.AskString(`kong.service.response.get_header`, name) + return r.AskString(`kong.service.response.get_header`, bridge.WrapString(name)) } // kong.ServiceResponse.GetRawBody() returns the raw body // of the response from the Service. func (r Response) GetRawBody() (string, error) { - return r.AskString(`kong.service.response.get_raw_body`) + return r.AskString(`kong.service.response.get_raw_body`, nil) } diff --git a/service/response/response_test.go b/service/response/response_test.go index e22c520..2575bc0 100644 --- a/service/response/response_test.go +++ b/service/response/response_test.go @@ -4,37 +4,47 @@ import ( "testing" "github.com/Kong/go-pdk/bridge" + "github.com/Kong/go-pdk/bridge/bridgetest" + "github.com/Kong/go-pdk/server/kong_plugin_protocol" "github.com/stretchr/testify/assert" ) -var response Response -var ch chan interface{} - -func init() { - ch = make(chan interface{}) - response = New(ch) -} - -func getBack(f func()) interface{} { - go f() - d := <-ch - ch <- nil - - return d -} - -func TestGetStatus(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.service.response.get_status"}, getBack(func() { response.GetStatus() })) -} - -func TestGetHeader(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.service.response.get_header", Args: []interface{}{"foo"}}, getBack(func() { response.GetHeader("foo") })) -} - -func TestGetHeaders(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.service.response.get_headers", Args: []interface{}{1}}, getBack(func() { response.GetHeaders(1) })) -} - -func TestGetRawBody(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.service.response.get_raw_body"}, getBack(func() { response.GetRawBody() })) +func TestResponse(t *testing.T) { + h, err := bridge.WrapHeaders(map[string][]string{ + "Host": []string{"example.com"}, + "X-Two-Things": []string{"first", "second"}, + }) + assert.NoError(t, err) + + body := `GET / HTTP/1.1 +Host: example.com +Accept: * + +this is the content` + + response := Response{bridge.New(bridgetest.Mock(t, []bridgetest.MockStep{ + {"kong.service.response.get_status", nil, &kong_plugin_protocol.Int{V: 404}}, + {"kong.service.response.get_header", bridge.WrapString("Host"), bridge.WrapString("example.com")}, + {"kong.service.response.get_headers", &kong_plugin_protocol.Int{V: 30}, h}, + {"kong.service.response.get_raw_body", nil, bridge.WrapString(body)}, + }))} + + res_n, err := response.GetStatus() + assert.NoError(t, err) + assert.Equal(t, 404, res_n) + + res_s, err := response.GetHeader("Host") + assert.NoError(t, err) + assert.Equal(t, "example.com", res_s) + + res_h, err := response.GetHeaders(30) + assert.NoError(t, err) + assert.Equal(t, map[string][]string{ + "Host": []string{"example.com"}, + "X-Two-Things": []string{"first", "second"}, + }, res_h) + + res_s, err = response.GetRawBody() + assert.NoError(t, err) + assert.Equal(t, body, res_s) } diff --git a/service/service.go b/service/service.go index 12bdd40..eba1565 100644 --- a/service/service.go +++ b/service/service.go @@ -9,6 +9,7 @@ or choosing a given Upstream entity for load-balancing and healthchecking. package service import ( + "github.com/Kong/go-pdk/server/kong_plugin_protocol" "github.com/Kong/go-pdk/bridge" ) @@ -18,9 +19,9 @@ type Service struct { } // Called by the plugin server at initialization. -func New(ch chan interface{}) Service { - return Service{bridge.New(ch)} -} +// func New(ch chan interface{}) Service { +// return Service{bridge.New(ch)} +// } // kong.Service.SetUpstream() sets the desired Upstream entity to handle // the load-balancing step for this request. Using this method is equivalent @@ -31,8 +32,7 @@ func New(ch chan interface{}) Service { // The host argument should receive a string equal to that of one of // the Upstream entities currently configured. func (s Service) SetUpstream(host string) error { - _, err := s.Ask(`kong.service.set_upstream`, host) - return err + return s.Ask(`kong.service.set_upstream`, bridge.WrapString(host), nil) } // kong.Service.SetTarget() sets the host and port on which to connect to @@ -47,8 +47,11 @@ func (s Service) SetUpstream(host string) error { // of the upstream server (IPv4/IPv6), and the port argument must // contain a number representing the port on which to connect to. func (s Service) SetTarget(host string, port int) error { - _, err := s.Ask(`kong.service.set_target`, host, port) - return err + arg := kong_plugin_protocol.Target{ + Host: host, + Port: int32(port), + } + return s.Ask(`kong.service.set_target`, &arg, nil) } // TODO set_tls_cert_key diff --git a/service/service_test.go b/service/service_test.go index 9a8c1d5..a00e207 100644 --- a/service/service_test.go +++ b/service/service_test.go @@ -4,29 +4,17 @@ import ( "testing" "github.com/Kong/go-pdk/bridge" + "github.com/Kong/go-pdk/bridge/bridgetest" + "github.com/Kong/go-pdk/server/kong_plugin_protocol" "github.com/stretchr/testify/assert" ) -var service Service -var ch chan interface{} +func TestService(t *testing.T) { + service := Service{bridge.New(bridgetest.Mock(t, []bridgetest.MockStep{ + {"kong.service.set_upstream", bridge.WrapString("farm_4"), nil}, + {"kong.service.set_target", &kong_plugin_protocol.Target{Host: "internal.server.lan", Port: 8443}, nil}, + }))} -func init() { - ch = make(chan interface{}) - service = New(ch) -} - -func getBack(f func()) interface{} { - go f() - d := <-ch - ch <- nil - - return d -} - -func TestSetUpstream(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.service.set_upstream", Args: []interface{}{"foo"}}, getBack(func() { service.SetUpstream("foo") })) -} - -func TestSetTarget(t *testing.T) { - assert.Equal(t, bridge.StepData{Method: "kong.service.set_target", Args: []interface{}{"foo", 1}}, getBack(func() { service.SetTarget("foo", 1) })) + assert.NoError(t, service.SetUpstream("farm_4")) + assert.NoError(t, service.SetTarget("internal.server.lan", 8443)) }