Skip to content

Commit

Permalink
Case insensitive address type matching
Browse files Browse the repository at this point in the history
  • Loading branch information
murgatroid99 committed Feb 4, 2025
1 parent 5f889b2 commit 77dc658
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/grpc-js-xds/interop/xds-interop-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ async function main() {
const argv = yargs
.string(['port', 'maintenance_port', 'address_type'])
.boolean(['secure_mode'])
.choices('address_type', ['IPV4', 'IPV6', 'IPV4_IPV6'])
.demandOption(['port'])
.default('address_type', 'IPV4_IPV6')
.default('secure_mode', false)
Expand All @@ -250,8 +249,9 @@ async function main() {
const reflection = new ReflectionService(packageDefinition, {
services: ['grpc.testing.TestService']
})
const addressType = argv.address_type.toUpperCase();
if (argv.secure_mode) {
if (argv.address_type !== 'IPV4_IPV6') {
if (addressType !== 'IPV4_IPV6') {
throw new Error('Secure mode only supports IPV4_IPV6 address type');
}
const maintenanceServer = new grpc.Server({interceptors: [adminServiceInterceptor]});
Expand All @@ -275,7 +275,7 @@ async function main() {
grpc.addAdminServicesToServer(server);
server.addService(loadedProto.grpc.testing.TestService.service, testServiceHandler);
const creds = grpc.ServerCredentials.createInsecure();
switch (argv.address_type) {
switch (addressType) {
case 'IPV4_IPV6':
await serverBindPromise(server, `[::]:${argv.port}`, creds);
break;
Expand Down

0 comments on commit 77dc658

Please sign in to comment.