Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dfss
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
7
Issues
7
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mpcs
dfss
Commits
64ba9b13
Commit
64ba9b13
authored
May 25, 2016
by
Richer Maximilien
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[demo] Verbose flag print DLog to stdout
parent
9cba231d
Pipeline
#2196
passed with stage
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
7 deletions
+18
-7
dfssc/cmd/root.go
dfssc/cmd/root.go
+1
-1
dfssd/api/client.go
dfssd/api/client.go
+9
-2
dfssp/cmd/root.go
dfssp/cmd/root.go
+1
-1
dfsst/cmd/root.go
dfsst/cmd/root.go
+7
-0
dfsst/cmd/start.go
dfsst/cmd/start.go
+0
-3
No files found.
dfssc/cmd/root.go
View file @
64ba9b13
...
@@ -24,7 +24,7 @@ A tool to sign multiparty contract using a secure cryptographic protocol`,
...
@@ -24,7 +24,7 @@ A tool to sign multiparty contract using a secure cryptographic protocol`,
},
},
PersistentPreRun
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
PersistentPreRun
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
net
.
DefaultTimeout
=
viper
.
GetDuration
(
"timeout"
)
net
.
DefaultTimeout
=
viper
.
GetDuration
(
"timeout"
)
dapi
.
Configure
(
viper
.
GetString
(
"demo"
)
!=
""
,
viper
.
GetString
(
"demo"
),
"client"
)
dapi
.
Configure
(
viper
.
Get
Bool
(
"verbose"
),
viper
.
Get
String
(
"demo"
)
!=
""
,
viper
.
GetString
(
"demo"
),
"client"
)
},
},
PersistentPostRun
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
PersistentPostRun
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
dapi
.
DClose
()
dapi
.
DClose
()
...
...
dfssd/api/client.go
View file @
64ba9b13
package
api
package
api
import
(
import
(
"fmt"
"time"
"time"
"golang.org/x/net/context"
"golang.org/x/net/context"
...
@@ -10,7 +11,7 @@ import (
...
@@ -10,7 +11,7 @@ import (
var
(
var
(
address
,
identifier
string
address
,
identifier
string
demo
bool
demo
,
verbose
bool
// lazy initializer
// lazy initializer
dial
*
grpc
.
ClientConn
dial
*
grpc
.
ClientConn
demoClient
DemonstratorClient
demoClient
DemonstratorClient
...
@@ -18,10 +19,11 @@ var (
...
@@ -18,10 +19,11 @@ var (
// Configure is used to update current parameters.
// Configure is used to update current parameters.
// Call it at least one time before the first DLog call.
// Call it at least one time before the first DLog call.
func
Configure
(
activated
bool
,
addrport
,
id
string
)
{
func
Configure
(
verbswitch
,
activated
bool
,
addrport
,
id
string
)
{
address
=
addrport
address
=
addrport
identifier
=
id
identifier
=
id
demo
=
activated
demo
=
activated
verbose
=
verbswitch
}
}
// SetIdentifier updates the current client identifier.
// SetIdentifier updates the current client identifier.
...
@@ -58,6 +60,11 @@ func DClose() {
...
@@ -58,6 +60,11 @@ func DClose() {
//
//
// The client is dialed in a lazy way
// The client is dialed in a lazy way
func
DLog
(
log
string
)
{
func
DLog
(
log
string
)
{
// check verbose switch
if
verbose
{
fmt
.
Println
(
log
)
}
// check demo switch
// check demo switch
if
!
demo
{
if
!
demo
{
return
return
...
...
dfssp/cmd/root.go
View file @
64ba9b13
...
@@ -20,7 +20,7 @@ Users and Contracts manager`,
...
@@ -20,7 +20,7 @@ Users and Contracts manager`,
_
=
cmd
.
Help
()
_
=
cmd
.
Help
()
},
},
PersistentPreRun
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
PersistentPreRun
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
dapi
.
Configure
(
viper
.
GetString
(
"demo"
)
!=
""
,
viper
.
GetString
(
"demo"
),
"platform"
)
dapi
.
Configure
(
viper
.
Get
Bool
(
"verbose"
),
viper
.
Get
String
(
"demo"
)
!=
""
,
viper
.
GetString
(
"demo"
),
"platform"
)
},
},
PersistentPostRun
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
PersistentPostRun
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
dapi
.
DClose
()
dapi
.
DClose
()
...
...
dfsst/cmd/root.go
View file @
64ba9b13
...
@@ -5,6 +5,7 @@ import (
...
@@ -5,6 +5,7 @@ import (
"fmt"
"fmt"
"dfss"
"dfss"
dapi
"dfss/dfssd/api"
"github.com/spf13/cobra"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/spf13/viper"
)
)
...
@@ -22,6 +23,12 @@ Sign your contract using a secure cryptographic protocol`,
...
@@ -22,6 +23,12 @@ Sign your contract using a secure cryptographic protocol`,
Run
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
Run
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
_
=
cmd
.
Help
()
_
=
cmd
.
Help
()
},
},
PersistentPreRun
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
dapi
.
Configure
(
viper
.
GetBool
(
"verbose"
),
viper
.
GetString
(
"demo"
)
!=
""
,
viper
.
GetString
(
"demo"
),
"ttp"
)
},
PersistentPostRun
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
dapi
.
DClose
()
},
}
}
// All of the flags will be gathered by viper, this is why
// All of the flags will be gathered by viper, this is why
...
...
dfsst/cmd/start.go
View file @
64ba9b13
...
@@ -20,9 +20,6 @@ var startCmd = &cobra.Command{
...
@@ -20,9 +20,6 @@ var startCmd = &cobra.Command{
Fill the DFSS_TTP_PASSWORD environment variable if the private key is enciphered`
,
Fill the DFSS_TTP_PASSWORD environment variable if the private key is enciphered`
,
Run
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
Run
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
demo
:=
viper
.
GetString
(
"demo"
)
dapi
.
Configure
(
demo
!=
""
,
demo
,
"ttp"
)
srv
:=
server
.
GetServer
()
srv
:=
server
.
GetServer
()
addrPort
:=
viper
.
GetString
(
"address"
)
+
":"
+
strconv
.
Itoa
(
viper
.
GetInt
(
"port"
))
addrPort
:=
viper
.
GetString
(
"address"
)
+
":"
+
strconv
.
Itoa
(
viper
.
GetInt
(
"port"
))
...
...
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