fixed bug ports and listservers
This commit is contained in:
@@ -38,7 +38,6 @@ var CliAction = func(ctx *cli.Context) error {
|
||||
if CreateVM != "" {
|
||||
|
||||
var PortsInt int
|
||||
PortsInt = 0
|
||||
|
||||
if Ports != "" {
|
||||
// Convert Get Request value to int
|
||||
|
||||
@@ -53,7 +53,7 @@ var AppConfigFlags = []cli.Flag{
|
||||
Name: "Ports",
|
||||
Usage: "Number of ports to open for the Docker Container",
|
||||
EnvVars: []string{"NUM_PORTS"},
|
||||
Destination: &ID,
|
||||
Destination: &Ports,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "GPU",
|
||||
|
||||
BIN
p2p/50.bin
BIN
p2p/50.bin
Binary file not shown.
@@ -1,7 +1,10 @@
|
||||
{
|
||||
"ip_address": [
|
||||
{
|
||||
"ipv4": "145.40.90.151"
|
||||
"ipv4": "145.40.90.151",
|
||||
"latency": 271458528,
|
||||
"download": 738.0909641092161,
|
||||
"upload": 1715.925379038264
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -65,7 +65,7 @@ func (i *IpAddresses) WriteIpTable() error {
|
||||
return err
|
||||
}
|
||||
|
||||
err = ioutil.WriteFile(config.SpeedTestFile, file, 0644)
|
||||
err = ioutil.WriteFile(config.IPTable, file, 0644)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -145,52 +145,53 @@ func (d *DockerVM)imageBuild(dockerClient *client.Client) error {
|
||||
func (d *DockerVM)runContainer(dockerClient *client.Client) error{
|
||||
ctx, _ := context.WithTimeout(context.Background(), time.Second*2000)
|
||||
|
||||
//Exposed ports for docker config file
|
||||
var ExposedPort nat.PortSet
|
||||
|
||||
ExposedPort = nat.PortSet{
|
||||
"22/tcp": struct{}{},
|
||||
"6901/tcp": struct{}{},
|
||||
}
|
||||
|
||||
// Port forwarding for VNC and SSH ports
|
||||
PortForwarding := nat.PortMap{
|
||||
"22/tcp": []nat.PortBinding{
|
||||
{
|
||||
HostIP: "0.0.0.0",
|
||||
HostPort: fmt.Sprint(d.SSHPort),
|
||||
},
|
||||
},
|
||||
"6901/tcp": []nat.PortBinding{
|
||||
{
|
||||
HostIP: "0.0.0.0",
|
||||
HostPort: fmt.Sprint(d.VNCPort),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for i := range d.Ports {
|
||||
|
||||
Port, err := nat.NewPort("tcp",fmt.Sprint(d.Ports[i]))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Exposed Ports
|
||||
ExposedPort[Port] = struct{}{}
|
||||
|
||||
PortForwarding[Port] = []nat.PortBinding{
|
||||
{
|
||||
HostIP: "0.0.0.0",
|
||||
HostPort: fmt.Sprint(d.Ports[i]),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// The first mode runs using the Docker Api. As the API supports using
|
||||
// CPU and uses a shell script for GPU call because till this point of
|
||||
// implementation docker api does not support the flag "--gpu all"
|
||||
if d.GPU != "true" {
|
||||
//Exposed ports for docker config file
|
||||
var ExposedPort nat.PortSet
|
||||
|
||||
ExposedPort = nat.PortSet{
|
||||
"22/tcp": struct{}{},
|
||||
"6901/tcp": struct{}{},
|
||||
}
|
||||
|
||||
// Port forwarding for VNC and SSH ports
|
||||
PortForwarding := nat.PortMap{
|
||||
"22/tcp": []nat.PortBinding{
|
||||
{
|
||||
HostIP: "0.0.0.0",
|
||||
HostPort: fmt.Sprint(d.SSHPort),
|
||||
},
|
||||
},
|
||||
"6901/tcp": []nat.PortBinding{
|
||||
{
|
||||
HostIP: "0.0.0.0",
|
||||
HostPort: fmt.Sprint(d.VNCPort),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for i := range d.Ports {
|
||||
|
||||
Port, err := nat.NewPort("tcp",fmt.Sprint(d.Ports[i]))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Exposed Ports
|
||||
ExposedPort[Port] = struct{}{}
|
||||
|
||||
PortForwarding[Port] = []nat.PortBinding{
|
||||
{
|
||||
HostIP: "0.0.0.0",
|
||||
HostPort: fmt.Sprint(d.Ports[i]),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
config := &container.Config{
|
||||
Image: d.TagName,
|
||||
Entrypoint: []string{"/dockerstartup/vnc_startup.sh", "/start"},
|
||||
|
||||
Reference in New Issue
Block a user