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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
typescript
duniter
Commits
fe063ef0
Unverified
Commit
fe063ef0
authored
7 years ago
by
Éloïs
Browse files
Options
Downloads
Patches
Plain Diff
[fix] insoleet feedbacks
parent
3c90b511
No related branches found
No related tags found
3 merge requests
!1222
Add startup scripts
,
!1220
Stable/ws2p v1.1 trymerge
,
!1208
Stable/ws2p v1.1
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/lib/dto/PeerDTO.ts
+2
-2
2 additions, 2 deletions
app/lib/dto/PeerDTO.ts
app/modules/ws2p/lib/WS2PCluster.ts
+11
-4
11 additions, 4 deletions
app/modules/ws2p/lib/WS2PCluster.ts
app/modules/ws2p/lib/WS2PConnection.ts
+1
-1
1 addition, 1 deletion
app/modules/ws2p/lib/WS2PConnection.ts
with
14 additions
and
7 deletions
app/lib/dto/PeerDTO.ts
+
2
−
2
View file @
fe063ef0
...
@@ -103,9 +103,9 @@ export class PeerDTO implements Cloneable {
...
@@ -103,9 +103,9 @@ export class PeerDTO implements Cloneable {
let
bestWS2PTORVersionAvailable
:
number
=
0
let
bestWS2PTORVersionAvailable
:
number
=
0
for
(
const
ep
of
this
.
endpoints
)
{
for
(
const
ep
of
this
.
endpoints
)
{
if
(
canReachTorEp
)
{
if
(
canReachTorEp
)
{
let
matches
:
any
=
ep
.
match
(
CommonConstants
.
WS2PTOR_V2_REGEXP
)
let
matches
:
RegExpMatchArray
|
null
=
ep
.
match
(
CommonConstants
.
WS2PTOR_V2_REGEXP
)
if
(
matches
&&
parseInt
(
matches
[
1
])
>
bestWS2PTORVersionAvailable
&&
(
uuidExcluded
.
indexOf
(
matches
[
2
])
===
-
1
))
{
if
(
matches
&&
parseInt
(
matches
[
1
])
>
bestWS2PTORVersionAvailable
&&
(
uuidExcluded
.
indexOf
(
matches
[
2
])
===
-
1
))
{
bestWS2PTORVersionAvailable
=
matches
[
1
]
bestWS2PTORVersionAvailable
=
parseInt
(
matches
[
1
]
)
api
=
{
api
=
{
version
:
parseInt
(
matches
[
1
]),
version
:
parseInt
(
matches
[
1
]),
uuid
:
matches
[
2
],
uuid
:
matches
[
2
],
...
...
This diff is collapsed.
Click to expand it.
app/modules/ws2p/lib/WS2PCluster.ts
+
11
−
4
View file @
fe063ef0
...
@@ -267,8 +267,7 @@ export class WS2PCluster {
...
@@ -267,8 +267,7 @@ export class WS2PCluster {
await
this
.
ws2pServer
.
close
()
await
this
.
ws2pServer
.
close
()
}
}
this
.
ws2pServer
=
await
WS2PServer
.
bindOn
(
this
.
server
,
host
,
port
,
this
.
fifo
,
(
pubkey
:
string
,
connectedPubkeys
:
string
[])
=>
{
this
.
ws2pServer
=
await
WS2PServer
.
bindOn
(
this
.
server
,
host
,
port
,
this
.
fifo
,
(
pubkey
:
string
,
connectedPubkeys
:
string
[])
=>
{
const
privilegedNodes
=
(
this
.
server
.
conf
.
ws2p
&&
this
.
server
.
conf
.
ws2p
.
privilegedNodes
)
?
this
.
server
.
conf
.
ws2p
.
privilegedNodes
:[]
return
this
.
acceptPubkey
(
pubkey
,
connectedPubkeys
,
[],
()
=>
this
.
servedCount
(),
this
.
maxLevel2Peers
,
this
.
privilegedNodes
(),
(
this
.
server
.
conf
.
ws2p
!==
undefined
&&
this
.
server
.
conf
.
ws2p
.
privilegedOnly
))
return
this
.
acceptPubkey
(
pubkey
,
connectedPubkeys
,
[],
()
=>
this
.
servedCount
(),
this
.
maxLevel2Peers
,
privilegedNodes
,
(
this
.
server
.
conf
.
ws2p
!==
undefined
&&
this
.
server
.
conf
.
ws2p
.
privilegedOnly
))
},
this
.
keyPriorityLevel
,
this
.
messageHandler
)
},
this
.
keyPriorityLevel
,
this
.
messageHandler
)
this
.
host
=
host
this
.
host
=
host
this
.
port
=
port
this
.
port
=
port
...
@@ -285,7 +284,7 @@ export class WS2PCluster {
...
@@ -285,7 +284,7 @@ export class WS2PCluster {
clientsCount
()
{
clientsCount
()
{
let
count
=
0
let
count
=
0
for
(
const
ws2pid
of
Object
.
keys
(
this
.
ws2pClients
)
)
{
for
(
const
ws2pid
in
this
.
ws2pClients
)
{
if
(
this
.
ws2pClients
[
ws2pid
].
connection
.
pubkey
!=
this
.
server
.
conf
.
pair
.
pub
)
{
if
(
this
.
ws2pClients
[
ws2pid
].
connection
.
pubkey
!=
this
.
server
.
conf
.
pair
.
pub
)
{
count
++
count
++
}
}
...
@@ -295,7 +294,7 @@ export class WS2PCluster {
...
@@ -295,7 +294,7 @@ export class WS2PCluster {
numberOfConnectedPublicNodesWithSameKey
()
{
numberOfConnectedPublicNodesWithSameKey
()
{
let
count
=
0
let
count
=
0
for
(
const
ws2pid
of
Object
.
keys
(
this
.
ws2pClients
)
)
{
for
(
const
ws2pid
in
this
.
ws2pClients
)
{
if
(
this
.
ws2pClients
[
ws2pid
].
connection
.
pubkey
===
this
.
server
.
conf
.
pair
.
pub
)
{
if
(
this
.
ws2pClients
[
ws2pid
].
connection
.
pubkey
===
this
.
server
.
conf
.
pair
.
pub
)
{
count
++
count
++
}
}
...
@@ -307,6 +306,14 @@ export class WS2PCluster {
...
@@ -307,6 +306,14 @@ export class WS2PCluster {
return
(
this
.
ws2pServer
)
?
this
.
ws2pServer
.
countConnexions
():
0
return
(
this
.
ws2pServer
)
?
this
.
ws2pServer
.
countConnexions
():
0
}
}
privilegedNodes
()
{
if
(
this
.
server
.
conf
.
ws2p
&&
this
.
server
.
conf
.
ws2p
.
privilegedNodes
)
{
return
this
.
server
.
conf
.
ws2p
.
privilegedNodes
}
else
{
return
[]
}
}
async
connectToRemoteWS
(
endpointVersion
:
number
,
host
:
string
,
port
:
number
,
path
:
string
,
messageHandler
:
WS2PMessageHandler
,
expectedPub
:
string
,
ws2pEndpointUUID
:
string
=
""
):
Promise
<
WS2PConnection
>
{
async
connectToRemoteWS
(
endpointVersion
:
number
,
host
:
string
,
port
:
number
,
path
:
string
,
messageHandler
:
WS2PMessageHandler
,
expectedPub
:
string
,
ws2pEndpointUUID
:
string
=
""
):
Promise
<
WS2PConnection
>
{
const
uuid
=
nuuid
.
v4
()
const
uuid
=
nuuid
.
v4
()
let
pub
=
expectedPub
.
slice
(
0
,
8
)
let
pub
=
expectedPub
.
slice
(
0
,
8
)
...
...
This diff is collapsed.
Click to expand it.
app/modules/ws2p/lib/WS2PConnection.ts
+
1
−
1
View file @
fe063ef0
...
@@ -430,7 +430,7 @@ export class WS2PConnection {
...
@@ -430,7 +430,7 @@ export class WS2PConnection {
return
this
.
errorDetected
(
WS2P_ERR
.
ALREADY_AUTHENTICATED_BY_REMOTE
)
return
this
.
errorDetected
(
WS2P_ERR
.
ALREADY_AUTHENTICATED_BY_REMOTE
)
}
}
else
if
(
else
if
(
typeof
data
.
pub
!==
"
string
"
||
typeof
data
.
sig
!==
"
string
"
||
typeof
data
.
challenge
!==
"
string
"
||
(
this
.
ws2pVersion
>
1
&&
data
.
ws2pId
!==
"
string
"
)
)
{
typeof
data
.
pub
!==
"
string
"
||
typeof
data
.
sig
!==
"
string
"
||
typeof
data
.
challenge
!==
"
string
"
||
(
this
.
ws2pVersion
>
1
&&
typeof
data
.
ws2pId
!==
"
string
"
)
)
{
await
this
.
errorDetected
(
WS2P_ERR
.
AUTH_INVALID_ASK_FIELDS
)
await
this
.
errorDetected
(
WS2P_ERR
.
AUTH_INVALID_ASK_FIELDS
)
}
else
{
}
else
{
if
(
this
.
expectedPub
&&
data
.
pub
!==
this
.
expectedPub
)
{
if
(
this
.
expectedPub
&&
data
.
pub
!==
this
.
expectedPub
)
{
...
...
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