Merge pull request #39 from Akilan1999/addcliipv6

Cli for add server accepts ipv4 and ipv6 address
This commit is contained in:
Akilan Selvacoumar
2021-07-06 15:36:28 +04:00
committed by GitHub
3 changed files with 10 additions and 4 deletions

View File

@@ -41,8 +41,15 @@ var CliAction = func(ctx *cli.Context) error {
//Create variable of type IpAddress and set IP address
// to it
var IpAddr p2p.IpAddress
IpAddr.Ipv4 = AddServer
//Checking if the address is a ipv4
// or ipv6 address
ip4Orip6 := p2p.Ip4or6(AddServer)
if ip4Orip6 == "version 6" {
IpAddr.Ipv6 = AddServer
} else {
IpAddr.Ipv4 = AddServer
}
// Append IP address to variable result which
// is a list
res.IpAddress = append(res.IpAddress, IpAddr)

View File

@@ -108,7 +108,6 @@ var AppConfigFlags = []cli.Flag{
EnvVars: []string{"SPECS"},
Destination: &Specs,
},
&cli.BoolFlag{
Name: "SetDefaultConfig",
Aliases: []string{"dc"},

View File

@@ -2,8 +2,8 @@
"ip_address": [
{
"ipv4": "",
"ipv6": "2001:8f8:172d:ee93:7588:ad57:c351:3309",
"latency": 1213198,
"ipv6": "2001:8f8:172d:ee93:8105:563b:dc98:6dbf",
"latency": 567539,
"download": 0,
"upload": 0
}