From 60fc4ebb599d82f5c7ddaca52f8aba74f0876381 Mon Sep 17 00:00:00 2001 From: simponic Date: Thu, 28 Mar 2024 16:58:07 -0400 Subject: internal recursive dns server (#2) Co-authored-by: Lizzy Hunt Reviewed-on: https://git.hatecomputers.club/hatecomputers/hatecomputers.club/pulls/2 --- args/args.go | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'args/args.go') diff --git a/args/args.go b/args/args.go index fe06f28..3be0abd 100644 --- a/args/args.go +++ b/args/args.go @@ -15,25 +15,35 @@ type Arguments struct { StaticPath string CloudflareToken string CloudflareZone string - Port int - Server bool - Migrate bool - Scheduler bool + Migrate bool + Scheduler bool + + Port int + Server bool OauthConfig *oauth2.Config OauthUserInfoURI string + + Dns bool + DnsRecursion []string + DnsPort int } func GetArgs() (*Arguments, error) { - port := flag.Int("port", 8080, "Port to listen on") databasePath := flag.String("database-path", "./hatecomputers.db", "Path to the SQLite database") templatePath := flag.String("template-path", "./templates", "Path to the template directory") staticPath := flag.String("static-path", "./static", "Path to the static directory") scheduler := flag.Bool("scheduler", false, "Run scheduled jobs via cron") - server := flag.Bool("server", false, "Run the server") migrate := flag.Bool("migrate", false, "Run the migrations") + port := flag.Int("port", 8080, "Port to listen on") + server := flag.Bool("server", false, "Run the server") + + dns := flag.Bool("dns", false, "Run DNS resolver") + dnsRecursion := flag.String("dns-recursion", "1.1.1.1:53,1.0.0.1:53", "Comma separated list of DNS resolvers") + dnsPort := flag.Int("dns-port", 8053, "Port to listen on for DNS resolver") + flag.Parse() cloudflareToken := os.Getenv("CLOUDFLARE_TOKEN") @@ -86,6 +96,9 @@ func GetArgs() (*Arguments, error) { Server: *server, Migrate: *migrate, Scheduler: *scheduler, + Dns: *dns, + DnsRecursion: strings.Split(*dnsRecursion, ","), + DnsPort: *dnsPort, OauthConfig: oauthConfig, OauthUserInfoURI: oauthUserInfoURI, -- cgit v1.2.3-70-g09d2