Merge branch 'master' into grpc-js_credentials_secure_connector

This commit is contained in:
Michael Lumish 2024-11-22 16:05:22 -08:00
commit 165732467d
6 changed files with 12 additions and 12 deletions

View File

@ -37,7 +37,7 @@
"@types/gulp": "^4.0.6", "@types/gulp": "^4.0.6",
"@types/gulp-mocha": "0.0.32", "@types/gulp-mocha": "0.0.32",
"@types/mocha": "^5.2.6", "@types/mocha": "^5.2.6",
"@types/node": "^13.11.1", "@types/node": ">=20.11.20",
"@types/yargs": "^15.0.5", "@types/yargs": "^15.0.5",
"find-free-ports": "^3.1.1", "find-free-ports": "^3.1.1",
"gts": "^5.0.1", "gts": "^5.0.1",

View File

@ -184,8 +184,8 @@ export class PriorityLoadBalancer implements LoadBalancer {
private connectivityState: ConnectivityState = ConnectivityState.IDLE; private connectivityState: ConnectivityState = ConnectivityState.IDLE;
private picker: Picker; private picker: Picker;
private childBalancer: ChildLoadBalancerHandler; private childBalancer: ChildLoadBalancerHandler;
private failoverTimer: NodeJS.Timer | null = null; private failoverTimer: NodeJS.Timeout | null = null;
private deactivationTimer: NodeJS.Timer | null = null; private deactivationTimer: NodeJS.Timeout | null = null;
private seenReadyOrIdleSinceTransientFailure = false; private seenReadyOrIdleSinceTransientFailure = false;
constructor(private parent: PriorityLoadBalancer, private name: string, ignoreReresolutionRequests: boolean) { constructor(private parent: PriorityLoadBalancer, private name: string, ignoreReresolutionRequests: boolean) {
this.childBalancer = new ChildLoadBalancerHandler(experimental.createChildChannelControlHelper(this.parent.channelControlHelper, { this.childBalancer = new ChildLoadBalancerHandler(experimental.createChildChannelControlHelper(this.parent.channelControlHelper, {

View File

@ -170,7 +170,7 @@ export class WeightedTargetLoadBalancer implements LoadBalancer {
private connectivityState: ConnectivityState = ConnectivityState.IDLE; private connectivityState: ConnectivityState = ConnectivityState.IDLE;
private picker: Picker; private picker: Picker;
private childBalancer: ChildLoadBalancerHandler; private childBalancer: ChildLoadBalancerHandler;
private deactivationTimer: NodeJS.Timer | null = null; private deactivationTimer: NodeJS.Timeout | null = null;
private weight: number = 0; private weight: number = 0;
constructor(private parent: WeightedTargetLoadBalancer, private name: string) { constructor(private parent: WeightedTargetLoadBalancer, private name: string) {

View File

@ -493,7 +493,7 @@ interface MatchFieldEvaluator<MatcherType, FieldType> {
isMoreSpecific: (matcher1: MatcherType, matcher2: MatcherType) => boolean; isMoreSpecific: (matcher1: MatcherType, matcher2: MatcherType) => boolean;
} }
type FieldType<MatcherType> = MatcherType extends CidrRange ? (string | undefined) : MatcherType extends (ConnectionSourceType) ? {localAddress: string, remoteAddress?: (string | undefined)} : MatcherType extends number ? number | undefined : never; type FieldType<MatcherType> = MatcherType extends CidrRange ? (string | undefined) : MatcherType extends (ConnectionSourceType) ? {localAddress?: (string | undefined), remoteAddress?: (string | undefined)} : MatcherType extends number ? number | undefined : never;
function cidrRangeMatch(range: CidrRange | undefined, address: string | undefined): boolean { function cidrRangeMatch(range: CidrRange | undefined, address: string | undefined): boolean {
return !range || (!!address && inCidrRange(range, address)); return !range || (!!address && inCidrRange(range, address));
@ -506,14 +506,14 @@ function cidrRangeMoreSpecific(range1: CidrRange | undefined, range2: CidrRange
return !!range1 && range1.prefixLen > range2.prefixLen; return !!range1 && range1.prefixLen > range2.prefixLen;
} }
function sourceTypeMatch(sourceType: ConnectionSourceType, addresses: {localAddress: string, remoteAddress?: (string | undefined)}): boolean { function sourceTypeMatch(sourceType: ConnectionSourceType, addresses: {localAddress?: (string | undefined), remoteAddress?: (string | undefined)}): boolean {
switch (sourceType) { switch (sourceType) {
case "ANY": case "ANY":
return true; return true;
case "SAME_IP_OR_LOOPBACK": case "SAME_IP_OR_LOOPBACK":
return !!addresses.remoteAddress && isSameIpOrLoopback(addresses.remoteAddress, addresses.localAddress); return !!addresses.localAddress && !!addresses.remoteAddress && isSameIpOrLoopback(addresses.remoteAddress, addresses.localAddress);
case "EXTERNAL": case "EXTERNAL":
return !!addresses.remoteAddress && !isSameIpOrLoopback(addresses.remoteAddress, addresses.localAddress); return !!addresses.localAddress && !!addresses.remoteAddress && !isSameIpOrLoopback(addresses.remoteAddress, addresses.localAddress);
} }
} }
@ -523,7 +523,7 @@ const cidrRangeEvaluator: MatchFieldEvaluator<CidrRange | undefined, string | un
isMoreSpecific: cidrRangeMoreSpecific isMoreSpecific: cidrRangeMoreSpecific
}; };
const sourceTypeEvaluator: MatchFieldEvaluator<ConnectionSourceType, {localAddress: string, remoteAddress?: (string | undefined)}> = { const sourceTypeEvaluator: MatchFieldEvaluator<ConnectionSourceType, {localAddress?: (string | undefined), remoteAddress?: (string | undefined)}> = {
isMatch: sourceTypeMatch, isMatch: sourceTypeMatch,
matcherEqual: (matcher1, matcher2) => matcher1 === matcher2, matcherEqual: (matcher1, matcher2) => matcher1 === matcher2,
isMoreSpecific: (matcher1, matcher2) => matcher1 !== 'ANY' && matcher2 === 'ANY' isMoreSpecific: (matcher1, matcher2) => matcher1 !== 'ANY' && matcher2 === 'ANY'

View File

@ -104,7 +104,7 @@ export class Watcher<UpdateType> implements ResourceWatcherInterface {
const RESOURCE_TIMEOUT_MS = 15_000; const RESOURCE_TIMEOUT_MS = 15_000;
class ResourceTimer { class ResourceTimer {
private timer: NodeJS.Timer | null = null; private timer: NodeJS.Timeout | null = null;
private resourceSeen = false; private resourceSeen = false;
constructor(private callState: AdsCallState, private type: XdsResourceType, private name: XdsResourceName) {} constructor(private callState: AdsCallState, private type: XdsResourceType, private name: XdsResourceName) {}
@ -673,7 +673,7 @@ class ClusterLoadReportMap {
} }
class LrsCallState { class LrsCallState {
private statsTimer: NodeJS.Timer | null = null; private statsTimer: NodeJS.Timeout | null = null;
private sentInitialMessage = false; private sentInitialMessage = false;
constructor(private client: XdsSingleServerClient, private call: LrsCall, private node: Node) { constructor(private client: XdsSingleServerClient, private call: LrsCall, private node: Node) {
call.on('data', (message: LoadStatsResponse__Output) => { call.on('data', (message: LoadStatsResponse__Output) => {

View File

@ -42,7 +42,7 @@ const BOOTSTRAP_CONFIG_KEY = 'grpc.TEST_ONLY_DO_NOT_USE_IN_PROD.xds_bootstrap_co
export class XdsTestClient { export class XdsTestClient {
private client: EchoTestServiceClient; private client: EchoTestServiceClient;
private callInterval: NodeJS.Timer; private callInterval: NodeJS.Timeout;
constructor(target: string, bootstrapInfo: string, creds?: ChannelCredentials | undefined, options?: ChannelOptions) { constructor(target: string, bootstrapInfo: string, creds?: ChannelCredentials | undefined, options?: ChannelOptions) {
this.client = new loadedProtos.grpc.testing.EchoTestService(target, creds ?? credentials.createInsecure(), {...options, [BOOTSTRAP_CONFIG_KEY]: bootstrapInfo}); this.client = new loadedProtos.grpc.testing.EchoTestService(target, creds ?? credentials.createInsecure(), {...options, [BOOTSTRAP_CONFIG_KEY]: bootstrapInfo});