diff --git a/src/integration_tests/internetAddressing.test.ts b/src/integration_tests/internetAddressing.test.ts index c78adafc5..d98d15258 100644 --- a/src/integration_tests/internetAddressing.test.ts +++ b/src/integration_tests/internetAddressing.test.ts @@ -32,11 +32,4 @@ describe('resolveInternetAddress', () => { test('Non-existing addresses should not be resolved', async () => { await expect(resolveInternetAddress(NON_EXISTING_ADDRESS, BindingType.PDC)).resolves.toBeNull(); }); - - test('Non-existing address should resolve if port is contained', async () => { - const port = 1234; - await expect( - resolveInternetAddress(`${NON_EXISTING_ADDRESS}:${port}`, BindingType.PDC), - ).resolves.toEqual({ host: NON_EXISTING_ADDRESS, port }); - }); }); diff --git a/src/lib/internetAddressing.spec.ts b/src/lib/internetAddressing.spec.ts index ee27d2e8e..f64ff4232 100644 --- a/src/lib/internetAddressing.spec.ts +++ b/src/lib/internetAddressing.spec.ts @@ -36,14 +36,6 @@ import { describe('resolveInternetAddress', () => { const MALFORMED_ANSWER_ERROR = new InternetAddressingError('DNS answer is malformed'); - test('DNS resolution should be skipped if host name contains port', async () => { - const address = await resolveInternetAddress(`${HOST}:${TARGET_PORT}`, BindingType.PDC); - - expect(address).toHaveProperty('host', HOST); - expect(address).toHaveProperty('port', TARGET_PORT); - expect(mockGetDNS).not.toBeCalled(); - }); - test('Specified domain name should be requested', async () => { await resolveInternetAddress(HOST, BindingType.PDC); diff --git a/src/lib/internetAddressing.ts b/src/lib/internetAddressing.ts index db22df026..6d14cba87 100644 --- a/src/lib/internetAddressing.ts +++ b/src/lib/internetAddressing.ts @@ -33,9 +33,6 @@ export class UnreachableResolverError extends RelaynetError {} * `null` is returned when `hostName` is an IP address or a non-existing SRV record for the service * in `bindingType`. * - * If `hostName` contains the port number (e.g., `example.com:443`), no DNS lookup will be done - * and the resulting address will simply be the result of parsing the input. - * * DNS resolution is done with DNS-over-HTTPS. */ export async function resolveInternetAddress( @@ -43,12 +40,6 @@ export async function resolveInternetAddress( bindingType: BindingType, resolverURL = CLOUDFLARE_RESOLVER_URL, ): Promise { - const urlParts = new URL(`scheme://${hostName}`); - if (urlParts.port !== '') { - const port = parseInt(urlParts.port, 10); - return { host: urlParts.hostname, port }; - } - const name = `_${bindingType}._tcp.${hostName}`; const doh = new DNSoverHTTPS({ url: resolverURL }); let result: LookupResult;