From f85f001a1c4db1c07dc83fb0481cf07b359a088f Mon Sep 17 00:00:00 2001 From: Akilan Date: Tue, 13 Apr 2021 21:07:57 +0400 Subject: [PATCH] fixing server side updating IP table --- p2p/ip_table.json | 6 +++--- server/server.go | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/p2p/ip_table.json b/p2p/ip_table.json index d166993..e179960 100644 --- a/p2p/ip_table.json +++ b/p2p/ip_table.json @@ -2,9 +2,9 @@ "ip_address": [ { "ipv4": "145.40.90.151", - "latency": 271458528, - "download": 738.0909641092161, - "upload": 1715.925379038264 + "latency": 262976449, + "download": 6.2124926386045, + "upload": 5144.270090126969 } ] } \ No newline at end of file diff --git a/server/server.go b/server/server.go index 3fe0a6f..15cf4c2 100644 --- a/server/server.go +++ b/server/server.go @@ -46,8 +46,6 @@ func Server() error{ ClientHost.Ipv4 = c.ClientIP() // Variable to store IP table information var IPTable p2p.IpAddresses - //Add Client IP address to IPTable struct - IPTable.IpAddress = append(IPTable.IpAddress, ClientHost) // Receive file from POST request body, err := c.FormFile("json") @@ -69,6 +67,9 @@ func Server() error{ json.Unmarshal(file,&IPTable) + //Add Client IP address to IPTable struct + IPTable.IpAddress = append(IPTable.IpAddress, ClientHost) + // Runs speed test to return only servers in the IP table pingable err = IPTable.SpeedTestUpdatedIPTable() if err != nil {