test/app/main.go

33 lines
617 B
Go

package main
import (
"log"
"os"
"os/signal"
"github.com/zeevdiukman/test/app/dns"
"github.com/zeevdiukman/test/app/helper"
)
func main() {
// Clear the terminal screen
helper.ClearScreen()
// Initialize the DNS server with the configuration file
d := dns.New("./dns.yml")
// Run the HTTP and DNS servers concurrently
go runHTTP()
go func() {
helper.P("DNS server started at " + d.Server.Addr)
d.Run()
}()
// Wait for SIGINT (Ctrl+C) to gracefully shut down the server
stop := make(chan os.Signal, 1)
signal.Notify(stop, os.Interrupt)
<-stop
log.Println("Shutting down the server...")
}