add domain whois/dns support, refactor codebase

This commit is contained in:
2025-09-17 20:38:51 +02:00
parent 477bc242aa
commit 16fc344a68
29 changed files with 1396 additions and 867 deletions
+27
View File
@@ -0,0 +1,27 @@
package db
import (
"crypto/md5"
"fmt"
"io"
"os"
)
// fileMD5 calculates the MD5 hash of a file.
func fileMD5(path string) (string, error) {
file, err := os.Open(path)
if err != nil {
return "", err
}
defer func() {
if err := file.Close(); err != nil {
fmt.Printf("Error closing file: %v\n", err)
}
}()
hash := md5.New()
if _, err := io.Copy(hash, file); err != nil {
return "", err
}
return fmt.Sprintf("%x", hash.Sum(nil)), nil
}