grpc 1.42.0.pre1-x86_64-darwin
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/etc/roots.pem +4337 -0
- data/grpc_c.32.ruby +0 -0
- data/grpc_c.64.ruby +0 -0
- data/src/ruby/bin/math_client.rb +140 -0
- data/src/ruby/bin/math_pb.rb +34 -0
- data/src/ruby/bin/math_server.rb +191 -0
- data/src/ruby/bin/math_services_pb.rb +51 -0
- data/src/ruby/bin/noproto_client.rb +93 -0
- data/src/ruby/bin/noproto_server.rb +97 -0
- data/src/ruby/ext/grpc/ext-export.clang +1 -0
- data/src/ruby/ext/grpc/ext-export.gcc +6 -0
- data/src/ruby/ext/grpc/extconf.rb +123 -0
- data/src/ruby/ext/grpc/rb_byte_buffer.c +65 -0
- data/src/ruby/ext/grpc/rb_byte_buffer.h +35 -0
- data/src/ruby/ext/grpc/rb_call.c +1051 -0
- data/src/ruby/ext/grpc/rb_call.h +57 -0
- data/src/ruby/ext/grpc/rb_call_credentials.c +341 -0
- data/src/ruby/ext/grpc/rb_call_credentials.h +31 -0
- data/src/ruby/ext/grpc/rb_channel.c +846 -0
- data/src/ruby/ext/grpc/rb_channel.h +34 -0
- data/src/ruby/ext/grpc/rb_channel_args.c +155 -0
- data/src/ruby/ext/grpc/rb_channel_args.h +38 -0
- data/src/ruby/ext/grpc/rb_channel_credentials.c +286 -0
- data/src/ruby/ext/grpc/rb_channel_credentials.h +37 -0
- data/src/ruby/ext/grpc/rb_completion_queue.c +101 -0
- data/src/ruby/ext/grpc/rb_completion_queue.h +36 -0
- data/src/ruby/ext/grpc/rb_compression_options.c +471 -0
- data/src/ruby/ext/grpc/rb_compression_options.h +29 -0
- data/src/ruby/ext/grpc/rb_enable_cpp.cc +22 -0
- data/src/ruby/ext/grpc/rb_event_thread.c +145 -0
- data/src/ruby/ext/grpc/rb_event_thread.h +21 -0
- data/src/ruby/ext/grpc/rb_grpc.c +333 -0
- data/src/ruby/ext/grpc/rb_grpc.h +77 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +605 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +913 -0
- data/src/ruby/ext/grpc/rb_loader.c +57 -0
- data/src/ruby/ext/grpc/rb_loader.h +25 -0
- data/src/ruby/ext/grpc/rb_server.c +385 -0
- data/src/ruby/ext/grpc/rb_server.h +32 -0
- data/src/ruby/ext/grpc/rb_server_credentials.c +259 -0
- data/src/ruby/ext/grpc/rb_server_credentials.h +37 -0
- data/src/ruby/ext/grpc/rb_xds_channel_credentials.c +218 -0
- data/src/ruby/ext/grpc/rb_xds_channel_credentials.h +37 -0
- data/src/ruby/ext/grpc/rb_xds_server_credentials.c +170 -0
- data/src/ruby/ext/grpc/rb_xds_server_credentials.h +37 -0
- data/src/ruby/lib/grpc/2.4/grpc_c.bundle +0 -0
- data/src/ruby/lib/grpc/2.5/grpc_c.bundle +0 -0
- data/src/ruby/lib/grpc/2.6/grpc_c.bundle +0 -0
- data/src/ruby/lib/grpc/2.7/grpc_c.bundle +0 -0
- data/src/ruby/lib/grpc/3.0/grpc_c.bundle +0 -0
- data/src/ruby/lib/grpc/core/status_codes.rb +135 -0
- data/src/ruby/lib/grpc/core/time_consts.rb +56 -0
- data/src/ruby/lib/grpc/errors.rb +277 -0
- data/src/ruby/lib/grpc/generic/active_call.rb +669 -0
- data/src/ruby/lib/grpc/generic/bidi_call.rb +233 -0
- data/src/ruby/lib/grpc/generic/client_stub.rb +503 -0
- data/src/ruby/lib/grpc/generic/interceptor_registry.rb +53 -0
- data/src/ruby/lib/grpc/generic/interceptors.rb +186 -0
- data/src/ruby/lib/grpc/generic/rpc_desc.rb +204 -0
- data/src/ruby/lib/grpc/generic/rpc_server.rb +551 -0
- data/src/ruby/lib/grpc/generic/service.rb +211 -0
- data/src/ruby/lib/grpc/google_rpc_status_utils.rb +40 -0
- data/src/ruby/lib/grpc/grpc.rb +24 -0
- data/src/ruby/lib/grpc/logconfig.rb +44 -0
- data/src/ruby/lib/grpc/notifier.rb +45 -0
- data/src/ruby/lib/grpc/structs.rb +15 -0
- data/src/ruby/lib/grpc/version.rb +18 -0
- data/src/ruby/lib/grpc.rb +37 -0
- data/src/ruby/pb/README.md +42 -0
- data/src/ruby/pb/generate_proto_ruby.sh +51 -0
- data/src/ruby/pb/grpc/health/checker.rb +75 -0
- data/src/ruby/pb/grpc/health/v1/health_pb.rb +31 -0
- data/src/ruby/pb/grpc/health/v1/health_services_pb.rb +62 -0
- data/src/ruby/pb/grpc/testing/duplicate/echo_duplicate_services_pb.rb +44 -0
- data/src/ruby/pb/grpc/testing/metrics_pb.rb +28 -0
- data/src/ruby/pb/grpc/testing/metrics_services_pb.rb +49 -0
- data/src/ruby/pb/src/proto/grpc/testing/empty_pb.rb +17 -0
- data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +145 -0
- data/src/ruby/pb/src/proto/grpc/testing/test_pb.rb +16 -0
- data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +152 -0
- data/src/ruby/pb/test/client.rb +769 -0
- data/src/ruby/pb/test/server.rb +252 -0
- data/src/ruby/pb/test/xds_client.rb +415 -0
- data/src/ruby/spec/call_credentials_spec.rb +42 -0
- data/src/ruby/spec/call_spec.rb +180 -0
- data/src/ruby/spec/channel_connection_spec.rb +126 -0
- data/src/ruby/spec/channel_credentials_spec.rb +124 -0
- data/src/ruby/spec/channel_spec.rb +245 -0
- data/src/ruby/spec/client_auth_spec.rb +152 -0
- data/src/ruby/spec/client_server_spec.rb +664 -0
- data/src/ruby/spec/compression_options_spec.rb +149 -0
- data/src/ruby/spec/debug_message_spec.rb +134 -0
- data/src/ruby/spec/error_sanity_spec.rb +49 -0
- data/src/ruby/spec/errors_spec.rb +142 -0
- data/src/ruby/spec/generic/active_call_spec.rb +683 -0
- data/src/ruby/spec/generic/client_interceptors_spec.rb +153 -0
- data/src/ruby/spec/generic/client_stub_spec.rb +1083 -0
- data/src/ruby/spec/generic/interceptor_registry_spec.rb +65 -0
- data/src/ruby/spec/generic/rpc_desc_spec.rb +374 -0
- data/src/ruby/spec/generic/rpc_server_pool_spec.rb +127 -0
- data/src/ruby/spec/generic/rpc_server_spec.rb +748 -0
- data/src/ruby/spec/generic/server_interceptors_spec.rb +218 -0
- data/src/ruby/spec/generic/service_spec.rb +263 -0
- data/src/ruby/spec/google_rpc_status_utils_spec.rb +282 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/package_options.proto +28 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/package_options_import.proto +22 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/package_options_import2.proto +23 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/package_options_ruby_style.proto +41 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/same_package_service_name.proto +27 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/same_ruby_package_service_name.proto +29 -0
- data/src/ruby/spec/pb/codegen/package_option_spec.rb +98 -0
- data/src/ruby/spec/pb/duplicate/codegen_spec.rb +57 -0
- data/src/ruby/spec/pb/health/checker_spec.rb +236 -0
- data/src/ruby/spec/server_credentials_spec.rb +104 -0
- data/src/ruby/spec/server_spec.rb +231 -0
- data/src/ruby/spec/spec_helper.rb +61 -0
- data/src/ruby/spec/support/helpers.rb +107 -0
- data/src/ruby/spec/support/services.rb +160 -0
- data/src/ruby/spec/testdata/README +1 -0
- data/src/ruby/spec/testdata/ca.pem +20 -0
- data/src/ruby/spec/testdata/client.key +28 -0
- data/src/ruby/spec/testdata/client.pem +20 -0
- data/src/ruby/spec/testdata/server1.key +28 -0
- data/src/ruby/spec/testdata/server1.pem +22 -0
- data/src/ruby/spec/time_consts_spec.rb +74 -0
- data/src/ruby/spec/user_agent_spec.rb +74 -0
- metadata +404 -0
@@ -0,0 +1,152 @@
|
|
1
|
+
# Copyright 2015 gRPC authors.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require 'spec_helper'
|
16
|
+
|
17
|
+
def create_channel_creds
|
18
|
+
test_root = File.join(File.dirname(__FILE__), 'testdata')
|
19
|
+
files = ['ca.pem', 'client.key', 'client.pem']
|
20
|
+
creds = files.map { |f| File.open(File.join(test_root, f)).read }
|
21
|
+
GRPC::Core::ChannelCredentials.new(creds[0], creds[1], creds[2])
|
22
|
+
end
|
23
|
+
|
24
|
+
def client_cert
|
25
|
+
test_root = File.join(File.dirname(__FILE__), 'testdata')
|
26
|
+
cert = File.open(File.join(test_root, 'client.pem')).read
|
27
|
+
fail unless cert.is_a?(String)
|
28
|
+
cert
|
29
|
+
end
|
30
|
+
|
31
|
+
def create_server_creds
|
32
|
+
test_root = File.join(File.dirname(__FILE__), 'testdata')
|
33
|
+
GRPC.logger.info("test root: #{test_root}")
|
34
|
+
files = ['ca.pem', 'server1.key', 'server1.pem']
|
35
|
+
creds = files.map { |f| File.open(File.join(test_root, f)).read }
|
36
|
+
GRPC::Core::ServerCredentials.new(
|
37
|
+
creds[0],
|
38
|
+
[{ private_key: creds[1], cert_chain: creds[2] }],
|
39
|
+
true) # force client auth
|
40
|
+
end
|
41
|
+
|
42
|
+
# a test service that checks the cert of its peer
|
43
|
+
class SslTestService
|
44
|
+
include GRPC::GenericService
|
45
|
+
rpc :an_rpc, EchoMsg, EchoMsg
|
46
|
+
rpc :a_client_streaming_rpc, stream(EchoMsg), EchoMsg
|
47
|
+
rpc :a_server_streaming_rpc, EchoMsg, stream(EchoMsg)
|
48
|
+
rpc :a_bidi_rpc, stream(EchoMsg), stream(EchoMsg)
|
49
|
+
|
50
|
+
def check_peer_cert(call)
|
51
|
+
error_msg = "want:\n#{client_cert}\n\ngot:\n#{call.peer_cert}"
|
52
|
+
fail(error_msg) unless call.peer_cert == client_cert
|
53
|
+
end
|
54
|
+
|
55
|
+
def an_rpc(req, call)
|
56
|
+
check_peer_cert(call)
|
57
|
+
req
|
58
|
+
end
|
59
|
+
|
60
|
+
def a_client_streaming_rpc(call)
|
61
|
+
check_peer_cert(call)
|
62
|
+
call.each_remote_read.each { |r| GRPC.logger.info(r) }
|
63
|
+
EchoMsg.new
|
64
|
+
end
|
65
|
+
|
66
|
+
def a_server_streaming_rpc(_, call)
|
67
|
+
check_peer_cert(call)
|
68
|
+
[EchoMsg.new, EchoMsg.new]
|
69
|
+
end
|
70
|
+
|
71
|
+
def a_bidi_rpc(requests, call)
|
72
|
+
check_peer_cert(call)
|
73
|
+
requests.each { |r| GRPC.logger.info(r) }
|
74
|
+
[EchoMsg.new, EchoMsg.new]
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
SslTestServiceStub = SslTestService.rpc_stub_class
|
79
|
+
|
80
|
+
describe 'client-server auth' do
|
81
|
+
RpcServer = GRPC::RpcServer
|
82
|
+
|
83
|
+
before(:all) do
|
84
|
+
server_opts = {
|
85
|
+
poll_period: 1
|
86
|
+
}
|
87
|
+
@srv = new_rpc_server_for_testing(**server_opts)
|
88
|
+
ssl_creds = create_server_creds
|
89
|
+
xds_creds = GRPC::Core::XdsServerCredentials.new(ssl_creds)
|
90
|
+
port = @srv.add_http2_port('0.0.0.0:0', ssl_creds)
|
91
|
+
xds_port = @srv.add_http2_port('0.0.0.0:0', xds_creds)
|
92
|
+
@srv.handle(SslTestService)
|
93
|
+
@srv_thd = Thread.new { @srv.run }
|
94
|
+
@srv.wait_till_running
|
95
|
+
|
96
|
+
client_opts = {
|
97
|
+
channel_args: {
|
98
|
+
GRPC::Core::Channel::SSL_TARGET => 'foo.test.google.fr'
|
99
|
+
}
|
100
|
+
}
|
101
|
+
@stub = SslTestServiceStub.new("localhost:#{port}",
|
102
|
+
create_channel_creds,
|
103
|
+
**client_opts)
|
104
|
+
# auth should success as the fallback creds wil be used
|
105
|
+
xds_channel_creds = GRPC::Core::XdsChannelCredentials.new(create_channel_creds)
|
106
|
+
@xds_stub = SslTestServiceStub.new("localhost:#{xds_port}",
|
107
|
+
xds_channel_creds,
|
108
|
+
**client_opts)
|
109
|
+
end
|
110
|
+
|
111
|
+
after(:all) do
|
112
|
+
expect(@srv.stopped?).to be(false)
|
113
|
+
@srv.stop
|
114
|
+
@srv_thd.join
|
115
|
+
end
|
116
|
+
|
117
|
+
it 'client-server auth with unary RPCs' do
|
118
|
+
@stub.an_rpc(EchoMsg.new)
|
119
|
+
end
|
120
|
+
|
121
|
+
it 'client-server auth with client streaming RPCs' do
|
122
|
+
@stub.a_client_streaming_rpc([EchoMsg.new, EchoMsg.new])
|
123
|
+
end
|
124
|
+
|
125
|
+
it 'client-server auth with server streaming RPCs' do
|
126
|
+
responses = @stub.a_server_streaming_rpc(EchoMsg.new)
|
127
|
+
responses.each { |r| GRPC.logger.info(r) }
|
128
|
+
end
|
129
|
+
|
130
|
+
it 'client-server auth with bidi RPCs' do
|
131
|
+
responses = @stub.a_bidi_rpc([EchoMsg.new, EchoMsg.new])
|
132
|
+
responses.each { |r| GRPC.logger.info(r) }
|
133
|
+
end
|
134
|
+
|
135
|
+
it 'xds_client-xds_server ssl fallback auth with unary RPCs' do
|
136
|
+
@xds_stub.an_rpc(EchoMsg.new)
|
137
|
+
end
|
138
|
+
|
139
|
+
it 'xds_client-xds_server ssl fallback auth with client streaming RPCs' do
|
140
|
+
@xds_stub.a_client_streaming_rpc([EchoMsg.new, EchoMsg.new])
|
141
|
+
end
|
142
|
+
|
143
|
+
it 'xds_client-xds_server ssl fallback auth with server streaming RPCs' do
|
144
|
+
responses = @xds_stub.a_server_streaming_rpc(EchoMsg.new)
|
145
|
+
responses.each { |r| GRPC.logger.info(r) }
|
146
|
+
end
|
147
|
+
|
148
|
+
it 'xds_client-xds_server ssl fallback auth with bidi RPCs' do
|
149
|
+
responses = @xds_stub.a_bidi_rpc([EchoMsg.new, EchoMsg.new])
|
150
|
+
responses.each { |r| GRPC.logger.info(r) }
|
151
|
+
end
|
152
|
+
end
|