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
7dcce5ad
Commit
7dcce5ad
authored
Apr 15, 2016
by
Loïck Bonniot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[d] Add configurable addrport and identifier
Fix
#3
- Should be merged asap in 192 branch
parent
2b63e8df
Pipeline
#642
passed with stage
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
31 deletions
+35
-31
dfssc/main.go
dfssc/main.go
+6
-0
dfssd/api/client.go
dfssd/api/client.go
+14
-17
dfssp/main.go
dfssp/main.go
+5
-5
dfsst/main.go
dfsst/main.go
+10
-9
No files found.
dfssc/main.go
View file @
7dcce5ad
...
...
@@ -5,10 +5,13 @@ import (
"flag"
"fmt"
"runtime"
dapi
"dfss/dfssd/api"
)
var
(
verbose
bool
demo
string
fca
string
// Path to the CA
fcert
string
// Path to the certificate
fkey
string
// Path to the private key
...
...
@@ -23,6 +26,7 @@ func init() {
flag
.
StringVar
(
&
fcert
,
"cert"
,
"cert.pem"
,
"Path to the user certificate"
)
flag
.
StringVar
(
&
fkey
,
"key"
,
"key.pem"
,
"Path to the private key"
)
flag
.
StringVar
(
&
addrPort
,
"host"
,
"localhost:9000"
,
"Host of the DFSS platform"
)
flag
.
StringVar
(
&
demo
,
"d"
,
""
,
"Demonstrator address and port (empty string disables debug)"
)
flag
.
IntVar
(
&
localPort
,
"port"
,
9005
,
"Port to use for P2P communication between clients"
)
flag
.
Usage
=
func
()
{
...
...
@@ -73,6 +77,8 @@ var commands = map[string]command{
func
main
()
{
flag
.
Parse
()
arg
:=
flag
.
Arg
(
0
)
dapi
.
Configure
(
demo
!=
""
,
demo
,
"client"
)
c
,
ok
:=
commands
[
arg
]
if
!
ok
||
flag
.
NArg
()
-
1
<
c
.
nbArgs
{
...
...
dfssd/api/client.go
View file @
7dcce5ad
package
api
import
(
"time"
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/grpclog"
"time"
)
var
(
// theses are the default parameters
address
=
"localhost:3000"
identifier
=
"platform"
demo
=
false
address
,
identifier
string
demo
bool
// lazy initializer
dial
*
grpc
.
ClientConn
demoClient
DemonstratorClient
)
//
Switch for demo mode
//
// Should be used to pass the value of `-d` switch
func
Switch
(
activationSwitch
bool
)
{
demo
=
activationSwitch
return
//
Configure is used to update current parameters.
//
Call it at least one time before the first DLog call.
func
Configure
(
activated
bool
,
addrport
,
id
string
)
{
address
=
addrport
identifier
=
id
demo
=
activated
}
// Lazy initialisation for demonstrator's connection to server
func
dInit
()
error
{
var
err
error
dial
,
err
=
grpc
.
Dial
(
address
,
grpc
.
WithInsecure
())
dial
,
err
=
grpc
.
Dial
(
address
,
grpc
.
WithInsecure
()
,
grpc
.
WithTimeout
(
10
*
time
.
Second
)
)
if
err
!=
nil
{
grpclog
.
Printf
(
"Fail to dial: %v"
,
err
)
return
err
}
demoClient
=
NewDemonstratorClient
(
dial
)
return
err
return
nil
}
// DClose close the connection with demonstrator server (if any)
...
...
@@ -45,7 +44,7 @@ func DClose() {
if
dial
!=
nil
{
err
:=
dial
.
Close
()
if
err
!=
nil
{
grpclog
.
Printf
(
"Fail
to close dialing
: %v"
,
err
)
grpclog
.
Printf
(
"Fail
ed to close dialing with demonstrator
: %v"
,
err
)
}
}
}
...
...
@@ -53,9 +52,7 @@ func DClose() {
// DLog send a message to the demonstrator
//
// The client is dialed in a lazy way
// The default demonstrator server address is localhost:3000
func
DLog
(
log
string
)
{
// check demo switch
if
!
demo
{
return
...
...
dfssp/main.go
View file @
7dcce5ad
...
...
@@ -15,16 +15,16 @@ import (
)
var
(
verbose
,
demo
bool
path
,
country
,
org
,
unit
,
cn
,
port
,
address
,
dbURI
string
keySize
,
rootValidity
,
certValidity
int
verbose
bool
path
,
country
,
org
,
unit
,
cn
,
port
,
address
,
dbURI
,
demo
string
keySize
,
rootValidity
,
certValidity
int
)
func
init
()
{
flag
.
BoolVar
(
&
verbose
,
"v"
,
false
,
"Print verbose messages"
)
flag
.
BoolVar
(
&
demo
,
"d"
,
false
,
"Enable demonstrator"
)
flag
.
StringVar
(
&
demo
,
"d"
,
""
,
"Demonstrator address and port (empty string disables debug)"
)
flag
.
StringVar
(
&
port
,
"p"
,
"9000"
,
"Default port listening"
)
flag
.
StringVar
(
&
address
,
"a"
,
"0.0.0.0"
,
"Default address to bind for listening"
)
...
...
@@ -67,7 +67,7 @@ func init() {
func
main
()
{
flag
.
Parse
()
command
:=
flag
.
Arg
(
0
)
dapi
.
Switch
(
demo
)
dapi
.
Configure
(
demo
!=
""
,
demo
,
"platform"
)
switch
command
{
case
"version"
:
...
...
dfsst/main.go
View file @
7dcce5ad
...
...
@@ -13,13 +13,14 @@ import (
)
var
(
verbose
,
demo
bool
fca
string
// Path to the CA
fcert
string
// Path to the certificate
fkey
string
// Path to the private key
address
string
dbURI
string
port
string
verbose
bool
fca
string
// Path to the CA
fcert
string
// Path to the certificate
fkey
string
// Path to the private key
address
string
dbURI
string
port
string
demo
string
)
func
init
()
{
...
...
@@ -28,7 +29,7 @@ func init() {
flag
.
StringVar
(
&
fca
,
"ca"
,
"ca.pem"
,
"Path to the root certificate"
)
flag
.
StringVar
(
&
fcert
,
"cert"
,
"cert.pem"
,
"Path to the user certificate"
)
flag
.
StringVar
(
&
fkey
,
"key"
,
"key.pem"
,
"Path to the private key"
)
flag
.
BoolVar
(
&
demo
,
"d"
,
false
,
"Enable demonstrator
"
)
flag
.
StringVar
(
&
demo
,
"d"
,
""
,
"Demonstrator address and port (empty string disables debug)
"
)
flag
.
StringVar
(
&
port
,
"p"
,
"9020"
,
"Default port listening"
)
flag
.
StringVar
(
&
address
,
"a"
,
"0.0.0.0"
,
"Default address to bind for listening"
)
...
...
@@ -58,7 +59,7 @@ func init() {
func
main
()
{
flag
.
Parse
()
command
:=
flag
.
Arg
(
0
)
dapi
.
Switch
(
demo
)
dapi
.
Configure
(
demo
!=
""
,
demo
,
"ttp"
)
switch
command
{
case
"version"
:
...
...
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