current implementation of ipv6
This commit is contained in:
@@ -17,6 +17,7 @@ type IpAddresses struct {
|
||||
|
||||
type IpAddress struct {
|
||||
Ipv4 string `json:"ipv4"`
|
||||
Ipv6 string `json:"ipv6"`
|
||||
Latency time.Duration `json:"latency"`
|
||||
Download float64 `json:"download"`
|
||||
Upload float64 `json:"upload"`
|
||||
|
||||
@@ -20,3 +20,5 @@ func TestReadIpTable(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -150,7 +150,13 @@ func mustOpen(f string) *os.File {
|
||||
// PingTest executes test to measure latency
|
||||
func (s *IpAddress) PingTest() error {
|
||||
//pingURL := strings.Split(s.URL, "/upload")[0] + "/latency.txt"
|
||||
pingURL := "http://" + s.Ipv4 + ":8088/server_info"
|
||||
var pingURL string
|
||||
if s.Ipv6 != "" {
|
||||
pingURL = "http://[" + s.Ipv6 + "]:8088/server_info"
|
||||
} else {
|
||||
pingURL = "http://" + s.Ipv4 + ":8088/server_info"
|
||||
}
|
||||
|
||||
l := time.Duration(100000000000) // 10sec
|
||||
for i := 0; i < 3; i++ {
|
||||
sTime := time.Now()
|
||||
|
||||
Reference in New Issue
Block a user