IPv6-Fix und kleine Bug-Fixes
All checks were successful
release-tag / release-image (push) Successful in 45s

This commit is contained in:
2025-01-16 02:27:00 +01:00
parent 50206677ec
commit a1c80dcc07

11
main.go
View File

@@ -129,6 +129,11 @@ func handler(w http.ResponseWriter, r *http.Request) {
D = make(map[string]dns_entry) D = make(map[string]dns_entry)
} }
if strings.Contains(Ip6, ".") {
WriteLog("!", "IPv6 nicht möglich (IP-Version-Mismatch):", Ip6, "eventuell eine IPv4-Adresse?")
Ip6 = ""
}
if strings.EqualFold(Dns, "") || strings.EqualFold(Ip, "") || strings.EqualFold(User, "") || strings.EqualFold(Token, "") { if strings.EqualFold(Dns, "") || strings.EqualFold(Ip, "") || strings.EqualFold(User, "") || strings.EqualFold(Token, "") {
/* strings.ToLower(Dns) != strings.ToLower("") && strings.ToLower(Ip) != strings.ToLower("") && strings.ToLower(User) != strings.ToLower("") && strings.ToLower(Token) != strings.ToLower("")*/ /* strings.ToLower(Dns) != strings.ToLower("") && strings.ToLower(Ip) != strings.ToLower("") && strings.ToLower(User) != strings.ToLower("") && strings.ToLower(Token) != strings.ToLower("")*/
WriteLog("!", "Eintrag unvollständig: ", D[Dns]) WriteLog("!", "Eintrag unvollständig: ", D[Dns])
@@ -307,14 +312,14 @@ func handleDNSRequest(w dns.ResponseWriter, r *dns.Msg) {
func prepareExit() { func prepareExit() {
WriteLog("~", "Running exit tasks...") WriteLog("~", "Running exit tasks...")
os.Rename("/data/error.log", "/data/error_"+time.Now().Format("2006-01-02_15-04-05")+".log")
WriteLog("~", "Exit completed.") fmt.Println("~", "Exit completed.")
} }
func StopServer(e error) { func StopServer(e error) {
WriteLog("~", "Stopping server...") WriteLog("~", "Stopping server...")
prepareExit() prepareExit()
WriteLog("~", "Server stopped!") fmt.Println("~", "Server stopped!")
} }
func main() { func main() {