modified config file

This commit is contained in:
2021-07-22 13:04:25 +04:00
parent c3647c2fe7
commit 4e0fd09d73
10 changed files with 99 additions and 23 deletions

View File

@@ -1,11 +1,12 @@
{
"ip_address": [
{
"ipv4": "172.104.44.195",
"ipv4": "139.162.246.221",
"ipv6": "",
"latency": 0,
"download": 0,
"upload": 0
"upload": 0,
"serverport": "8088"
}
]
}

View File

@@ -23,6 +23,7 @@ type IpAddress struct {
Latency time.Duration `json:"latency"`
Download float64 `json:"download"`
Upload float64 `json:"upload"`
ServerPort string `json:"serverport"`
}
type IP struct {
@@ -69,6 +70,7 @@ func ReadIpTable()(*IpAddresses ,error){
}
PublicIP.Ipv4 = ip
PublicIP.Ipv6 = ipv6
PublicIP.ServerPort = config.ServerPort
// Updates current machine IP address to the IP table
ipAddresses.IpAddress = append(ipAddresses.IpAddress, PublicIP)
@@ -120,6 +122,7 @@ func PrintIpTable() error {
"-----------------\n",table.IpAddress[i].Ipv4,table.IpAddress[i].Ipv6,
table.IpAddress[i].Latency)
}
return nil
}

View File

@@ -105,7 +105,7 @@ func (s *IpAddress)UploadSpeed() error {
b, w := createMultipartFormData("file",config.SpeedTestFile)
req, err := http.NewRequest("GET", "http://" + s.Ipv4 + ":8088/upload", &b)
req, err := http.NewRequest("GET", "http://" + s.Ipv4 + ":" + s.ServerPort + "/upload", &b)
if err != nil {
return err
}
@@ -152,10 +152,10 @@ func (s *IpAddress) PingTest() error {
//pingURL := strings.Split(s.URL, "/upload")[0] + "/latency.txt"
var pingURL string
if s.Ipv6 != "" {
pingURL = "http://[" + s.Ipv6 + "]:8088/server_info"
pingURL = "http://[" + s.Ipv6 + "]:" + s.ServerPort + "/server_info"
s.Ipv4 = ""
} else {
pingURL = "http://" + s.Ipv4 + ":8088/server_info"
pingURL = "http://" + s.Ipv4 + ":" + s.ServerPort + "/server_info"
}
l := time.Duration(100000000000) // 10sec