summaryrefslogtreecommitdiff
path: root/args
diff options
context:
space:
mode:
authorsimponic <simponic@hatecomputers.club>2024-03-28 16:58:07 -0400
committersimponic <simponic@hatecomputers.club>2024-03-28 16:58:07 -0400
commit60fc4ebb599d82f5c7ddaca52f8aba74f0876381 (patch)
treeabe1eebb6154453cfa67812d7dfc982d758931a0 /args
parentdee173cc63d3b51d47c1a321096a4963fe458075 (diff)
downloadhatecomputers.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 'args')
-rw-r--r--args/args.go25
1 files changed, 19 insertions, 6 deletions
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,