Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
duniter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
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
nodes
typescript
duniter
Commits
3d54e3fd
Commit
3d54e3fd
authored
6 years ago
by
Cédric Moreau
Browse files
Options
Downloads
Patches
Plain Diff
[fix] WS2P: UPnP local host interface can be forced (in case of UPnP fail for example)
parent
097d1d7a
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/modules/upnp-provider.ts
+6
-2
6 additions, 2 deletions
app/modules/upnp-provider.ts
app/modules/ws2p/index.ts
+2
-1
2 additions, 1 deletion
app/modules/ws2p/index.ts
with
8 additions
and
3 deletions
app/modules/upnp-provider.ts
+
6
−
2
View file @
3d54e3fd
...
@@ -32,6 +32,7 @@ export class UpnpProvider {
...
@@ -32,6 +32,7 @@ export class UpnpProvider {
private
upnpInterval
=
300
,
private
upnpInterval
=
300
,
private
ttl
=
600
,
private
ttl
=
600
,
private
logger
?:
any
,
private
logger
?:
any
,
private
host
=
''
)
{}
)
{}
async
checkUPnPisAvailable
()
{
async
checkUPnPisAvailable
()
{
...
@@ -72,7 +73,10 @@ export class UpnpProvider {
...
@@ -72,7 +73,10 @@ export class UpnpProvider {
const
client
=
upnp
.
createClient
()
const
client
=
upnp
.
createClient
()
client
.
portMapping
({
client
.
portMapping
({
'
public
'
:
this
.
currentConfig
.
port
,
'
public
'
:
this
.
currentConfig
.
port
,
'
private
'
:
this
.
currentConfig
.
port
,
'
private
'
:
{
host
:
this
.
currentConfig
.
host
,
port
:
this
.
currentConfig
.
port
,
},
'
ttl
'
:
this
.
ttl
,
'
ttl
'
:
this
.
ttl
,
'
description
'
:
this
.
getUpnpDescription
()
'
description
'
:
this
.
getUpnpDescription
()
},
(
err
:
any
)
=>
{
},
(
err
:
any
)
=>
{
...
@@ -123,7 +127,7 @@ export class UpnpProvider {
...
@@ -123,7 +127,7 @@ export class UpnpProvider {
}
}
private
async
getAvailablePort
(
client
:
any
)
{
private
async
getAvailablePort
(
client
:
any
)
{
const
localIP
=
await
UpnpProvider
.
getLocalIP
(
client
)
const
localIP
=
this
.
host
||
await
UpnpProvider
.
getLocalIP
(
client
)
const
remoteIP
=
await
UpnpProvider
.
getRemoteIP
(
client
)
const
remoteIP
=
await
UpnpProvider
.
getRemoteIP
(
client
)
const
mappings
:{
const
mappings
:{
private
:
{
private
:
{
...
...
This diff is collapsed.
Click to expand it.
app/modules/ws2p/index.ts
+
2
−
1
View file @
3d54e3fd
...
@@ -243,7 +243,8 @@ export class WS2PAPI extends stream.Transform {
...
@@ -243,7 +243,8 @@ export class WS2PAPI extends stream.Transform {
'
:ws2p:
'
+
suffix
,
'
:ws2p:
'
+
suffix
,
WS2PConstants
.
WS2P_UPNP_INTERVAL
,
WS2PConstants
.
WS2P_UPNP_INTERVAL
,
WS2PConstants
.
WS2P_UPNP_TTL
,
WS2PConstants
.
WS2P_UPNP_TTL
,
logger
)
logger
,
this
.
conf
.
ws2p
.
host
)
const
{
host
,
port
,
available
}
=
await
this
.
upnpAPI
.
startRegular
()
const
{
host
,
port
,
available
}
=
await
this
.
upnpAPI
.
startRegular
()
if
(
available
)
{
if
(
available
)
{
// Defaults UPnP to true if not defined and available
// Defaults UPnP to true if not defined and available
...
...
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