mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-13 07:25:03 +01:00
parse host as FQDN or IP
This commit is contained in:
14
main.go
14
main.go
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"net"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
@@ -48,6 +49,19 @@ func main() {
|
||||
preventClose("Database password is blank")
|
||||
}
|
||||
|
||||
if net.ParseIP(erupeConfig.Host) == nil {
|
||||
ips, _ := net.LookupIP(erupeConfig.Host)
|
||||
for _, ip := range ips {
|
||||
if ip != nil {
|
||||
erupeConfig.Host = ip.String()
|
||||
break
|
||||
}
|
||||
}
|
||||
if net.ParseIP(erupeConfig.Host) == nil {
|
||||
preventClose("Invalid host address")
|
||||
}
|
||||
}
|
||||
|
||||
// Discord bot
|
||||
var discordBot *discordbot.DiscordBot = nil
|
||||
|
||||
|
||||
Reference in New Issue
Block a user