addeded 2 extra cli commands: ListServers and UpdateIPTableList
This commit is contained in:
@@ -16,7 +16,7 @@ var CliAction = func(ctx *cli.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Listing servers and also updates IP tables (Default 3 hops)
|
//Listing servers and also updates IP tables (Default 3 hops)
|
||||||
if ListServers {
|
if UpdateServerList {
|
||||||
|
|
||||||
err := client.UpdateIpTableListClient()
|
err := client.UpdateIpTableListClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -26,6 +26,10 @@ var CliAction = func(ctx *cli.Context) error {
|
|||||||
p2p.PrintIpTable()
|
p2p.PrintIpTable()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ServerList {
|
||||||
|
p2p.PrintIpTable()
|
||||||
|
}
|
||||||
|
|
||||||
// Function called to stop and remove server from Docker
|
// Function called to stop and remove server from Docker
|
||||||
if RemoveVM != "" && ID != "" {
|
if RemoveVM != "" && ID != "" {
|
||||||
err := client.RemoveContianer(RemoveVM,ID)
|
err := client.RemoveContianer(RemoveVM,ID)
|
||||||
|
|||||||
25
cmd/flags.go
25
cmd/flags.go
@@ -6,14 +6,15 @@ import (
|
|||||||
|
|
||||||
// Variables declared for CLI
|
// Variables declared for CLI
|
||||||
var (
|
var (
|
||||||
CreateVM string
|
CreateVM string
|
||||||
Ports string
|
Ports string
|
||||||
Mode string
|
Mode string
|
||||||
RemoveVM string
|
RemoveVM string
|
||||||
ID string
|
ID string
|
||||||
Specs string
|
Specs string
|
||||||
GPU bool
|
GPU bool
|
||||||
ListServers bool
|
UpdateServerList bool
|
||||||
|
ServerList bool
|
||||||
)
|
)
|
||||||
|
|
||||||
var AppConfigFlags = []cli.Flag{
|
var AppConfigFlags = []cli.Flag{
|
||||||
@@ -25,11 +26,17 @@ var AppConfigFlags = []cli.Flag{
|
|||||||
EnvVars: []string{"P2P_MODE"},
|
EnvVars: []string{"P2P_MODE"},
|
||||||
Destination: &Mode,
|
Destination: &Mode,
|
||||||
},
|
},
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "UpdateServerList",
|
||||||
|
Usage: "Update List of Server available based on servers iptables",
|
||||||
|
EnvVars: []string{"UPDATE_SERVER_LIST"},
|
||||||
|
Destination: &UpdateServerList,
|
||||||
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "ListServers",
|
Name: "ListServers",
|
||||||
Usage: "List servers which can render tasks",
|
Usage: "List servers which can render tasks",
|
||||||
EnvVars: []string{"LIST_SERVERS"},
|
EnvVars: []string{"LIST_SERVERS"},
|
||||||
Destination: &ListServers,
|
Destination: &ServerList,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "CreateVM",
|
Name: "CreateVM",
|
||||||
|
|||||||
@@ -2,15 +2,15 @@
|
|||||||
"ip_address": [
|
"ip_address": [
|
||||||
{
|
{
|
||||||
"ipv4": "145.40.90.151",
|
"ipv4": "145.40.90.151",
|
||||||
"latency": 146389678,
|
"latency": 144024138,
|
||||||
"download": 9.020151819319478,
|
"download": 6.124989686501195,
|
||||||
"upload": 6325.413957228309
|
"upload": 3863.649528583081
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ipv4": "86.99.70.106",
|
"ipv4": "86.99.70.106",
|
||||||
"latency": 9320246,
|
"latency": 7972645,
|
||||||
"download": 841.138792914018,
|
"download": 87.32677875720803,
|
||||||
"upload": 6849.211861191133
|
"upload": 6006.624976985241
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user