com.jimuwd.xian.registry-proxy 1.0.116 → 1.0.118

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +8 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -394,7 +394,7 @@ export async function startProxyServer(proxyConfigPath, localYarnConfigPath, glo
394
394
  logger.info(`Proxy server's initial maxConnections is ${serverIpv4.maxConnections}, adjusting to ${serverMaxConnections}`);
395
395
  serverIpv6.maxConnections = serverMaxConnections;
396
396
  serverIpv4.maxConnections = serverMaxConnections;
397
- logger.info(`Proxy server's initial timeout is ${serverIpv4.timeout}, adjusting to ${serverTimeoutMs}ms`);
397
+ logger.info(`Proxy server's initial timeout is ${serverIpv4.timeout}ms, adjusting to ${serverTimeoutMs}ms`);
398
398
  serverIpv6.timeout = serverTimeoutMs;
399
399
  serverIpv4.timeout = serverTimeoutMs;
400
400
  const promisedServer = new Promise((resolve, reject) => {
@@ -416,17 +416,16 @@ export async function startProxyServer(proxyConfigPath, localYarnConfigPath, glo
416
416
  serverIpv6.on('connection', connectionHandler);
417
417
  serverIpv4.on('connection', connectionHandler);
418
418
  // 为了代理服务器的健壮性,先启动ipv6监听,然后再在其回调函数中启动ipv4监听
419
- serverIpv6.listen(port, '::', () => {
419
+ const listenOptions = { port, host: '0.0.0.0', ipv6Only: false };
420
+ serverIpv6.listen(listenOptions, () => {
420
421
  const addressInfo = serverIpv6.address();
421
422
  // 回写上层局部变量
422
423
  realPort = addressInfo.port;
423
- logger.info(`前面已经监听了ipv6端口 ${addressInfo.address} ${addressInfo.port},追加监听Ipv4同端口号 0.0.0.0:${addressInfo.port}`);
424
- serverIpv4.listen(addressInfo.port, '0.0.0.0', () => {
425
- const portFile = join(process.env.PROJECT_ROOT || process.cwd(), '.registry-proxy-port');
426
- writeFile(portFile, addressInfo.port.toString()).catch(e => logger.error(`Failed to write port file: ${portFile}`, e));
427
- logger.info(`Proxy server running on ${proxyInfo.https ? 'https' : 'http'}://localhost:${addressInfo.port}${basePathPrefixedWithSlash === '/' ? '' : basePathPrefixedWithSlash}`);
428
- resolve({ serverIpv6, serverIpv4, });
429
- });
424
+ //logger.info(`前面已经监听了ipv6端口 ${addressInfo.address} ${addressInfo.port},追加监听Ipv4同端口号 0.0.0.0:${addressInfo.port}`);
425
+ const portFile = join(process.env.PROJECT_ROOT || process.cwd(), '.registry-proxy-port');
426
+ writeFile(portFile, addressInfo.port.toString()).catch(e => logger.error(`Failed to write port file: ${portFile}`, e));
427
+ logger.info(`Proxy server running on ${proxyInfo.https ? 'https' : 'http'}://localhost:${addressInfo.port}${basePathPrefixedWithSlash === '/' ? '' : basePathPrefixedWithSlash}`);
428
+ resolve({ serverIpv6, serverIpv4, });
430
429
  });
431
430
  });
432
431
  return promisedServer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.jimuwd.xian.registry-proxy",
3
- "version": "1.0.116",
3
+ "version": "1.0.118",
4
4
  "description": "A lightweight npm registry proxy with fallback support",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",