grpc-js: use tls.ConnectionOptions type for proxy connection options

This commit is contained in:
Tom Kirkpatrick 2020-04-19 20:02:38 +02:00
parent 48072d5f4f
commit eef75a5c1b
No known key found for this signature in database
GPG Key ID: 72203A8EC5967EA8
2 changed files with 3 additions and 4 deletions

View File

@ -24,7 +24,6 @@ import { Socket } from 'net';
import * as http from 'http'; import * as http from 'http';
import * as tls from 'tls'; import * as tls from 'tls';
import * as logging from './logging'; import * as logging from './logging';
import { SecureClientSessionOptions } from 'http2'
import { import {
SubchannelAddress, SubchannelAddress,
isTcpSubchannelAddress, isTcpSubchannelAddress,
@ -161,7 +160,7 @@ export interface ProxyConnectionResult {
export function getProxiedConnection( export function getProxiedConnection(
address: SubchannelAddress, address: SubchannelAddress,
channelOptions: ChannelOptions, channelOptions: ChannelOptions,
connectionOptions: SecureClientSessionOptions connectionOptions: tls.ConnectionOptions
): Promise<ProxyConnectionResult> { ): Promise<ProxyConnectionResult> {
if (!('grpc.http_connect_target' in channelOptions)) { if (!('grpc.http_connect_target' in channelOptions)) {
return Promise.resolve<ProxyConnectionResult>({}); return Promise.resolve<ProxyConnectionResult>({});

View File

@ -28,7 +28,7 @@ import * as logging from './logging';
import { LogVerbosity } from './constants'; import { LogVerbosity } from './constants';
import { getProxiedConnection, ProxyConnectionResult } from './http_proxy'; import { getProxiedConnection, ProxyConnectionResult } from './http_proxy';
import * as net from 'net'; import * as net from 'net';
import * as tls from 'tls'; import { ConnectionOptions } from 'tls';
const clientVersion = require('../../package.json').version; const clientVersion = require('../../package.json').version;
@ -420,7 +420,7 @@ export class Subchannel {
* upgrade it's connection to support tls if needed. * upgrade it's connection to support tls if needed.
* This is a workaround for https://github.com/nodejs/node/issues/32922 * This is a workaround for https://github.com/nodejs/node/issues/32922
* See https://github.com/grpc/grpc-node/pull/1369 for more info. */ * See https://github.com/grpc/grpc-node/pull/1369 for more info. */
const connectionOptions: http2.SecureClientSessionOptions = const connectionOptions: ConnectionOptions =
this.credentials._getConnectionOptions() || {}; this.credentials._getConnectionOptions() || {};
if ('secureContext' in connectionOptions) { if ('secureContext' in connectionOptions) {