From 33da86511d1a9fc4992cea459f3db9a5d3049075 Mon Sep 17 00:00:00 2001 From: binchencoder <15811514091@163.com> Date: Thu, 14 Apr 2022 12:38:46 +0800 Subject: [PATCH 01/10] Add example-grpc-client --- .../cmd/example-grpc-client/BUILD.bazel | 29 ++++++ .../internal/cmd/example-grpc-client/main.go | 97 +++++++++++++++++++ .../cmd/example-grpc-server/BUILD.bazel | 1 + .../internal/cmd/example-grpc-server/main.go | 17 +++- repositories.bzl | 17 ++-- 5 files changed, 151 insertions(+), 10 deletions(-) create mode 100644 examples/internal/cmd/example-grpc-client/BUILD.bazel create mode 100644 examples/internal/cmd/example-grpc-client/main.go diff --git a/examples/internal/cmd/example-grpc-client/BUILD.bazel b/examples/internal/cmd/example-grpc-client/BUILD.bazel new file mode 100644 index 0000000..1d2326d --- /dev/null +++ b/examples/internal/cmd/example-grpc-client/BUILD.bazel @@ -0,0 +1,29 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +package(default_visibility = ["//visibility:private"]) + +go_library( + name = "go_default_library", + srcs = ["main.go"], + importpath = "github.com/binchencoder/ease-gateway/examples/internal/cmd/example-grpc-client", + deps = [ + "//examples/internal/proto/examplepb:go_default_library", + "//examples/internal/server:go_default_library", + "@com_github_binchencoder_letsgo//:go_default_library", + "@com_github_binchencoder_gateway_proto//data:go_default_library", + "@com_github_binchencoder_skylb_api//client:go_default_library", + "@com_github_binchencoder_skylb_api//proto:go_default_library", + "@com_github_binchencoder_skylb_api//server:go_default_library", + "@com_github_golang_glog//:go_default_library", + "@com_github_prometheus_client_golang//prometheus:go_default_library", + "@org_golang_x_net//context:go_default_library", + "@org_golang_google_grpc//:go_default_library", + "@org_golang_google_grpc//health/grpc_health_v1:go_default_library", + ], +) + +go_binary( + name = "example-grpc-client", + embed = [":go_default_library"], + visibility = ["//visibility:public"], +) \ No newline at end of file diff --git a/examples/internal/cmd/example-grpc-client/main.go b/examples/internal/cmd/example-grpc-client/main.go new file mode 100644 index 0000000..35d689d --- /dev/null +++ b/examples/internal/cmd/example-grpc-client/main.go @@ -0,0 +1,97 @@ +package main + +import ( + "flag" + "fmt" + "os" + "time" + + "github.com/golang/glog" + prom "github.com/prometheus/client_golang/prometheus" + "golang.org/x/net/context" + "google.golang.org/grpc" + hpb "google.golang.org/grpc/health/grpc_health_v1" + + examplepb "github.com/binchencoder/ease-gateway/examples/internal/proto/examplepb" + vexpb "github.com/binchencoder/gateway-proto/data" + "github.com/binchencoder/letsgo" + skylb "github.com/binchencoder/skylb-api/client" + skypb "github.com/binchencoder/skylb-api/proto" +) + +var ( + nBatchRequest = flag.Int("n-batch-request", 10000, "The number of batched request") + requestSleep = flag.Duration("request-sleep", 100*time.Millisecond, "The sleep time after each request") + requestTimeout = flag.Duration("request-timeout", 100*time.Millisecond, "The timeout of each request") + + spec = skylb.NewServiceSpec(skylb.DefaultNameSpace, vexpb.ServiceId_CUSTOM_EASE_GATEWAY_TEST, skylb.DefaultPortName) + + grpcFailCount = prom.NewCounter( + prom.CounterOpts{ + Namespace: "skytest", + Subsystem: "client", + Name: "grpc_call_failure", + Help: "The number of failed gRPC calls.", + }, + ) +) + +func startSkylb(sid vexpb.ServiceId) (skylb.ServiceCli, examplepb.EchoServiceClient, hpb.HealthClient) { + skycli := skylb.NewServiceCli(vexpb.ServiceId_SHARED_TEST_CLIENT_SERVICE) + options := []grpc.DialOption{} + options = append(options, grpc.WithDefaultServiceConfig(`{"loadBalancingConfig": [{"round_robin": {}}]}`)) + skycli.Resolve(skylb.NewServiceSpec(skylb.DefaultNameSpace, sid, skylb.DefaultPortName), options...) + skycli.EnableHistogram() + var cli examplepb.EchoServiceClient + var healthCli hpb.HealthClient + skycli.Start(func(spec *skypb.ServiceSpec, conn *grpc.ClientConn) { + cli = examplepb.NewEchoServiceClient(conn) + healthCli = hpb.NewHealthClient(conn) + }) + return skycli, cli, healthCli +} + +func usage() { + fmt.Println(`Skytest gRPC client. + +Usage: + skytest-client [options] + +Options:`) + + flag.PrintDefaults() + os.Exit(2) +} + +func main() { + letsgo.Init(letsgo.FlagUsage(usage)) + + testClient() +} + +func testClient() { + sl, cli, healthCli := startSkylb(vexpb.ServiceId_CUSTOM_EASE_GATEWAY_TEST) + for { + for i := 0; i < *nBatchRequest; i++ { + req := examplepb.SimpleMessage{ + Id: fmt.Sprintf("John Doe %d", time.Now().Second()), + } + ctx, cancel := context.WithTimeout(context.Background(), *requestTimeout) + _, err := cli.Echo(ctx, &req, grpc.FailFast(false)) + if err != nil { + cancel() + glog.Errorf("Failed to greet service, %v \n", err) + grpcFailCount.Inc() + time.Sleep(*requestTimeout) + continue + } + + // glog.Infof("Greeting resp: %v \n", resp) + + healthCli.Check(context.Background(), &hpb.HealthCheckRequest{}) + time.Sleep(*requestSleep) + } + } + + sl.Shutdown() +} diff --git a/examples/internal/cmd/example-grpc-server/BUILD.bazel b/examples/internal/cmd/example-grpc-server/BUILD.bazel index 2c690d0..9ccd69a 100644 --- a/examples/internal/cmd/example-grpc-server/BUILD.bazel +++ b/examples/internal/cmd/example-grpc-server/BUILD.bazel @@ -12,6 +12,7 @@ go_library( "@com_github_binchencoder_gateway_proto//data:go_default_library", "@com_github_binchencoder_skylb_api//server:go_default_library", "@com_github_golang_glog//:go_default_library", + "@com_github_prometheus_client_golang//prometheus:go_default_library", "@org_golang_google_grpc//:go_default_library", ], ) diff --git a/examples/internal/cmd/example-grpc-server/main.go b/examples/internal/cmd/example-grpc-server/main.go index 1482ee4..633154e 100644 --- a/examples/internal/cmd/example-grpc-server/main.go +++ b/examples/internal/cmd/example-grpc-server/main.go @@ -7,8 +7,11 @@ package main import ( "flag" "fmt" + "log" + "net/http" examplepb "github.com/binchencoder/ease-gateway/examples/internal/proto/examplepb" + "github.com/prometheus/client_golang/prometheus" "github.com/binchencoder/gateway-proto/data" skylb "github.com/binchencoder/skylb-api/server" @@ -19,12 +22,20 @@ import ( ) var ( - addr = flag.String("addr", ":9090", "endpoint of the gRPC service") - network = flag.String("network", "tcp", "a valid network type which is consistent to -addr") + addr = flag.String("addr", ":9090", "endpoint of the gRPC service") + network = flag.String("network", "tcp", "a valid network type which is consistent to -addr") + scrapeAddr = flag.String("scrape-addr", "0.0.0.0:18001", "The prometheus scrape port") port = flag.Int("port", 9090, "The gRPC port of the server") ) +func registerPrometheus() { + http.Handle("/_/metrics", prometheus.UninstrumentedHandler()) + if err := http.ListenAndServe(*scrapeAddr, nil); err != nil { + log.Fatal("ListenServerError:", err) + } +} + func main() { flag.Parse() defer glog.Flush() @@ -35,6 +46,8 @@ func main() { // glog.Fatal(err) // } + go registerPrometheus() + skylb.Register(data.ServiceId_CUSTOM_EASE_GATEWAY_TEST, "grpc", *port) skylb.EnableHistogram() skylb.Start(fmt.Sprintf(":%d", *port), func(s *grpc.Server) error { diff --git a/repositories.bzl b/repositories.bzl index 7b65028..4cbd74e 100644 --- a/repositories.bzl +++ b/repositories.bzl @@ -199,29 +199,30 @@ def go_repositories(): sum = "h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g=", version = "v1.2.0", ) + # Prometheus go_repository( name = "com_github_prometheus_client_golang", importpath = "github.com/prometheus/client_golang", - sum = "h1:9iH4JKXLzFbOAdtqv/a+j8aewx2Y8lAjAydhbaScPF8=", - version = "v0.9.3", + sum = "h1:Y8E/JaaPbmFSW2V81Ab/d8yZFYQQGbni1b1jPcG9Y6A=", + version = "v0.9.4", ) go_repository( name = "com_github_prometheus_client_model", importpath = "github.com/prometheus/client_model", - sum = "h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM=", - version = "v0.0.0-20190812154241-14fe0d1b01d4", + sum = "h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M=", + version = "v0.2.0", ) go_repository( name = "com_github_prometheus_common", importpath = "github.com/prometheus/common", - sum = "h1:7etb9YClo3a6HjLzfl6rIQaU+FDfi0VSX39io3aQ+DM=", - version = "v0.4.0", + sum = "h1:RyRA7RzGXQZiW+tGMr7sxa85G1z0yOpM1qq5c8lNawc=", + version = "v0.10.0", ) go_repository( name = "com_github_prometheus_procfs", importpath = "github.com/prometheus/procfs", - sum = "h1:sofwID9zm4tzrgykg80hfFph1mryUeLRsUfoocVVmRY=", - version = "v0.0.0-20190507164030-5867b95ac084", + sum = "h1:F0+tqvhOksq22sc6iCHF5WGlWjdwj92p0udFh1VFBS8=", + version = "v0.1.3", ) go_repository( name = "com_github_prometheus_tsdb", From 098f40df6b4c31e1cb75a8eb0e339909aa9fc2f1 Mon Sep 17 00:00:00 2001 From: binchencoder <15811514091@163.com> Date: Fri, 15 Apr 2022 22:00:58 +0800 Subject: [PATCH 02/10] Add gateway client for test. --- .../cmd/example-grpc-client/BUILD.bazel | 14 +++- .../cmd/example-grpc-client/gatewayclient.go | 83 +++++++++++++++++++ .../{main.go => grpcclient.go} | 2 + 3 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 examples/internal/cmd/example-grpc-client/gatewayclient.go rename examples/internal/cmd/example-grpc-client/{main.go => grpcclient.go} (99%) diff --git a/examples/internal/cmd/example-grpc-client/BUILD.bazel b/examples/internal/cmd/example-grpc-client/BUILD.bazel index 1d2326d..f91e673 100644 --- a/examples/internal/cmd/example-grpc-client/BUILD.bazel +++ b/examples/internal/cmd/example-grpc-client/BUILD.bazel @@ -4,7 +4,7 @@ package(default_visibility = ["//visibility:private"]) go_library( name = "go_default_library", - srcs = ["main.go"], + srcs = ["grpcclient.go"], importpath = "github.com/binchencoder/ease-gateway/examples/internal/cmd/example-grpc-client", deps = [ "//examples/internal/proto/examplepb:go_default_library", @@ -23,7 +23,17 @@ go_library( ) go_binary( - name = "example-grpc-client", + name = "grpc-client", embed = [":go_default_library"], visibility = ["//visibility:public"], +) + +go_binary( + name = "gateway-client", + srcs = ["gatewayclient.go"], + deps = [ + "//examples/internal/proto/examplepb:go_default_library", + "@com_github_binchencoder_letsgo//:go_default_library", + "@com_github_golang_protobuf//jsonpb:go_default_library", + ] ) \ No newline at end of file diff --git a/examples/internal/cmd/example-grpc-client/gatewayclient.go b/examples/internal/cmd/example-grpc-client/gatewayclient.go new file mode 100644 index 0000000..01f3b10 --- /dev/null +++ b/examples/internal/cmd/example-grpc-client/gatewayclient.go @@ -0,0 +1,83 @@ +package main + +import ( + "flag" + "fmt" + "io/ioutil" + "log" + "net/http" + "time" + + "github.com/golang/protobuf/jsonpb" + + examplepb "github.com/binchencoder/ease-gateway/examples/internal/proto/examplepb" + "github.com/binchencoder/letsgo" +) + +const urlPattern = "http://%s/v1/example/echo/2211/1" + +var ( + flagServer = flag.String("server", "localhost:8080", "The server host:port") + onceOnly = flag.Bool("send-once", false, "Send the request once only") + clientId = flag.String("client-id", "", "Client ID") + xSource = flag.String("x-source", "web", "X-Source to use") +) + +func main() { + letsgo.Init() + + url := fmt.Sprintf(urlPattern, *flagServer) + + // If specified, send request once and return. + if *onceOnly { + sendRequest(url) + return + } + + for i := 0; i < 10; i++ { + go func() { + for range time.Tick(50 * time.Millisecond) { + sendRequest(url) + } + }() + } + + select {} +} + +func sendRequest(url string) { + req, err := http.NewRequest("GET", url, nil) + if err != nil { + log.Println("NewRequest: ", err) + return + } + req.Header.Set("x-source", *xSource) + req.Header.Set("Content-Type", "application/json") + req.Header.Set("x-Uid", "marlin") + req.Header.Set("X-Cid", "disney") + + client := &http.Client{} + resp, err := client.Do(req) + if err != nil { + log.Fatal("Do: ", err) + return + } + defer resp.Body.Close() + + if resp.StatusCode == 200 { + bodyBytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + log.Println(err) + return + } + + record := examplepb.SimpleMessage{} + if err = jsonpb.UnmarshalString(string(bodyBytes), &record); err != nil { + log.Println(err) + return + } + fmt.Printf("%d, resp: %+v.\n", resp.StatusCode, record) + } else { + fmt.Println(resp.StatusCode) + } +} diff --git a/examples/internal/cmd/example-grpc-client/main.go b/examples/internal/cmd/example-grpc-client/grpcclient.go similarity index 99% rename from examples/internal/cmd/example-grpc-client/main.go rename to examples/internal/cmd/example-grpc-client/grpcclient.go index 35d689d..fc4b664 100644 --- a/examples/internal/cmd/example-grpc-client/main.go +++ b/examples/internal/cmd/example-grpc-client/grpcclient.go @@ -38,10 +38,12 @@ var ( func startSkylb(sid vexpb.ServiceId) (skylb.ServiceCli, examplepb.EchoServiceClient, hpb.HealthClient) { skycli := skylb.NewServiceCli(vexpb.ServiceId_SHARED_TEST_CLIENT_SERVICE) + options := []grpc.DialOption{} options = append(options, grpc.WithDefaultServiceConfig(`{"loadBalancingConfig": [{"round_robin": {}}]}`)) skycli.Resolve(skylb.NewServiceSpec(skylb.DefaultNameSpace, sid, skylb.DefaultPortName), options...) skycli.EnableHistogram() + var cli examplepb.EchoServiceClient var healthCli hpb.HealthClient skycli.Start(func(spec *skypb.ServiceSpec, conn *grpc.ClientConn) { From a8cabc5c5c50d32f86101feb659a417651c0d423 Mon Sep 17 00:00:00 2001 From: binchencoder <15811514091@163.com> Date: Fri, 15 Apr 2022 22:37:33 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E8=A7=A3=E5=86=B3custom=20gateway=20ctrl?= =?UTF-8?q?+c=20=E6=97=A0=E6=B3=95=E5=81=9C=E6=8E=89=E8=BF=9B=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/custom-gateway/BUILD.bazel | 1 + cmd/custom-gateway/main.go | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/cmd/custom-gateway/BUILD.bazel b/cmd/custom-gateway/BUILD.bazel index 2d65430..a7bd2df 100644 --- a/cmd/custom-gateway/BUILD.bazel +++ b/cmd/custom-gateway/BUILD.bazel @@ -18,6 +18,7 @@ go_library( "//examples/internal/proto/examplepb", "//gateway/runtime", "//integrate:go_default_library", + "//util:go_default_library", "@com_github_binchencoder_gateway_proto//data:go_default_library", "@com_github_binchencoder_letsgo//:go_default_library", "@com_github_golang_glog//:go_default_library", diff --git a/cmd/custom-gateway/main.go b/cmd/custom-gateway/main.go index 26f65e5..0da3ac8 100644 --- a/cmd/custom-gateway/main.go +++ b/cmd/custom-gateway/main.go @@ -11,6 +11,7 @@ import ( "github.com/binchencoder/ease-gateway/gateway/runtime" "github.com/binchencoder/ease-gateway/integrate" + "github.com/binchencoder/ease-gateway/util" "github.com/binchencoder/gateway-proto/data" "github.com/binchencoder/letsgo" ) @@ -34,6 +35,8 @@ Options:`) func startHTTPGateway(mux *runtime.ServeMux, hostPort string) { if err := http.ListenAndServe(hostPort, integrate.HttpMux(mux)); err != nil { + glog.Errorf("Start http gateway error: %v", err) + shutdown() panic(err) } } @@ -60,5 +63,14 @@ func main() { signals := make(chan os.Signal, 1) signal.Notify(signals, os.Interrupt, os.Kill) - startHTTPGateway(mux, hostPort) + go startHTTPGateway(mux, hostPort) + + select { + case <-signals: + shutdown() + } +} + +func shutdown() { + util.Flush() } From f721507a6e2daf62546b231e456a60d845a57aa6 Mon Sep 17 00:00:00 2001 From: binchencoder <15811514091@163.com> Date: Sat, 23 Apr 2022 19:34:58 +0800 Subject: [PATCH 04/10] Rename ease-gateway to janus-gateway --- .circleci/README.md | 2 +- .circleci/config.yml | 20 ++-- .gitignore | 2 +- BUILD | 2 +- Issues.md | 8 +- README.md | 16 +-- WORKSPACE | 26 ++--- cmd/custom-gateway/BUILD.bazel | 4 +- cmd/custom-gateway/main.go | 10 +- cmd/custom-gateway/registrydemo.go | 2 +- cmd/gateway/BUILD.bazel | 12 +-- cmd/gateway/main.go | 12 +-- cmd/gateway/registryprod.go | 2 +- docs/design.md | 28 ++--- docs/gateway-validation-rule.md | 16 +-- docs/scripts/start.sh | 6 +- docs/scripts/stop.sh | 4 +- examples/grpc-server/BUILD.bazel | 2 +- examples/grpc-server/echo.go | 2 +- examples/grpc-server/main.go | 2 +- examples/internal/README.md | 12 +-- .../cmd/example-gateway-server/BUILD.bazel | 2 +- .../cmd/example-gateway-server/main.go | 2 +- .../cmd/example-grpc-client/BUILD.bazel | 2 +- .../cmd/example-grpc-client/gatewayclient.go | 2 +- .../cmd/example-grpc-client/grpcclient.go | 2 +- .../cmd/example-grpc-server/BUILD.bazel | 2 +- .../internal/cmd/example-grpc-server/main.go | 4 +- examples/internal/gateway/BUILD.bazel | 2 +- examples/internal/gateway/gateway.go | 4 +- examples/internal/gateway/main.go | 2 +- examples/internal/integration/README.md | 2 +- .../internal/integration/integration_test.go | 4 +- examples/internal/integration/main_test.go | 6 +- examples/internal/proto/examplepb/BUILD.bazel | 4 +- .../proto/examplepb/echo_service.pb.go | 2 +- .../proto/examplepb/echo_service.pb.gw.go | 2 +- .../proto/examplepb/echo_service.proto | 18 ++-- .../proto/examplepb/generated_input.proto | 2 +- .../examplepb/unannotated_echo_service.pb.go | 2 +- .../examplepb/unannotated_echo_service.proto | 4 +- examples/internal/server/BUILD.bazel | 2 +- examples/internal/server/echo.go | 2 +- examples/internal/server/main.go | 4 +- gateway/README.md | 2 +- gateway/internal/BUILD.bazel | 4 +- gateway/internal/casing/BUILD.bazel | 2 +- gateway/internal/descriptor/BUILD.bazel | 2 +- .../internal/descriptor/apiconfig/BUILD.bazel | 4 +- .../descriptor/apiconfig/apiconfig.pb.go | 4 +- .../descriptor/apiconfig/apiconfig.proto | 4 +- .../descriptor/grpc_api_configuration.go | 2 +- .../descriptor/openapi_configuration.go | 2 +- .../descriptor/openapi_configuration_test.go | 2 +- .../descriptor/openapiconfig/BUILD.bazel | 4 +- .../openapiconfig/openapiconfig.pb.go | 2 +- .../openapiconfig/openapiconfig.proto | 2 +- gateway/internal/descriptor/registry.go | 6 +- gateway/internal/descriptor/registry_test.go | 2 +- gateway/internal/descriptor/services.go | 6 +- gateway/internal/descriptor/types.go | 4 +- gateway/internal/generator/BUILD.bazel | 2 +- gateway/internal/generator/generator.go | 2 +- gateway/protoc-gen-grpc-gateway/BUILD.bazel | 2 +- .../internal/gengateway/BUILD.bazel | 2 +- .../internal/gengateway/generator.go | 6 +- .../internal/gengateway/generator_test.go | 2 +- .../internal/gengateway/template.go | 4 +- .../internal/gengateway/template_test.go | 2 +- gateway/protoc-gen-grpc-gateway/main.go | 4 +- gateway/protoc-gen-grpc-gateway/main_test.go | 2 +- gateway/protoc-gen-openapiv2/BUILD.bazel | 2 +- .../internal/genopenapi/BUILD.bazel | 2 +- .../internal/genopenapi/generator.go | 6 +- .../internal/genopenapi/template.go | 8 +- .../internal/genopenapi/types.go | 4 +- gateway/protoc-gen-openapiv2/main.go | 4 +- .../protoc-gen-openapiv2/options/BUILD.bazel | 4 +- .../options/annotations.proto | 2 +- .../options/openapiv2.proto | 2 +- gateway/runtime/BUILD.bazel | 2 +- gateway/runtime/balancer.go | 2 +- gateway/runtime/balancer_test.go | 4 +- gateway/runtime/context_test.go | 2 +- gateway/runtime/convert_test.go | 2 +- gateway/runtime/errors.go | 2 +- gateway/runtime/errors_test.go | 2 +- gateway/runtime/handler_test.go | 4 +- .../runtime/internal/examplepb/BUILD.bazel | 4 +- .../runtime/internal/examplepb/proto3.pb.go | 100 +++++++++--------- .../runtime/internal/examplepb/proto3.proto | 4 +- gateway/runtime/marshal_httpbodyproto_test.go | 2 +- gateway/runtime/marshaler_registry_test.go | 2 +- gateway/runtime/mux_test.go | 2 +- gateway/runtime/service.go | 4 +- go.mod | 2 +- go.sum | 2 +- httpoptions/BUILD.bazel | 4 +- httpoptions/annotations.pb.go | 88 +++++++-------- httpoptions/annotations.proto | 10 +- httpoptions/http.pb.go | 12 +-- httpoptions/http.proto | 6 +- httpoptions/pom.xml | 4 +- integrate/BUILD.bazel | 2 +- integrate/hook.go | 14 +-- integrate/hookexternal.go | 10 +- integrate/metrics/BUILD | 2 +- integrate/metrics/reporter.go | 4 +- integrate/middleware.go | 2 +- proto/examplepb/BUILD.bazel | 4 +- proto/examplepb/echo_service.proto | 14 +-- repositories.bzl | 4 +- util/BUILD.bazel | 2 +- util/glog/BUILD.bazel | 2 +- util/glog/cmd/BUILD.bazel | 2 +- util/glog/cmd/main.go | 2 +- util/log.go | 8 +- 117 files changed, 361 insertions(+), 361 deletions(-) diff --git a/.circleci/README.md b/.circleci/README.md index 70cf33b..bbdcc3b 100644 --- a/.circleci/README.md +++ b/.circleci/README.md @@ -5,4 +5,4 @@ Contained within is the CI test setup for the Gateway. It runs on Circle CI. ### Whats up with the Dockerfile? The `Dockerfile` in this folder is used as the build environment when regenerating the files (see CONTRIBUTING.md). -The canonical repository for this Dockerfile is `docker.pkg.github.com/binchencoder/ease-gateway/build-env`. +The canonical repository for this Dockerfile is `docker.pkg.github.com/binchencoder/janus-gateway/build-env`. diff --git a/.circleci/config.yml b/.circleci/config.yml index 5894410..076541f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -41,7 +41,7 @@ executors: password1: "3ec86b2e5a431be2d72c" GLOG_logtostderr: "1" docker: - - image: docker.pkg.github.com/binchencoder/ease-gateway/build-env:1.15 + - image: docker.pkg.github.com/binchencoder/janus-gateway/build-env:1.15 auth: username: gateway-ci-user password: ${password0}${password1} @@ -49,20 +49,20 @@ executors: jobs: build: executor: build-env - working_directory: /home/vscode/src/ease-gateway + working_directory: /home/vscode/src/janus-gateway steps: - checkout - run: go build ./... test: executor: build-env - working_directory: /home/vscode/src/ease-gateway + working_directory: /home/vscode/src/janus-gateway steps: - checkout - run: go test -race -coverprofile=coverage.txt ./... - run: bash <(curl -s https://codecov.io/bash) node_test: executor: build-env - working_directory: /home/vscode/src/ease-gateway + working_directory: /home/vscode/src/janus-gateway steps: - checkout - run: go mod vendor @@ -73,14 +73,14 @@ jobs: ./node_modules/.bin/gulp generate: executor: build-env - working_directory: /home/vscode/src/ease-gateway + working_directory: /home/vscode/src/janus-gateway steps: - checkout - generate - run: git diff --exit-code bazel: executor: build-env - working_directory: /home/vscode/src/ease-gateway + working_directory: /home/vscode/src/janus-gateway steps: - checkout - restore_cache: @@ -112,7 +112,7 @@ jobs: - /home/vscode/.cache/_ease_gateway_bazel gorelease: executor: build-env - working_directory: /home/vscode/src/ease-gateway + working_directory: /home/vscode/src/janus-gateway steps: - checkout - run: @@ -156,14 +156,14 @@ jobs: - run: BUF_TOKEN="${BUF_API_TOKEN}" buf push --tag "$CIRCLE_SHA1" release: executor: build-env - working_directory: /home/vscode/src/ease-gateway + working_directory: /home/vscode/src/janus-gateway steps: - checkout - run: go mod vendor - run: curl -sL https://git.io/goreleaser | bash update-repositoriesbzl: executor: build-env - working_directory: /home/vscode/src/ease-gateway + working_directory: /home/vscode/src/janus-gateway steps: - checkout - restore_cache: @@ -178,7 +178,7 @@ jobs: - renovate_git_amend_push regenerate: executor: build-env - working_directory: /home/vscode/src/ease-gateway + working_directory: /home/vscode/src/janus-gateway steps: - checkout - generate diff --git a/.gitignore b/.gitignore index 649d93d..82c6465 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,7 @@ _output/ # Bazel. bazel-bin bazel-genfiles -bazel-ease-gateway +bazel-janus-gateway bazel-out bazel-testlogs *.bin diff --git a/BUILD b/BUILD index cf3996f..581db5d 100644 --- a/BUILD +++ b/BUILD @@ -15,7 +15,7 @@ buildifier( ) # gazelle:exclude _output -# gazelle:prefix github.com/binchencoder/ease-gateway/gateway +# gazelle:prefix github.com/binchencoder/janus-gateway/gateway # gazelle:go_proto_compilers //:go_apiv2 # gazelle:go_grpc_compilers //:go_apiv2, //:go_grpc # gazelle:go_naming_convention import_alias diff --git a/Issues.md b/Issues.md index 249004e..f38b53e 100644 --- a/Issues.md +++ b/Issues.md @@ -24,7 +24,7 @@ org_golang_google_grpc 最新版本已经升级到v1.33.1,编译会出现如下error: ```verilog - chenbin@chenbin-ThinkPad:~/.../github-workspace/ease-gateway$ bazel build gateway/... + chenbin@chenbin-ThinkPad:~/.../github-workspace/janus-gateway$ bazel build gateway/... ERROR: /home/chenbin/.cache/bazel/_bazel_chenbin/95d98bab223e52f58e53a4599e22df3c/external/com_github_binchencoder_skylb_api/balancer/BUILD:5:1: no such package '@org_golang_google_grpc//naming': BUILD file not found in directory 'naming' of external repository @org_golang_google_grpc. Add a BUILD file to a directory to mark it as a package. and referenced by '@com_github_binchencoder_skylb_api//balancer:go_default_library' ERROR: Analysis of target '//gateway/runtime:go_default_test' failed; build aborted: no such package '@org_golang_google_grpc//naming': BUILD file not found in directory 'naming' of external repository @org_golang_google_grpc. Add a BUILD file to a directory to mark it as a package. INFO: Elapsed time: 3.781s @@ -52,16 +52,16 @@ ) ``` - github.com/grpc-ecosystem/grpc-gateway 使用 org_golang_google_grpc_cmd_protoc_gen_go_grpc的版本是v1.0.0,ease-gateway 升级会出现如下error: + github.com/grpc-ecosystem/grpc-gateway 使用 org_golang_google_grpc_cmd_protoc_gen_go_grpc的版本是v1.0.0,janus-gateway 升级会出现如下error: ```verilog - chenbin@chenbin-ThinkPad:~/.../github-workspace/ease-gateway$ bazel build gateway/... + chenbin@chenbin-ThinkPad:~/.../github-workspace/janus-gateway$ bazel build gateway/... INFO: Analyzed 32 targets (103 packages loaded, 1391 targets configured). INFO: Found 32 targets... ERROR: /home/chenbin/.cache/bazel/_bazel_chenbin/95d98bab223e52f58e53a4599e22df3c/external/com_github_grpc_ecosystem_grpc_gateway/runtime/internal/examplepb/BUILD.bazel:39:1: GoCompilePkg external/com_github_grpc_ecosystem_grpc_gateway/runtime/internal/examplepb/go_default_library.a failed (Exit 1) builder failed: error executing command bazel-out/host/bin/external/go_sdk/builder compilepkg -sdk external/go_sdk -installsuffix linux_amd64 -src ... (remaining 67 argument(s) skipped) Use --sandbox_debug to see verbose messages from the sandbox - /home/chenbin/.cache/bazel/_bazel_chenbin/95d98bab223e52f58e53a4599e22df3c/sandbox/linux-sandbox/845/execroot/com_github_binchencoder_ease_gateway/bazel-out/k8-fastbuild/bin/external/com_github_grpc_ecosystem_grpc_gateway/runtime/internal/examplepb/examplepb_go_proto_/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/internal/examplepb/non_standard_names_grpc.pb.go:14:11: undefined: grpc.SupportPackageIsVersion7 + /home/chenbin/.cache/bazel/_bazel_chenbin/95d98bab223e52f58e53a4599e22df3c/sandbox/linux-sandbox/845/execroot/com_github_binchencoder_janus_gateway/bazel-out/k8-fastbuild/bin/external/com_github_grpc_ecosystem_grpc_gateway/runtime/internal/examplepb/examplepb_go_proto_/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/internal/examplepb/non_standard_names_grpc.pb.go:14:11: undefined: grpc.SupportPackageIsVersion7 compilepkg: error running subcommand external/go_sdk/pkg/tool/linux_amd64/compile: exit status 2 INFO: Elapsed time: 11.320s, Critical Path: 1.12s INFO: 5 processes: 5 linux-sandbox. diff --git a/README.md b/README.md index c5236f9..be219a7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Ease-gateway +# Janus-gateway Gateway service based on [grpc-ecosystem/grpc-gateway](https://github.com/grpc-ecosystem/grpc-gateway). This helps you provide your APIs in both gRPC and RESTful style at the same time. @@ -8,7 +8,7 @@ Gateway service based on [grpc-ecosystem/grpc-gateway](https://github.com/grpc-e **grpc-gateway** 的出现更能引起开发者对使用gRPC的兴趣, 她可以帮你在原有gRPC服务的基础上做少量的改动, 便可以将原gRPC服务同时提供RESTful HTTP API, 了解更多RESTful API的例子可以参考[GitHub REST API](https://developer.github.com/v3/) 、[Google REST API](https://developers.google.com/drive/v2/reference/) -**ease-gateway** 是站在巨人的肩膀上实现的, 增加了更符合企业级应用开发的**Features**: +**janus-gateway** 是站在巨人的肩膀上实现的, 增加了更符合企业级应用开发的**Features**: - 支持自定义的LoadBalancer - 既可以部署单机版模式, 也可注册到注册中心实现集群模式 @@ -21,15 +21,15 @@ Gateway service based on [grpc-ecosystem/grpc-gateway](https://github.com/grpc-e ## Design -[design.md](https://github.com/binchencoder/ease-gateway/tree/master/docs/design.md) +[design.md](https://github.com/binchencoder/janus-gateway/tree/master/docs/design.md) ## Validation Rule -[gateway-validation-rule.md](https://github.com/binchencoder/ease-gateway/tree/master/docs/gateway-validation-rule.md) +[gateway-validation-rule.md](https://github.com/binchencoder/janus-gateway/tree/master/docs/gateway-validation-rule.md) ## Prepared -**ease-gateway** 使用GO MOD来管理Dependencies,clone代码之后直接在本地使用bazel构建 +**janus-gateway** 使用GO MOD来管理Dependencies,clone代码之后直接在本地使用bazel构建 ### Build tools @@ -39,13 +39,13 @@ Gateway service based on [grpc-ecosystem/grpc-gateway](https://github.com/grpc-e ## Clone code ```shell -git clone https://github.com/binchencoder/ease-gateway.git +git clone https://github.com/binchencoder/janus-gateway.git ``` ## Bazel build gateway ``` -cd ease-gateway +cd janus-gateway bazel build cmd/gateway/... ``` @@ -56,4 +56,4 @@ TODO ## Run Examples -See [examples/README.md](https://github.com/binchencoder/ease-gateway/tree/master/examples) +See [examples/README.md](https://github.com/binchencoder/janus-gateway/tree/master/examples) diff --git a/WORKSPACE b/WORKSPACE index bf71513..15bae63 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1,4 +1,4 @@ -workspace(name = "com_github_binchencoder_ease_gateway") +workspace(name = "com_github_binchencoder_janus_gateway") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") @@ -109,17 +109,17 @@ load("@com_github_bazelbuild_buildtools//buildifier:deps.bzl", "buildifier_depen buildifier_dependencies() # ---------- local repositories -# local_repository( -# name = "com_github_binchencoder_gateway_proto", -# path = "../gateway-proto", -# ) +local_repository( + name = "com_github_binchencoder_gateway_proto", + path = "../gateway-proto", +) -# local_repository( -# name = "com_github_binchencoder_letsgo", -# path = "../letsgo", -# ) +local_repository( + name = "com_github_binchencoder_letsgo", + path = "../letsgo", +) -# local_repository( -# name = "com_github_binchencoder_skylb_api", -# path = "../skylb-api", -# ) +local_repository( + name = "com_github_binchencoder_skylb_api", + path = "../skylb-api", +) diff --git a/cmd/custom-gateway/BUILD.bazel b/cmd/custom-gateway/BUILD.bazel index a7bd2df..0ae5f8e 100644 --- a/cmd/custom-gateway/BUILD.bazel +++ b/cmd/custom-gateway/BUILD.bazel @@ -3,7 +3,7 @@ package(default_visibility = ["//visibility:public"]) load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") go_binary( - name = "custom-ease-gateway", + name = "custom-janus-gateway", embed = [":go_default_library"], ) @@ -13,7 +13,7 @@ go_library( "main.go", "registrydemo.go", ], - importpath = "github.com/binchencoder/ease-gateway/cmd/custom-gateway", + importpath = "github.com/binchencoder/janus-gateway/cmd/custom-gateway", deps = [ "//examples/internal/proto/examplepb", "//gateway/runtime", diff --git a/cmd/custom-gateway/main.go b/cmd/custom-gateway/main.go index 0da3ac8..b82b1f3 100644 --- a/cmd/custom-gateway/main.go +++ b/cmd/custom-gateway/main.go @@ -9,9 +9,9 @@ import ( "github.com/golang/glog" - "github.com/binchencoder/ease-gateway/gateway/runtime" - "github.com/binchencoder/ease-gateway/integrate" - "github.com/binchencoder/ease-gateway/util" + "github.com/binchencoder/janus-gateway/gateway/runtime" + "github.com/binchencoder/janus-gateway/integrate" + "github.com/binchencoder/janus-gateway/util" "github.com/binchencoder/gateway-proto/data" "github.com/binchencoder/letsgo" ) @@ -25,7 +25,7 @@ func usage() { fmt.Println(`EaseGateway - Ease Gateway of binchencoder. Usage: - ease-gateway [options] + janus-gateway [options] Options:`) @@ -58,7 +58,7 @@ func main() { mux := runtime.NewServeMux() runtime.SetGatewayServiceHook(integrate.NewGatewayHook(mux, hostPort)) - glog.Infof("***** Starting custom ease-gateway at %s. *****", hostPort) + glog.Infof("***** Starting custom janus-gateway at %s. *****", hostPort) signals := make(chan os.Signal, 1) signal.Notify(signals, os.Interrupt, os.Kill) diff --git a/cmd/custom-gateway/registrydemo.go b/cmd/custom-gateway/registrydemo.go index af7e752..e314c16 100755 --- a/cmd/custom-gateway/registrydemo.go +++ b/cmd/custom-gateway/registrydemo.go @@ -2,5 +2,5 @@ package main // Import so that applications register themselves to gateway. import ( - _ "github.com/binchencoder/ease-gateway/examples/internal/proto/examplepb" + _ "github.com/binchencoder/janus-gateway/examples/internal/proto/examplepb" ) diff --git a/cmd/gateway/BUILD.bazel b/cmd/gateway/BUILD.bazel index 494226f..5d20127 100644 --- a/cmd/gateway/BUILD.bazel +++ b/cmd/gateway/BUILD.bazel @@ -2,12 +2,12 @@ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar") go_library( - name = "ease-gateway", + name = "janus-gateway", srcs = [ "main.go", "registryprod.go", ], - importpath = "github.com/binchencoder/ease-gateway/cmd/gateway", + importpath = "github.com/binchencoder/janus-gateway/cmd/gateway", visibility = ["//visibility:public"], deps = [ "//proto/examplepb", @@ -22,15 +22,15 @@ go_library( ) # pkg_tar( -# name = "ease-gateway-tar", +# name = "janus-gateway-tar", # srcs = [ -# ":ease-gateway", +# ":janus-gateway", # ], -# package_dir = "/ease-gateway/bin", +# package_dir = "/janus-gateway/bin", # ) go_binary( name = "gateway", - embed = [":ease-gateway"], + embed = [":janus-gateway"], visibility = ["//visibility:public"], ) diff --git a/cmd/gateway/main.go b/cmd/gateway/main.go index 826ccf3..d76a067 100644 --- a/cmd/gateway/main.go +++ b/cmd/gateway/main.go @@ -9,17 +9,17 @@ import ( "github.com/golang/glog" - "github.com/binchencoder/ease-gateway/gateway/runtime" - "github.com/binchencoder/ease-gateway/integrate" - "github.com/binchencoder/ease-gateway/util" + "github.com/binchencoder/janus-gateway/gateway/runtime" + "github.com/binchencoder/janus-gateway/integrate" + "github.com/binchencoder/janus-gateway/util" "github.com/binchencoder/gateway-proto/data" "github.com/binchencoder/letsgo" "github.com/binchencoder/letsgo/service/naming" ) var ( - host = flag.String("host", "", "The ease-gateway service host ") - port = flag.Int("port", 8080, "The ease-gateway service port") + host = flag.String("host", "", "The janus-gateway service host ") + port = flag.Int("port", 8080, "The janus-gateway service port") enableHTTPS = flag.Bool("enable-https", false, "Whether to enable https.") certFile = flag.String("cert-file", "", "The TLS cert file.") keyFile = flag.String("key-file", "", "The TLS key file.") @@ -29,7 +29,7 @@ func usage() { fmt.Println(`Ease Gateway - Universal Gateway of xxx Inc. Usage: - ease-gateway [options] + janus-gateway [options] Options:`) diff --git a/cmd/gateway/registryprod.go b/cmd/gateway/registryprod.go index bd4c0cf..3bbe031 100755 --- a/cmd/gateway/registryprod.go +++ b/cmd/gateway/registryprod.go @@ -2,5 +2,5 @@ package main // Import so that applications register themselves to gateway. import ( - _ "github.com/binchencoder/ease-gateway/proto/examplepb" + _ "github.com/binchencoder/janus-gateway/proto/examplepb" ) diff --git a/docs/design.md b/docs/design.md index 56e2215..7c73894 100644 --- a/docs/design.md +++ b/docs/design.md @@ -1,26 +1,26 @@ # Ease-gatway - Enterprise Universal Gateway Service -`ease-gateway` is a enterprise universal gateway service for mobile, native, and web apps. +`janus-gateway` is a enterprise universal gateway service for mobile, native, and web apps. It's based on `grpc-gateway` and mobile team's gateway development experience. ## Overview -`ease-gateway` is a thin gateway layer on top of all front-end or APIs services. It's the single entrance for all enterprise internal services except the connection services (such as EIM connection layer, SSO, etc.). All clients access the gateway (through the reverse proxy or load balancer) with RESTful APIs, the gateway translates the requests to gRPC calls to the target services. +`janus-gateway` is a thin gateway layer on top of all front-end or APIs services. It's the single entrance for all enterprise internal services except the connection services (such as EIM connection layer, SSO, etc.). All clients access the gateway (through the reverse proxy or load balancer) with RESTful APIs, the gateway translates the requests to gRPC calls to the target services. ![Architecture](images/Arch.png) > SkyLB is an external load balancer for gRPC which is able to load balance on -> gRPC's long-lived connections. `ease-gateway` instances connect to SkyLB for endpoints +> gRPC's long-lived connections. `janus-gateway` instances connect to SkyLB for endpoints > of the target services, and load balance the end-users' requests to the target > services. -Based on this structure, `ease-gateway` provides foundamental functions to enterprise +Based on this structure, `janus-gateway` provides foundamental functions to enterprise infrastructure such as user identity verification, API management, monitoring, and logging. -## How does Ease-gateway Work? +## How does Janus-gateway Work? -`ease-gateway` is based on the open-sourced `grpc-gateway` framework. The following +`janus-gateway` is based on the open-sourced `grpc-gateway` framework. The following diagram shows how grpc-gateway works: ![grpc-gateway](images/mechanism.png) @@ -40,7 +40,7 @@ gateway and gRPC service stubs in Golang. The generated code can be easily hooked up with a HTTP server, and when HTTP requests arrive, it issues gRPC calls to the target service. -`ease-gateway` is the project to create such a HTTP server to meet enterprise business +`janus-gateway` is the project to create such a HTTP server to meet enterprise business needs. ### Request Interception @@ -83,7 +83,7 @@ translates the proto, it also generates a SkyLB client for each service. The SkyLB clients talk to the SkyLB to fetch service endpoints, and get notified when the service endpoints were changed so that it can do client side load balance properly. A typical SkyLB client example can be found at -[ease-gateway demo](https://github.com/binchencoder/ease-gateway/tree/master/examples/gateway) (it also contains the `grpc-gateway` example). +[janus-gateway demo](https://github.com/binchencoder/janus-gateway/tree/master/examples/gateway) (it also contains the `grpc-gateway` example). The GatewayServiceHook provides a Bootstrap() method for us to do initialization work (triggered by calling runtime.SetGatewayServiceHook() of @@ -136,7 +136,7 @@ In gRPC service proto, engineers need to specify the service ID like this: import "options/extension.proto"; service Demo { - option (ease.api.service_spec) = { + option (janus.api.service_spec) = { service_id: EASE_GATEWAY_DEMO namespace: "default" port_name: "grpc" @@ -162,7 +162,7 @@ import "httpoptions/annotations.proto"; // The request message for greeting. message GreetingRequest { string name = 1 [ - (ease.api.rules) = { + (janus.api.rules) = { rules: { type: STRING, operator: NON_NIL, @@ -196,7 +196,7 @@ We can add Janus customized instrumentation if needed. ## Gateway Rollout Procedure -When a new target service or service update is going to be added to `ease-gateway`, +When a new target service or service update is going to be added to `janus-gateway`, it has to following the following steps: 1. Add a service enum if it's a new service. @@ -206,15 +206,15 @@ it has to following the following steps: 3. Implement the gRPC service and push to production. 4. Link the service to gateway if it's a new service. This can be easily done - by adding an anonymous import in `//ease-gateway/cmd/gateway/registryprod.go ` : + by adding an anonymous import in `//janus-gateway/cmd/gateway/registryprod.go ` : ```go import ( - _ "github.com/binchencoder/ease-gateway/proto/examples" + _ "github.com/binchencoder/janus-gateway/proto/examples" ) ``` -5. Rebuild the `ease-gateway` binary and push to production. +5. Rebuild the `janus-gateway` binary and push to production. ## References diff --git a/docs/gateway-validation-rule.md b/docs/gateway-validation-rule.md index 914691e..20858ed 100644 --- a/docs/gateway-validation-rule.md +++ b/docs/gateway-validation-rule.md @@ -1,10 +1,10 @@ -# Ease-gateway Validation Rule +# Janus-gateway Validation Rule ## Rules Defination Validation Rule定义可以在这里找到: -> ease-gateway/httpoptions/annotations.proto +> janus-gateway/httpoptions/annotations.proto ```protobuf // The opertaion type. @@ -66,7 +66,7 @@ message Payment { PaymentType type = 1; // 100 > paied_amount > 10 int64 paied_amount = 2 [ - (ease.api.rules) = { + (janus.api.rules) = { rules: { type:NUMBER, operator: GT, @@ -84,7 +84,7 @@ message Payment { PaymentType type = 1; // 长度=10 string message_value_len_eq = 3 [ - (ease.api.rules) = { + (janus.api.rules) = { rules: { type:STRING, operator: LEN_EQ, @@ -95,7 +95,7 @@ message Payment { // 长度Trim之后小于21 string message_value_len_gt = 4 [ - (ease.api.rules) = { + (janus.api.rules) = { rules: { type:STRING, operator: LEN_LT, @@ -109,7 +109,7 @@ message Payment { 更多例子可以以下目录找到: -> ease-gateway/proto/examples/... +> janus-gateway/proto/examples/... ## Implemention Details @@ -148,10 +148,10 @@ func Validate__sharedproto_Payment(v *Payment) error { ### Defination -> ease-gateway/httpoptions/annotations.proto +> janus-gateway/httpoptions/annotations.proto ### Implementation Validation Rule -> ease-gateway/gateway/protoc-gen-grpc-gateway/internal/gengateway/template.go +> janus-gateway/gateway/protoc-gen-grpc-gateway/internal/gengateway/template.go 所有Validation Rule的实现都在template.go 文件中, 搜索`validatorTemplate`, 参照现有实现Coding \ No newline at end of file diff --git a/docs/scripts/start.sh b/docs/scripts/start.sh index 2047ede..9734a17 100755 --- a/docs/scripts/start.sh +++ b/docs/scripts/start.sh @@ -29,7 +29,7 @@ fi STDOUT_FILE=$HOMEDIR/std.out set +e -PIDS=`pgrep ^ease-gateway$` +PIDS=`pgrep ^janus-gateway$` if [ $? -eq 0 ]; then echo "ERROR: The service Ease Gateway already started!" echo "PID: $PIDS" @@ -38,7 +38,7 @@ fi set -e echo "Service Ease Gateway start..." -nohup $HOMEDIR/bin/ease-gateway \ +nohup $HOMEDIR/bin/janus-gateway \ -debug-svc-endpoint=vexillary-service=192.168.10.41:4100 \ -debug-svc-endpoint=pay-grpc-service=192.168.32.18:10008 \ -skylb-endpoints=$SKYLB_ENDPOINTS \ @@ -50,7 +50,7 @@ nohup $HOMEDIR/bin/ease-gateway \ sleep 2 -PIDS_COUNT=`pgrep ^ease-gateway$|wc -l` +PIDS_COUNT=`pgrep ^janus-gateway$|wc -l` if [ $PIDS_COUNT -eq 0 ]; then echo "ERROR: The service Ease Gateway does not started!" exit 1 diff --git a/docs/scripts/stop.sh b/docs/scripts/stop.sh index fbf0655..54ff16c 100755 --- a/docs/scripts/stop.sh +++ b/docs/scripts/stop.sh @@ -1,7 +1,7 @@ #!/bin/sh set +e -PIDS=`pgrep ^ease-gateway$` +PIDS=`pgrep ^janus-gateway$` if [ $? -ne 0 ]; then echo "INFO: The service Ease Gateway did not started!" exit 0 @@ -15,7 +15,7 @@ done while [ true ]; do echo -e ".\c" - IDS=`pgrep ^ease-gateway$` + IDS=`pgrep ^janus-gateway$` if [ $? -ne 0 ]; then echo echo "PID: $PIDS" diff --git a/examples/grpc-server/BUILD.bazel b/examples/grpc-server/BUILD.bazel index 4c9fcd7..b55c434 100644 --- a/examples/grpc-server/BUILD.bazel +++ b/examples/grpc-server/BUILD.bazel @@ -8,7 +8,7 @@ go_library( "main.go", "echo.go", ], - importpath = "github.com/binchencoder/ease-gateway/examples/grpc-server", + importpath = "github.com/binchencoder/janus-gateway/examples/grpc-server", deps = [ "//proto/examplepb", "@com_github_binchencoder_gateway_proto//data:go_default_library", diff --git a/examples/grpc-server/echo.go b/examples/grpc-server/echo.go index 181a464..752a723 100644 --- a/examples/grpc-server/echo.go +++ b/examples/grpc-server/echo.go @@ -3,7 +3,7 @@ package main import ( "context" - "github.com/binchencoder/ease-gateway/proto/examplepb" + "github.com/binchencoder/janus-gateway/proto/examplepb" "github.com/golang/glog" "google.golang.org/grpc" "google.golang.org/grpc/metadata" diff --git a/examples/grpc-server/main.go b/examples/grpc-server/main.go index 5b07a39..4a3de71 100644 --- a/examples/grpc-server/main.go +++ b/examples/grpc-server/main.go @@ -8,7 +8,7 @@ import ( "flag" "fmt" - examplepb "github.com/binchencoder/ease-gateway/proto/examplepb" + examplepb "github.com/binchencoder/janus-gateway/proto/examplepb" "github.com/binchencoder/gateway-proto/data" skylb "github.com/binchencoder/skylb-api/server" "github.com/golang/glog" diff --git a/examples/internal/README.md b/examples/internal/README.md index 59660c2..51dc903 100644 --- a/examples/internal/README.md +++ b/examples/internal/README.md @@ -1,6 +1,6 @@ # Overrview -ease-gateway/examples/internal 是使用ease-gateway的一个完整示例,包含gateway-server 和 gRPC-server. 还有Java实现gRPC Server的例子 [https://github.com/binchencoder/spring-boot-grpc/tree/master/spring-boot-grpc-examples] +janus-gateway/examples/internal 是使用ease-gateway的一个完整示例,包含gateway-server 和 gRPC-server. 还有Java实现gRPC Server的例子 [https://github.com/binchencoder/spring-boot-grpc/tree/master/spring-boot-grpc-examples] # Build the example @@ -18,27 +18,27 @@ bazel build examples/internal/cmd/example-grpc-server/... start gateway server ```shell -ease-gateway/bazel-bin/examples/internal/cmd/example-gateway-server/example-gateway-server_/example-gateway-server -skylb-endpoints="127.0.0.1:1900" -debug-svc-endpoint=custom-ease-gateway-test=localhost:9090 +janus-gateway/bazel-bin/examples/internal/cmd/example-gateway-server/example-gateway-server_/example-gateway-server -skylb-endpoints="127.0.0.1:1900" -debug-svc-endpoint=custom-janus-gateway-test=localhost:9090 ``` start custom-gateway server ```shell -ease-gateway/bazel-bin/cmd/custom-gateway/custom-ease-gateway_/custom-ease-gateway -skylb-endpoints="127.0.0.1:1900" -debug-service=custom-ease-gateway-test -debug-svc-endpoint=custom-ease-gateway-test=localhost:9090 +janus-gateway/bazel-bin/cmd/custom-gateway/custom-janus-gateway_/custom-janus-gateway -skylb-endpoints="127.0.0.1:1900" -debug-service=custom-janus-gateway-test -debug-svc-endpoint=custom-janus-gateway-test=localhost:9090 ``` start examples gRPC server for test //examples/internal/cmd/example-grpc-server ```shell -ease-gateway/bazel-bin/examples/internal/cmd/example-grpc-server/example-grpc-server_/example-grpc-server -skylb-endpoints="127.0.0.1:1900,127.0.0.1:1901" +janus-gateway/bazel-bin/examples/internal/cmd/example-grpc-server/example-grpc-server_/example-grpc-server -skylb-endpoints="127.0.0.1:1900,127.0.0.1:1901" ``` start gRPC server for test //cmd/gateway ```shell -ease-gateway/bazel-bin/examples/grpc-server/grpc-server_/grpc-server -skylb-endpoints="127.0.0.1:1900" +janus-gateway/bazel-bin/examples/grpc-server/grpc-server_/grpc-server -skylb-endpoints="127.0.0.1:1900" ``` start //cmd/gateway ```shell -ease-gateway/bazel-bin/cmd/gateway/gateway_/gateway -skylb-endpoints="127.0.0.1:1900" -v=2 -log_dir=. +janus-gateway/bazel-bin/cmd/gateway/gateway_/gateway -skylb-endpoints="127.0.0.1:1900" -v=2 -log_dir=. ``` # Usage diff --git a/examples/internal/cmd/example-gateway-server/BUILD.bazel b/examples/internal/cmd/example-gateway-server/BUILD.bazel index c5df729..39d663d 100644 --- a/examples/internal/cmd/example-gateway-server/BUILD.bazel +++ b/examples/internal/cmd/example-gateway-server/BUILD.bazel @@ -3,7 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") go_library( name = "go_default_library", srcs = ["main.go"], - importpath = "github.com/binchencoder/ease-gateway/examples/internal/cmd/example-gateway-server", + importpath = "github.com/binchencoder/janus-gateway/examples/internal/cmd/example-gateway-server", visibility = ["//visibility:private"], deps = [ "//examples/internal/gateway:go_default_library", diff --git a/examples/internal/cmd/example-gateway-server/main.go b/examples/internal/cmd/example-gateway-server/main.go index 313bd51..2d34925 100644 --- a/examples/internal/cmd/example-gateway-server/main.go +++ b/examples/internal/cmd/example-gateway-server/main.go @@ -9,7 +9,7 @@ import ( "flag" "github.com/golang/glog" - "github.com/binchencoder/ease-gateway/examples/internal/gateway" + "github.com/binchencoder/janus-gateway/examples/internal/gateway" ) var ( diff --git a/examples/internal/cmd/example-grpc-client/BUILD.bazel b/examples/internal/cmd/example-grpc-client/BUILD.bazel index f91e673..25ddab5 100644 --- a/examples/internal/cmd/example-grpc-client/BUILD.bazel +++ b/examples/internal/cmd/example-grpc-client/BUILD.bazel @@ -5,7 +5,7 @@ package(default_visibility = ["//visibility:private"]) go_library( name = "go_default_library", srcs = ["grpcclient.go"], - importpath = "github.com/binchencoder/ease-gateway/examples/internal/cmd/example-grpc-client", + importpath = "github.com/binchencoder/janus-gateway/examples/internal/cmd/example-grpc-client", deps = [ "//examples/internal/proto/examplepb:go_default_library", "//examples/internal/server:go_default_library", diff --git a/examples/internal/cmd/example-grpc-client/gatewayclient.go b/examples/internal/cmd/example-grpc-client/gatewayclient.go index 01f3b10..818459b 100644 --- a/examples/internal/cmd/example-grpc-client/gatewayclient.go +++ b/examples/internal/cmd/example-grpc-client/gatewayclient.go @@ -10,7 +10,7 @@ import ( "github.com/golang/protobuf/jsonpb" - examplepb "github.com/binchencoder/ease-gateway/examples/internal/proto/examplepb" + examplepb "github.com/binchencoder/janus-gateway/examples/internal/proto/examplepb" "github.com/binchencoder/letsgo" ) diff --git a/examples/internal/cmd/example-grpc-client/grpcclient.go b/examples/internal/cmd/example-grpc-client/grpcclient.go index fc4b664..2ea1100 100644 --- a/examples/internal/cmd/example-grpc-client/grpcclient.go +++ b/examples/internal/cmd/example-grpc-client/grpcclient.go @@ -12,7 +12,7 @@ import ( "google.golang.org/grpc" hpb "google.golang.org/grpc/health/grpc_health_v1" - examplepb "github.com/binchencoder/ease-gateway/examples/internal/proto/examplepb" + examplepb "github.com/binchencoder/janus-gateway/examples/internal/proto/examplepb" vexpb "github.com/binchencoder/gateway-proto/data" "github.com/binchencoder/letsgo" skylb "github.com/binchencoder/skylb-api/client" diff --git a/examples/internal/cmd/example-grpc-server/BUILD.bazel b/examples/internal/cmd/example-grpc-server/BUILD.bazel index 9ccd69a..eec50ac 100644 --- a/examples/internal/cmd/example-grpc-server/BUILD.bazel +++ b/examples/internal/cmd/example-grpc-server/BUILD.bazel @@ -5,7 +5,7 @@ package(default_visibility = ["//visibility:private"]) go_library( name = "go_default_library", srcs = ["main.go"], - importpath = "github.com/binchencoder/ease-gateway/examples/internal/cmd/example-grpc-server", + importpath = "github.com/binchencoder/janus-gateway/examples/internal/cmd/example-grpc-server", deps = [ "//examples/internal/proto/examplepb:go_default_library", "//examples/internal/server:go_default_library", diff --git a/examples/internal/cmd/example-grpc-server/main.go b/examples/internal/cmd/example-grpc-server/main.go index 633154e..d2752b7 100644 --- a/examples/internal/cmd/example-grpc-server/main.go +++ b/examples/internal/cmd/example-grpc-server/main.go @@ -10,13 +10,13 @@ import ( "log" "net/http" - examplepb "github.com/binchencoder/ease-gateway/examples/internal/proto/examplepb" + examplepb "github.com/binchencoder/janus-gateway/examples/internal/proto/examplepb" "github.com/prometheus/client_golang/prometheus" "github.com/binchencoder/gateway-proto/data" skylb "github.com/binchencoder/skylb-api/server" - "github.com/binchencoder/ease-gateway/examples/internal/server" + "github.com/binchencoder/janus-gateway/examples/internal/server" "github.com/golang/glog" "google.golang.org/grpc" ) diff --git a/examples/internal/gateway/BUILD.bazel b/examples/internal/gateway/BUILD.bazel index 5739512..cdc26b2 100644 --- a/examples/internal/gateway/BUILD.bazel +++ b/examples/internal/gateway/BUILD.bazel @@ -8,7 +8,7 @@ go_library( "handlers.go", "main.go", ], - importpath = "github.com/binchencoder/ease-gateway/examples/internal/gateway", + importpath = "github.com/binchencoder/janus-gateway/examples/internal/gateway", visibility = ["//visibility:public"], deps = [ "//examples/internal/proto/examplepb", diff --git a/examples/internal/gateway/gateway.go b/examples/internal/gateway/gateway.go index 65b42ff..87cb3af 100644 --- a/examples/internal/gateway/gateway.go +++ b/examples/internal/gateway/gateway.go @@ -6,8 +6,8 @@ import ( "net" "net/http" - "github.com/binchencoder/ease-gateway/examples/internal/proto/examplepb" - gwruntime "github.com/binchencoder/ease-gateway/gateway/runtime" + "github.com/binchencoder/janus-gateway/examples/internal/proto/examplepb" + gwruntime "github.com/binchencoder/janus-gateway/gateway/runtime" "google.golang.org/grpc" ) diff --git a/examples/internal/gateway/main.go b/examples/internal/gateway/main.go index 8d4f3cd..e467b68 100644 --- a/examples/internal/gateway/main.go +++ b/examples/internal/gateway/main.go @@ -5,7 +5,7 @@ import ( "net/http" "github.com/golang/glog" - gwruntime "github.com/binchencoder/ease-gateway/gateway/runtime" + gwruntime "github.com/binchencoder/janus-gateway/gateway/runtime" ) // Endpoint describes a gRPC endpoint diff --git a/examples/internal/integration/README.md b/examples/internal/integration/README.md index 2c55f9e..6b1d01f 100644 --- a/examples/internal/integration/README.md +++ b/examples/internal/integration/README.md @@ -3,7 +3,7 @@ ## Bazel test ```shell -bazel run examples/internal/integration/... --test_arg=--skylb-endpoints="" --test_arg=--debug-svc-endpoint=custom-ease-gateway-test=localhost:9090 +bazel run examples/internal/integration/... --test_arg=--skylb-endpoints="" --test_arg=--debug-svc-endpoint=custom-janus-gateway-test=localhost:9090 ``` > 通过bazel run 执行integration test diff --git a/examples/internal/integration/integration_test.go b/examples/internal/integration/integration_test.go index d43092d..bcae784 100644 --- a/examples/internal/integration/integration_test.go +++ b/examples/internal/integration/integration_test.go @@ -9,8 +9,8 @@ import ( "strings" "testing" - examplepb "github.com/binchencoder/ease-gateway/examples/internal/proto/examplepb" - "github.com/binchencoder/ease-gateway/gateway/runtime" + examplepb "github.com/binchencoder/janus-gateway/examples/internal/proto/examplepb" + "github.com/binchencoder/janus-gateway/gateway/runtime" "github.com/google/go-cmp/cmp" fieldmaskpb "google.golang.org/genproto/protobuf/field_mask" diff --git a/examples/internal/integration/main_test.go b/examples/internal/integration/main_test.go index e795158..6c06980 100644 --- a/examples/internal/integration/main_test.go +++ b/examples/internal/integration/main_test.go @@ -10,9 +10,9 @@ import ( "time" "github.com/golang/glog" - "github.com/binchencoder/ease-gateway/examples/internal/gateway" - server "github.com/binchencoder/ease-gateway/examples/internal/server" - gwruntime "github.com/binchencoder/ease-gateway/gateway/runtime" + "github.com/binchencoder/janus-gateway/examples/internal/gateway" + server "github.com/binchencoder/janus-gateway/examples/internal/server" + gwruntime "github.com/binchencoder/janus-gateway/gateway/runtime" ) var ( diff --git a/examples/internal/proto/examplepb/BUILD.bazel b/examples/internal/proto/examplepb/BUILD.bazel index 8084e43..748a4d0 100644 --- a/examples/internal/proto/examplepb/BUILD.bazel +++ b/examples/internal/proto/examplepb/BUILD.bazel @@ -85,7 +85,7 @@ go_proto_library( "//:go_grpc", "//gateway/protoc-gen-grpc-gateway:go_gen_grpc_gateway", ], - importpath = "github.com/binchencoder/ease-gateway/examples/internal/proto/examplepb", + importpath = "github.com/binchencoder/janus-gateway/examples/internal/proto/examplepb", proto = ":examplepb_proto", deps = [ "//httpoptions", @@ -105,7 +105,7 @@ go_proto_library( go_library( name = "examplepb", embed = [":examplepb_go_proto"], - importpath = "github.com/binchencoder/ease-gateway/examples/internal/proto/examplepb", + importpath = "github.com/binchencoder/janus-gateway/examples/internal/proto/examplepb", deps = [ "//httpoptions", "//gateway/runtime", diff --git a/examples/internal/proto/examplepb/echo_service.pb.go b/examples/internal/proto/examplepb/echo_service.pb.go index c31ddf4..eb22854 100755 --- a/examples/internal/proto/examplepb/echo_service.pb.go +++ b/examples/internal/proto/examplepb/echo_service.pb.go @@ -7,7 +7,7 @@ package examplepb import ( - _ "github.com/binchencoder/ease-gateway/httpoptions" + _ "github.com/binchencoder/janus-gateway/httpoptions" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" diff --git a/examples/internal/proto/examplepb/echo_service.pb.gw.go b/examples/internal/proto/examplepb/echo_service.pb.gw.go index b4a4cc8..75b4582 100755 --- a/examples/internal/proto/examplepb/echo_service.pb.gw.go +++ b/examples/internal/proto/examplepb/echo_service.pb.gw.go @@ -17,7 +17,7 @@ import ( "sync" "unicode/utf8" - "github.com/binchencoder/ease-gateway/gateway/runtime" + "github.com/binchencoder/janus-gateway/gateway/runtime" vexpb "github.com/binchencoder/gateway-proto/data" fpb "github.com/binchencoder/gateway-proto/frontend" lgr "github.com/binchencoder/letsgo/grpc" diff --git a/examples/internal/proto/examplepb/echo_service.proto b/examples/internal/proto/examplepb/echo_service.proto index 216c78a..589f5cd 100644 --- a/examples/internal/proto/examplepb/echo_service.proto +++ b/examples/internal/proto/examplepb/echo_service.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -option go_package = "github.com/binchencoder/ease-gateway/examples/internal/proto/examplepb;examplepb"; +option go_package = "github.com/binchencoder/janus-gateway/examples/internal/proto/examplepb;examplepb"; // Echo Service // @@ -41,7 +41,7 @@ message ValidationRuleTestRequest { // Id represents the message identifier. string id = 1 [ - (ease.api.rules) = { + (janus.api.rules) = { rules: { type: STRING, operator: NON_NIL, @@ -62,7 +62,7 @@ message ValidationRuleTestRequest { ]; int64 num = 2 [ - (ease.api.rules) = { + (janus.api.rules) = { rules: { type: NUMBER, operator: GT, @@ -90,7 +90,7 @@ message DynamicMessageUpdate { // Echo service responds to incoming echo requests. service EchoService { - option (ease.api.service_spec) = { + option (janus.api.service_spec) = { service_id: CUSTOM_EASE_GATEWAY_TEST port_name : "grpc" namespace : "default" @@ -102,7 +102,7 @@ service EchoService { // The message posted as the id parameter will also be // returned. rpc Echo(SimpleMessage) returns (SimpleMessage) { - option (ease.api.http) = { + option (janus.api.http) = { post: "/v1/example/echo/{id}" additional_bindings { get: "/v1/example/echo/{id}/{num}" @@ -120,20 +120,20 @@ service EchoService { } // EchoBody method receives a simple message and returns it. rpc EchoBody(SimpleMessage) returns (SimpleMessage) { - option (ease.api.http) = { + option (janus.api.http) = { post: "/v1/example/echo_body" body: "*" }; } // EchoDelete method receives a simple message and returns it. rpc EchoDelete(SimpleMessage) returns (SimpleMessage) { - option (ease.api.http) = { + option (janus.api.http) = { delete: "/v1/example/echo_delete" }; } // EchoPatch method receives a NonStandardUpdateRequest and returns it. rpc EchoPatch(DynamicMessageUpdate) returns (DynamicMessageUpdate) { - option (ease.api.http) = { + option (janus.api.http) = { patch: "/v1/example/echo_patch" body: "body" }; @@ -141,7 +141,7 @@ service EchoService { // EchoValidationRule method for validation http rules integration test. rpc EchoValidationRule(ValidationRuleTestRequest) returns (ValidationRuleTestResponse) { - option (ease.api.http) = { + option (janus.api.http) = { post: "/v1/example/echo:validationRules" body: "*" }; diff --git a/examples/internal/proto/examplepb/generated_input.proto b/examples/internal/proto/examplepb/generated_input.proto index b2ac0c6..ed6df0f 100644 --- a/examples/internal/proto/examplepb/generated_input.proto +++ b/examples/internal/proto/examplepb/generated_input.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -option go_package = "github.com/binchencoder/ease-gateway/examples/internal/proto/examplepb"; +option go_package = "github.com/binchencoder/janus-gateway/examples/internal/proto/examplepb"; package grpc.gateway.examples.internal.proto.examplepb; import "google/api/annotations.proto"; diff --git a/examples/internal/proto/examplepb/unannotated_echo_service.pb.go b/examples/internal/proto/examplepb/unannotated_echo_service.pb.go index 9ef8067..e7b48a7 100755 --- a/examples/internal/proto/examplepb/unannotated_echo_service.pb.go +++ b/examples/internal/proto/examplepb/unannotated_echo_service.pb.go @@ -7,7 +7,7 @@ package examplepb import ( - _ "github.com/binchencoder/ease-gateway/httpoptions" + _ "github.com/binchencoder/janus-gateway/httpoptions" duration "github.com/golang/protobuf/ptypes/duration" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" diff --git a/examples/internal/proto/examplepb/unannotated_echo_service.proto b/examples/internal/proto/examplepb/unannotated_echo_service.proto index 0f48846..ef7161a 100644 --- a/examples/internal/proto/examplepb/unannotated_echo_service.proto +++ b/examples/internal/proto/examplepb/unannotated_echo_service.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -option go_package = "github.com/binchencoder/ease-gateway/examples/internal/proto/examplepb;examplepb"; +option go_package = "github.com/binchencoder/janus-gateway/examples/internal/proto/examplepb;examplepb"; // Unannotated Echo Service // Similar to echo_service.proto but without annotations. See @@ -41,7 +41,7 @@ message UnannotatedSimpleMessage { // Echo service responds to incoming echo requests. service UnannotatedEchoService { - option (ease.api.service_spec) = { + option (janus.api.service_spec) = { service_id: CUSTOM_EASE_GATEWAY_TEST port_name : "grpc" namespace : "default" diff --git a/examples/internal/server/BUILD.bazel b/examples/internal/server/BUILD.bazel index 458a608..fc491f1 100644 --- a/examples/internal/server/BUILD.bazel +++ b/examples/internal/server/BUILD.bazel @@ -8,7 +8,7 @@ go_library( "echo.go", "main.go", ], - importpath = "github.com/binchencoder/ease-gateway/examples/internal/server", + importpath = "github.com/binchencoder/janus-gateway/examples/internal/server", deps = [ "//examples/internal/proto/examplepb", "//gateway/runtime", diff --git a/examples/internal/server/echo.go b/examples/internal/server/echo.go index 3721fbf..1a057d3 100644 --- a/examples/internal/server/echo.go +++ b/examples/internal/server/echo.go @@ -3,7 +3,7 @@ package server import ( "context" - examples "github.com/binchencoder/ease-gateway/examples/internal/proto/examplepb" + examples "github.com/binchencoder/janus-gateway/examples/internal/proto/examplepb" "github.com/golang/glog" "google.golang.org/grpc" "google.golang.org/grpc/metadata" diff --git a/examples/internal/server/main.go b/examples/internal/server/main.go index 60729e1..dec1cbc 100644 --- a/examples/internal/server/main.go +++ b/examples/internal/server/main.go @@ -5,8 +5,8 @@ import ( "net" "net/http" - examples "github.com/binchencoder/ease-gateway/examples/internal/proto/examplepb" - "github.com/binchencoder/ease-gateway/gateway/runtime" + examples "github.com/binchencoder/janus-gateway/examples/internal/proto/examplepb" + "github.com/binchencoder/janus-gateway/gateway/runtime" "github.com/golang/glog" "google.golang.org/grpc" ) diff --git a/gateway/README.md b/gateway/README.md index 961e4e2..7142e1a 100644 --- a/gateway/README.md +++ b/gateway/README.md @@ -2,7 +2,7 @@ grpc-gateway 是一款非常优秀的网关服务器,负责转化和代理转发。让```RESTful API ```和 ```gRPC```可以相互转化,这样可以实现一套```gRPC```接口提供两种接口服务(提供内部的```gRPC```服务和外部```RESTful API```服务),大大提高了开发效率。 -但是官方提供的版本还是单机版的,还不支持集群,所以并不能直接运行在生产环境中。```ease-gateway```就是为了解决这些问题应运而生的,在```grpc-gateway```的基础上增加了新的feature +但是官方提供的版本还是单机版的,还不支持集群,所以并不能直接运行在生产环境中。```janus-gateway```就是为了解决这些问题应运而生的,在```grpc-gateway```的基础上增加了新的feature - 支持自定义的loadbalancer - 支持网关层的parameter validation diff --git a/gateway/internal/BUILD.bazel b/gateway/internal/BUILD.bazel index d1917c5..8d84966 100644 --- a/gateway/internal/BUILD.bazel +++ b/gateway/internal/BUILD.bazel @@ -15,7 +15,7 @@ proto_library( go_proto_library( name = "internal_go_proto", - importpath = "github.com/binchencoder/ease-gateway/gateway/internal", + importpath = "github.com/binchencoder/janus-gateway/gateway/internal", proto = ":internal_proto", deps = [ "@com_github_binchencoder_gateway_proto//frontend:error_go_proto", @@ -25,7 +25,7 @@ go_proto_library( go_library( name = "go_default_library", embed = [":internal_go_proto"], - importpath = "github.com/binchencoder/ease-gateway/gateway/internal", + importpath = "github.com/binchencoder/janus-gateway/gateway/internal", deps = [ "@com_github_binchencoder_gateway_proto//frontend:go_default_library", ] diff --git a/gateway/internal/casing/BUILD.bazel b/gateway/internal/casing/BUILD.bazel index f7ce84c..5876df8 100644 --- a/gateway/internal/casing/BUILD.bazel +++ b/gateway/internal/casing/BUILD.bazel @@ -3,7 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "casing", srcs = ["camel.go"], - importpath = "github.com/binchencoder/ease-gateway/gateway/internal/casing", + importpath = "github.com/binchencoder/janus-gateway/gateway/internal/casing", visibility = ["//:__subpackages__"], ) diff --git a/gateway/internal/descriptor/BUILD.bazel b/gateway/internal/descriptor/BUILD.bazel index 0bff1b9..4f836d9 100644 --- a/gateway/internal/descriptor/BUILD.bazel +++ b/gateway/internal/descriptor/BUILD.bazel @@ -11,7 +11,7 @@ go_library( "services.go", "types.go", ], - importpath = "github.com/binchencoder/ease-gateway/gateway/internal/descriptor", + importpath = "github.com/binchencoder/janus-gateway/gateway/internal/descriptor", deps = [ "//gateway/internal/casing", "@com_github_grpc_ecosystem_grpc_gateway//internal/codegenerator", diff --git a/gateway/internal/descriptor/apiconfig/BUILD.bazel b/gateway/internal/descriptor/apiconfig/BUILD.bazel index 98baaed..2f40350 100644 --- a/gateway/internal/descriptor/apiconfig/BUILD.bazel +++ b/gateway/internal/descriptor/apiconfig/BUILD.bazel @@ -17,7 +17,7 @@ proto_library( go_proto_library( name = "apiconfig_go_proto", compilers = ["//:go_apiv2"], - importpath = "github.com/binchencoder/ease-gateway/gateway/internal/descriptor/apiconfig", + importpath = "github.com/binchencoder/janus-gateway/gateway/internal/descriptor/apiconfig", proto = ":apiconfig_proto", deps = ["//httpoptions"], ) @@ -25,7 +25,7 @@ go_proto_library( go_library( name = "apiconfig", embed = [":apiconfig_go_proto"], - importpath = "github.com/binchencoder/ease-gateway/gateway/internal/descriptor/apiconfig", + importpath = "github.com/binchencoder/janus-gateway/gateway/internal/descriptor/apiconfig", ) alias( diff --git a/gateway/internal/descriptor/apiconfig/apiconfig.pb.go b/gateway/internal/descriptor/apiconfig/apiconfig.pb.go index 1254efb..1abad8b 100644 --- a/gateway/internal/descriptor/apiconfig/apiconfig.pb.go +++ b/gateway/internal/descriptor/apiconfig/apiconfig.pb.go @@ -120,10 +120,10 @@ func file_gateway_internal_descriptor_apiconfig_apiconfig_proto_rawDescGZIP() [] var file_gateway_internal_descriptor_apiconfig_apiconfig_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_gateway_internal_descriptor_apiconfig_apiconfig_proto_goTypes = []interface{}{ (*GrpcAPIService)(nil), // 0: grpc.gateway.internal.descriptor.apiconfig.GrpcAPIService - (*httpoptions.Http)(nil), // 1: ease.api.Http + (*httpoptions.Http)(nil), // 1: janus.api.Http } var file_gateway_internal_descriptor_apiconfig_apiconfig_proto_depIdxs = []int32{ - 1, // 0: grpc.gateway.internal.descriptor.apiconfig.GrpcAPIService.http:type_name -> ease.api.Http + 1, // 0: grpc.gateway.internal.descriptor.apiconfig.GrpcAPIService.http:type_name -> janus.api.Http 1, // [1:1] is the sub-list for method output_type 1, // [1:1] is the sub-list for method input_type 1, // [1:1] is the sub-list for extension type_name diff --git a/gateway/internal/descriptor/apiconfig/apiconfig.proto b/gateway/internal/descriptor/apiconfig/apiconfig.proto index ed897c2..2ffc0ed 100644 --- a/gateway/internal/descriptor/apiconfig/apiconfig.proto +++ b/gateway/internal/descriptor/apiconfig/apiconfig.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package grpc.gateway.internal.descriptor.apiconfig; -option go_package = "github.com/binchencoder/ease-gateway/gatewayinternal/descriptor/apiconfig"; +option go_package = "github.com/binchencoder/janus-gateway/gatewayinternal/descriptor/apiconfig"; import "httpoptions/http.proto"; @@ -17,5 +17,5 @@ import "httpoptions/http.proto"; // compatibility guarantees by protobuf it is safe for us to remove the other fields. message GrpcAPIService { // Http Rule. - ease.api.Http http = 1; + janus.api.Http http = 1; } diff --git a/gateway/internal/descriptor/grpc_api_configuration.go b/gateway/internal/descriptor/grpc_api_configuration.go index e125b4c..dd59a30 100644 --- a/gateway/internal/descriptor/grpc_api_configuration.go +++ b/gateway/internal/descriptor/grpc_api_configuration.go @@ -6,7 +6,7 @@ import ( "strings" // "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor/apiconfig" - "github.com/binchencoder/ease-gateway/gateway/internal/descriptor/apiconfig" + "github.com/binchencoder/janus-gateway/gateway/internal/descriptor/apiconfig" "google.golang.org/protobuf/encoding/protojson" "sigs.k8s.io/yaml" ) diff --git a/gateway/internal/descriptor/openapi_configuration.go b/gateway/internal/descriptor/openapi_configuration.go index d8d131d..ebbaf6b 100644 --- a/gateway/internal/descriptor/openapi_configuration.go +++ b/gateway/internal/descriptor/openapi_configuration.go @@ -5,7 +5,7 @@ import ( "io/ioutil" // "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor/openapiconfig" - "github.com/binchencoder/ease-gateway/gateway/internal/descriptor/openapiconfig" + "github.com/binchencoder/janus-gateway/gateway/internal/descriptor/openapiconfig" "google.golang.org/protobuf/encoding/protojson" "sigs.k8s.io/yaml" ) diff --git a/gateway/internal/descriptor/openapi_configuration_test.go b/gateway/internal/descriptor/openapi_configuration_test.go index 6755b19..6dcec93 100644 --- a/gateway/internal/descriptor/openapi_configuration_test.go +++ b/gateway/internal/descriptor/openapi_configuration_test.go @@ -5,7 +5,7 @@ import ( "testing" // "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" - "github.com/binchencoder/ease-gateway/gateway/protoc-gen-openapiv2/options" + "github.com/binchencoder/janus-gateway/gateway/protoc-gen-openapiv2/options" ) func TestLoadOpenAPIConfigFromYAMLRejectInvalidYAML(t *testing.T) { diff --git a/gateway/internal/descriptor/openapiconfig/BUILD.bazel b/gateway/internal/descriptor/openapiconfig/BUILD.bazel index c65a584..60d2a9a 100644 --- a/gateway/internal/descriptor/openapiconfig/BUILD.bazel +++ b/gateway/internal/descriptor/openapiconfig/BUILD.bazel @@ -12,7 +12,7 @@ proto_library( go_proto_library( name = "openapiconfig_go_proto", compilers = ["//:go_apiv2"], - importpath = "github.com/binchencoder/ease-gateway/gateway/internal/descriptor/openapiconfig", + importpath = "github.com/binchencoder/janus-gateway/gateway/internal/descriptor/openapiconfig", proto = ":openapiconfig_proto", visibility = ["//:__subpackages__"], deps = ["//gateway/protoc-gen-openapiv2/options"], @@ -21,7 +21,7 @@ go_proto_library( go_library( name = "openapiconfig", embed = [":openapiconfig_go_proto"], - importpath = "github.com/binchencoder/ease-gateway/gateway/internal/descriptor/openapiconfig", + importpath = "github.com/binchencoder/janus-gateway/gateway/internal/descriptor/openapiconfig", visibility = ["//:__subpackages__"], ) diff --git a/gateway/internal/descriptor/openapiconfig/openapiconfig.pb.go b/gateway/internal/descriptor/openapiconfig/openapiconfig.pb.go index e792bd0..405ef9b 100755 --- a/gateway/internal/descriptor/openapiconfig/openapiconfig.pb.go +++ b/gateway/internal/descriptor/openapiconfig/openapiconfig.pb.go @@ -7,7 +7,7 @@ package openapiconfig import ( - options "github.com/binchencoder/ease-gateway/gateway/protoc-gen-openapiv2/options" + options "github.com/binchencoder/janus-gateway/gateway/protoc-gen-openapiv2/options" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" diff --git a/gateway/internal/descriptor/openapiconfig/openapiconfig.proto b/gateway/internal/descriptor/openapiconfig/openapiconfig.proto index 3c194f2..f65a649 100644 --- a/gateway/internal/descriptor/openapiconfig/openapiconfig.proto +++ b/gateway/internal/descriptor/openapiconfig/openapiconfig.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package grpc.gateway.internal.descriptor.openapiconfig; -option go_package = "github.com/binchencoder/ease-gateway/gateway/internal/descriptor/openapiconfig"; +option go_package = "github.com/binchencoder/janus-gateway/gateway/internal/descriptor/openapiconfig"; import "gateway/protoc-gen-openapiv2/options/openapiv2.proto"; diff --git a/gateway/internal/descriptor/registry.go b/gateway/internal/descriptor/registry.go index d4ff801..73a67fe 100644 --- a/gateway/internal/descriptor/registry.go +++ b/gateway/internal/descriptor/registry.go @@ -8,11 +8,11 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/v2/internal/codegenerator" // "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor/openapiconfig" - "github.com/binchencoder/ease-gateway/gateway/internal/descriptor/openapiconfig" + "github.com/binchencoder/janus-gateway/gateway/internal/descriptor/openapiconfig" // "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" - "github.com/binchencoder/ease-gateway/gateway/protoc-gen-openapiv2/options" + "github.com/binchencoder/janus-gateway/gateway/protoc-gen-openapiv2/options" // "google.golang.org/genproto/googleapis/api/annotations" - annotations "github.com/binchencoder/ease-gateway/httpoptions" + annotations "github.com/binchencoder/janus-gateway/httpoptions" "google.golang.org/protobuf/compiler/protogen" "google.golang.org/protobuf/types/descriptorpb" "google.golang.org/protobuf/types/pluginpb" diff --git a/gateway/internal/descriptor/registry_test.go b/gateway/internal/descriptor/registry_test.go index a886063..a87be10 100644 --- a/gateway/internal/descriptor/registry_test.go +++ b/gateway/internal/descriptor/registry_test.go @@ -4,7 +4,7 @@ import ( "testing" // "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor/openapiconfig" - "github.com/binchencoder/ease-gateway/gateway/internal/descriptor/openapiconfig" + "github.com/binchencoder/janus-gateway/gateway/internal/descriptor/openapiconfig" "google.golang.org/protobuf/compiler/protogen" "google.golang.org/protobuf/encoding/prototext" "google.golang.org/protobuf/proto" diff --git a/gateway/internal/descriptor/services.go b/gateway/internal/descriptor/services.go index 6e2249e..11c181e 100644 --- a/gateway/internal/descriptor/services.go +++ b/gateway/internal/descriptor/services.go @@ -8,7 +8,7 @@ import ( "github.com/golang/glog" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule" // options "google.golang.org/genproto/googleapis/api/annotations" - options "github.com/binchencoder/ease-gateway/httpoptions" + options "github.com/binchencoder/janus-gateway/httpoptions" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/descriptorpb" ) @@ -243,7 +243,7 @@ func extractServiceSpec(svc *descriptorpb.ServiceDescriptorProto) (*options.Serv return nil, errNoServiceSpec } spec := proto.GetExtension(svc.Options, options.E_ServiceSpec) - // Extract ease gateway service spec options. + // Extract janus gateway service spec options. svcSpec, ok := spec.(*options.ServiceSpec) if !ok { return nil, fmt.Errorf("extension is %T; Want a service spec", spec) @@ -283,7 +283,7 @@ func extractAPIOptions(meth *descriptorpb.MethodDescriptorProto) (*options.HttpR if !proto.HasExtension(meth.Options, options.E_Method) { return opts, mopts, nil } - // Extract ease gateway method options. + // Extract janus gateway method options. m := proto.GetExtension(meth.Options, options.E_Method) mopts, ok = m.(*options.ApiMethod) if !ok { diff --git a/gateway/internal/descriptor/types.go b/gateway/internal/descriptor/types.go index f8b8626..79b20d7 100644 --- a/gateway/internal/descriptor/types.go +++ b/gateway/internal/descriptor/types.go @@ -6,12 +6,12 @@ import ( "unicode" // "github.com/grpc-ecosystem/grpc-gateway/v2/internal/casing" - "github.com/binchencoder/ease-gateway/gateway/internal/casing" + "github.com/binchencoder/janus-gateway/gateway/internal/casing" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule" "google.golang.org/protobuf/types/descriptorpb" "google.golang.org/protobuf/types/pluginpb" - options "github.com/binchencoder/ease-gateway/httpoptions" + options "github.com/binchencoder/janus-gateway/httpoptions" "github.com/binchencoder/gateway-proto/data" ) diff --git a/gateway/internal/generator/BUILD.bazel b/gateway/internal/generator/BUILD.bazel index fec2a2c..225c6a1 100644 --- a/gateway/internal/generator/BUILD.bazel +++ b/gateway/internal/generator/BUILD.bazel @@ -5,7 +5,7 @@ package(default_visibility = ["//visibility:public"]) go_library( name = "generator", srcs = ["generator.go"], - importpath = "github.com/binchencoder/ease-gateway/gateway/internal/generator", + importpath = "github.com/binchencoder/janus-gateway/gateway/internal/generator", deps = ["//gateway/internal/descriptor:go_default_library"], ) diff --git a/gateway/internal/generator/generator.go b/gateway/internal/generator/generator.go index ee5f503..d03c1f7 100644 --- a/gateway/internal/generator/generator.go +++ b/gateway/internal/generator/generator.go @@ -3,7 +3,7 @@ package generator import ( // "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" - "github.com/binchencoder/ease-gateway/gateway/internal/descriptor" + "github.com/binchencoder/janus-gateway/gateway/internal/descriptor" ) // Generator is an abstraction of code generators. diff --git a/gateway/protoc-gen-grpc-gateway/BUILD.bazel b/gateway/protoc-gen-grpc-gateway/BUILD.bazel index 6d60b23..8c39b20 100644 --- a/gateway/protoc-gen-grpc-gateway/BUILD.bazel +++ b/gateway/protoc-gen-grpc-gateway/BUILD.bazel @@ -6,7 +6,7 @@ package(default_visibility = ["//visibility:private"]) go_library( name = "protoc-gen-grpc-gateway_lib", srcs = ["main.go"], - importpath = "github.com/binchencoder/ease-gateway/gateway/protoc-gen-grpc-gateway", + importpath = "github.com/binchencoder/janus-gateway/gateway/protoc-gen-grpc-gateway", deps = [ "@com_github_grpc_ecosystem_grpc_gateway//internal/codegenerator", "//gateway/internal/descriptor:go_default_library", diff --git a/gateway/protoc-gen-grpc-gateway/internal/gengateway/BUILD.bazel b/gateway/protoc-gen-grpc-gateway/internal/gengateway/BUILD.bazel index 555e8fa..880cd64 100644 --- a/gateway/protoc-gen-grpc-gateway/internal/gengateway/BUILD.bazel +++ b/gateway/protoc-gen-grpc-gateway/internal/gengateway/BUILD.bazel @@ -9,7 +9,7 @@ go_library( "generator.go", "template.go", ], - importpath = "github.com/binchencoder/ease-gateway/gateway/protoc-gen-grpc-gateway/internal/gengateway", + importpath = "github.com/binchencoder/janus-gateway/gateway/protoc-gen-grpc-gateway/internal/gengateway", deps = [ "//httpoptions", "//gateway/internal/casing", diff --git a/gateway/protoc-gen-grpc-gateway/internal/gengateway/generator.go b/gateway/protoc-gen-grpc-gateway/internal/gengateway/generator.go index ce62bb0..5b95e48 100644 --- a/gateway/protoc-gen-grpc-gateway/internal/gengateway/generator.go +++ b/gateway/protoc-gen-grpc-gateway/internal/gengateway/generator.go @@ -8,9 +8,9 @@ import ( "github.com/golang/glog" // "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" - "github.com/binchencoder/ease-gateway/gateway/internal/descriptor" + "github.com/binchencoder/janus-gateway/gateway/internal/descriptor" // gen "github.com/grpc-ecosystem/grpc-gateway/v2/internal/generator" - gen "github.com/binchencoder/ease-gateway/gateway/internal/generator" + gen "github.com/binchencoder/janus-gateway/gateway/internal/generator" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/pluginpb" ) @@ -41,7 +41,7 @@ func New(reg *descriptor.Registry, useRequestContext bool, registerFuncSuffix st "sync": "", "unicode/utf8": "", // "github.com/grpc-ecosystem/grpc-gateway/v2/runtime", - "github.com/binchencoder/ease-gateway/gateway/runtime": "", + "github.com/binchencoder/janus-gateway/gateway/runtime": "", "github.com/grpc-ecosystem/grpc-gateway/v2/utilities": "", "google.golang.org/protobuf/proto": "", "github.com/binchencoder/gateway-proto/data": "vexpb", diff --git a/gateway/protoc-gen-grpc-gateway/internal/gengateway/generator_test.go b/gateway/protoc-gen-grpc-gateway/internal/gengateway/generator_test.go index e2d73f3..4ba41e0 100644 --- a/gateway/protoc-gen-grpc-gateway/internal/gengateway/generator_test.go +++ b/gateway/protoc-gen-grpc-gateway/internal/gengateway/generator_test.go @@ -4,7 +4,7 @@ import ( "testing" // "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" - "github.com/binchencoder/ease-gateway/gateway/internal/descriptor" + "github.com/binchencoder/janus-gateway/gateway/internal/descriptor" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/descriptorpb" ) diff --git a/gateway/protoc-gen-grpc-gateway/internal/gengateway/template.go b/gateway/protoc-gen-grpc-gateway/internal/gengateway/template.go index 4bd2bc5..f46ec6b 100644 --- a/gateway/protoc-gen-grpc-gateway/internal/gengateway/template.go +++ b/gateway/protoc-gen-grpc-gateway/internal/gengateway/template.go @@ -10,9 +10,9 @@ import ( "github.com/golang/glog" // "github.com/grpc-ecosystem/grpc-gateway/v2/internal/casing" - "github.com/binchencoder/ease-gateway/gateway/internal/casing" + "github.com/binchencoder/janus-gateway/gateway/internal/casing" // "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" - "github.com/binchencoder/ease-gateway/gateway/internal/descriptor" + "github.com/binchencoder/janus-gateway/gateway/internal/descriptor" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" ) diff --git a/gateway/protoc-gen-grpc-gateway/internal/gengateway/template_test.go b/gateway/protoc-gen-grpc-gateway/internal/gengateway/template_test.go index b9730a6..7b414a1 100644 --- a/gateway/protoc-gen-grpc-gateway/internal/gengateway/template_test.go +++ b/gateway/protoc-gen-grpc-gateway/internal/gengateway/template_test.go @@ -5,7 +5,7 @@ import ( "testing" // "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" - "github.com/binchencoder/ease-gateway/gateway/internal/descriptor" + "github.com/binchencoder/janus-gateway/gateway/internal/descriptor" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/descriptorpb" diff --git a/gateway/protoc-gen-grpc-gateway/main.go b/gateway/protoc-gen-grpc-gateway/main.go index 5a2c1cb..ff91461 100644 --- a/gateway/protoc-gen-grpc-gateway/main.go +++ b/gateway/protoc-gen-grpc-gateway/main.go @@ -18,9 +18,9 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/v2/internal/codegenerator" // "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" - "github.com/binchencoder/ease-gateway/gateway/internal/descriptor" + "github.com/binchencoder/janus-gateway/gateway/internal/descriptor" // "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/internal/gengateway" - "github.com/binchencoder/ease-gateway/gateway/protoc-gen-grpc-gateway/internal/gengateway" + "github.com/binchencoder/janus-gateway/gateway/protoc-gen-grpc-gateway/internal/gengateway" "google.golang.org/protobuf/compiler/protogen" ) diff --git a/gateway/protoc-gen-grpc-gateway/main_test.go b/gateway/protoc-gen-grpc-gateway/main_test.go index 7708b12..78068b3 100644 --- a/gateway/protoc-gen-grpc-gateway/main_test.go +++ b/gateway/protoc-gen-grpc-gateway/main_test.go @@ -4,7 +4,7 @@ import ( "testing" // "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" - "github.com/binchencoder/ease-gateway/gateway/internal/descriptor" + "github.com/binchencoder/janus-gateway/gateway/internal/descriptor" ) func TestParseFlagsEmptyNoPanic(t *testing.T) { diff --git a/gateway/protoc-gen-openapiv2/BUILD.bazel b/gateway/protoc-gen-openapiv2/BUILD.bazel index dda91e1..948ef3e 100644 --- a/gateway/protoc-gen-openapiv2/BUILD.bazel +++ b/gateway/protoc-gen-openapiv2/BUILD.bazel @@ -5,7 +5,7 @@ package(default_visibility = ["//visibility:private"]) go_library( name = "protoc-gen-openapiv2_lib", srcs = ["main.go"], - importpath = "github.com/binchencoder/ease-gateway/gateway/protoc-gen-openapiv2", + importpath = "github.com/binchencoder/janus-gateway/gateway/protoc-gen-openapiv2", deps = [ "@com_github_grpc_ecosystem_grpc_gateway//internal/codegenerator", "//gateway/internal/descriptor", diff --git a/gateway/protoc-gen-openapiv2/internal/genopenapi/BUILD.bazel b/gateway/protoc-gen-openapiv2/internal/genopenapi/BUILD.bazel index 90b780b..9285616 100644 --- a/gateway/protoc-gen-openapiv2/internal/genopenapi/BUILD.bazel +++ b/gateway/protoc-gen-openapiv2/internal/genopenapi/BUILD.bazel @@ -14,7 +14,7 @@ go_library( "template.go", "types.go", ], - importpath = "github.com/binchencoder/ease-gateway/gateway/protoc-gen-openapiv2/internal/genopenapi", + importpath = "github.com/binchencoder/janus-gateway/gateway/protoc-gen-openapiv2/internal/genopenapi", deps = [ "//gateway/internal/casing", "//gateway/internal/descriptor", diff --git a/gateway/protoc-gen-openapiv2/internal/genopenapi/generator.go b/gateway/protoc-gen-openapiv2/internal/genopenapi/generator.go index ab67212..06c317d 100644 --- a/gateway/protoc-gen-openapiv2/internal/genopenapi/generator.go +++ b/gateway/protoc-gen-openapiv2/internal/genopenapi/generator.go @@ -12,11 +12,11 @@ import ( "github.com/golang/glog" anypb "github.com/golang/protobuf/ptypes/any" // "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" - "github.com/binchencoder/ease-gateway/gateway/internal/descriptor" + "github.com/binchencoder/janus-gateway/gateway/internal/descriptor" // gen "github.com/grpc-ecosystem/grpc-gateway/v2/internal/generator" - gen "github.com/binchencoder/ease-gateway/gateway/internal/generator" + gen "github.com/binchencoder/janus-gateway/gateway/internal/generator" // openapi_options "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" - openapi_options "github.com/binchencoder/ease-gateway/gateway/protoc-gen-openapiv2/options" + openapi_options "github.com/binchencoder/janus-gateway/gateway/protoc-gen-openapiv2/options" statuspb "google.golang.org/genproto/googleapis/rpc/status" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/descriptorpb" diff --git a/gateway/protoc-gen-openapiv2/internal/genopenapi/template.go b/gateway/protoc-gen-openapiv2/internal/genopenapi/template.go index 5fccfa2..ca82733 100644 --- a/gateway/protoc-gen-openapiv2/internal/genopenapi/template.go +++ b/gateway/protoc-gen-openapiv2/internal/genopenapi/template.go @@ -20,11 +20,11 @@ import ( "github.com/golang/glog" // "github.com/grpc-ecosystem/grpc-gateway/v2/internal/casing" - "github.com/binchencoder/ease-gateway/gateway/internal/casing" + "github.com/binchencoder/janus-gateway/gateway/internal/casing" // "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" - "github.com/binchencoder/ease-gateway/gateway/internal/descriptor" + "github.com/binchencoder/janus-gateway/gateway/internal/descriptor" // openapi_options "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" - openapi_options "github.com/binchencoder/ease-gateway/gateway/protoc-gen-openapiv2/options" + openapi_options "github.com/binchencoder/janus-gateway/gateway/protoc-gen-openapiv2/options" "google.golang.org/genproto/googleapis/api/annotations" "google.golang.org/genproto/googleapis/api/visibility" "google.golang.org/protobuf/encoding/protojson" @@ -33,7 +33,7 @@ import ( "google.golang.org/protobuf/types/known/structpb" - options "github.com/binchencoder/ease-gateway/httpoptions" + options "github.com/binchencoder/janus-gateway/httpoptions" ) // The OpenAPI specification does not allow for more than one endpoint with the same HTTP method and path. diff --git a/gateway/protoc-gen-openapiv2/internal/genopenapi/types.go b/gateway/protoc-gen-openapiv2/internal/genopenapi/types.go index 1155b78..3c40929 100644 --- a/gateway/protoc-gen-openapiv2/internal/genopenapi/types.go +++ b/gateway/protoc-gen-openapiv2/internal/genopenapi/types.go @@ -6,8 +6,8 @@ import ( "fmt" // "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" - "github.com/binchencoder/ease-gateway/gateway/internal/descriptor" - options "github.com/binchencoder/ease-gateway/httpoptions" + "github.com/binchencoder/janus-gateway/gateway/internal/descriptor" + options "github.com/binchencoder/janus-gateway/httpoptions" "gopkg.in/yaml.v2" ) diff --git a/gateway/protoc-gen-openapiv2/main.go b/gateway/protoc-gen-openapiv2/main.go index 3e48a20..63cbaf3 100644 --- a/gateway/protoc-gen-openapiv2/main.go +++ b/gateway/protoc-gen-openapiv2/main.go @@ -10,9 +10,9 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/v2/internal/codegenerator" // "github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" - "github.com/binchencoder/ease-gateway/gateway/internal/descriptor" + "github.com/binchencoder/janus-gateway/gateway/internal/descriptor" // "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/internal/genopenapi" - genopenapi "github.com/binchencoder/ease-gateway/gateway/protoc-gen-openapiv2/internal/genopenapi" + genopenapi "github.com/binchencoder/janus-gateway/gateway/protoc-gen-openapiv2/internal/genopenapi" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/pluginpb" diff --git a/gateway/protoc-gen-openapiv2/options/BUILD.bazel b/gateway/protoc-gen-openapiv2/options/BUILD.bazel index ecbca2b..5cab09c 100644 --- a/gateway/protoc-gen-openapiv2/options/BUILD.bazel +++ b/gateway/protoc-gen-openapiv2/options/BUILD.bazel @@ -15,7 +15,7 @@ filegroup( go_library( name = "options", embed = [":options_go_proto"], - importpath = "github.com/binchencoder/ease-gateway/gateway/protoc-gen-openapiv2/options", + importpath = "github.com/binchencoder/janus-gateway/gateway/protoc-gen-openapiv2/options", ) proto_library( @@ -33,7 +33,7 @@ proto_library( go_proto_library( name = "options_go_proto", compilers = ["//:go_apiv2"], - importpath = "github.com/binchencoder/ease-gateway/gateway/protoc-gen-openapiv2/options", + importpath = "github.com/binchencoder/janus-gateway/gateway/protoc-gen-openapiv2/options", proto = ":options_proto", ) diff --git a/gateway/protoc-gen-openapiv2/options/annotations.proto b/gateway/protoc-gen-openapiv2/options/annotations.proto index 63dc872..98b03fb 100644 --- a/gateway/protoc-gen-openapiv2/options/annotations.proto +++ b/gateway/protoc-gen-openapiv2/options/annotations.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package grpc.gateway.protoc_gen_openapiv2.options; -option go_package = "github.com/binchencoder/ease-gateway/gateway/protoc-gen-openapiv2/options"; +option go_package = "github.com/binchencoder/janus-gateway/gateway/protoc-gen-openapiv2/options"; import "google/protobuf/descriptor.proto"; import "gateway/protoc-gen-openapiv2/options/openapiv2.proto"; diff --git a/gateway/protoc-gen-openapiv2/options/openapiv2.proto b/gateway/protoc-gen-openapiv2/options/openapiv2.proto index 9d078a5..a2bd206 100644 --- a/gateway/protoc-gen-openapiv2/options/openapiv2.proto +++ b/gateway/protoc-gen-openapiv2/options/openapiv2.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package grpc.gateway.protoc_gen_openapiv2.options; -option go_package = "github.com/binchencoder/ease-gateway/gateway/protoc-gen-openapiv2/options"; +option go_package = "github.com/binchencoder/janus-gateway/gateway/protoc-gen-openapiv2/options"; import "google/protobuf/struct.proto"; diff --git a/gateway/runtime/BUILD.bazel b/gateway/runtime/BUILD.bazel index dab62cc..8365d14 100644 --- a/gateway/runtime/BUILD.bazel +++ b/gateway/runtime/BUILD.bazel @@ -8,7 +8,7 @@ go_library( ["*.go"], exclude = ["*_test.go"], ), - importpath = "github.com/binchencoder/ease-gateway/gateway/runtime", + importpath = "github.com/binchencoder/janus-gateway/gateway/runtime", deps = [ "@com_github_grpc_ecosystem_grpc_gateway//internal/httprule", "@com_github_grpc_ecosystem_grpc_gateway//utilities", diff --git a/gateway/runtime/balancer.go b/gateway/runtime/balancer.go index 0d17ca7..bef183d 100644 --- a/gateway/runtime/balancer.go +++ b/gateway/runtime/balancer.go @@ -6,7 +6,7 @@ import ( "github.com/pborman/uuid" "google.golang.org/protobuf/proto" - options "github.com/binchencoder/ease-gateway/httpoptions" + options "github.com/binchencoder/janus-gateway/httpoptions" "github.com/binchencoder/letsgo/grpc" "github.com/binchencoder/letsgo/hashring" ) diff --git a/gateway/runtime/balancer_test.go b/gateway/runtime/balancer_test.go index 29b50d8..462e64d 100644 --- a/gateway/runtime/balancer_test.go +++ b/gateway/runtime/balancer_test.go @@ -4,10 +4,10 @@ import ( "context" "testing" - pb "github.com/binchencoder/ease-gateway/gateway/runtime/internal/examplepb" + pb "github.com/binchencoder/janus-gateway/gateway/runtime/internal/examplepb" "google.golang.org/protobuf/proto" - options "github.com/binchencoder/ease-gateway/httpoptions" + options "github.com/binchencoder/janus-gateway/httpoptions" "github.com/binchencoder/letsgo/hashring" ) diff --git a/gateway/runtime/context_test.go b/gateway/runtime/context_test.go index 76f79d8..9fa740e 100644 --- a/gateway/runtime/context_test.go +++ b/gateway/runtime/context_test.go @@ -9,7 +9,7 @@ import ( "time" // "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/binchencoder/ease-gateway/gateway/runtime" + "github.com/binchencoder/janus-gateway/gateway/runtime" "google.golang.org/grpc/metadata" ) diff --git a/gateway/runtime/convert_test.go b/gateway/runtime/convert_test.go index 457c0f8..5e971ba 100644 --- a/gateway/runtime/convert_test.go +++ b/gateway/runtime/convert_test.go @@ -4,7 +4,7 @@ import ( "testing" // "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/binchencoder/ease-gateway/gateway/runtime" + "github.com/binchencoder/janus-gateway/gateway/runtime" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/durationpb" "google.golang.org/protobuf/types/known/timestamppb" diff --git a/gateway/runtime/errors.go b/gateway/runtime/errors.go index 0acfcda..1499301 100644 --- a/gateway/runtime/errors.go +++ b/gateway/runtime/errors.go @@ -12,7 +12,7 @@ import ( "google.golang.org/grpc/grpclog" "google.golang.org/grpc/status" - "github.com/binchencoder/ease-gateway/gateway/internal" + "github.com/binchencoder/janus-gateway/gateway/internal" fpb "github.com/binchencoder/gateway-proto/frontend" ) diff --git a/gateway/runtime/errors_test.go b/gateway/runtime/errors_test.go index a761001..498b304 100644 --- a/gateway/runtime/errors_test.go +++ b/gateway/runtime/errors_test.go @@ -10,7 +10,7 @@ import ( "testing" // "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/binchencoder/ease-gateway/gateway/runtime" + "github.com/binchencoder/janus-gateway/gateway/runtime" "google.golang.org/genproto/googleapis/rpc/errdetails" statuspb "google.golang.org/genproto/googleapis/rpc/status" "google.golang.org/grpc/codes" diff --git a/gateway/runtime/handler_test.go b/gateway/runtime/handler_test.go index 13de50d..e3c74a7 100644 --- a/gateway/runtime/handler_test.go +++ b/gateway/runtime/handler_test.go @@ -9,9 +9,9 @@ import ( "testing" // "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/binchencoder/ease-gateway/gateway/runtime" + "github.com/binchencoder/janus-gateway/gateway/runtime" // pb "github.com/grpc-ecosystem/grpc-gateway/v2/runtime/internal/examplepb" - pb "github.com/binchencoder/ease-gateway/examples/internal/proto/examplepb" + pb "github.com/binchencoder/janus-gateway/examples/internal/proto/examplepb" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" diff --git a/gateway/runtime/internal/examplepb/BUILD.bazel b/gateway/runtime/internal/examplepb/BUILD.bazel index 2acced4..84ae71c 100644 --- a/gateway/runtime/internal/examplepb/BUILD.bazel +++ b/gateway/runtime/internal/examplepb/BUILD.bazel @@ -29,7 +29,7 @@ go_proto_library( "//:go_apiv2", "//:go_grpc", ], - importpath = "github.com/binchencoder/ease-gateway/gateway/runtime/internal/examplepb", + importpath = "github.com/binchencoder/janus-gateway/gateway/runtime/internal/examplepb", proto = ":examplepb_proto", deps = ["@go_googleapis//google/api:annotations_go_proto"], ) @@ -37,7 +37,7 @@ go_proto_library( go_library( name = "examplepb", embed = [":examplepb_go_proto"], - importpath = "github.com/binchencoder/ease-gateway/gateway/runtime/internal/examplepb", + importpath = "github.com/binchencoder/janus-gateway/gateway/runtime/internal/examplepb", ) alias( diff --git a/gateway/runtime/internal/examplepb/proto3.pb.go b/gateway/runtime/internal/examplepb/proto3.pb.go index faacca3..3aa2d7e 100755 --- a/gateway/runtime/internal/examplepb/proto3.pb.go +++ b/gateway/runtime/internal/examplepb/proto3.pb.go @@ -90,8 +90,8 @@ type Proto3Message struct { BytesValue []byte `protobuf:"bytes,9,opt,name=bytes_value,json=bytesValue,proto3" json:"bytes_value,omitempty"` RepeatedValue []string `protobuf:"bytes,10,rep,name=repeated_value,json=repeatedValue,proto3" json:"repeated_value,omitempty"` RepeatedMessage []*wrapperspb.UInt64Value `protobuf:"bytes,44,rep,name=repeated_message,json=repeatedMessage,proto3" json:"repeated_message,omitempty"` - EnumValue EnumValue `protobuf:"varint,11,opt,name=enum_value,json=enumValue,proto3,enum=ease.gateway.runtime.internal.examplepb.EnumValue" json:"enum_value,omitempty"` - RepeatedEnum []EnumValue `protobuf:"varint,12,rep,packed,name=repeated_enum,json=repeatedEnum,proto3,enum=ease.gateway.runtime.internal.examplepb.EnumValue" json:"repeated_enum,omitempty"` + EnumValue EnumValue `protobuf:"varint,11,opt,name=enum_value,json=enumValue,proto3,enum=janus.gateway.runtime.internal.examplepb.EnumValue" json:"enum_value,omitempty"` + RepeatedEnum []EnumValue `protobuf:"varint,12,rep,packed,name=repeated_enum,json=repeatedEnum,proto3,enum=janus.gateway.runtime.internal.examplepb.EnumValue" json:"repeated_enum,omitempty"` TimestampValue *timestamppb.Timestamp `protobuf:"bytes,13,opt,name=timestamp_value,json=timestampValue,proto3" json:"timestamp_value,omitempty"` DurationValue *durationpb.Duration `protobuf:"bytes,14,opt,name=duration_value,json=durationValue,proto3" json:"duration_value,omitempty"` FieldmaskValue *fieldmaskpb.FieldMask `protobuf:"bytes,15,opt,name=fieldmask_value,json=fieldmaskValue,proto3" json:"fieldmask_value,omitempty"` @@ -803,22 +803,22 @@ func file_gateway_runtime_internal_examplepb_proto3_proto_rawDescGZIP() []byte { var file_gateway_runtime_internal_examplepb_proto3_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_gateway_runtime_internal_examplepb_proto3_proto_msgTypes = make([]protoimpl.MessageInfo, 15) var file_gateway_runtime_internal_examplepb_proto3_proto_goTypes = []interface{}{ - (EnumValue)(0), // 0: ease.gateway.runtime.internal.examplepb.EnumValue - (*Proto3Message)(nil), // 1: ease.gateway.runtime.internal.examplepb.Proto3Message - nil, // 2: ease.gateway.runtime.internal.examplepb.Proto3Message.MapValueEntry - nil, // 3: ease.gateway.runtime.internal.examplepb.Proto3Message.MapValue2Entry - nil, // 4: ease.gateway.runtime.internal.examplepb.Proto3Message.MapValue3Entry - nil, // 5: ease.gateway.runtime.internal.examplepb.Proto3Message.MapValue4Entry - nil, // 6: ease.gateway.runtime.internal.examplepb.Proto3Message.MapValue5Entry - nil, // 7: ease.gateway.runtime.internal.examplepb.Proto3Message.MapValue6Entry - nil, // 8: ease.gateway.runtime.internal.examplepb.Proto3Message.MapValue7Entry - nil, // 9: ease.gateway.runtime.internal.examplepb.Proto3Message.MapValue8Entry - nil, // 10: ease.gateway.runtime.internal.examplepb.Proto3Message.MapValue9Entry - nil, // 11: ease.gateway.runtime.internal.examplepb.Proto3Message.MapValue10Entry - nil, // 12: ease.gateway.runtime.internal.examplepb.Proto3Message.MapValue12Entry - nil, // 13: ease.gateway.runtime.internal.examplepb.Proto3Message.MapValue14Entry - nil, // 14: ease.gateway.runtime.internal.examplepb.Proto3Message.MapValue15Entry - nil, // 15: ease.gateway.runtime.internal.examplepb.Proto3Message.MapValue16Entry + (EnumValue)(0), // 0: janus.gateway.runtime.internal.examplepb.EnumValue + (*Proto3Message)(nil), // 1: janus.gateway.runtime.internal.examplepb.Proto3Message + nil, // 2: janus.gateway.runtime.internal.examplepb.Proto3Message.MapValueEntry + nil, // 3: janus.gateway.runtime.internal.examplepb.Proto3Message.MapValue2Entry + nil, // 4: janus.gateway.runtime.internal.examplepb.Proto3Message.MapValue3Entry + nil, // 5: janus.gateway.runtime.internal.examplepb.Proto3Message.MapValue4Entry + nil, // 6: janus.gateway.runtime.internal.examplepb.Proto3Message.MapValue5Entry + nil, // 7: janus.gateway.runtime.internal.examplepb.Proto3Message.MapValue6Entry + nil, // 8: janus.gateway.runtime.internal.examplepb.Proto3Message.MapValue7Entry + nil, // 9: janus.gateway.runtime.internal.examplepb.Proto3Message.MapValue8Entry + nil, // 10: janus.gateway.runtime.internal.examplepb.Proto3Message.MapValue9Entry + nil, // 11: janus.gateway.runtime.internal.examplepb.Proto3Message.MapValue10Entry + nil, // 12: janus.gateway.runtime.internal.examplepb.Proto3Message.MapValue12Entry + nil, // 13: janus.gateway.runtime.internal.examplepb.Proto3Message.MapValue14Entry + nil, // 14: janus.gateway.runtime.internal.examplepb.Proto3Message.MapValue15Entry + nil, // 15: janus.gateway.runtime.internal.examplepb.Proto3Message.MapValue16Entry (*wrapperspb.UInt64Value)(nil), // 16: google.protobuf.UInt64Value (*timestamppb.Timestamp)(nil), // 17: google.protobuf.Timestamp (*durationpb.Duration)(nil), // 18: google.protobuf.Duration @@ -833,38 +833,38 @@ var file_gateway_runtime_internal_examplepb_proto3_proto_goTypes = []interface{} (*wrapperspb.BytesValue)(nil), // 27: google.protobuf.BytesValue } var file_gateway_runtime_internal_examplepb_proto3_proto_depIdxs = []int32{ - 1, // 0: ease.gateway.runtime.internal.examplepb.Proto3Message.nested:type_name -> ease.gateway.runtime.internal.examplepb.Proto3Message - 16, // 1: ease.gateway.runtime.internal.examplepb.Proto3Message.repeated_message:type_name -> google.protobuf.UInt64Value - 0, // 2: ease.gateway.runtime.internal.examplepb.Proto3Message.enum_value:type_name -> ease.gateway.runtime.internal.examplepb.EnumValue - 0, // 3: ease.gateway.runtime.internal.examplepb.Proto3Message.repeated_enum:type_name -> ease.gateway.runtime.internal.examplepb.EnumValue - 17, // 4: ease.gateway.runtime.internal.examplepb.Proto3Message.timestamp_value:type_name -> google.protobuf.Timestamp - 18, // 5: ease.gateway.runtime.internal.examplepb.Proto3Message.duration_value:type_name -> google.protobuf.Duration - 19, // 6: ease.gateway.runtime.internal.examplepb.Proto3Message.fieldmask_value:type_name -> google.protobuf.FieldMask - 1, // 7: ease.gateway.runtime.internal.examplepb.Proto3Message.nested_oneof_value_one:type_name -> ease.gateway.runtime.internal.examplepb.Proto3Message - 20, // 8: ease.gateway.runtime.internal.examplepb.Proto3Message.wrapper_double_value:type_name -> google.protobuf.DoubleValue - 21, // 9: ease.gateway.runtime.internal.examplepb.Proto3Message.wrapper_float_value:type_name -> google.protobuf.FloatValue - 22, // 10: ease.gateway.runtime.internal.examplepb.Proto3Message.wrapper_int64_value:type_name -> google.protobuf.Int64Value - 23, // 11: ease.gateway.runtime.internal.examplepb.Proto3Message.wrapper_int32_value:type_name -> google.protobuf.Int32Value - 16, // 12: ease.gateway.runtime.internal.examplepb.Proto3Message.wrapper_u_int64_value:type_name -> google.protobuf.UInt64Value - 24, // 13: ease.gateway.runtime.internal.examplepb.Proto3Message.wrapper_u_int32_value:type_name -> google.protobuf.UInt32Value - 25, // 14: ease.gateway.runtime.internal.examplepb.Proto3Message.wrapper_bool_value:type_name -> google.protobuf.BoolValue - 26, // 15: ease.gateway.runtime.internal.examplepb.Proto3Message.wrapper_string_value:type_name -> google.protobuf.StringValue - 27, // 16: ease.gateway.runtime.internal.examplepb.Proto3Message.wrapper_bytes_value:type_name -> google.protobuf.BytesValue - 2, // 17: ease.gateway.runtime.internal.examplepb.Proto3Message.map_value:type_name -> ease.gateway.runtime.internal.examplepb.Proto3Message.MapValueEntry - 3, // 18: ease.gateway.runtime.internal.examplepb.Proto3Message.map_value2:type_name -> ease.gateway.runtime.internal.examplepb.Proto3Message.MapValue2Entry - 4, // 19: ease.gateway.runtime.internal.examplepb.Proto3Message.map_value3:type_name -> ease.gateway.runtime.internal.examplepb.Proto3Message.MapValue3Entry - 5, // 20: ease.gateway.runtime.internal.examplepb.Proto3Message.map_value4:type_name -> ease.gateway.runtime.internal.examplepb.Proto3Message.MapValue4Entry - 6, // 21: ease.gateway.runtime.internal.examplepb.Proto3Message.map_value5:type_name -> ease.gateway.runtime.internal.examplepb.Proto3Message.MapValue5Entry - 7, // 22: ease.gateway.runtime.internal.examplepb.Proto3Message.map_value6:type_name -> ease.gateway.runtime.internal.examplepb.Proto3Message.MapValue6Entry - 8, // 23: ease.gateway.runtime.internal.examplepb.Proto3Message.map_value7:type_name -> ease.gateway.runtime.internal.examplepb.Proto3Message.MapValue7Entry - 9, // 24: ease.gateway.runtime.internal.examplepb.Proto3Message.map_value8:type_name -> ease.gateway.runtime.internal.examplepb.Proto3Message.MapValue8Entry - 10, // 25: ease.gateway.runtime.internal.examplepb.Proto3Message.map_value9:type_name -> ease.gateway.runtime.internal.examplepb.Proto3Message.MapValue9Entry - 11, // 26: ease.gateway.runtime.internal.examplepb.Proto3Message.map_value10:type_name -> ease.gateway.runtime.internal.examplepb.Proto3Message.MapValue10Entry - 12, // 27: ease.gateway.runtime.internal.examplepb.Proto3Message.map_value12:type_name -> ease.gateway.runtime.internal.examplepb.Proto3Message.MapValue12Entry - 13, // 28: ease.gateway.runtime.internal.examplepb.Proto3Message.map_value14:type_name -> ease.gateway.runtime.internal.examplepb.Proto3Message.MapValue14Entry - 14, // 29: ease.gateway.runtime.internal.examplepb.Proto3Message.map_value15:type_name -> ease.gateway.runtime.internal.examplepb.Proto3Message.MapValue15Entry - 15, // 30: ease.gateway.runtime.internal.examplepb.Proto3Message.map_value16:type_name -> ease.gateway.runtime.internal.examplepb.Proto3Message.MapValue16Entry - 16, // 31: ease.gateway.runtime.internal.examplepb.Proto3Message.MapValue16Entry.value:type_name -> google.protobuf.UInt64Value + 1, // 0: janus.gateway.runtime.internal.examplepb.Proto3Message.nested:type_name -> janus.gateway.runtime.internal.examplepb.Proto3Message + 16, // 1: janus.gateway.runtime.internal.examplepb.Proto3Message.repeated_message:type_name -> google.protobuf.UInt64Value + 0, // 2: janus.gateway.runtime.internal.examplepb.Proto3Message.enum_value:type_name -> janus.gateway.runtime.internal.examplepb.EnumValue + 0, // 3: janus.gateway.runtime.internal.examplepb.Proto3Message.repeated_enum:type_name -> janus.gateway.runtime.internal.examplepb.EnumValue + 17, // 4: janus.gateway.runtime.internal.examplepb.Proto3Message.timestamp_value:type_name -> google.protobuf.Timestamp + 18, // 5: janus.gateway.runtime.internal.examplepb.Proto3Message.duration_value:type_name -> google.protobuf.Duration + 19, // 6: janus.gateway.runtime.internal.examplepb.Proto3Message.fieldmask_value:type_name -> google.protobuf.FieldMask + 1, // 7: janus.gateway.runtime.internal.examplepb.Proto3Message.nested_oneof_value_one:type_name -> janus.gateway.runtime.internal.examplepb.Proto3Message + 20, // 8: janus.gateway.runtime.internal.examplepb.Proto3Message.wrapper_double_value:type_name -> google.protobuf.DoubleValue + 21, // 9: janus.gateway.runtime.internal.examplepb.Proto3Message.wrapper_float_value:type_name -> google.protobuf.FloatValue + 22, // 10: janus.gateway.runtime.internal.examplepb.Proto3Message.wrapper_int64_value:type_name -> google.protobuf.Int64Value + 23, // 11: janus.gateway.runtime.internal.examplepb.Proto3Message.wrapper_int32_value:type_name -> google.protobuf.Int32Value + 16, // 12: janus.gateway.runtime.internal.examplepb.Proto3Message.wrapper_u_int64_value:type_name -> google.protobuf.UInt64Value + 24, // 13: janus.gateway.runtime.internal.examplepb.Proto3Message.wrapper_u_int32_value:type_name -> google.protobuf.UInt32Value + 25, // 14: janus.gateway.runtime.internal.examplepb.Proto3Message.wrapper_bool_value:type_name -> google.protobuf.BoolValue + 26, // 15: janus.gateway.runtime.internal.examplepb.Proto3Message.wrapper_string_value:type_name -> google.protobuf.StringValue + 27, // 16: janus.gateway.runtime.internal.examplepb.Proto3Message.wrapper_bytes_value:type_name -> google.protobuf.BytesValue + 2, // 17: janus.gateway.runtime.internal.examplepb.Proto3Message.map_value:type_name -> janus.gateway.runtime.internal.examplepb.Proto3Message.MapValueEntry + 3, // 18: janus.gateway.runtime.internal.examplepb.Proto3Message.map_value2:type_name -> janus.gateway.runtime.internal.examplepb.Proto3Message.MapValue2Entry + 4, // 19: janus.gateway.runtime.internal.examplepb.Proto3Message.map_value3:type_name -> janus.gateway.runtime.internal.examplepb.Proto3Message.MapValue3Entry + 5, // 20: janus.gateway.runtime.internal.examplepb.Proto3Message.map_value4:type_name -> janus.gateway.runtime.internal.examplepb.Proto3Message.MapValue4Entry + 6, // 21: janus.gateway.runtime.internal.examplepb.Proto3Message.map_value5:type_name -> janus.gateway.runtime.internal.examplepb.Proto3Message.MapValue5Entry + 7, // 22: janus.gateway.runtime.internal.examplepb.Proto3Message.map_value6:type_name -> janus.gateway.runtime.internal.examplepb.Proto3Message.MapValue6Entry + 8, // 23: janus.gateway.runtime.internal.examplepb.Proto3Message.map_value7:type_name -> janus.gateway.runtime.internal.examplepb.Proto3Message.MapValue7Entry + 9, // 24: janus.gateway.runtime.internal.examplepb.Proto3Message.map_value8:type_name -> janus.gateway.runtime.internal.examplepb.Proto3Message.MapValue8Entry + 10, // 25: janus.gateway.runtime.internal.examplepb.Proto3Message.map_value9:type_name -> janus.gateway.runtime.internal.examplepb.Proto3Message.MapValue9Entry + 11, // 26: janus.gateway.runtime.internal.examplepb.Proto3Message.map_value10:type_name -> janus.gateway.runtime.internal.examplepb.Proto3Message.MapValue10Entry + 12, // 27: janus.gateway.runtime.internal.examplepb.Proto3Message.map_value12:type_name -> janus.gateway.runtime.internal.examplepb.Proto3Message.MapValue12Entry + 13, // 28: janus.gateway.runtime.internal.examplepb.Proto3Message.map_value14:type_name -> janus.gateway.runtime.internal.examplepb.Proto3Message.MapValue14Entry + 14, // 29: janus.gateway.runtime.internal.examplepb.Proto3Message.map_value15:type_name -> janus.gateway.runtime.internal.examplepb.Proto3Message.MapValue15Entry + 15, // 30: janus.gateway.runtime.internal.examplepb.Proto3Message.map_value16:type_name -> janus.gateway.runtime.internal.examplepb.Proto3Message.MapValue16Entry + 16, // 31: janus.gateway.runtime.internal.examplepb.Proto3Message.MapValue16Entry.value:type_name -> google.protobuf.UInt64Value 32, // [32:32] is the sub-list for method output_type 32, // [32:32] is the sub-list for method input_type 32, // [32:32] is the sub-list for extension type_name diff --git a/gateway/runtime/internal/examplepb/proto3.proto b/gateway/runtime/internal/examplepb/proto3.proto index c5b0f10..043b576 100644 --- a/gateway/runtime/internal/examplepb/proto3.proto +++ b/gateway/runtime/internal/examplepb/proto3.proto @@ -1,8 +1,8 @@ syntax = "proto3"; -package ease.gateway.runtime.internal.examplepb; +package janus.gateway.runtime.internal.examplepb; -option go_package = "github.com/binchencoder/ease-gateway/gateway/runtime/internal/examplepb"; +option go_package = "github.com/binchencoder/janus-gateway/gateway/runtime/internal/examplepb"; import "google/protobuf/duration.proto"; import "google/protobuf/field_mask.proto"; diff --git a/gateway/runtime/marshal_httpbodyproto_test.go b/gateway/runtime/marshal_httpbodyproto_test.go index dbfbadb..f7e907a 100644 --- a/gateway/runtime/marshal_httpbodyproto_test.go +++ b/gateway/runtime/marshal_httpbodyproto_test.go @@ -5,7 +5,7 @@ import ( "testing" // "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/binchencoder/ease-gateway/gateway/runtime" + "github.com/binchencoder/janus-gateway/gateway/runtime" "google.golang.org/genproto/googleapis/api/httpbody" "google.golang.org/protobuf/encoding/protojson" ) diff --git a/gateway/runtime/marshaler_registry_test.go b/gateway/runtime/marshaler_registry_test.go index 36028d2..d3854b5 100644 --- a/gateway/runtime/marshaler_registry_test.go +++ b/gateway/runtime/marshaler_registry_test.go @@ -8,7 +8,7 @@ import ( "testing" // "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/binchencoder/ease-gateway/gateway/runtime" + "github.com/binchencoder/janus-gateway/gateway/runtime" ) func TestMarshalerForRequest(t *testing.T) { diff --git a/gateway/runtime/mux_test.go b/gateway/runtime/mux_test.go index 180b7b7..91cba14 100644 --- a/gateway/runtime/mux_test.go +++ b/gateway/runtime/mux_test.go @@ -12,7 +12,7 @@ import ( "testing" // "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/binchencoder/ease-gateway/gateway/runtime" + "github.com/binchencoder/janus-gateway/gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "google.golang.org/grpc" "google.golang.org/grpc/codes" diff --git a/gateway/runtime/service.go b/gateway/runtime/service.go index b048912..8b8846b 100755 --- a/gateway/runtime/service.go +++ b/gateway/runtime/service.go @@ -3,14 +3,14 @@ package runtime import ( "google.golang.org/grpc" - options "github.com/binchencoder/ease-gateway/httpoptions" + options "github.com/binchencoder/janus-gateway/httpoptions" vexpb "github.com/binchencoder/gateway-proto/data" skypb "github.com/binchencoder/skylb-api/proto" ) var ( // CallerServiceId sets the gRPC caller service ID of the gateway. - // For ease-gateway, it's ServiceId_EASE_GATEWAY. + // For janus-gateway, it's ServiceId_EASE_GATEWAY. CallerServiceId = vexpb.ServiceId_EASE_GATEWAY ) diff --git a/go.mod b/go.mod index 8788eaa..79e2544 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/binchencoder/ease-gateway +module github.com/binchencoder/janus-gateway go 1.17 diff --git a/go.sum b/go.sum index 43f6716..7912701 100644 --- a/go.sum +++ b/go.sum @@ -59,7 +59,7 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/binchencoder/ease-gateway v0.0.4/go.mod h1:L8fCaUA1FaYO0ReFNAri15ozAj9NeJ9B+Q6CQAyPFqY= +github.com/binchencoder/janus-gateway v0.0.4/go.mod h1:L8fCaUA1FaYO0ReFNAri15ozAj9NeJ9B+Q6CQAyPFqY= github.com/binchencoder/gateway-proto v0.0.5/go.mod h1:853l4bAOm0Gt8XrDy+9obeKRlBLwP4HAk9tVYbgnSmU= github.com/binchencoder/gateway-proto v0.0.7 h1:+3d1QEBqDxFrTIVrSiao4saXNFNeK/vxsIsa1ClSYBI= github.com/binchencoder/gateway-proto v0.0.7/go.mod h1:DUtwTL1FDBeVIDIHxS8v2YajyWqe444jSvCxexR161A= diff --git a/httpoptions/BUILD.bazel b/httpoptions/BUILD.bazel index 11e15fe..32f020d 100644 --- a/httpoptions/BUILD.bazel +++ b/httpoptions/BUILD.bazel @@ -14,7 +14,7 @@ filegroup( go_library( name = "httpoptions", embed = [":options_go_proto"], - importpath = "github.com/binchencoder/ease-gateway/httpoptions", + importpath = "github.com/binchencoder/janus-gateway/httpoptions", ) proto_library( @@ -34,7 +34,7 @@ proto_library( go_proto_library( name = "options_go_proto", compilers = ["@io_bazel_rules_go//proto:go_grpc"], - importpath = "github.com/binchencoder/ease-gateway/httpoptions", + importpath = "github.com/binchencoder/janus-gateway/httpoptions", proto = ":options_proto", deps = [ "@com_github_binchencoder_gateway_proto//data:go_default_library", diff --git a/httpoptions/annotations.pb.go b/httpoptions/annotations.pb.go index 599940e..ccaa7b5 100755 --- a/httpoptions/annotations.pb.go +++ b/httpoptions/annotations.pb.go @@ -382,9 +382,9 @@ type ApiMethod struct { HashKey string `protobuf:"bytes,3,opt,name=hash_key,json=hashKey,proto3" json:"hash_key,omitempty"` IsThirdParty bool `protobuf:"varint,4,opt,name=is_third_party,json=isThirdParty,proto3" json:"is_third_party,omitempty"` Timeout string `protobuf:"bytes,5,opt,name=timeout,proto3" json:"timeout,omitempty"` - ApiSource ApiSourceType `protobuf:"varint,6,opt,name=api_source,json=apiSource,proto3,enum=ease.api.ApiSourceType" json:"api_source,omitempty"` - TokenType AuthTokenType `protobuf:"varint,7,opt,name=token_type,json=tokenType,proto3,enum=ease.api.AuthTokenType" json:"token_type,omitempty"` - SpecSourceType SpecSourceType `protobuf:"varint,8,opt,name=spec_source_type,json=specSourceType,proto3,enum=ease.api.SpecSourceType" json:"spec_source_type,omitempty"` + ApiSource ApiSourceType `protobuf:"varint,6,opt,name=api_source,json=apiSource,proto3,enum=janus.api.ApiSourceType" json:"api_source,omitempty"` + TokenType AuthTokenType `protobuf:"varint,7,opt,name=token_type,json=tokenType,proto3,enum=janus.api.AuthTokenType" json:"token_type,omitempty"` + SpecSourceType SpecSourceType `protobuf:"varint,8,opt,name=spec_source_type,json=specSourceType,proto3,enum=janus.api.SpecSourceType" json:"spec_source_type,omitempty"` } func (x *ApiMethod) Reset() { @@ -484,7 +484,7 @@ type ServiceSpec struct { PortName string `protobuf:"bytes,2,opt,name=port_name,json=portName,proto3" json:"port_name,omitempty"` Namespace string `protobuf:"bytes,3,opt,name=namespace,proto3" json:"namespace,omitempty"` GenController bool `protobuf:"varint,4,opt,name=gen_controller,json=genController,proto3" json:"gen_controller,omitempty"` - Balancer LoadBalancer `protobuf:"varint,5,opt,name=balancer,proto3,enum=ease.api.LoadBalancer" json:"balancer,omitempty"` + Balancer LoadBalancer `protobuf:"varint,5,opt,name=balancer,proto3,enum=janus.api.LoadBalancer" json:"balancer,omitempty"` } func (x *ServiceSpec) Reset() { @@ -559,10 +559,10 @@ type ValidationRule struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Operator OperatorType `protobuf:"varint,1,opt,name=operator,proto3,enum=ease.api.OperatorType" json:"operator,omitempty"` - Type ValueType `protobuf:"varint,2,opt,name=type,proto3,enum=ease.api.ValueType" json:"type,omitempty"` + Operator OperatorType `protobuf:"varint,1,opt,name=operator,proto3,enum=janus.api.OperatorType" json:"operator,omitempty"` + Type ValueType `protobuf:"varint,2,opt,name=type,proto3,enum=janus.api.ValueType" json:"type,omitempty"` Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` - Function FunctionType `protobuf:"varint,4,opt,name=function,proto3,enum=ease.api.FunctionType" json:"function,omitempty"` + Function FunctionType `protobuf:"varint,4,opt,name=function,proto3,enum=janus.api.FunctionType" json:"function,omitempty"` } func (x *ValidationRule) Reset() { @@ -677,7 +677,7 @@ var file_httpoptions_annotations_proto_extTypes = []protoimpl.ExtensionInfo{ ExtendedType: (*descriptorpb.MethodOptions)(nil), ExtensionType: (*HttpRule)(nil), Field: 108345, - Name: "ease.api.http", + Name: "janus.api.http", Tag: "bytes,108345,opt,name=http", Filename: "httpoptions/annotations.proto", }, @@ -685,7 +685,7 @@ var file_httpoptions_annotations_proto_extTypes = []protoimpl.ExtensionInfo{ ExtendedType: (*descriptorpb.MethodOptions)(nil), ExtensionType: (*ApiMethod)(nil), Field: 108361, - Name: "ease.api.method", + Name: "janus.api.method", Tag: "bytes,108361,opt,name=method", Filename: "httpoptions/annotations.proto", }, @@ -693,7 +693,7 @@ var file_httpoptions_annotations_proto_extTypes = []protoimpl.ExtensionInfo{ ExtendedType: (*descriptorpb.ServiceOptions)(nil), ExtensionType: (*ServiceSpec)(nil), Field: 108349, - Name: "ease.api.service_spec", + Name: "janus.api.service_spec", Tag: "bytes,108349,opt,name=service_spec", Filename: "httpoptions/annotations.proto", }, @@ -701,7 +701,7 @@ var file_httpoptions_annotations_proto_extTypes = []protoimpl.ExtensionInfo{ ExtendedType: (*descriptorpb.FieldOptions)(nil), ExtensionType: (*ValidationRules)(nil), Field: 108102, - Name: "ease.api.rules", + Name: "janus.api.rules", Tag: "bytes,108102,opt,name=rules", Filename: "httpoptions/annotations.proto", }, @@ -709,21 +709,21 @@ var file_httpoptions_annotations_proto_extTypes = []protoimpl.ExtensionInfo{ // Extension fields to descriptorpb.MethodOptions. var ( - // optional ease.api.HttpRule http = 108345; + // optional janus.api.HttpRule http = 108345; E_Http = &file_httpoptions_annotations_proto_extTypes[0] - // optional ease.api.ApiMethod method = 108361; + // optional janus.api.ApiMethod method = 108361; E_Method = &file_httpoptions_annotations_proto_extTypes[1] ) // Extension fields to descriptorpb.ServiceOptions. var ( - // optional ease.api.ServiceSpec service_spec = 108349; + // optional janus.api.ServiceSpec service_spec = 108349; E_ServiceSpec = &file_httpoptions_annotations_proto_extTypes[2] ) // Extension fields to descriptorpb.FieldOptions. var ( - // optional ease.api.ValidationRules rules = 108102; + // optional janus.api.ValidationRules rules = 108102; E_Rules = &file_httpoptions_annotations_proto_extTypes[3] ) @@ -865,41 +865,41 @@ func file_httpoptions_annotations_proto_rawDescGZIP() []byte { var file_httpoptions_annotations_proto_enumTypes = make([]protoimpl.EnumInfo, 7) var file_httpoptions_annotations_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_httpoptions_annotations_proto_goTypes = []interface{}{ - (ApiSourceType)(0), // 0: ease.api.ApiSourceType - (AuthTokenType)(0), // 1: ease.api.AuthTokenType - (SpecSourceType)(0), // 2: ease.api.SpecSourceType - (LoadBalancer)(0), // 3: ease.api.LoadBalancer - (OperatorType)(0), // 4: ease.api.OperatorType - (FunctionType)(0), // 5: ease.api.FunctionType - (ValueType)(0), // 6: ease.api.ValueType - (*ApiMethod)(nil), // 7: ease.api.ApiMethod - (*ServiceSpec)(nil), // 8: ease.api.ServiceSpec - (*ValidationRule)(nil), // 9: ease.api.ValidationRule - (*ValidationRules)(nil), // 10: ease.api.ValidationRules + (ApiSourceType)(0), // 0: janus.api.ApiSourceType + (AuthTokenType)(0), // 1: janus.api.AuthTokenType + (SpecSourceType)(0), // 2: janus.api.SpecSourceType + (LoadBalancer)(0), // 3: janus.api.LoadBalancer + (OperatorType)(0), // 4: janus.api.OperatorType + (FunctionType)(0), // 5: janus.api.FunctionType + (ValueType)(0), // 6: janus.api.ValueType + (*ApiMethod)(nil), // 7: janus.api.ApiMethod + (*ServiceSpec)(nil), // 8: janus.api.ServiceSpec + (*ValidationRule)(nil), // 9: janus.api.ValidationRule + (*ValidationRules)(nil), // 10: janus.api.ValidationRules (data.ServiceId)(0), // 11: data.ServiceId (*descriptorpb.MethodOptions)(nil), // 12: google.protobuf.MethodOptions (*descriptorpb.ServiceOptions)(nil), // 13: google.protobuf.ServiceOptions (*descriptorpb.FieldOptions)(nil), // 14: google.protobuf.FieldOptions - (*HttpRule)(nil), // 15: ease.api.HttpRule + (*HttpRule)(nil), // 15: janus.api.HttpRule } var file_httpoptions_annotations_proto_depIdxs = []int32{ - 0, // 0: ease.api.ApiMethod.api_source:type_name -> ease.api.ApiSourceType - 1, // 1: ease.api.ApiMethod.token_type:type_name -> ease.api.AuthTokenType - 2, // 2: ease.api.ApiMethod.spec_source_type:type_name -> ease.api.SpecSourceType - 11, // 3: ease.api.ServiceSpec.service_id:type_name -> data.ServiceId - 3, // 4: ease.api.ServiceSpec.balancer:type_name -> ease.api.LoadBalancer - 4, // 5: ease.api.ValidationRule.operator:type_name -> ease.api.OperatorType - 6, // 6: ease.api.ValidationRule.type:type_name -> ease.api.ValueType - 5, // 7: ease.api.ValidationRule.function:type_name -> ease.api.FunctionType - 9, // 8: ease.api.ValidationRules.rules:type_name -> ease.api.ValidationRule - 12, // 9: ease.api.http:extendee -> google.protobuf.MethodOptions - 12, // 10: ease.api.method:extendee -> google.protobuf.MethodOptions - 13, // 11: ease.api.service_spec:extendee -> google.protobuf.ServiceOptions - 14, // 12: ease.api.rules:extendee -> google.protobuf.FieldOptions - 15, // 13: ease.api.http:type_name -> ease.api.HttpRule - 7, // 14: ease.api.method:type_name -> ease.api.ApiMethod - 8, // 15: ease.api.service_spec:type_name -> ease.api.ServiceSpec - 10, // 16: ease.api.rules:type_name -> ease.api.ValidationRules + 0, // 0: janus.api.ApiMethod.api_source:type_name -> janus.api.ApiSourceType + 1, // 1: janus.api.ApiMethod.token_type:type_name -> janus.api.AuthTokenType + 2, // 2: janus.api.ApiMethod.spec_source_type:type_name -> janus.api.SpecSourceType + 11, // 3: janus.api.ServiceSpec.service_id:type_name -> data.ServiceId + 3, // 4: janus.api.ServiceSpec.balancer:type_name -> janus.api.LoadBalancer + 4, // 5: janus.api.ValidationRule.operator:type_name -> janus.api.OperatorType + 6, // 6: janus.api.ValidationRule.type:type_name -> janus.api.ValueType + 5, // 7: janus.api.ValidationRule.function:type_name -> janus.api.FunctionType + 9, // 8: janus.api.ValidationRules.rules:type_name -> janus.api.ValidationRule + 12, // 9: janus.api.http:extendee -> google.protobuf.MethodOptions + 12, // 10: janus.api.method:extendee -> google.protobuf.MethodOptions + 13, // 11: janus.api.service_spec:extendee -> google.protobuf.ServiceOptions + 14, // 12: janus.api.rules:extendee -> google.protobuf.FieldOptions + 15, // 13: janus.api.http:type_name -> janus.api.HttpRule + 7, // 14: janus.api.method:type_name -> janus.api.ApiMethod + 8, // 15: janus.api.service_spec:type_name -> janus.api.ServiceSpec + 10, // 16: janus.api.rules:type_name -> janus.api.ValidationRules 17, // [17:17] is the sub-list for method output_type 17, // [17:17] is the sub-list for method input_type 13, // [13:17] is the sub-list for extension type_name diff --git a/httpoptions/annotations.proto b/httpoptions/annotations.proto index d5c38d8..c1862a8 100644 --- a/httpoptions/annotations.proto +++ b/httpoptions/annotations.proto @@ -15,7 +15,7 @@ // See `https://github.com/googleapis/googleapis/blob/master/google/api/annotations.proto` syntax = "proto3"; -package ease.api; +package janus.api; import "google/protobuf/descriptor.proto"; import "httpoptions/http.proto"; @@ -23,9 +23,9 @@ import "data/data.proto"; import "frontend/error.proto"; option java_multiple_files = true; -option go_package = "github.com/binchencoder/ease-gateway/httpoptions;annotations"; +option go_package = "github.com/binchencoder/janus-gateway/httpoptions;annotations"; option java_outer_classname = "AnnotationsProto"; -option java_package = "com.ease.api"; +option java_package = "com.janus.api"; option objc_class_prefix = "EAPI"; extend google.protobuf.MethodOptions { @@ -66,13 +66,13 @@ message ApiMethod { // Api regist gateway. enum ApiSourceType { - EASE_GATEWAY = 0; // ease-gateway apis. + EASE_GATEWAY = 0; // janus-gateway apis. OPEN_GATEWAY = 1; // open-gateway open apis. } // Auth token type. enum AuthTokenType { - EASE_AUTH_TOKEN = 0; // ease gateway auth type. + EASE_AUTH_TOKEN = 0; // janus gateway auth type. BASE_ACCESS_TOKEN = 1; // open platform baseAccessToken. } diff --git a/httpoptions/http.pb.go b/httpoptions/http.pb.go index 7b6ae47..1bd6d48 100755 --- a/httpoptions/http.pb.go +++ b/httpoptions/http.pb.go @@ -359,14 +359,14 @@ func file_httpoptions_http_proto_rawDescGZIP() []byte { var file_httpoptions_http_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var file_httpoptions_http_proto_goTypes = []interface{}{ - (*Http)(nil), // 0: ease.api.Http - (*HttpRule)(nil), // 1: ease.api.HttpRule - (*CustomHttpPattern)(nil), // 2: ease.api.CustomHttpPattern + (*Http)(nil), // 0: janus.api.Http + (*HttpRule)(nil), // 1: janus.api.HttpRule + (*CustomHttpPattern)(nil), // 2: janus.api.CustomHttpPattern } var file_httpoptions_http_proto_depIdxs = []int32{ - 1, // 0: ease.api.Http.rules:type_name -> ease.api.HttpRule - 2, // 1: ease.api.HttpRule.custom:type_name -> ease.api.CustomHttpPattern - 1, // 2: ease.api.HttpRule.additional_bindings:type_name -> ease.api.HttpRule + 1, // 0: janus.api.Http.rules:type_name -> janus.api.HttpRule + 2, // 1: janus.api.HttpRule.custom:type_name -> janus.api.CustomHttpPattern + 1, // 2: janus.api.HttpRule.additional_bindings:type_name -> janus.api.HttpRule 3, // [3:3] is the sub-list for method output_type 3, // [3:3] is the sub-list for method input_type 3, // [3:3] is the sub-list for extension type_name diff --git a/httpoptions/http.proto b/httpoptions/http.proto index ee1d88b..499627e 100644 --- a/httpoptions/http.proto +++ b/httpoptions/http.proto @@ -14,13 +14,13 @@ // See `https://github.com/googleapis/googleapis/blob/master/google/api/http.proto` syntax = "proto3"; -package ease.api; +package janus.api; option cc_enable_arenas = true; -option go_package = "github.com/binchencoder/ease-gateway/httpoptions;annotations"; +option go_package = "github.com/binchencoder/janus-gateway/httpoptions;annotations"; option java_multiple_files = true; option java_outer_classname = "HttpProto"; -option java_package = "com.ease.api"; +option java_package = "com.janus.api"; option objc_class_prefix = "EAPI"; // Defines the HTTP configuration for an API service. It contains a list of diff --git a/httpoptions/pom.xml b/httpoptions/pom.xml index f91570c..7f72b56 100755 --- a/httpoptions/pom.xml +++ b/httpoptions/pom.xml @@ -2,8 +2,8 @@ 4.0.0 - com.binchencoder.easegw - easegw-options-protos + com.binchencoder.gateway + janus-options-protos jar 1.0-SNAPSHOT diff --git a/integrate/BUILD.bazel b/integrate/BUILD.bazel index f1d2fab..55c5ca2 100755 --- a/integrate/BUILD.bazel +++ b/integrate/BUILD.bazel @@ -8,7 +8,7 @@ go_library( ["*.go"], exclude = ["*_test.go"], ), - importpath = "github.com/binchencoder/ease-gateway/integrate", + importpath = "github.com/binchencoder/janus-gateway/integrate", deps = [ "//httpoptions", "//gateway/runtime", diff --git a/integrate/hook.go b/integrate/hook.go index db7fb0f..31020f1 100755 --- a/integrate/hook.go +++ b/integrate/hook.go @@ -13,10 +13,10 @@ import ( "google.golang.org/grpc/metadata" "google.golang.org/protobuf/proto" - "github.com/binchencoder/ease-gateway/gateway/runtime" - options "github.com/binchencoder/ease-gateway/httpoptions" - "github.com/binchencoder/ease-gateway/integrate/metrics" - "github.com/binchencoder/ease-gateway/util" + "github.com/binchencoder/janus-gateway/gateway/runtime" + options "github.com/binchencoder/janus-gateway/httpoptions" + "github.com/binchencoder/janus-gateway/integrate/metrics" + "github.com/binchencoder/janus-gateway/util" "github.com/binchencoder/letsgo/grpc" "github.com/binchencoder/letsgo/trace" @@ -41,7 +41,7 @@ var ( ) // gatewayHook implements interface GatewayServiceHook in package -// github.com/binchencoder/ease-gateway/gateway/runtime. +// github.com/binchencoder/janus-gateway/gateway/runtime. type gatewayHook struct { mux *runtime.ServeMux host string @@ -149,13 +149,13 @@ func NewGatewayHook(mux *runtime.ServeMux, host string) runtime.GatewayServiceHo } } -// addMetrics add metrics to prometheus for ease-gateway. +// addMetrics add metrics to prometheus for janus-gateway. func addMetrics(ctx context.Context, svc *runtime.Service, m *runtime.Method, code codes.Code, startTime time.Time, clt string) float64 { rp := &metrics.ReporterParam{StartTime: startTime, ServiceName: svc.Spec.GetServiceName(), Url: m.Path, HttpMethod: m.HttpMethod, Code: strconv.FormatUint(uint64(code), 10), Client: clt} return rp.RequestComplete() } -// getClient returns client value who request ease-gateway from Md. +// getClient returns client value who request janus-gateway from Md. func getClientFroMd(md metadata.MD) string { if s, ok := md[XSource]; ok && len(s) > 0 && s[0] != ResourceClient { return s[0] diff --git a/integrate/hookexternal.go b/integrate/hookexternal.go index 1bf12d0..9be3e8a 100644 --- a/integrate/hookexternal.go +++ b/integrate/hookexternal.go @@ -1,4 +1,4 @@ -// Note: this file is for ease-gateway which are exposed to external users. +// Note: this file is for janus-gateway which are exposed to external users. package integrate @@ -12,9 +12,9 @@ import ( gr "google.golang.org/grpc" "google.golang.org/grpc/codes" - "github.com/binchencoder/ease-gateway/gateway/runtime" - options "github.com/binchencoder/ease-gateway/httpoptions" - "github.com/binchencoder/ease-gateway/util" + "github.com/binchencoder/janus-gateway/gateway/runtime" + options "github.com/binchencoder/janus-gateway/httpoptions" + "github.com/binchencoder/janus-gateway/util" vexpb "github.com/binchencoder/gateway-proto/data" fpb "github.com/binchencoder/gateway-proto/frontend" "github.com/binchencoder/letsgo/grpc" @@ -217,7 +217,7 @@ func verifyHeader(ctx context.Context, header http.Header, svc *runtime.Service, return nil } -// getClient returns client value who request ease-gateway from header. +// getClient returns client value who request janus-gateway from header. func getClientFromHeader(header http.Header) string { xs := header.Get(XSource) cl := header.Get(XClient) diff --git a/integrate/metrics/BUILD b/integrate/metrics/BUILD index a068559..dca50df 100755 --- a/integrate/metrics/BUILD +++ b/integrate/metrics/BUILD @@ -5,7 +5,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "go_default_library", srcs = ["reporter.go"], - importpath = "github.com/binchencoder/ease-gateway/integrate/metrics", + importpath = "github.com/binchencoder/janus-gateway/integrate/metrics", deps = [ "@com_github_binchencoder_letsgo//time:go_default_library", "@com_github_prometheus_client_golang//prometheus:go_default_library", diff --git a/integrate/metrics/reporter.go b/integrate/metrics/reporter.go index 5f9f716..9de191e 100755 --- a/integrate/metrics/reporter.go +++ b/integrate/metrics/reporter.go @@ -9,7 +9,7 @@ import ( ) var ( - // Create a histogram for record response latency (milliseconds) of ease-gateway. + // Create a histogram for record response latency (milliseconds) of janus-gateway. // And it will generate additional metric, for example: // gateway_http_response_ms_count, it is the total number of request. gatewayHandledHistogram = prometheus.NewHistogramVec( @@ -23,7 +23,7 @@ var ( []string{"client", "service_name", "url", "http_method", "code"}, ) - // Create a counter for record total system errors of ease-gateway. + // Create a counter for record total system errors of janus-gateway. gatewayErrCounter = prometheus.NewCounterVec( prometheus.CounterOpts{ Namespace: "gateway", diff --git a/integrate/middleware.go b/integrate/middleware.go index 6c3fb21..40db393 100644 --- a/integrate/middleware.go +++ b/integrate/middleware.go @@ -4,7 +4,7 @@ import ( "flag" "net/http" - "github.com/binchencoder/ease-gateway/gateway/runtime" + "github.com/binchencoder/janus-gateway/gateway/runtime" ) var ( diff --git a/proto/examplepb/BUILD.bazel b/proto/examplepb/BUILD.bazel index 7248172..4b2b9fe 100644 --- a/proto/examplepb/BUILD.bazel +++ b/proto/examplepb/BUILD.bazel @@ -30,7 +30,7 @@ go_proto_library( "//:go_grpc", "//gateway/protoc-gen-grpc-gateway:go_gen_grpc_gateway", # keep ], - importpath = "github.com/binchencoder/ease-gateway/proto/examplepb", + importpath = "github.com/binchencoder/janus-gateway/proto/examplepb", proto = ":examplepb_proto", deps = [ "//httpoptions", @@ -45,7 +45,7 @@ go_proto_library( go_library( name = "examplepb", embed = [":examplepb_go_proto"], - importpath = "github.com/binchencoder/ease-gateway/proto/examplepb", + importpath = "github.com/binchencoder/janus-gateway/proto/examplepb", deps = [ "//httpoptions", "//gateway/runtime", diff --git a/proto/examplepb/echo_service.proto b/proto/examplepb/echo_service.proto index 72707da..dbaf516 100644 --- a/proto/examplepb/echo_service.proto +++ b/proto/examplepb/echo_service.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -option go_package = "github.com/binchencoder/ease-gateway/gateway/proto/examplepb"; +option go_package = "github.com/binchencoder/janus-gateway/gateway/proto/examplepb"; package grpc.gateway.proto.examplepb; @@ -23,7 +23,7 @@ message SimpleMessage { // Id represents the message identifier. string id = 1 [ - (ease.api.rules) = { + (janus.api.rules) = { rules: { type: STRING, operator: NON_NIL, @@ -44,7 +44,7 @@ message SimpleMessage { ]; int64 num = 2 [ - (ease.api.rules) = { + (janus.api.rules) = { rules: { type: NUMBER, operator: GT, @@ -65,7 +65,7 @@ message SimpleMessage { // Echo service responds to incoming echo requests. service EchoService { - option (ease.api.service_spec) = { + option (janus.api.service_spec) = { service_id: CUSTOM_EASE_GATEWAY_TEST port_name : "grpc" namespace : "default" @@ -77,7 +77,7 @@ service EchoService { // The message posted as the id parameter will also be // returned. rpc Echo(SimpleMessage) returns (SimpleMessage) { - option (ease.api.http) = { + option (janus.api.http) = { post: "/v1/example/echo/{id}" additional_bindings { get: "/v1/example/echo/{id}/{num}" @@ -95,14 +95,14 @@ service EchoService { } // EchoBody method receives a simple message and returns it. rpc EchoBody(SimpleMessage) returns (SimpleMessage) { - option (ease.api.http) = { + option (janus.api.http) = { post: "/v1/example/echo_body" body: "*" }; } // EchoDelete method receives a simple message and returns it. rpc EchoDelete(SimpleMessage) returns (SimpleMessage) { - option (ease.api.http) = { + option (janus.api.http) = { delete: "/v1/example/echo_delete" }; } diff --git a/repositories.bzl b/repositories.bzl index 4cbd74e..63a42de 100644 --- a/repositories.bzl +++ b/repositories.bzl @@ -2,8 +2,8 @@ load("@bazel_gazelle//:deps.bzl", "go_repository") def go_repositories(): go_repository( - name = "com_github_binchencoder_ease_gateway", - importpath = "github.com/binchencoder/ease-gateway", + name = "com_github_binchencoder_janus_gateway", + importpath = "github.com/binchencoder/janus-gateway", sum = "h1:wYZv8TO4TGO2U8HjEO5Odf8OYWQjfrXS8ddfGZWQfHI=", version = "v1.0.3", ) diff --git a/util/BUILD.bazel b/util/BUILD.bazel index 6de1b86..2a8810e 100755 --- a/util/BUILD.bazel +++ b/util/BUILD.bazel @@ -10,7 +10,7 @@ go_library( ["*.go"], exclude = ["*_test.go"], ), - importpath = "github.com/binchencoder/ease-gateway/util", + importpath = "github.com/binchencoder/janus-gateway/util", deps = [ "//util/glog:go_default_library", "@com_github_fatih_color//:go_default_library", diff --git a/util/glog/BUILD.bazel b/util/glog/BUILD.bazel index d6888fb..56b648e 100755 --- a/util/glog/BUILD.bazel +++ b/util/glog/BUILD.bazel @@ -8,7 +8,7 @@ go_library( ["*.go"], exclude = ["*_test.go"], ), - importpath = "github.com/binchencoder/ease-gateway/util/glog", + importpath = "github.com/binchencoder/janus-gateway/util/glog", deps = [ "@com_github_binchencoder_letsgo//trace:go_default_library", "@org_golang_x_net//context:go_default_library", diff --git a/util/glog/cmd/BUILD.bazel b/util/glog/cmd/BUILD.bazel index 97c7aca..2b3c7f0 100644 --- a/util/glog/cmd/BUILD.bazel +++ b/util/glog/cmd/BUILD.bazel @@ -3,7 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") go_library( name = "go_default_library", srcs = ["main.go"], - importpath = "github.com/binchencoder/ease-gateway/util/glog/cmd", + importpath = "github.com/binchencoder/janus-gateway/util/glog/cmd", visibility = ["//visibility:private"], deps = ["//util/glog:go_default_library"], ) diff --git a/util/glog/cmd/main.go b/util/glog/cmd/main.go index b0285e2..75c9145 100755 --- a/util/glog/cmd/main.go +++ b/util/glog/cmd/main.go @@ -3,7 +3,7 @@ package main import ( "flag" - "github.com/binchencoder/ease-gateway/util/glog" + "github.com/binchencoder/janus-gateway/util/glog" ) func main() { diff --git a/util/log.go b/util/log.go index 0fc7645..750137e 100755 --- a/util/log.go +++ b/util/log.go @@ -3,7 +3,7 @@ package util import ( col "github.com/fatih/color" - "github.com/binchencoder/ease-gateway/util/glog" + "github.com/binchencoder/janus-gateway/util/glog" ) func init() { @@ -12,7 +12,7 @@ func init() { // gateway-rest日志 var ( - // ease-gateway 请求和响应详情日志. 支持格式包括: + // janus-gateway 请求和响应详情日志. 支持格式包括: // 1. RequestRestFormat // 2. ResponseRestFormat RestLogger = glog.Context(nil, glog.FileName{Name: "gateway-rest"}) @@ -30,13 +30,13 @@ var ( // gateway-config日志 var ( - // ease-gateway 配置操作相关日志. + // janus-gateway 配置操作相关日志. ConfigLogger = glog.Context(nil, glog.FileName{Name: "gateway-config"}) ) // gateway-stat日志 var ( - // ease-gateway 访问统计日志. 支持格式包括: + // janus-gateway 访问统计日志. 支持格式包括: // 1. StatFormat StatLogger = glog.Context(nil, glog.FileName{Name: "gateway-stat"}) From 7ea6e3ab793c65cb09a1a8821b813b27d5161e5e Mon Sep 17 00:00:00 2001 From: binchencoder <15811514091@163.com> Date: Sat, 23 Apr 2022 19:54:15 +0800 Subject: [PATCH 05/10] Rename ease-gateway to janus-gateway --- .circleci/config.yml | 4 +- README.md | 2 +- cmd/custom-gateway/main.go | 6 +- cmd/gateway/main.go | 4 +- docs/design.md | 4 +- ...se-Gateway.drawio => Janus-Gateway.drawio} | 0 .../{Ease-Gateway.png => Janus-Gateway.png} | Bin docs/scripts/start.sh | 8 +- docs/scripts/stop.sh | 6 +- examples/grpc-server/main.go | 2 +- examples/internal/README.md | 2 +- .../cmd/example-grpc-client/grpcclient.go | 4 +- .../internal/cmd/example-grpc-server/main.go | 2 +- examples/internal/gateway/gateway.go | 2 +- .../proto/examplepb/echo_service.pb.gw.go | 192 +++++++++--------- .../proto/examplepb/echo_service.proto | 2 +- .../examplepb/unannotated_echo_service.proto | 2 +- gateway/README.md | 2 +- gateway/runtime/service.go | 4 +- httpoptions/BUILD.bazel | 2 +- httpoptions/annotations.pb.go | 16 +- httpoptions/annotations.proto | 4 +- integrate/hookexternal.go | 8 +- proto/examplepb/echo_service.proto | 4 +- proto/examplepb/pom.xml | 8 +- proto/pom.xml | 8 +- 26 files changed, 149 insertions(+), 149 deletions(-) rename docs/images/{Ease-Gateway.drawio => Janus-Gateway.drawio} (100%) rename docs/images/{Ease-Gateway.png => Janus-Gateway.png} (100%) diff --git a/.circleci/config.yml b/.circleci/config.yml index 076541f..b693f4d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,7 +6,7 @@ commands: steps: - run: | cat > .bazelrc \<< EOF - startup --output_base /home/vscode/.cache/_ease_gateway_bazel + startup --output_base /home/vscode/.cache/_janus_gateway_bazel build --test_output errors build --features race # Workaround https://github.com/bazelbuild/bazel/issues/3645 @@ -109,7 +109,7 @@ jobs: - save_cache: key: v3-bazel-cache-{{ checksum "repositories.bzl" }} paths: - - /home/vscode/.cache/_ease_gateway_bazel + - /home/vscode/.cache/_janus_gateway_bazel gorelease: executor: build-env working_directory: /home/vscode/src/janus-gateway diff --git a/README.md b/README.md index be219a7..e08868f 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Gateway service based on [grpc-ecosystem/grpc-gateway](https://github.com/grpc-e ## Architecture -![](./docs/images/Ease-Gateway.png) +![](./docs/images/Janus-Gateway.png) ## Design diff --git a/cmd/custom-gateway/main.go b/cmd/custom-gateway/main.go index b82b1f3..ef9df18 100644 --- a/cmd/custom-gateway/main.go +++ b/cmd/custom-gateway/main.go @@ -22,7 +22,7 @@ var ( ) func usage() { - fmt.Println(`EaseGateway - Ease Gateway of binchencoder. + fmt.Println(`JanusGateway - Janus Gateway of binchencoder. Usage: janus-gateway [options] @@ -48,11 +48,11 @@ func main() { // debugMode := flag.Lookup("debug-mode") // debugMode.Value.Set("true") - runtime.CallerServiceId = data.ServiceId_EASE_GATEWAY + runtime.CallerServiceId = data.ServiceId_JANUS_GATEWAY // integrate.SetAllowCredentials(true) // integrate.SetAllowHostsRegexp([]string{"*"}) - glog.Info("***** Ease gateway init. *****") + glog.Info("***** Janus gateway init. *****") hostPort := fmt.Sprintf("%s:%d", *host, *port) mux := runtime.NewServeMux() diff --git a/cmd/gateway/main.go b/cmd/gateway/main.go index d76a067..e5eab81 100644 --- a/cmd/gateway/main.go +++ b/cmd/gateway/main.go @@ -26,7 +26,7 @@ var ( ) func usage() { - fmt.Println(`Ease Gateway - Universal Gateway of xxx Inc. + fmt.Println(`Janus Gateway - Universal Gateway of xxx Inc. Usage: janus-gateway [options] @@ -72,7 +72,7 @@ func main() { checkFlags() hostPort := fmt.Sprintf("%s:%d", *host, *port) - runtime.CallerServiceId = data.ServiceId_EASE_GATEWAY + runtime.CallerServiceId = data.ServiceId_JANUS_GATEWAY serviceName, err := naming.ServiceIdToName(runtime.CallerServiceId) if err != nil { glog.Errorf("Invalid service id %d", runtime.CallerServiceId) diff --git a/docs/design.md b/docs/design.md index 7c73894..1da7f9c 100644 --- a/docs/design.md +++ b/docs/design.md @@ -1,4 +1,4 @@ -# Ease-gatway - Enterprise Universal Gateway Service +# Janus-gatway - Enterprise Universal Gateway Service `janus-gateway` is a enterprise universal gateway service for mobile, native, and web apps. It's based on `grpc-gateway` and mobile team's gateway development experience. @@ -137,7 +137,7 @@ import "options/extension.proto"; service Demo { option (janus.api.service_spec) = { - service_id: EASE_GATEWAY_DEMO + service_id: JANUS_GATEWAY_DEMO namespace: "default" port_name: "grpc" } diff --git a/docs/images/Ease-Gateway.drawio b/docs/images/Janus-Gateway.drawio similarity index 100% rename from docs/images/Ease-Gateway.drawio rename to docs/images/Janus-Gateway.drawio diff --git a/docs/images/Ease-Gateway.png b/docs/images/Janus-Gateway.png similarity index 100% rename from docs/images/Ease-Gateway.png rename to docs/images/Janus-Gateway.png diff --git a/docs/scripts/start.sh b/docs/scripts/start.sh index 9734a17..6c31e93 100755 --- a/docs/scripts/start.sh +++ b/docs/scripts/start.sh @@ -31,13 +31,13 @@ STDOUT_FILE=$HOMEDIR/std.out set +e PIDS=`pgrep ^janus-gateway$` if [ $? -eq 0 ]; then - echo "ERROR: The service Ease Gateway already started!" + echo "ERROR: The service Janus Gateway already started!" echo "PID: $PIDS" exit 1 fi set -e -echo "Service Ease Gateway start..." +echo "Service Janus Gateway start..." nohup $HOMEDIR/bin/janus-gateway \ -debug-svc-endpoint=vexillary-service=192.168.10.41:4100 \ -debug-svc-endpoint=pay-grpc-service=192.168.32.18:10008 \ @@ -52,8 +52,8 @@ sleep 2 PIDS_COUNT=`pgrep ^janus-gateway$|wc -l` if [ $PIDS_COUNT -eq 0 ]; then - echo "ERROR: The service Ease Gateway does not started!" + echo "ERROR: The service Janus Gateway does not started!" exit 1 fi -echo "Service Ease Gateway start success!" +echo "Service Janus Gateway start success!" diff --git a/docs/scripts/stop.sh b/docs/scripts/stop.sh index 54ff16c..fd54eb6 100755 --- a/docs/scripts/stop.sh +++ b/docs/scripts/stop.sh @@ -3,11 +3,11 @@ set +e PIDS=`pgrep ^janus-gateway$` if [ $? -ne 0 ]; then - echo "INFO: The service Ease Gateway did not started!" + echo "INFO: The service Janus Gateway did not started!" exit 0 fi -echo -e "Stopping the service Ease Gateway ...\c" +echo -e "Stopping the service Janus Gateway ...\c" for PID in $PIDS ; do kill $PID > /dev/null 2>&1 done @@ -19,7 +19,7 @@ while [ true ]; do if [ $? -ne 0 ]; then echo echo "PID: $PIDS" - echo "Service Ease Gateway stopped." + echo "Service Janus Gateway stopped." exit 0 fi diff --git a/examples/grpc-server/main.go b/examples/grpc-server/main.go index 4a3de71..0880604 100644 --- a/examples/grpc-server/main.go +++ b/examples/grpc-server/main.go @@ -26,7 +26,7 @@ func main() { defer glog.Flush() // Regist to skylbserver - skylb.Register(data.ServiceId_CUSTOM_EASE_GATEWAY_TEST, "grpc", *port) + skylb.Register(data.ServiceId_CUSTOM_JANUS_GATEWAY_TEST, "grpc", *port) skylb.EnableHistogram() skylb.Start(fmt.Sprintf(":%d", *port), func(s *grpc.Server) error { examplepb.RegisterEchoServiceServer(s, NewEchoServer()) diff --git a/examples/internal/README.md b/examples/internal/README.md index 51dc903..89cd791 100644 --- a/examples/internal/README.md +++ b/examples/internal/README.md @@ -1,6 +1,6 @@ # Overrview -janus-gateway/examples/internal 是使用ease-gateway的一个完整示例,包含gateway-server 和 gRPC-server. 还有Java实现gRPC Server的例子 [https://github.com/binchencoder/spring-boot-grpc/tree/master/spring-boot-grpc-examples] +janus-gateway/examples/internal 是使用janus-gateway的一个完整示例,包含gateway-server 和 gRPC-server. 还有Java实现gRPC Server的例子 [https://github.com/binchencoder/spring-boot-grpc/tree/master/spring-boot-grpc-examples] # Build the example diff --git a/examples/internal/cmd/example-grpc-client/grpcclient.go b/examples/internal/cmd/example-grpc-client/grpcclient.go index 2ea1100..f75e756 100644 --- a/examples/internal/cmd/example-grpc-client/grpcclient.go +++ b/examples/internal/cmd/example-grpc-client/grpcclient.go @@ -24,7 +24,7 @@ var ( requestSleep = flag.Duration("request-sleep", 100*time.Millisecond, "The sleep time after each request") requestTimeout = flag.Duration("request-timeout", 100*time.Millisecond, "The timeout of each request") - spec = skylb.NewServiceSpec(skylb.DefaultNameSpace, vexpb.ServiceId_CUSTOM_EASE_GATEWAY_TEST, skylb.DefaultPortName) + spec = skylb.NewServiceSpec(skylb.DefaultNameSpace, vexpb.ServiceId_CUSTOM_JANUS_GATEWAY_TEST, skylb.DefaultPortName) grpcFailCount = prom.NewCounter( prom.CounterOpts{ @@ -72,7 +72,7 @@ func main() { } func testClient() { - sl, cli, healthCli := startSkylb(vexpb.ServiceId_CUSTOM_EASE_GATEWAY_TEST) + sl, cli, healthCli := startSkylb(vexpb.ServiceId_CUSTOM_JANUS_GATEWAY_TEST) for { for i := 0; i < *nBatchRequest; i++ { req := examplepb.SimpleMessage{ diff --git a/examples/internal/cmd/example-grpc-server/main.go b/examples/internal/cmd/example-grpc-server/main.go index d2752b7..7df8f7a 100644 --- a/examples/internal/cmd/example-grpc-server/main.go +++ b/examples/internal/cmd/example-grpc-server/main.go @@ -48,7 +48,7 @@ func main() { go registerPrometheus() - skylb.Register(data.ServiceId_CUSTOM_EASE_GATEWAY_TEST, "grpc", *port) + skylb.Register(data.ServiceId_CUSTOM_JANUS_GATEWAY_TEST, "grpc", *port) skylb.EnableHistogram() skylb.Start(fmt.Sprintf(":%d", *port), func(s *grpc.Server) error { examplepb.RegisterEchoServiceServer(s, server.NewEchoServer()) diff --git a/examples/internal/gateway/gateway.go b/examples/internal/gateway/gateway.go index 87cb3af..357cd75 100644 --- a/examples/internal/gateway/gateway.go +++ b/examples/internal/gateway/gateway.go @@ -24,7 +24,7 @@ func newGateway(ctx context.Context, conn *grpc.ClientConn, opts []gwruntime.Ser mux := gwruntime.NewServeMux(opts...) - // examplepb.Enable_CUSTOM_EASE_GATEWAY_TEST__default__grpc_ServiceGroup() + // examplepb.Enable_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_ServiceGroup() for _, f := range []func(context.Context, *gwruntime.ServeMux, *grpc.ClientConn) error{ examplepb.RegisterEchoServiceHandler, } { diff --git a/examples/internal/proto/examplepb/echo_service.pb.gw.go b/examples/internal/proto/examplepb/echo_service.pb.gw.go index 75b4582..bc7235f 100755 --- a/examples/internal/proto/examplepb/echo_service.pb.gw.go +++ b/examples/internal/proto/examplepb/echo_service.pb.gw.go @@ -108,7 +108,7 @@ var ( func request_EchoService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimpleMessage var metadata runtime.ServerMetadata - spec := internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_spec + spec := internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_spec var ( val string @@ -188,7 +188,7 @@ var ( func request_EchoService_Echo_1(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimpleMessage var metadata runtime.ServerMetadata - spec := internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_spec + spec := internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_spec var ( val string @@ -289,7 +289,7 @@ var ( func request_EchoService_Echo_2(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimpleMessage var metadata runtime.ServerMetadata - spec := internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_spec + spec := internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_spec var ( val string @@ -421,7 +421,7 @@ var ( func request_EchoService_Echo_3(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimpleMessage var metadata runtime.ServerMetadata - spec := internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_spec + spec := internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_spec var ( val string @@ -553,7 +553,7 @@ var ( func request_EchoService_Echo_4(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimpleMessage var metadata runtime.ServerMetadata - spec := internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_spec + spec := internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_spec var ( val string @@ -629,7 +629,7 @@ func local_request_EchoService_Echo_4(ctx context.Context, marshaler runtime.Mar func request_EchoService_EchoBody_0(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimpleMessage var metadata runtime.ServerMetadata - spec := internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_spec + spec := internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_spec newReader, berr := utilities.IOReaderFactory(req.Body) if berr != nil { @@ -677,7 +677,7 @@ var ( func request_EchoService_EchoDelete_0(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimpleMessage var metadata runtime.ServerMetadata - spec := internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_spec + spec := internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_spec if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) @@ -722,7 +722,7 @@ var ( func request_EchoService_EchoPatch_0(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq DynamicMessageUpdate var metadata runtime.ServerMetadata - spec := internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_spec + spec := internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_spec newReader, berr := utilities.IOReaderFactory(req.Body) if berr != nil { @@ -794,7 +794,7 @@ func local_request_EchoService_EchoPatch_0(ctx context.Context, marshaler runtim func request_EchoService_EchoValidationRule_0(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ValidationRuleTestRequest var metadata runtime.ServerMetadata - spec := internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_spec + spec := internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_spec newReader, berr := utilities.IOReaderFactory(req.Body) if berr != nil { @@ -848,7 +848,7 @@ func local_request_EchoService_EchoValidationRule_0(ctx context.Context, marshal // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterEchoServiceHandlerFromEndpoint instead. func RegisterEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server EchoServiceServer) error { - mux.Handle("POST", pattern_EchoService_Echo_0, vexpb.ServiceId_CUSTOM_EASE_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_EchoService_Echo_0, vexpb.ServiceId_CUSTOM_JANUS_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -872,7 +872,7 @@ func RegisterEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux }) - mux.Handle("GET", pattern_EchoService_Echo_1, vexpb.ServiceId_CUSTOM_EASE_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_EchoService_Echo_1, vexpb.ServiceId_CUSTOM_JANUS_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -896,7 +896,7 @@ func RegisterEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux }) - mux.Handle("GET", pattern_EchoService_Echo_2, vexpb.ServiceId_CUSTOM_EASE_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_EchoService_Echo_2, vexpb.ServiceId_CUSTOM_JANUS_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -920,7 +920,7 @@ func RegisterEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux }) - mux.Handle("GET", pattern_EchoService_Echo_3, vexpb.ServiceId_CUSTOM_EASE_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_EchoService_Echo_3, vexpb.ServiceId_CUSTOM_JANUS_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -944,7 +944,7 @@ func RegisterEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux }) - mux.Handle("GET", pattern_EchoService_Echo_4, vexpb.ServiceId_CUSTOM_EASE_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_EchoService_Echo_4, vexpb.ServiceId_CUSTOM_JANUS_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -968,7 +968,7 @@ func RegisterEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux }) - mux.Handle("POST", pattern_EchoService_EchoBody_0, vexpb.ServiceId_CUSTOM_EASE_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_EchoService_EchoBody_0, vexpb.ServiceId_CUSTOM_JANUS_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -992,7 +992,7 @@ func RegisterEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux }) - mux.Handle("DELETE", pattern_EchoService_EchoDelete_0, vexpb.ServiceId_CUSTOM_EASE_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("DELETE", pattern_EchoService_EchoDelete_0, vexpb.ServiceId_CUSTOM_JANUS_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1016,7 +1016,7 @@ func RegisterEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux }) - mux.Handle("PATCH", pattern_EchoService_EchoPatch_0, vexpb.ServiceId_CUSTOM_EASE_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("PATCH", pattern_EchoService_EchoPatch_0, vexpb.ServiceId_CUSTOM_JANUS_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1040,7 +1040,7 @@ func RegisterEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux }) - mux.Handle("POST", pattern_EchoService_EchoValidationRule_0, vexpb.ServiceId_CUSTOM_EASE_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_EchoService_EchoValidationRule_0, vexpb.ServiceId_CUSTOM_JANUS_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1075,7 +1075,7 @@ func init() { _ = s _ = spec - spec = internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_spec + spec = internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_spec s = &runtime.Service{ Spec: *spec, Name: "EchoService", @@ -1084,7 +1084,7 @@ func init() { Disable: DisableEchoService_Service, } - runtime.AddService(s, Enable_CUSTOM_EASE_GATEWAY_TEST__default__grpc_ServiceGroup, Disable_CUSTOM_EASE_GATEWAY_TEST__default__grpc_ServiceGroup) + runtime.AddService(s, Enable_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_ServiceGroup, Disable_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_ServiceGroup) } @@ -1126,14 +1126,14 @@ func RegisterEchoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "EchoServiceClient" to call the correct interceptors. func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client EchoServiceClient) error { - spec := internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_spec + spec := internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_spec - runtime.AddMethod(spec, "EchoService", "Echo", "/v1/example/echo/{id}", "POST", true, false, false, "UNSPECIFIED", "EASE_GATEWAY", "EASE_AUTH_TOKEN", "") - mux.Handle("POST", pattern_EchoService_Echo_0, vexpb.ServiceId_CUSTOM_EASE_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + runtime.AddMethod(spec, "EchoService", "Echo", "/v1/example/echo/{id}", "POST", true, false, false, "UNSPECIFIED", "JANUS_GATEWAY", "JANUS_AUTH_TOKEN", "") + mux.Handle("POST", pattern_EchoService_Echo_0, vexpb.ServiceId_CUSTOM_JANUS_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { // TODO(mojz): review all locking/unlocking logic. - // internal_CUSTOM_EASE_GATEWAY_TEST__default__grpc_lock.RLock() - // defer internal_CUSTOM_EASE_GATEWAY_TEST__default__grpc_lock.RUnlock() - client := internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_client + // internal_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_lock.RLock() + // defer internal_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_lock.RUnlock() + client := internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_client inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) if client == nil { err := status.Error(codes.Internal, "service disabled") @@ -1141,7 +1141,7 @@ func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux return } - ctx, err := runtime.RequestAccepted(inctx, internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_spec, "EchoService", "Echo", w, req) + ctx, err := runtime.RequestAccepted(inctx, internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_spec, "EchoService", "Echo", w, req) if err != nil { grpclog.Errorf("runtime.RequestAccepted returns error: %v", err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1167,12 +1167,12 @@ func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux }) - runtime.AddMethod(spec, "EchoService", "Echo", "/v1/example/echo/{id}/{num}", "GET", true, false, false, "UNSPECIFIED", "EASE_GATEWAY", "EASE_AUTH_TOKEN", "") - mux.Handle("GET", pattern_EchoService_Echo_1, vexpb.ServiceId_CUSTOM_EASE_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + runtime.AddMethod(spec, "EchoService", "Echo", "/v1/example/echo/{id}/{num}", "GET", true, false, false, "UNSPECIFIED", "JANUS_GATEWAY", "JANUS_AUTH_TOKEN", "") + mux.Handle("GET", pattern_EchoService_Echo_1, vexpb.ServiceId_CUSTOM_JANUS_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { // TODO(mojz): review all locking/unlocking logic. - // internal_CUSTOM_EASE_GATEWAY_TEST__default__grpc_lock.RLock() - // defer internal_CUSTOM_EASE_GATEWAY_TEST__default__grpc_lock.RUnlock() - client := internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_client + // internal_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_lock.RLock() + // defer internal_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_lock.RUnlock() + client := internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_client inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) if client == nil { err := status.Error(codes.Internal, "service disabled") @@ -1180,7 +1180,7 @@ func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux return } - ctx, err := runtime.RequestAccepted(inctx, internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_spec, "EchoService", "Echo", w, req) + ctx, err := runtime.RequestAccepted(inctx, internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_spec, "EchoService", "Echo", w, req) if err != nil { grpclog.Errorf("runtime.RequestAccepted returns error: %v", err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1206,12 +1206,12 @@ func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux }) - runtime.AddMethod(spec, "EchoService", "Echo", "/v1/example/echo/{id}/{num}/{lang}", "GET", true, false, false, "UNSPECIFIED", "EASE_GATEWAY", "EASE_AUTH_TOKEN", "") - mux.Handle("GET", pattern_EchoService_Echo_2, vexpb.ServiceId_CUSTOM_EASE_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + runtime.AddMethod(spec, "EchoService", "Echo", "/v1/example/echo/{id}/{num}/{lang}", "GET", true, false, false, "UNSPECIFIED", "JANUS_GATEWAY", "JANUS_AUTH_TOKEN", "") + mux.Handle("GET", pattern_EchoService_Echo_2, vexpb.ServiceId_CUSTOM_JANUS_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { // TODO(mojz): review all locking/unlocking logic. - // internal_CUSTOM_EASE_GATEWAY_TEST__default__grpc_lock.RLock() - // defer internal_CUSTOM_EASE_GATEWAY_TEST__default__grpc_lock.RUnlock() - client := internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_client + // internal_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_lock.RLock() + // defer internal_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_lock.RUnlock() + client := internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_client inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) if client == nil { err := status.Error(codes.Internal, "service disabled") @@ -1219,7 +1219,7 @@ func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux return } - ctx, err := runtime.RequestAccepted(inctx, internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_spec, "EchoService", "Echo", w, req) + ctx, err := runtime.RequestAccepted(inctx, internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_spec, "EchoService", "Echo", w, req) if err != nil { grpclog.Errorf("runtime.RequestAccepted returns error: %v", err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1245,12 +1245,12 @@ func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux }) - runtime.AddMethod(spec, "EchoService", "Echo", "/v1/example/echo1/{id}/{line_num}/{status.note}", "GET", true, false, false, "UNSPECIFIED", "EASE_GATEWAY", "EASE_AUTH_TOKEN", "") - mux.Handle("GET", pattern_EchoService_Echo_3, vexpb.ServiceId_CUSTOM_EASE_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + runtime.AddMethod(spec, "EchoService", "Echo", "/v1/example/echo1/{id}/{line_num}/{status.note}", "GET", true, false, false, "UNSPECIFIED", "JANUS_GATEWAY", "JANUS_AUTH_TOKEN", "") + mux.Handle("GET", pattern_EchoService_Echo_3, vexpb.ServiceId_CUSTOM_JANUS_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { // TODO(mojz): review all locking/unlocking logic. - // internal_CUSTOM_EASE_GATEWAY_TEST__default__grpc_lock.RLock() - // defer internal_CUSTOM_EASE_GATEWAY_TEST__default__grpc_lock.RUnlock() - client := internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_client + // internal_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_lock.RLock() + // defer internal_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_lock.RUnlock() + client := internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_client inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) if client == nil { err := status.Error(codes.Internal, "service disabled") @@ -1258,7 +1258,7 @@ func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux return } - ctx, err := runtime.RequestAccepted(inctx, internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_spec, "EchoService", "Echo", w, req) + ctx, err := runtime.RequestAccepted(inctx, internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_spec, "EchoService", "Echo", w, req) if err != nil { grpclog.Errorf("runtime.RequestAccepted returns error: %v", err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1284,12 +1284,12 @@ func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux }) - runtime.AddMethod(spec, "EchoService", "Echo", "/v1/example/echo2/{no.note}", "GET", true, false, false, "UNSPECIFIED", "EASE_GATEWAY", "EASE_AUTH_TOKEN", "") - mux.Handle("GET", pattern_EchoService_Echo_4, vexpb.ServiceId_CUSTOM_EASE_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + runtime.AddMethod(spec, "EchoService", "Echo", "/v1/example/echo2/{no.note}", "GET", true, false, false, "UNSPECIFIED", "JANUS_GATEWAY", "JANUS_AUTH_TOKEN", "") + mux.Handle("GET", pattern_EchoService_Echo_4, vexpb.ServiceId_CUSTOM_JANUS_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { // TODO(mojz): review all locking/unlocking logic. - // internal_CUSTOM_EASE_GATEWAY_TEST__default__grpc_lock.RLock() - // defer internal_CUSTOM_EASE_GATEWAY_TEST__default__grpc_lock.RUnlock() - client := internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_client + // internal_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_lock.RLock() + // defer internal_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_lock.RUnlock() + client := internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_client inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) if client == nil { err := status.Error(codes.Internal, "service disabled") @@ -1297,7 +1297,7 @@ func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux return } - ctx, err := runtime.RequestAccepted(inctx, internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_spec, "EchoService", "Echo", w, req) + ctx, err := runtime.RequestAccepted(inctx, internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_spec, "EchoService", "Echo", w, req) if err != nil { grpclog.Errorf("runtime.RequestAccepted returns error: %v", err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1323,12 +1323,12 @@ func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux }) - runtime.AddMethod(spec, "EchoService", "EchoBody", "/v1/example/echo_body", "POST", true, false, false, "UNSPECIFIED", "EASE_GATEWAY", "EASE_AUTH_TOKEN", "") - mux.Handle("POST", pattern_EchoService_EchoBody_0, vexpb.ServiceId_CUSTOM_EASE_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + runtime.AddMethod(spec, "EchoService", "EchoBody", "/v1/example/echo_body", "POST", true, false, false, "UNSPECIFIED", "JANUS_GATEWAY", "JANUS_AUTH_TOKEN", "") + mux.Handle("POST", pattern_EchoService_EchoBody_0, vexpb.ServiceId_CUSTOM_JANUS_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { // TODO(mojz): review all locking/unlocking logic. - // internal_CUSTOM_EASE_GATEWAY_TEST__default__grpc_lock.RLock() - // defer internal_CUSTOM_EASE_GATEWAY_TEST__default__grpc_lock.RUnlock() - client := internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_client + // internal_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_lock.RLock() + // defer internal_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_lock.RUnlock() + client := internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_client inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) if client == nil { err := status.Error(codes.Internal, "service disabled") @@ -1336,7 +1336,7 @@ func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux return } - ctx, err := runtime.RequestAccepted(inctx, internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_spec, "EchoService", "EchoBody", w, req) + ctx, err := runtime.RequestAccepted(inctx, internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_spec, "EchoService", "EchoBody", w, req) if err != nil { grpclog.Errorf("runtime.RequestAccepted returns error: %v", err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1362,12 +1362,12 @@ func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux }) - runtime.AddMethod(spec, "EchoService", "EchoDelete", "/v1/example/echo_delete", "DELETE", true, false, false, "UNSPECIFIED", "EASE_GATEWAY", "EASE_AUTH_TOKEN", "") - mux.Handle("DELETE", pattern_EchoService_EchoDelete_0, vexpb.ServiceId_CUSTOM_EASE_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + runtime.AddMethod(spec, "EchoService", "EchoDelete", "/v1/example/echo_delete", "DELETE", true, false, false, "UNSPECIFIED", "JANUS_GATEWAY", "JANUS_AUTH_TOKEN", "") + mux.Handle("DELETE", pattern_EchoService_EchoDelete_0, vexpb.ServiceId_CUSTOM_JANUS_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { // TODO(mojz): review all locking/unlocking logic. - // internal_CUSTOM_EASE_GATEWAY_TEST__default__grpc_lock.RLock() - // defer internal_CUSTOM_EASE_GATEWAY_TEST__default__grpc_lock.RUnlock() - client := internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_client + // internal_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_lock.RLock() + // defer internal_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_lock.RUnlock() + client := internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_client inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) if client == nil { err := status.Error(codes.Internal, "service disabled") @@ -1375,7 +1375,7 @@ func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux return } - ctx, err := runtime.RequestAccepted(inctx, internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_spec, "EchoService", "EchoDelete", w, req) + ctx, err := runtime.RequestAccepted(inctx, internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_spec, "EchoService", "EchoDelete", w, req) if err != nil { grpclog.Errorf("runtime.RequestAccepted returns error: %v", err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1401,12 +1401,12 @@ func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux }) - runtime.AddMethod(spec, "EchoService", "EchoPatch", "/v1/example/echo_patch", "PATCH", true, false, false, "UNSPECIFIED", "EASE_GATEWAY", "EASE_AUTH_TOKEN", "") - mux.Handle("PATCH", pattern_EchoService_EchoPatch_0, vexpb.ServiceId_CUSTOM_EASE_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + runtime.AddMethod(spec, "EchoService", "EchoPatch", "/v1/example/echo_patch", "PATCH", true, false, false, "UNSPECIFIED", "JANUS_GATEWAY", "JANUS_AUTH_TOKEN", "") + mux.Handle("PATCH", pattern_EchoService_EchoPatch_0, vexpb.ServiceId_CUSTOM_JANUS_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { // TODO(mojz): review all locking/unlocking logic. - // internal_CUSTOM_EASE_GATEWAY_TEST__default__grpc_lock.RLock() - // defer internal_CUSTOM_EASE_GATEWAY_TEST__default__grpc_lock.RUnlock() - client := internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_client + // internal_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_lock.RLock() + // defer internal_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_lock.RUnlock() + client := internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_client inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) if client == nil { err := status.Error(codes.Internal, "service disabled") @@ -1414,7 +1414,7 @@ func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux return } - ctx, err := runtime.RequestAccepted(inctx, internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_spec, "EchoService", "EchoPatch", w, req) + ctx, err := runtime.RequestAccepted(inctx, internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_spec, "EchoService", "EchoPatch", w, req) if err != nil { grpclog.Errorf("runtime.RequestAccepted returns error: %v", err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1440,12 +1440,12 @@ func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux }) - runtime.AddMethod(spec, "EchoService", "EchoValidationRule", "/v1/example/echo:validationRules", "POST", true, false, false, "UNSPECIFIED", "EASE_GATEWAY", "EASE_AUTH_TOKEN", "") - mux.Handle("POST", pattern_EchoService_EchoValidationRule_0, vexpb.ServiceId_CUSTOM_EASE_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + runtime.AddMethod(spec, "EchoService", "EchoValidationRule", "/v1/example/echo:validationRules", "POST", true, false, false, "UNSPECIFIED", "JANUS_GATEWAY", "JANUS_AUTH_TOKEN", "") + mux.Handle("POST", pattern_EchoService_EchoValidationRule_0, vexpb.ServiceId_CUSTOM_JANUS_GATEWAY_TEST, func(inctx context.Context, w http.ResponseWriter, req *http.Request, pathParams map[string]string) { // TODO(mojz): review all locking/unlocking logic. - // internal_CUSTOM_EASE_GATEWAY_TEST__default__grpc_lock.RLock() - // defer internal_CUSTOM_EASE_GATEWAY_TEST__default__grpc_lock.RUnlock() - client := internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_client + // internal_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_lock.RLock() + // defer internal_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_lock.RUnlock() + client := internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_client inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) if client == nil { err := status.Error(codes.Internal, "service disabled") @@ -1453,7 +1453,7 @@ func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux return } - ctx, err := runtime.RequestAccepted(inctx, internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_spec, "EchoService", "EchoValidationRule", w, req) + ctx, err := runtime.RequestAccepted(inctx, internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_spec, "EchoService", "EchoValidationRule", w, req) if err != nil { grpclog.Errorf("runtime.RequestAccepted returns error: %v", err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1482,34 +1482,34 @@ func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux return nil } -func Disable_CUSTOM_EASE_GATEWAY_TEST__default__grpc_ServiceGroup() { - // internal_CUSTOM_EASE_GATEWAY_TEST__default__grpc_lock.Lock() - // defer internal_CUSTOM_EASE_GATEWAY_TEST__default__grpc_lock.Unlock() - if internal_CUSTOM_EASE_GATEWAY_TEST__default__grpc_skycli != nil { - spec := internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_spec +func Disable_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_ServiceGroup() { + // internal_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_lock.Lock() + // defer internal_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_lock.Unlock() + if internal_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_skycli != nil { + spec := internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_spec sg := runtime.GetServiceGroup(spec) for _, svc := range sg.Services { svc.Disable() } - internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_client = nil - internal_CUSTOM_EASE_GATEWAY_TEST__default__grpc_skycli.Shutdown() - internal_CUSTOM_EASE_GATEWAY_TEST__default__grpc_skycli = nil + internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_client = nil + internal_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_skycli.Shutdown() + internal_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_skycli = nil } } -func Enable_CUSTOM_EASE_GATEWAY_TEST__default__grpc_ServiceGroup() { - // internal_CUSTOM_EASE_GATEWAY_TEST__default__grpc_lock.Lock() - // defer internal_CUSTOM_EASE_GATEWAY_TEST__default__grpc_lock.Unlock() +func Enable_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_ServiceGroup() { + // internal_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_lock.Lock() + // defer internal_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_lock.Unlock() - internal_CUSTOM_EASE_GATEWAY_TEST__default__grpc_skycli = client.NewServiceCli(runtime.CallerServiceId) + internal_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_skycli = client.NewServiceCli(runtime.CallerServiceId) // Resolve service - spec := internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_spec + spec := internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_spec - internal_CUSTOM_EASE_GATEWAY_TEST__default__grpc_skycli.Resolve(spec) + internal_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_skycli.Resolve(spec) - internal_CUSTOM_EASE_GATEWAY_TEST__default__grpc_skycli.Start(func(spec *skypb.ServiceSpec, conn *grpc.ClientConn) { + internal_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_skycli.Start(func(spec *skypb.ServiceSpec, conn *grpc.ClientConn) { sg := runtime.GetServiceGroup(spec) for _, svc := range sg.Services { svc.Enable(spec, conn) @@ -1518,11 +1518,11 @@ func Enable_CUSTOM_EASE_GATEWAY_TEST__default__grpc_ServiceGroup() { } func EnableEchoService_Service(spec *skypb.ServiceSpec, conn *grpc.ClientConn) { - internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_client = NewEchoServiceClient(conn) + internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_client = NewEchoServiceClient(conn) } func DisableEchoService_Service() { - internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_client = nil + internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_client = nil } var ( @@ -1566,10 +1566,10 @@ var ( ) var ( - internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_spec = client.NewServiceSpec("default", vexpb.ServiceId_CUSTOM_EASE_GATEWAY_TEST, "grpc") - internal_EchoService_CUSTOM_EASE_GATEWAY_TEST_client EchoServiceClient + internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_spec = client.NewServiceSpec("default", vexpb.ServiceId_CUSTOM_JANUS_GATEWAY_TEST, "grpc") + internal_EchoService_CUSTOM_JANUS_GATEWAY_TEST_client EchoServiceClient - internal_CUSTOM_EASE_GATEWAY_TEST__default__grpc_skycli client.ServiceCli + internal_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_skycli client.ServiceCli - internal_CUSTOM_EASE_GATEWAY_TEST__default__grpc_lock = sync.RWMutex{} + internal_CUSTOM_JANUS_GATEWAY_TEST__default__grpc_lock = sync.RWMutex{} ) diff --git a/examples/internal/proto/examplepb/echo_service.proto b/examples/internal/proto/examplepb/echo_service.proto index 589f5cd..0f18f38 100644 --- a/examples/internal/proto/examplepb/echo_service.proto +++ b/examples/internal/proto/examplepb/echo_service.proto @@ -91,7 +91,7 @@ message DynamicMessageUpdate { // Echo service responds to incoming echo requests. service EchoService { option (janus.api.service_spec) = { - service_id: CUSTOM_EASE_GATEWAY_TEST + service_id: CUSTOM_JANUS_GATEWAY_TEST port_name : "grpc" namespace : "default" gen_controller: true diff --git a/examples/internal/proto/examplepb/unannotated_echo_service.proto b/examples/internal/proto/examplepb/unannotated_echo_service.proto index ef7161a..add92fe 100644 --- a/examples/internal/proto/examplepb/unannotated_echo_service.proto +++ b/examples/internal/proto/examplepb/unannotated_echo_service.proto @@ -42,7 +42,7 @@ message UnannotatedSimpleMessage { // Echo service responds to incoming echo requests. service UnannotatedEchoService { option (janus.api.service_spec) = { - service_id: CUSTOM_EASE_GATEWAY_TEST + service_id: CUSTOM_JANUS_GATEWAY_TEST port_name : "grpc" namespace : "default" }; diff --git a/gateway/README.md b/gateway/README.md index 7142e1a..0318594 100644 --- a/gateway/README.md +++ b/gateway/README.md @@ -8,7 +8,7 @@ grpc-gateway 是一款非常优秀的网关服务器,负责转化和代理转 - 支持网关层的parameter validation - 支持自定义的annotaion -为了支持这些新feature,我不得不将grpc-gateway的源码拷贝到ease-gateway中并进行大量的修改,```//gateway``` 目录下就是从grpc-gateway中拷贝的部分源码 +为了支持这些新feature,我不得不将grpc-gateway的源码拷贝到janus-gateway中并进行大量的修改,```//gateway``` 目录下就是从grpc-gateway中拷贝的部分源码 # Changed History diff --git a/gateway/runtime/service.go b/gateway/runtime/service.go index 8b8846b..5b37ec2 100755 --- a/gateway/runtime/service.go +++ b/gateway/runtime/service.go @@ -10,8 +10,8 @@ import ( var ( // CallerServiceId sets the gRPC caller service ID of the gateway. - // For janus-gateway, it's ServiceId_EASE_GATEWAY. - CallerServiceId = vexpb.ServiceId_EASE_GATEWAY + // For janus-gateway, it's ServiceId_JANUS_GATEWAY. + CallerServiceId = vexpb.ServiceId_JANUS_GATEWAY ) // Method represents a gRPC service method. diff --git a/httpoptions/BUILD.bazel b/httpoptions/BUILD.bazel index 32f020d..5bf5ff1 100644 --- a/httpoptions/BUILD.bazel +++ b/httpoptions/BUILD.bazel @@ -43,7 +43,7 @@ go_proto_library( ) # proto_library( -# name = "ease_api_proto", +# name = "janus_api_proto", # srcs = [ # "annotations.proto", # "http.proto", diff --git a/httpoptions/annotations.pb.go b/httpoptions/annotations.pb.go index ccaa7b5..575c928 100755 --- a/httpoptions/annotations.pb.go +++ b/httpoptions/annotations.pb.go @@ -26,18 +26,18 @@ const ( type ApiSourceType int32 const ( - ApiSourceType_EASE_GATEWAY ApiSourceType = 0 + ApiSourceType_JANUS_GATEWAY ApiSourceType = 0 ApiSourceType_OPEN_GATEWAY ApiSourceType = 1 ) // Enum value maps for ApiSourceType. var ( ApiSourceType_name = map[int32]string{ - 0: "EASE_GATEWAY", + 0: "JANUS_GATEWAY", 1: "OPEN_GATEWAY", } ApiSourceType_value = map[string]int32{ - "EASE_GATEWAY": 0, + "JANUS_GATEWAY": 0, "OPEN_GATEWAY": 1, } ) @@ -72,18 +72,18 @@ func (ApiSourceType) EnumDescriptor() ([]byte, []int) { type AuthTokenType int32 const ( - AuthTokenType_EASE_AUTH_TOKEN AuthTokenType = 0 + AuthTokenType_JANUS_AUTH_TOKEN AuthTokenType = 0 AuthTokenType_BASE_ACCESS_TOKEN AuthTokenType = 1 ) // Enum value maps for AuthTokenType. var ( AuthTokenType_name = map[int32]string{ - 0: "EASE_AUTH_TOKEN", + 0: "JANUS_AUTH_TOKEN", 1: "BASE_ACCESS_TOKEN", } AuthTokenType_value = map[string]int32{ - "EASE_AUTH_TOKEN": 0, + "JANUS_AUTH_TOKEN": 0, "BASE_ACCESS_TOKEN": 1, } ) @@ -458,14 +458,14 @@ func (x *ApiMethod) GetApiSource() ApiSourceType { if x != nil { return x.ApiSource } - return ApiSourceType_EASE_GATEWAY + return ApiSourceType_JANUS_GATEWAY } func (x *ApiMethod) GetTokenType() AuthTokenType { if x != nil { return x.TokenType } - return AuthTokenType_EASE_AUTH_TOKEN + return AuthTokenType_JANUS_AUTH_TOKEN } func (x *ApiMethod) GetSpecSourceType() SpecSourceType { diff --git a/httpoptions/annotations.proto b/httpoptions/annotations.proto index c1862a8..01a27cf 100644 --- a/httpoptions/annotations.proto +++ b/httpoptions/annotations.proto @@ -66,13 +66,13 @@ message ApiMethod { // Api regist gateway. enum ApiSourceType { - EASE_GATEWAY = 0; // janus-gateway apis. + JANUS_GATEWAY = 0; // janus-gateway apis. OPEN_GATEWAY = 1; // open-gateway open apis. } // Auth token type. enum AuthTokenType { - EASE_AUTH_TOKEN = 0; // janus gateway auth type. + JANUS_AUTH_TOKEN = 0; // janus gateway auth type. BASE_ACCESS_TOKEN = 1; // open platform baseAccessToken. } diff --git a/integrate/hookexternal.go b/integrate/hookexternal.go index 9be3e8a..a51ed42 100644 --- a/integrate/hookexternal.go +++ b/integrate/hookexternal.go @@ -326,11 +326,11 @@ func getHeader(h http.Header, key string) string { } func isGatewayApi(api *runtime.Method) bool { - if runtime.CallerServiceId == vexpb.ServiceId_EASE_GATEWAY { - return api.ApiSource == options.ApiSourceType_EASE_GATEWAY + if runtime.CallerServiceId == vexpb.ServiceId_JANUS_GATEWAY { + return api.ApiSource == options.ApiSourceType_JANUS_GATEWAY } - // else if runtime.CallerServiceId == vexpb.ServiceId_EASE_OPEN_GATEWAY { - // return api.ApiSource == options.ApiSourceType_EASE_OPEN_GATEWAY || + // else if runtime.CallerServiceId == vexpb.ServiceId_JANUS_OPEN_GATEWAY { + // return api.ApiSource == options.ApiSourceType_JANUS_OPEN_GATEWAY || // api.ApiSource == options.ApiSourceType_OPEN_GATEWAY_PRIVATE // } return false diff --git a/proto/examplepb/echo_service.proto b/proto/examplepb/echo_service.proto index dbaf516..ebb4c08 100644 --- a/proto/examplepb/echo_service.proto +++ b/proto/examplepb/echo_service.proto @@ -4,7 +4,7 @@ option go_package = "github.com/binchencoder/janus-gateway/gateway/proto/example package grpc.gateway.proto.examplepb; -option java_package = "com.binchencoder.easegw.examplepb"; +option java_package = "com.binchencoder.janusgw.examplepb"; option java_outer_classname = "ExamplesProto"; // import "google/api/annotations.proto"; @@ -66,7 +66,7 @@ message SimpleMessage { // Echo service responds to incoming echo requests. service EchoService { option (janus.api.service_spec) = { - service_id: CUSTOM_EASE_GATEWAY_TEST + service_id: CUSTOM_JANUS_GATEWAY_TEST port_name : "grpc" namespace : "default" gen_controller: true diff --git a/proto/examplepb/pom.xml b/proto/examplepb/pom.xml index 68446a2..18f6c78 100755 --- a/proto/examplepb/pom.xml +++ b/proto/examplepb/pom.xml @@ -8,16 +8,16 @@ - com.binchencoder.easegw - easegw-proto + com.binchencoder.gateway + janus-proto 1.0-SNAPSHOT ../pom.xml - com.binchencoder.easegw - easegw-options-protos + com.binchencoder.gateway + janus-options-protos com.binchencoder.gateway diff --git a/proto/pom.xml b/proto/pom.xml index 8da16f4..9724b50 100755 --- a/proto/pom.xml +++ b/proto/pom.xml @@ -2,8 +2,8 @@ 4.0.0 - com.binchencoder.easegw - easegw-proto + com.binchencoder.gateway + janus-proto pom 1.0-SNAPSHOT @@ -45,8 +45,8 @@ 1.0-SNAPSHOT - com.binchencoder.easegw - easegw-options-protos + com.binchencoder.gateway + janus-options-protos 1.0-SNAPSHOT provided From d4f627fcdf24040485f476f2956bf7e5c4b82a94 Mon Sep 17 00:00:00 2001 From: binchencoder <15811514091@163.com> Date: Sat, 23 Apr 2022 20:51:32 +0800 Subject: [PATCH 06/10] Not use local repository --- WORKSPACE | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 15bae63..a4bb804 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -109,17 +109,17 @@ load("@com_github_bazelbuild_buildtools//buildifier:deps.bzl", "buildifier_depen buildifier_dependencies() # ---------- local repositories -local_repository( - name = "com_github_binchencoder_gateway_proto", - path = "../gateway-proto", -) +# local_repository( +# name = "com_github_binchencoder_gateway_proto", +# path = "../gateway-proto", +# ) -local_repository( - name = "com_github_binchencoder_letsgo", - path = "../letsgo", -) +# local_repository( +# name = "com_github_binchencoder_letsgo", +# path = "../letsgo", +# ) -local_repository( - name = "com_github_binchencoder_skylb_api", - path = "../skylb-api", -) +# local_repository( +# name = "com_github_binchencoder_skylb_api", +# path = "../skylb-api", +# ) From 7902387203f2ff0d3531b59d579afd2aeb1f5315 Mon Sep 17 00:00:00 2001 From: chenbin1314 Date: Sat, 23 Apr 2022 21:21:50 +0800 Subject: [PATCH 07/10] Format --- WORKSPACE | 1 + 1 file changed, 1 insertion(+) diff --git a/WORKSPACE b/WORKSPACE index a4bb804..4068380 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -123,3 +123,4 @@ buildifier_dependencies() # name = "com_github_binchencoder_skylb_api", # path = "../skylb-api", # ) + From 7c09a04ad4a7036723da79f2aaa3a67d2666d3b8 Mon Sep 17 00:00:00 2001 From: chenbin1314 Date: Sat, 23 Apr 2022 21:30:55 +0800 Subject: [PATCH 08/10] Format WORKSPACE --- WORKSPACE | 1 - 1 file changed, 1 deletion(-) diff --git a/WORKSPACE b/WORKSPACE index 4068380..a4bb804 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -123,4 +123,3 @@ buildifier_dependencies() # name = "com_github_binchencoder_skylb_api", # path = "../skylb-api", # ) - From ab14c231b1bc8c76845fbdee5018b48cfcf2fb07 Mon Sep 17 00:00:00 2001 From: chenbin1314 Date: Sat, 23 Apr 2022 22:01:41 +0800 Subject: [PATCH 09/10] Upgrade gateway-proto versiont v0.0.9 --- cmd/gateway/main.go | 2 +- proto/examplepb/pom.xml | 14 +++++++------- repositories.bzl | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cmd/gateway/main.go b/cmd/gateway/main.go index e5eab81..19ece71 100644 --- a/cmd/gateway/main.go +++ b/cmd/gateway/main.go @@ -9,10 +9,10 @@ import ( "github.com/golang/glog" + "github.com/binchencoder/gateway-proto/data" "github.com/binchencoder/janus-gateway/gateway/runtime" "github.com/binchencoder/janus-gateway/integrate" "github.com/binchencoder/janus-gateway/util" - "github.com/binchencoder/gateway-proto/data" "github.com/binchencoder/letsgo" "github.com/binchencoder/letsgo/service/naming" ) diff --git a/proto/examplepb/pom.xml b/proto/examplepb/pom.xml index 18f6c78..95d132e 100755 --- a/proto/examplepb/pom.xml +++ b/proto/examplepb/pom.xml @@ -15,13 +15,13 @@ - - com.binchencoder.gateway - janus-options-protos - - - com.binchencoder.gateway - data-proto + + com.binchencoder.gateway + janus-options-protos + + + com.binchencoder.gateway + data-proto diff --git a/repositories.bzl b/repositories.bzl index 63a42de..aa043bc 100644 --- a/repositories.bzl +++ b/repositories.bzl @@ -23,7 +23,7 @@ def go_repositories(): name = "com_github_binchencoder_gateway_proto", importpath = "github.com/binchencoder/gateway-proto", sum = "h1:ZvjzhU0CR93EdhqGtQj0Wkwd76D+KsvMuNEMAS1XVos=", - version = "v0.0.8", + version = "v0.0.9", ) go_repository( name = "com_github_armon_circbuf", From c4f6b1364e7cd20a5ad43fc62f4249bbef595573 Mon Sep 17 00:00:00 2001 From: chenbin1314 Date: Sat, 23 Apr 2022 22:10:53 +0800 Subject: [PATCH 10/10] Upgrade gateway-proto versiont v0.0.9 --- repositories.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repositories.bzl b/repositories.bzl index aa043bc..299ddda 100644 --- a/repositories.bzl +++ b/repositories.bzl @@ -22,7 +22,7 @@ def go_repositories(): go_repository( name = "com_github_binchencoder_gateway_proto", importpath = "github.com/binchencoder/gateway-proto", - sum = "h1:ZvjzhU0CR93EdhqGtQj0Wkwd76D+KsvMuNEMAS1XVos=", + sum = "h1:+B4hxnqdYOP2DErADRLNpP0tTxEqYxAugQ0EDMpPxZc=", version = "v0.0.9", ) go_repository(