Added internet check and warning when offline

This commit is contained in:
2026-05-21 10:10:18 -06:00
parent 283ffb66eb
commit 93c4825ff7
4 changed files with 117 additions and 94 deletions

View File

@@ -4,10 +4,12 @@ import (
"archive/zip"
"fmt"
"io"
"net"
"net/http"
"os"
"path/filepath"
"strings"
"time"
)
//Utilities
@@ -91,3 +93,13 @@ func unzip(src, dest string) ([]string, error) {
return filenames, nil
}
func hasInternet() bool {
timeout := 2 * time.Second
conn, err := net.DialTimeout("tcp", "8.8.8.8:53", timeout)
if err != nil {
return false
}
conn.Close()
return true
}