Home

tailroute @main - refs - log -
-
https://git.jolheiser.com/tailroute.git
Router for tailnet and funnel across tailscale
tree log patch
tailproxy: add host option Signed-off-by: jolheiser <git@jolheiser.com>
Signature
-----BEGIN SSH SIGNATURE----- U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgBTEvCQk6VqUAdN2RuH6bj1dNkY oOpbPWj+jw4ua1B1cAAAADZ2l0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5 AAAAQF90LPoYt42a3tX3igP9Ks9AulkPi+19vd6DeHVJYmazbhuBmLEHz7nx3wETy4oTxp kyuYADpqeCIzD2L/H2IQM= -----END SSH SIGNATURE-----
jolheiser <git@jolheiser.com>
13 hours ago
3 changed files, 14 additions(+), 4 deletions(-)
cmd/tailproxy/main.goflake.locknix/module.nix
M cmd/tailproxy/main.go -> cmd/tailproxy/main.go
 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
28
29
30
31
32
33
34
diff --git a/cmd/tailproxy/main.go b/cmd/tailproxy/main.go
index fd08e895ac2ae318c3c552ac524cd96578671279..0980a332edeb205a69b83aeb19d4d1b38fa21650 100644
--- a/cmd/tailproxy/main.go
+++ b/cmd/tailproxy/main.go
@@ -17,25 +17,28 @@ 	Hostname string
 	AuthKey  string
 	Funnel   bool
 	DataDir  string
+	Host     string
 	Port     int
 }
 
 func main() {
 	args := &Args{
 		DataDir: ".tailproxy",
+		Host:    "localhost",
 	}
 	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.StringVar(&args.Host, "host", args.Host, "Host to proxy")
 	fs.IntVar(&args.Port, "port", args.Port, "Port to proxy")
 	if err := fs.Parse(os.Args[1:]); err != nil {
 		panic(err)
 	}
 	os.Setenv("TS_AUTHKEY", args.AuthKey)
 
-	proxyURL, err := url.Parse(fmt.Sprintf("http://localhost:%d", args.Port))
+	proxyURL, err := url.Parse(fmt.Sprintf("http://%s:%d", args.Host, args.Port))
 	if err != nil {
 		panic(err)
 	}
M flake.lock -> flake.lock
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
diff --git a/flake.lock b/flake.lock
index 43f5d18754de728e604375a24a2e67a1e54960f3..da719b6cb09c64334ae1ba1ecf90af52587095f2 100644
--- a/flake.lock
+++ b/flake.lock
@@ -2,11 +2,11 @@ {
   "nodes": {
     "nixpkgs": {
       "locked": {
-        "lastModified": 1754800730,
-        "narHash": "sha256-HfVZCXic9XLBgybP0318ym3cDnGwBs/+H5MgxFVYF4I=",
+        "lastModified": 1788922888,
+        "narHash": "sha256-QMX3uerxnW2R5dHcWpIQILHDltOZnon3x3Spq7EzBFI=",
         "owner": "nixos",
         "repo": "nixpkgs",
-        "rev": "641d909c4a7538f1539da9240dedb1755c907e40",
+        "rev": "a391f95d4557d685fd8e5dc0d4b1f9271aa2f342",
         "type": "github"
       },
       "original": {
M nix/module.nix -> nix/module.nix
 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
diff --git a/nix/module.nix b/nix/module.nix
index d3cee8a2bf9e68f56a3b954d9653d20c62a9b618..4c8391307d156b2f4c72ee8b714f85cc48151f82 100644
--- a/nix/module.nix
+++ b/nix/module.nix
@@ -46,6 +46,12 @@           description = "tsnet data directory";
           default = "/var/lib/tailproxy-${name}";
         };
 
+        host = mkOption {
+          type = types.str;
+          description = "Host to proxy";
+          default = "localhost";
+        };
+
         port = mkOption {
           type = types.int;
           description = "Port to proxy";
@@ -90,6 +96,7 @@                 ]
                 ++ [
                   (lib.optionalString instanceCfg.funnel "--funnel")
                   "--hostname=${instanceCfg.hostname}"
+                  "--host=${instanceCfg.host}"
                   "--port=${builtins.toString instanceCfg.port}"
                   "--data-dir=${instanceCfg.dataDir}"
                 ];