Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
T
tun
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
Railgun
tun
Commits
65041043
Commit
65041043
authored
Mar 27, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v6
parent
cd0e5924
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
src/inventory.ts
src/inventory.ts
+13
-4
No files found.
src/inventory.ts
View file @
65041043
...
...
@@ -78,8 +78,8 @@ class InventoryBuilder {
async
resolveDomainProcess
(
domain
:
string
,
ipv6
:
boolean
)
{
const
cacheKey
=
`
${
domain
}
-
${
ipv6
?
'
:v6
'
:
'
v4
'
}
`
;
if
(
this
.
resolveCache
.
has
(
domain
))
{
return
this
.
resolveCache
.
get
(
domain
);
if
(
this
.
resolveCache
.
has
(
cacheKey
))
{
return
this
.
resolveCache
.
get
(
cacheKey
);
}
const
rrtype
=
(
domain
.
includes
(
'
-v6
'
)
||
ipv6
)
?
'
AAAA
'
:
'
A
'
;
let
resolvedIP
:
string
;
...
...
@@ -95,7 +95,7 @@ class InventoryBuilder {
resolvedIP
=
`[
${
resolvedIP
}
]`
;
}
console
.
log
(
`
${
domain
}
=>
${
resolvedIP
}
`
);
this
.
resolveCache
.
set
(
domain
,
resolvedIP
);
this
.
resolveCache
.
set
(
cacheKey
,
resolvedIP
);
return
resolvedIP
;
}
...
...
@@ -421,6 +421,12 @@ class InventoryBuilder {
};
}
makeV6Domain
(
domain
:
string
)
{
const
domainParts
=
domain
.
split
(
'
.
'
);
domainParts
[
domainParts
.
length
-
3
]
+=
'
-v6
'
;
return
domainParts
.
join
(
'
.
'
);
}
async
parse_connection
(
local
:
any
,
remote
:
any
,
connstr
:
string
,
inbound
:
boolean
,
outbound
:
boolean
,
reverse
:
boolean
)
{
const
leftbottom
=
local
.
id
>
remote
.
id
;
// true 条目位于左下,false 条目位于右上
const
cis
=
!
reverse
;
// true 无需翻转,false 需要翻转。
...
...
@@ -443,10 +449,13 @@ class InventoryBuilder {
//const remoteGatewayMark = remoteGatewayName ? remoteGateway.mark : undefined;
//console.log(remoteGateway.name);
let
remoteAddress
=
remoteGateway
.
address
||
null
;
const
preferV6
=
(
!
remoteGateway
.
ipv4
||
params
.
ipv6
===
'
on
'
)
&&
remoteGateway
.
ipv6
&&
params
.
ipv6
!==
'
off
'
;
const
preferV6
=
(
!
remoteGateway
.
ipv4
||
params
.
ipv6
===
'
on
'
||
params
.
ipv6
===
'
force
'
)
&&
remoteGateway
.
ipv6
&&
params
.
ipv6
!==
'
off
'
;
if
(
!
localGateway
.
ipv6
&&
preferV6
)
{
remoteAddress
=
null
;
}
if
(
remoteAddress
&&
params
.
ipv6
===
'
force
'
)
{
remoteAddress
=
this
.
makeV6Domain
(
remoteAddress
);
}
const
resolvedRemoteAddress
=
remoteAddress
?
await
this
.
resolveDomain
(
remoteAddress
,
preferV6
)
:
null
;
const
remoteLocalAddress
=
remote
.
address
;
const
remoteNextMark
=
remote
.
nextMark
;
...
...
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