[ Hidden Content! ]
package main
import (
"fmt"
"os"
"time"
"net/http"
"io/ioutil"
"encoding/json"
)
type Result struct {
RequestID string `json:"request_id"`
}
func main() {
if len(os.Args) != 3 {
fmt.Println("Usage: paping <IP_or_Domain> <Port>")
return
}
host := os.Args[1]
port := os.Args[2]
fmt.Println("Waiting for 10 seconds before starting the ping test...")
time.Sleep(10 * time.Second)
url := fmt.Sprintf("https://check-host.net/check-ping?host=%s&max_nodes=5", host)
resp, err := http.Get(url)
if err != nil {
fmt.Println("Error during request:", err)
return
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
var result Result
err = json.Unmarshal(body, &result)
if err != nil {
fmt.Println("Error parsing JSON:", err)
return
}
reportLink := fmt.Sprintf("https://check-host.net/check-result/%s", result.RequestID)
fmt.Printf("Ping results are available at: %s\n", reportLink)
}
import (
"fmt"
"os"
"time"
"net/http"
"io/ioutil"
"encoding/json"
)
type Result struct {
RequestID string `json:"request_id"`
}
func main() {
if len(os.Args) != 3 {
fmt.Println("Usage: paping <IP_or_Domain> <Port>")
return
}
host := os.Args[1]
port := os.Args[2]
fmt.Println("Waiting for 10 seconds before starting the ping test...")
time.Sleep(10 * time.Second)
url := fmt.Sprintf("https://check-host.net/check-ping?host=%s&max_nodes=5", host)
resp, err := http.Get(url)
if err != nil {
fmt.Println("Error during request:", err)
return
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
var result Result
err = json.Unmarshal(body, &result)
if err != nil {
fmt.Println("Error parsing JSON:", err)
return
}
reportLink := fmt.Sprintf("https://check-host.net/check-result/%s", result.RequestID)
fmt.Printf("Ping results are available at: %s\n", reportLink)
}