Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
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
elixxir
client
Commits
4b8ee3ed
Commit
4b8ee3ed
authored
3 years ago
by
Josh Brooks
Browse files
Options
Downloads
Patches
Plain Diff
Formatting
parent
29c0229f
No related branches found
No related tags found
2 merge requests
!117
Release
,
!77
Xx 3563/disable tls check
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bindings/group.go
+8
-9
8 additions, 9 deletions
bindings/group.go
interfaces/preimage/generate.go
+1
-1
1 addition, 1 deletion
interfaces/preimage/generate.go
network/manager.go
+7
-8
7 additions, 8 deletions
network/manager.go
with
16 additions
and
18 deletions
bindings/group.go
+
8
−
9
View file @
4b8ee3ed
...
@@ -64,10 +64,10 @@ func NewGroupManager(client *Client, requestFunc GroupRequestFunc,
...
@@ -64,10 +64,10 @@ func NewGroupManager(client *Client, requestFunc GroupRequestFunc,
// MakeGroup creates a new group and sends a group request to all members in the
// MakeGroup creates a new group and sends a group request to all members in the
// group. The ID of the new group, the rounds the requests were sent on, and the
// group. The ID of the new group, the rounds the requests were sent on, and the
// status of the send are contained in NewGroupReport.
// status of the send are contained in NewGroupReport.
func
(
g
*
GroupChat
)
MakeGroup
(
membership
*
IdList
,
name
,
message
[]
byte
)
*
NewGroupReport
{
func
(
g
*
GroupChat
)
MakeGroup
(
membership
*
IdList
,
name
,
message
[]
byte
)
*
NewGroupReport
{
grp
,
rounds
,
status
,
err
:=
g
.
m
.
MakeGroup
(
membership
.
list
,
name
,
message
)
grp
,
rounds
,
status
,
err
:=
g
.
m
.
MakeGroup
(
membership
.
list
,
name
,
message
)
errStr
:=
""
errStr
:=
""
if
err
!=
nil
{
if
err
!=
nil
{
errStr
=
err
.
Error
()
errStr
=
err
.
Error
()
}
}
return
&
NewGroupReport
{
&
Group
{
grp
},
rounds
,
status
,
errStr
}
return
&
NewGroupReport
{
&
Group
{
grp
},
rounds
,
status
,
errStr
}
...
@@ -83,14 +83,14 @@ func (g *GroupChat) ResendRequest(groupIdBytes []byte) (*NewGroupReport, error)
...
@@ -83,14 +83,14 @@ func (g *GroupChat) ResendRequest(groupIdBytes []byte) (*NewGroupReport, error)
}
}
grp
,
exists
:=
g
.
m
.
GetGroup
(
groupID
)
grp
,
exists
:=
g
.
m
.
GetGroup
(
groupID
)
if
!
exists
{
if
!
exists
{
return
nil
,
errors
.
Errorf
(
"Failed to find group %s"
,
groupID
)
return
nil
,
errors
.
Errorf
(
"Failed to find group %s"
,
groupID
)
}
}
rounds
,
status
,
err
:=
g
.
m
.
ResendRequest
(
groupID
)
rounds
,
status
,
err
:=
g
.
m
.
ResendRequest
(
groupID
)
errStr
:=
""
errStr
:=
""
if
err
!=
nil
{
if
err
!=
nil
{
errStr
=
err
.
Error
()
errStr
=
err
.
Error
()
}
}
return
&
NewGroupReport
{
&
Group
{
grp
},
rounds
,
status
,
errStr
},
nil
return
&
NewGroupReport
{
&
Group
{
grp
},
rounds
,
status
,
errStr
},
nil
...
@@ -166,11 +166,11 @@ type NewGroupReport struct {
...
@@ -166,11 +166,11 @@ type NewGroupReport struct {
group
*
Group
group
*
Group
rounds
[]
id
.
Round
rounds
[]
id
.
Round
status
gc
.
RequestStatus
status
gc
.
RequestStatus
err
string
err
string
}
}
type
GroupReportDisk
struct
{
type
GroupReportDisk
struct
{
List
[]
id
.
Round
List
[]
id
.
Round
GrpId
[]
byte
GrpId
[]
byte
Status
int
Status
int
}
}
...
@@ -201,10 +201,9 @@ func (ngr *NewGroupReport) GetError() string {
...
@@ -201,10 +201,9 @@ func (ngr *NewGroupReport) GetError() string {
return
ngr
.
err
return
ngr
.
err
}
}
func
(
ngr
*
NewGroupReport
)
Marshal
()
([]
byte
,
error
)
{
func
(
ngr
*
NewGroupReport
)
Marshal
()
([]
byte
,
error
)
{
grpReportDisk
:=
GroupReportDisk
{
grpReportDisk
:=
GroupReportDisk
{
List
:
ngr
.
rounds
,
List
:
ngr
.
rounds
,
GrpId
:
ngr
.
group
.
GetID
()[
:
],
GrpId
:
ngr
.
group
.
GetID
()[
:
],
Status
:
ngr
.
GetStatus
(),
Status
:
ngr
.
GetStatus
(),
}
}
...
...
This diff is collapsed.
Click to expand it.
interfaces/preimage/generate.go
+
1
−
1
View file @
4b8ee3ed
...
@@ -7,7 +7,7 @@ import (
...
@@ -7,7 +7,7 @@ import (
func
Generate
(
data
[]
byte
,
t
string
)
[]
byte
{
func
Generate
(
data
[]
byte
,
t
string
)
[]
byte
{
if
t
==
Default
{
if
t
==
Default
{
return
data
return
data
}
}
// Hash fingerprints
// Hash fingerprints
...
...
This diff is collapsed.
Click to expand it.
network/manager.go
+
7
−
8
View file @
4b8ee3ed
...
@@ -99,10 +99,10 @@ func NewManager(session *storage.Session, switchboard *switchboard.Switchboard,
...
@@ -99,10 +99,10 @@ func NewManager(session *storage.Session, switchboard *switchboard.Switchboard,
earliest
:=
uint64
(
0
)
earliest
:=
uint64
(
0
)
// create manager object
// create manager object
m
:=
manager
{
m
:=
manager
{
param
:
params
,
param
:
params
,
tracker
:
&
tracker
,
tracker
:
&
tracker
,
addrSpace
:
ephemeral
.
NewAddressSpace
(),
addrSpace
:
ephemeral
.
NewAddressSpace
(),
events
:
events
,
events
:
events
,
earliestRound
:
&
earliest
,
earliestRound
:
&
earliest
,
}
}
...
@@ -258,19 +258,18 @@ func (m *manager) GetVerboseRounds() string {
...
@@ -258,19 +258,18 @@ func (m *manager) GetVerboseRounds() string {
return
m
.
verboseRounds
.
String
()
return
m
.
verboseRounds
.
String
()
}
}
func
(
m
*
manager
)
SetFakeEarliestRound
(
rnd
id
.
Round
)
{
func
(
m
*
manager
)
SetFakeEarliestRound
(
rnd
id
.
Round
)
{
atomic
.
StoreUint64
(
m
.
earliestRound
,
uint64
(
rnd
))
atomic
.
StoreUint64
(
m
.
earliestRound
,
uint64
(
rnd
))
}
}
// GetFakeEarliestRound generates a random earliest round for a fake identity.
// GetFakeEarliestRound generates a random earliest round for a fake identity.
func
(
m
*
manager
)
GetFakeEarliestRound
()
id
.
Round
{
func
(
m
*
manager
)
GetFakeEarliestRound
()
id
.
Round
{
b
,
err
:=
csprng
.
Generate
(
8
,
rand
.
Reader
)
b
,
err
:=
csprng
.
Generate
(
8
,
rand
.
Reader
)
if
err
!=
nil
{
if
err
!=
nil
{
jww
.
FATAL
.
Panicf
(
"Could not get random number: %v"
,
err
)
jww
.
FATAL
.
Panicf
(
"Could not get random number: %v"
,
err
)
}
}
rangeVal
:=
binary
.
LittleEndian
.
Uint64
(
b
)
%
800
rangeVal
:=
binary
.
LittleEndian
.
Uint64
(
b
)
%
800
earliestKnown
:=
atomic
.
LoadUint64
(
m
.
earliestRound
)
earliestKnown
:=
atomic
.
LoadUint64
(
m
.
earliestRound
)
...
...
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