From a0b63fa2ec0c4368508ccde3532954884d7fc74a Mon Sep 17 00:00:00 2001 From: Akilan Selvacoumar Date: Tue, 6 Jul 2021 15:25:52 +0400 Subject: [PATCH 1/2] uncomitted changes --- cmd/flags.go | 1 - p2p/ip_table.json | 10 +--------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/cmd/flags.go b/cmd/flags.go index 2b5d87e..bf927b6 100644 --- a/cmd/flags.go +++ b/cmd/flags.go @@ -108,7 +108,6 @@ var AppConfigFlags = []cli.Flag{ EnvVars: []string{"SPECS"}, Destination: &Specs, }, - &cli.BoolFlag{ Name: "SetDefaultConfig", Aliases: []string{"dc"}, diff --git a/p2p/ip_table.json b/p2p/ip_table.json index 7ba6cde..e8729ed 100644 --- a/p2p/ip_table.json +++ b/p2p/ip_table.json @@ -1,11 +1,3 @@ { - "ip_address": [ - { - "ipv4": "", - "ipv6": "2001:8f8:172d:ee93:7588:ad57:c351:3309", - "latency": 1213198, - "download": 0, - "upload": 0 - } - ] + "ip_address": null } \ No newline at end of file From f7bae1100abace992a97dacb09e1f3cd0c2baa4a Mon Sep 17 00:00:00 2001 From: Akilan Selvacoumar Date: Tue, 6 Jul 2021 15:34:18 +0400 Subject: [PATCH 2/2] added possibility to add ipv4 and ipv6 address --- cmd/action.go | 9 ++++++++- p2p/ip_table.json | 10 +++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/cmd/action.go b/cmd/action.go index d59944c..76fa125 100644 --- a/cmd/action.go +++ b/cmd/action.go @@ -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) diff --git a/p2p/ip_table.json b/p2p/ip_table.json index e8729ed..43d7e54 100644 --- a/p2p/ip_table.json +++ b/p2p/ip_table.json @@ -1,3 +1,11 @@ { - "ip_address": null + "ip_address": [ + { + "ipv4": "", + "ipv6": "2001:8f8:172d:ee93:8105:563b:dc98:6dbf", + "latency": 567539, + "download": 0, + "upload": 0 + } + ] } \ No newline at end of file