Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d7789f5a44 | |||
| 2638990667 |
@@ -1,5 +1,13 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2026-02-13 - 5.4.2 - fix(dcrouter)
|
||||||
|
improve domain pattern matching to support routing-glob and wildcard patterns and use matching logic when resolving routes
|
||||||
|
|
||||||
|
- Support routing-glob patterns beginning with '*' (e.g. *example.com) to match base domain, wildcard form, and subdomains
|
||||||
|
- Treat standard wildcard patterns ('*.example.com') as matching both the base domain (example.com) and its subdomains
|
||||||
|
- Use isDomainMatch when resolving routes instead of exact array includes to allow pattern matching
|
||||||
|
- Normalize domain and pattern to lowercase and simplify equality checks
|
||||||
|
|
||||||
## 2026-02-13 - 5.4.1 - fix(network,dcrouter)
|
## 2026-02-13 - 5.4.1 - fix(network,dcrouter)
|
||||||
Always register SmartProxy certificate event handlers and include total bytes + improved connection metrics in network stats/UI
|
Always register SmartProxy certificate event handlers and include total bytes + improved connection metrics in network stats/UI
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@serve.zone/dcrouter",
|
"name": "@serve.zone/dcrouter",
|
||||||
"private": false,
|
"private": false,
|
||||||
"version": "5.4.1",
|
"version": "5.4.2",
|
||||||
"description": "A multifaceted routing service handling mail and SMS delivery functions.",
|
"description": "A multifaceted routing service handling mail and SMS delivery functions.",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"exports": {
|
"exports": {
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@serve.zone/dcrouter',
|
name: '@serve.zone/dcrouter',
|
||||||
version: '5.4.1',
|
version: '5.4.2',
|
||||||
description: 'A multifaceted routing service handling mail and SMS delivery functions.'
|
description: 'A multifaceted routing service handling mail and SMS delivery functions.'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -674,24 +674,25 @@ export class DcRouter {
|
|||||||
* @returns Whether the domain matches the pattern
|
* @returns Whether the domain matches the pattern
|
||||||
*/
|
*/
|
||||||
private isDomainMatch(domain: string, pattern: string): boolean {
|
private isDomainMatch(domain: string, pattern: string): boolean {
|
||||||
// Normalize inputs
|
|
||||||
domain = domain.toLowerCase();
|
domain = domain.toLowerCase();
|
||||||
pattern = pattern.toLowerCase();
|
pattern = pattern.toLowerCase();
|
||||||
|
|
||||||
// Check for exact match
|
if (domain === pattern) return true;
|
||||||
if (domain === pattern) {
|
|
||||||
return true;
|
// Routing-glob: *example.com matches example.com, sub.example.com, *.example.com
|
||||||
|
if (pattern.startsWith('*') && !pattern.startsWith('*.')) {
|
||||||
|
const baseDomain = pattern.slice(1); // *nevermind.cloud → nevermind.cloud
|
||||||
|
if (domain === baseDomain || domain === `*.${baseDomain}`) return true;
|
||||||
|
if (domain.endsWith(baseDomain) && domain.length > baseDomain.length) return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for wildcard match (*.example.com)
|
// Standard wildcard: *.example.com matches sub.example.com and example.com
|
||||||
if (pattern.startsWith('*.')) {
|
if (pattern.startsWith('*.')) {
|
||||||
const patternSuffix = pattern.slice(2); // Remove the "*." prefix
|
const suffix = pattern.slice(2);
|
||||||
|
if (domain === suffix) return true;
|
||||||
// Check if domain ends with the pattern suffix and has at least one character before it
|
return domain.endsWith(suffix) && domain.length > suffix.length;
|
||||||
return domain.endsWith(patternSuffix) && domain.length > patternSuffix.length;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// No match
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -705,7 +706,9 @@ export class DcRouter {
|
|||||||
const routeDomains = Array.isArray(route.match.domains)
|
const routeDomains = Array.isArray(route.match.domains)
|
||||||
? route.match.domains
|
? route.match.domains
|
||||||
: [route.match.domains];
|
: [route.match.domains];
|
||||||
if (routeDomains.includes(domain)) return route.name;
|
for (const pattern of routeDomains) {
|
||||||
|
if (this.isDomainMatch(domain, pattern)) return route.name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@serve.zone/dcrouter',
|
name: '@serve.zone/dcrouter',
|
||||||
version: '5.4.1',
|
version: '5.4.2',
|
||||||
description: 'A multifaceted routing service handling mail and SMS delivery functions.'
|
description: 'A multifaceted routing service handling mail and SMS delivery functions.'
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user