Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Sharkey
Manage
Activity
Members
Labels
Plan
Issues
336
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
23
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TransFem.org
Sharkey
Commits
76569bfb
Unverified
Commit
76569bfb
authored
6 years ago
by
Acid Chicken (硫酸鶏)
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Create type definition for 'lookup-dns-cache' (#4051)
parent
bbcdf1bb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/@types/lookup-dns-cache.d.ts
+17
-0
17 additions, 0 deletions
src/@types/lookup-dns-cache.d.ts
src/remote/activitypub/request.ts
+6
-6
6 additions, 6 deletions
src/remote/activitypub/request.ts
with
23 additions
and
6 deletions
src/@types/lookup-dns-cache.d.ts
0 → 100644
+
17
−
0
View file @
76569bfb
declare
module
'
lookup-dns-cache
'
{
type
IPv4
=
4
;
type
IPv6
=
6
;
type
Family
=
IPv4
|
IPv6
|
undefined
;
interface
IRunOptions
{
family
?:
Family
;
all
?:
boolean
;
}
type
RunCallback
=
(
error
:
Error
|
null
,
address
?:
string
|
string
[],
family
?:
Family
)
=>
void
;
export
function
lookup
(
hostname
:
string
,
options
:
IRunOptions
|
Family
,
callback
:
RunCallback
):
{}
|
undefined
;
export
function
lookup
(
hostname
:
string
,
callback
:
RunCallback
):
{}
|
undefined
;
}
This diff is collapsed.
Click to expand it.
src/remote/activitypub/request.ts
+
6
−
6
View file @
76569bfb
...
...
@@ -3,7 +3,7 @@ const { sign } = require('http-signature');
import
{
URL
}
from
'
url
'
;
import
*
as
debug
from
'
debug
'
;
import
*
as
crypto
from
'
crypto
'
;
cons
t
{
lookup
}
=
require
(
'
lookup-dns-cache
'
)
;
impor
t
{
lookup
,
IRunOptions
}
from
'
lookup-dns-cache
'
;
import
*
as
promiseAny
from
'
promise-any
'
;
import
config
from
'
../../config
'
;
...
...
@@ -89,16 +89,16 @@ export default (user: ILocalUser, url: string, object: any) => new Promise(async
async
function
resolveAddr
(
domain
:
string
)
{
// v4/v6で先に取得できた方を採用する
return
await
promiseAny
([
resolveAddrInner
(
domain
,
{
ipv6
:
false
}),
resolveAddrInner
(
domain
,
{
ipv6
:
true
})
resolveAddrInner
(
domain
,
{
family
:
4
}),
resolveAddrInner
(
domain
,
{
family
:
6
})
]);
}
function
resolveAddrInner
(
domain
:
string
,
options
=
{
}):
Promise
<
string
>
{
function
resolveAddrInner
(
domain
:
string
,
options
:
IRunOptions
=
{}):
Promise
<
string
>
{
return
new
Promise
((
res
,
rej
)
=>
{
lookup
(
domain
,
options
,
(
error
:
any
,
address
:
string
)
=>
{
lookup
(
domain
,
options
,
(
error
:
any
,
address
:
string
|
string
[]
)
=>
{
if
(
error
)
return
rej
(
error
);
return
res
(
address
);
return
res
(
Array
.
isArray
(
address
)
?
address
[
0
]
:
address
);
});
});
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment