On Tue, Sep 25, 2018 at 7:15 AM Josh Humphries <
jh...@bluegosling.com> wrote:
>> 1) if anyone seen a Nodejs version of GRPCurl, I may learn some code from there,
>>
https://github.com/fullstorydev/grpcurl
>
> I don't know of a Node.js version of gRPCurl, but I do know of some other dynamic gRPC stuff written in Node.js. @konsumer on GitHub has done a lot of stuff with this. A quick scan of those repos reveals this:
https://github.com/konsumer/grpc-dynamic-gateway
> It's not gRPCurl, but it does use dynamic gRPC, so you might glean what you need from the source for it.
Thanks for the great information about grpc-dynamic-gateway project,
while it seems lack support of multiple proto_path
filed an issue there
https://github.com/konsumer/grpc-dynamic-gateway/issues/15 also
ask here if anyone in the mailing list has an answer
the protoc compilation support `--proto_path=` to be specified
multiple times, but this project seems not? because in a real large
project, there are multiple proto definition files in a complex
hierarchy ...
```console
$ protoc --help
Usage: protoc [OPTION] PROTO_FILES
Parse PROTO_FILES and generate output based on the options given:
-IPATH, --proto_path=PATH Specify the directory in which to search for
imports. May be specified multiple times;
directories will be searched in order. If not
given, the current working directory is used.
-oFILE, Writes a FileDescriptorSet (a protocol buffer,
--descriptor_set_out=FILE defined in descriptor.proto) containing all of
the input files to FILE.
```
I read the code seems requiring the `include` to be one string only?
https://github.com/konsumer/grpc-dynamic-gateway/blob/master/index.js#L37
While, I've tried to touch the code a bit if I can make it working,
but the `grpc.load({ file: p, root: include })` call seems
undocumented? there are a lot of Nodejs GRPC API is definitely lack of
Documentation , while, do you know if it support multiple include
proto path?
https://grpc.io/grpc/node/grpc.html#.load__anchor
Another possibility is I see protoc can compile the complex hierarchy
`*.proto` into a single protoset binary file, and it's well supported
by tools like `grpcurl` Are you aware if nodejs-grpc has similar
protoset-files support?
https://github.com/fullstorydev/grpcurl#protoset-files
I've google searched grpc + nodejs + protoset support seems nothing
>
>>
>> 2) what's the terminology mapping? between Go code uses
>> cacert/cert/key to the Nodejs uses root_cert, private_key,
>> cert_chain ?
>
>
> root_cert == cacert
> This is one or more certificates for trusted "root certificate authorities"
>
> cert == cert_chain
> This is the full certificate that the server presents, including its public key as well as the full chain of trust (e.g. certificate issuer/authority signatures)
>
> key == private_key
> This is the private key that corresponds to the public key in the server's certificate
Wish different programming API can have same names to refer same thing
, But ...
>
>>
>>
>> <static> createSsl( [root_certs] [, private_key] [, cert_chain])
>> Create an SSL Credentials object. If using a client-side certificate,
>> both the second and third arguments must be passed. Additional peer
>> verification options can be passed in the fourth argument as described
>> below.
>>
>> Parameters:
>> Name Type Argument Description
>> root_certs Buffer <optional>
>> The root certificate data
>>
>> private_key Buffer <optional>
>> The client certificate private key, if applicable
>>
>> cert_chain Buffer <optional>
>> The client certificate cert chain, if applicable
>>
>> verify_options.checkServerIdentity function
>> Optional callback receiving the expected hostname and peer certificate
>> for additional verification. The callback should return an Error if
>> verification fails and otherwise return undefined.
then each key in what format is still not well documented, my
inherited project gives me ca.pem client.pem client-key.pem and also
*.csr files, I've tried load each of them, always got a Connect
Failed...
// these 3 pem files can get working with grpcurl ...
const client = new api.Api(
'<server:port>',
grpc.credentials.createSsl(
fs.readFileSync('./testdata/tls/ca.pem'),
// ca, key, cert,
fs.readFileSync('./testdata/tls/client-key.pem'),
fs.readFileSync('./testdata/tls/client.pem'),
{ checkServerIdentity: function(){} },
// I've tried set the 4th parameter as an object with empty
verify_options.checkServerIdentity function to return undefined, but
not helpful
));
console.log(client.SomeGRPCAPICall({}, (err, obj) => {
console.log(new Date, 'ERROR:', err, obj);
}));
All got result:
ClientUnaryCall {
_events: {},
_eventsCount: 0,
_maxListeners: undefined,
call:
InterceptingCall {
next_call: InterceptingCall { next_call: null, requester: [Object] },
requester: undefined } }
2018-09-25T15:48:34.796Z 'ERROR:' { Error: 14 UNAVAILABLE: Connect Failed ...