package main import ( "fmt" "io" "net/http" "regexp" "time" ) func main() { http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, "0.0") }) http.HandleFunc("/int", func(w http.ResponseWriter, r *http.Request) { ip := r.FormValue("ip address") mask := r.FormValue("mask") gateway := r.FormValue("gateway") dns := r.FormValue("DNS") fmt.Fprintf(w, " ip address: 90.111.188.111 %s\n mask: 255.255.255.0 %s\n gateway: 90.111.188.111 %s\n DNS: 8.8.8.8 %s\n", ip, mask, gateway, dns) }) http.ListenAndServe(":8080", nil) } var re = regexp.MustCompile("(\\d+\\.)(\\d+\\.\\d+)(\\.\\d+)") func sayinfo(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "Сизов Валентин 794") } func status(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "794svs\n") response, error := http.Get("https://api.ipify.org/?format=text") if error != nil { fmt.Println(error) } body, error := io.ReadAll(response.Body) if error != nil { fmt.Println(error) } response.Body.Close() out := re.ReplaceAllString(string(body), "$1***.***$3") fmt.Fprint(w, "IP-address: ", out, "\n") now := time.Now() fmt.Fprintf(w, now.Format("2022-12-10 3:4:5 pm")) }