diff options
| author | simponic <simponic@hatecomputers.club> | 2024-03-28 16:58:07 -0400 |
|---|---|---|
| committer | simponic <simponic@hatecomputers.club> | 2024-03-28 16:58:07 -0400 |
| commit | 60fc4ebb599d82f5c7ddaca52f8aba74f0876381 (patch) | |
| tree | abe1eebb6154453cfa67812d7dfc982d758931a0 /main.go | |
| parent | dee173cc63d3b51d47c1a321096a4963fe458075 (diff) | |
| download | hatecomputers.club-60fc4ebb599d82f5c7ddaca52f8aba74f0876381.tar.gz hatecomputers.club-60fc4ebb599d82f5c7ddaca52f8aba74f0876381.zip | |
internal recursive dns server (#2)
Co-authored-by: Lizzy Hunt <lizzy.hunt@usu.edu>
Reviewed-on: https://git.hatecomputers.club/hatecomputers/hatecomputers.club/pulls/2
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 28 |
1 files changed, 23 insertions, 5 deletions
@@ -6,6 +6,7 @@ import ( "git.hatecomputers.club/hatecomputers/hatecomputers.club/api" "git.hatecomputers.club/hatecomputers/hatecomputers.club/args" "git.hatecomputers.club/hatecomputers/hatecomputers.club/database" + "git.hatecomputers.club/hatecomputers/hatecomputers.club/dns" "git.hatecomputers.club/hatecomputers/hatecomputers.club/scheduler" "github.com/joho/godotenv" ) @@ -40,10 +41,27 @@ func main() { if argv.Server { server := api.MakeServer(argv, dbConn) - err = server.ListenAndServe() - if err != nil { - log.Fatal(err) - } - log.Println("🚀🚀 server listening on port", argv.Port) + log.Println("🚀🚀 API listening on port", argv.Port) + + go func() { + err = server.ListenAndServe() + if err != nil { + log.Fatal(err) + } + }() } + + if argv.Dns { + server := dns.MakeServer(argv, dbConn) + log.Println("🚀🚀 DNS resolver listening on port", argv.DnsPort) + go func() { + err = server.ListenAndServe() + if err != nil { + log.Fatal(err) + } + }() + } + + runForever := make(chan struct{}) + <-runForever } |
