-
大小: 228KB文件类型: .zip金币: 2下载: 1 次发布日期: 2021-06-17
- 语言: JavaScript
- 标签:
资源简介
gRPC-Web:提供了一个Javascript库,允许浏览器客户端访问gRPC服务
代码片段和文件信息
/**
*
* Copyright 2018 Google LLC
*
* Licensed under the Apache License Version 2.0 (the “License“);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing software
* distributed under the License is distributed on an “AS IS“ BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
// The Nginx module for GRPC gateway.
// It proxies the HTTP requests (follows go/http-api) to GRPC backends.
// Usage:
// location / {
// grpc_pass :
// grpc_channel_reuse on|off
// grpc_client_liveness_detection_interval
// }
// Example:
// location / {
// grpc_pass localhost:8090
// grpc_channel_reuse on
// grpc_client_liveness_detection_interval 60000
// }
#include
#include
#include
#include
#include
#include
#include “net/grpc/gateway/frontend/nginx_bridge.h“
#include “third_party/grpc/include/grpc/byte_buffer.h“
#include “third_party/grpc/include/grpc/byte_buffer_reader.h“
#include “third_party/grpc/include/grpc/grpc.h“
#include “third_party/grpc/include/grpc/slice.h“
#include “third_party/grpc/include/grpc/status.h“
#include “third_party/grpc/include/grpc/support/time.h“
// Tag for requests to GRPC backend. It contains the content and will be send
// back to the grpc_event_callback once the GRPC event comes from the completion
// queue.
typedef struct grpc_event_tag grpc_event_tag;
struct grpc_event_tag {
ngx_http_request_t *ngx_http_request;
grpc_metadata_array recv_init_metadata;
grpc_byte_buffer *recv_message;
grpc_status_code recv_status;
char *recv_status_details;
size_t recv_status_details_capacity;
grpc_metadata_array recv_trailing_metadata;
void (*grpc_event_callback)(grpc_event_tag * bool);
};
extern ngx_int_t grpc_gateway_init_process(ngx_cycle_t *cycle);
extern void grpc_gateway_exit_process(ngx_cycle_t *cycle);
// Initiates the ngx_grpc_gateway module.
static char *grpc_gateway(ngx_conf_t *cf ngx_command_t *cmd void *conf);
// Callback when receiving a new HTTP request.
extern ngx_int_t grpc_gateway_handler(ngx_http_request_t *r);
// Creates the local configure.
static void *grpc_gateway_create_loc_conf(ngx_conf_t *cf);
// Merges the local configure.
static char *grpc_gateway_merge_loc_conf(ngx_conf_t *cf void *parent
void *child);
// Commands for grpc_gateway module.
static ngx_command_t grpc_gateway_commands[] = {
{ngx_string(“grpc_pass“) NGX_HTTP_LOC_CONF | NGX_CONF_TAKE1 grpc_gateway
NGX_HTTP_LOC_CONF_OFFSET 0 NULL}
{ngx_string(“grpc_channel_reuse“) NGX_HTTP_LOC_CONF | NGX_CONF_FLAG
ngx_conf_set_flag_slot NGX_HTTP_LOC
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-08-01 00:42 grpc-grpc-web-8b501a9\
文件 90 2019-08-01 00:42 grpc-grpc-web-8b501a9\.gitignore
文件 445 2019-08-01 00:42 grpc-grpc-web-8b501a9\.gitmodules
文件 12 2019-08-01 00:42 grpc-grpc-web-8b501a9\AUTHORS
文件 2890 2019-08-01 00:42 grpc-grpc-web-8b501a9\BROWSER-FEATURES.md
文件 142 2019-08-01 00:42 grpc-grpc-web-8b501a9\CODE-OF-CONDUCT.md
文件 462 2019-08-01 00:42 grpc-grpc-web-8b501a9\CONTRIBUTING.md
文件 1585 2019-08-01 00:42 grpc-grpc-web-8b501a9\IN-PROCESS-PROXY.md
文件 11357 2019-08-01 00:42 grpc-grpc-web-8b501a9\LICENSE
文件 4284 2019-08-01 00:42 grpc-grpc-web-8b501a9\Makefile
文件 1315 2019-08-01 00:42 grpc-grpc-web-8b501a9\PATENTS
文件 9421 2019-08-01 00:42 grpc-grpc-web-8b501a9\README.md
文件 3875 2019-08-01 00:42 grpc-grpc-web-8b501a9\ROADMAP.md
文件 554 2019-08-01 00:42 grpc-grpc-web-8b501a9\WORKSPACE
文件 2171 2019-08-01 00:42 grpc-grpc-web-8b501a9\advanced.yml
目录 0 2019-08-01 00:42 grpc-grpc-web-8b501a9\bazel\
文件 0 2019-08-01 00:42 grpc-grpc-web-8b501a9\bazel\BUILD.bazel
文件 6202 2019-08-01 00:42 grpc-grpc-web-8b501a9\bazel\closure_grpc_web_library.bzl
文件 756 2019-08-01 00:42 grpc-grpc-web-8b501a9\docker-compose.yml
目录 0 2019-08-01 00:42 grpc-grpc-web-8b501a9\etc\
文件 1086 2019-08-01 00:42 grpc-grpc-web-8b501a9\etc\localhost.crt
文件 1675 2019-08-01 00:42 grpc-grpc-web-8b501a9\etc\localhost.key
目录 0 2019-08-01 00:42 grpc-grpc-web-8b501a9\ja
目录 0 2019-08-01 00:42 grpc-grpc-web-8b501a9\ja
目录 0 2019-08-01 00:42 grpc-grpc-web-8b501a9\ja
目录 0 2019-08-01 00:42 grpc-grpc-web-8b501a9\ja
文件 4293 2019-08-01 00:42 grpc-grpc-web-8b501a9\ja
文件 940 2019-08-01 00:42 grpc-grpc-web-8b501a9\ja
文件 3903 2019-08-01 00:42 grpc-grpc-web-8b501a9\ja
文件 1686 2019-08-01 00:42 grpc-grpc-web-8b501a9\ja
文件 982 2019-08-01 00:42 grpc-grpc-web-8b501a9\ja
............此处省略230个文件信息
评论
共有 条评论