From 1b27e57287ae917790585ea78364c64a20dab9d0 Mon Sep 17 00:00:00 2001 From: aaronbarnardsound Date: Sat, 22 Jul 2023 07:10:11 +1000 Subject: [PATCH 1/2] Update dns regex --- src/validation.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/validation.ts b/src/validation.ts index 61d3143..1a09bcc 100644 --- a/src/validation.ts +++ b/src/validation.ts @@ -10,10 +10,10 @@ export function validateInit(options: LnWebSocketOptions): void { const ipRegex = /^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}$/ - const domainRegex = - /^((?!-))(xn--)?[a-z0-9][a-z0-9-_]{0,61}[a-z0-9]{0,1}\.(xn--)?([a-z0-9-]{1,61}|[a-z0-9-]{1,30}\.[a-z]{2,})$/ + const dnsRegex = + /^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9])$/ - if (!ip || (!ip.match(ipRegex) && !ip.match(domainRegex) && ip !== 'localhost')) { + if (!ip || (!ip.match(ipRegex) && !ip.match(dnsRegex) && ip !== 'localhost')) { throw new Error(`${ip} is not a valid IP or DNS address`) } From 7e8da37e7b5c5e1fdf4517deb57bcfe509ab46f1 Mon Sep 17 00:00:00 2001 From: aaronbarnardsound Date: Sat, 22 Jul 2023 07:11:03 +1000 Subject: [PATCH 2/2] Inc version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 183b262..e955ffa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lnmessage", - "version": "0.2.2", + "version": "0.2.2-0.0.1", "description": "Talk to Lightning nodes from your browser", "main": "dist/index.js", "type": "module",