Home

tailproxy @main - refs - log -
-
https://git.jolheiser.com/tailproxy.git
Tailscale reverse proxy
tailproxy / flags.go
- raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package main

import "flag"

// Args are commandline arguments
type Args struct {
	Hostname string
	AuthKey  string
	Funnel   bool
	DataDir  string
	Port     int
}

// Flags is the [flag.FlagSet] for tailproxy
func Flags() (*Args, *flag.FlagSet) {
	args := &Args{

		DataDir: ".tailproxy",
	}
	fs := flag.NewFlagSet("tailproxy", flag.ExitOnError)
	fs.StringVar(&args.Hostname, "hostname", args.Hostname, "Tailscale hostname")
	fs.StringVar(&args.AuthKey, "auth-key", args.AuthKey, "Tailscale auth key")
	fs.BoolVar(&args.Funnel, "funnel", args.Funnel, "Expose on Tailscale funnel")
	fs.StringVar(&args.DataDir, "data-dir", args.DataDir, "tsnet data directory")
	fs.IntVar(&args.Port, "port", args.Port, "Port to proxy")
	return args, fs
}