constructor(proxy, opts) {
        super(opts);
        this.options = { path: undefined };
        this.proxy = typeof proxy === 'string' ? new URL(proxy) : proxy;
        this.proxyHeaders = opts?.headers ?? {};
        debug('Creating new HttpsProxyAgent instance: %o', this.proxy.href);
        // Trim off the brackets from IPv6 addresses
        const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, '');
        const port = this.proxy.port
            ? parseInt(this.proxy.port, 10)
            : this.proxy.protocol === 'https:'
                ? 443
                : 80;
        this.connectOpts = {
            // Attempt to negotiate http/1.1 for proxy servers that support http/2
            ALPNProtocols: ['http/1.1'],
            ...(opts ? omit(opts, 'headers') : null),
            host,
            port,
        };
    }
The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to
the specified "HTTP(s) proxy server" in order to proxy HTTPS requests.

Outgoing HTTP requests are first tunneled through the proxy server using the
`CONNECT` HTTP request method to establish a connection to the proxy server,
and then the proxy server connects to the destination target and issues the
HTTP request from the proxy server.

`https:` requests have their socket connection upgraded to TLS once
the connection to the proxy server has been established.