@clonegod/ttd-core 3.1.87 → 3.1.90

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.
@@ -87,10 +87,19 @@ function createAxiosInstance() {
87
87
  return config;
88
88
  }
89
89
  const ip = (0, ip_util_1.getNextIP)();
90
- if (ip) {
91
- const url = config.url || '';
92
- const baseURL = config.baseURL || '';
93
- const fullUrl = url.startsWith('http') ? url : (baseURL + url);
90
+ const url = config.url || '';
91
+ const baseURL = config.baseURL || '';
92
+ const fullUrl = url.startsWith('http') ? url : (baseURL + url);
93
+ const isLoopbackTarget = (() => {
94
+ try {
95
+ const host = new URL(fullUrl).hostname;
96
+ return host === 'localhost' || host === '::1' || /^127\./.test(host);
97
+ }
98
+ catch (_a) {
99
+ return false;
100
+ }
101
+ })();
102
+ if (ip && !isLoopbackTarget) {
94
103
  const isHttps = fullUrl.startsWith('https:');
95
104
  if (isHttps) {
96
105
  config.httpsAgent = createHttpsAgent(ip);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-core",
3
- "version": "3.1.87",
3
+ "version": "3.1.90",
4
4
  "description": "Common types and utilities for trading systems - use `npm run push` to publish",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",