pmcf 6.65.5 → 6.66.1
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.
- package/package.json +1 -1
- package/src/constants.mjs +1 -0
- package/src/core-service.mjs +7 -1
- package/src/endpoint.mjs +20 -14
package/package.json
CHANGED
package/src/constants.mjs
CHANGED
package/src/core-service.mjs
CHANGED
|
@@ -145,6 +145,8 @@ export class CoreService extends base {
|
|
|
145
145
|
filter = undefined;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
+
const seen = new Set();
|
|
149
|
+
|
|
148
150
|
for (const e of data) {
|
|
149
151
|
if (type && e.type.name !== type) {
|
|
150
152
|
continue;
|
|
@@ -172,7 +174,11 @@ export class CoreService extends base {
|
|
|
172
174
|
}
|
|
173
175
|
|
|
174
176
|
if (e.scheme || e.pathname) {
|
|
175
|
-
|
|
177
|
+
const he = new HTTPEndpoint(this, na, options);
|
|
178
|
+
if (!seen.has(he.url.toString())) {
|
|
179
|
+
seen.add(he.url.toString());
|
|
180
|
+
result.push(he);
|
|
181
|
+
}
|
|
176
182
|
} else {
|
|
177
183
|
result.push(new Endpoint(this, na, options));
|
|
178
184
|
}
|
package/src/endpoint.mjs
CHANGED
|
@@ -169,12 +169,13 @@ export class DomainNameEndpoint extends PortEndpoint {
|
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
/**
|
|
172
|
-
* Endpoint based on
|
|
172
|
+
* Endpoint based on url
|
|
173
173
|
*/
|
|
174
174
|
export class HTTPEndpoint extends BaseEndpoint {
|
|
175
175
|
static name = "url_endpoint";
|
|
176
176
|
static attributes = {
|
|
177
|
-
url: url_attribute
|
|
177
|
+
url: url_attribute,
|
|
178
|
+
addressType: { ...string_attribute, name: "addressType" }
|
|
178
179
|
};
|
|
179
180
|
|
|
180
181
|
static {
|
|
@@ -199,21 +200,22 @@ export class HTTPEndpoint extends BaseEndpoint {
|
|
|
199
200
|
} else if (address instanceof URL) {
|
|
200
201
|
this.url = address;
|
|
201
202
|
} else {
|
|
203
|
+
this.networkAddress = address;
|
|
202
204
|
this.family = data.family ?? address.family;
|
|
203
205
|
|
|
204
|
-
const scheme = data.scheme ?
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
206
|
+
const scheme = data.scheme ? data.scheme : data.tls ? "https" : "http";
|
|
207
|
+
|
|
208
|
+
const domainName = [...address.domainNames][0];
|
|
209
|
+
const hostname =
|
|
210
|
+
domainName ??
|
|
211
|
+
(data.family === FAMILY_IPV6
|
|
212
|
+
? "[" + address.address + "]"
|
|
213
|
+
: address.address);
|
|
214
|
+
|
|
215
|
+
this.url = new URL(
|
|
216
|
+
`${scheme}://${hostname}:${data.port}` + (data.pathname ?? "/")
|
|
215
217
|
);
|
|
216
|
-
this.hostname = address.address;
|
|
218
|
+
this.hostname = domainName ?? address.address;
|
|
217
219
|
}
|
|
218
220
|
}
|
|
219
221
|
|
|
@@ -240,6 +242,10 @@ export class HTTPEndpoint extends BaseEndpoint {
|
|
|
240
242
|
return PROTOCOL_TCP;
|
|
241
243
|
}
|
|
242
244
|
|
|
245
|
+
get addressType() {
|
|
246
|
+
return this.networkAddress?.type;
|
|
247
|
+
}
|
|
248
|
+
|
|
243
249
|
get tls() {
|
|
244
250
|
return this.url.toString().startsWith("https:");
|
|
245
251
|
}
|