Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
cdn-node-checker
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
cdn-node-checker
Commits
75eee2c2
Commit
75eee2c2
authored
Jul 24, 2020
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enable cdn recursive
parent
d4254bb4
Pipeline
#783
passed with stages
in 13 minutes and 46 seconds
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
14 deletions
+23
-14
run.ts
run.ts
+23
-14
No files found.
run.ts
View file @
75eee2c2
...
...
@@ -66,6 +66,9 @@ class Checker {
cdnRecordsRegex
:
RegExp
[];
static
order
:
number
=
0
;
id
:
number
;
records
:
DomainRecordInfo
[];
nonCDNRecords
:
DomainRecordInfo
[];
CDNRecords
:
DomainRecordInfo
[];
constructor
(
config
:
Config
)
{
this
.
config
=
config
;
this
.
client
=
new
Aliyun
(
config
.
aliyun
);
...
...
@@ -143,13 +146,19 @@ class Checker {
const
good
=
await
this
.
checkNode
(
record
.
Value
,
recordInfo
.
port
);
await
this
.
handleRecordResult
(
recordInfo
,
good
);
}
async
checkCDNRecord
(
recordInfo
:
DomainRecordInfo
,
nonCDNRecords
:
DomainRecordInfo
[])
{
const
record
=
recordInfo
.
record
;
this
.
message
(
`Checking CDN record
${
this
.
getRecordPattern
(
recordInfo
)}
with old status of
${
record
.
Status
}
.`
)
const
valuePrefix
=
this
.
getRecordPrefix
(
record
);
const
good
=
_
.
any
(
nonCDNRecords
,
r
=>
{
return
r
.
record
.
RR
===
valuePrefix
&&
r
.
good
;
});
isRecordGood
(
recordInfo
:
DomainRecordInfo
):
boolean
{
if
(
recordInfo
.
isCDN
)
{
const
valuePrefix
=
this
.
getRecordPrefix
(
recordInfo
.
record
);
return
_
.
any
(
this
.
records
,
r
=>
{
return
r
.
record
.
RR
===
valuePrefix
&&
this
.
isRecordGood
(
r
);
});
}
else
{
return
recordInfo
.
good
;
}
}
async
checkCDNRecord
(
recordInfo
:
DomainRecordInfo
)
{
this
.
message
(
`Checking CDN record
${
this
.
getRecordPattern
(
recordInfo
)}
with old status of
${
recordInfo
.
record
.
Status
}
.`
)
const
good
=
this
.
isRecordGood
(
recordInfo
);
this
.
message
(
`CDN Record
${
this
.
getRecordPattern
(
recordInfo
)}
is
${
good
?
"
good
"
:
"
bad
"
}
.`
);
await
this
.
handleRecordResult
(
recordInfo
,
good
);
}
...
...
@@ -168,15 +177,15 @@ class Checker {
}
async
start
()
{
this
.
message
(
`Started.`
);
const
records
=
await
this
.
getRecords
();
const
nonCDNRecords
=
records
.
filter
(
m
=>
!
m
.
isCDN
);
const
CDNRecords
=
records
.
filter
(
m
=>
!!
m
.
isCDN
);
await
Promise
.
all
(
nonCDNRecords
.
map
(
r
=>
{
this
.
records
=
await
this
.
getRecords
();
this
.
nonCDNRecords
=
this
.
records
.
filter
(
m
=>
!
m
.
isCDN
);
this
.
CDNRecords
=
this
.
records
.
filter
(
m
=>
!!
m
.
isCDN
);
await
Promise
.
all
(
this
.
nonCDNRecords
.
map
(
r
=>
{
return
this
.
checkRecord
(
r
);
}));
//await Promise.all(
CDNRecords.map(r => {
// return this.checkCDNRecord(r, nonCDNRecords
);
//
}));
await
Promise
.
all
(
this
.
CDNRecords
.
map
(
r
=>
{
return
this
.
checkCDNRecord
(
r
);
}));
this
.
message
(
`Finished.`
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment