Skip to content

Commit

Permalink
feat: add socket path option
Browse files Browse the repository at this point in the history
  • Loading branch information
SamyDjemai committed Nov 13, 2024
1 parent c60c459 commit 20eab40
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/TailscaleManager.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ data TailscaleManagerOptions
{ configFile :: FilePath
, dryRun :: Bool
, tailscaleCmd :: FilePath
, socketPath :: FilePath
, interval :: Seconds
, maxShrinkRatio :: Double
}
Expand Down Expand Up @@ -68,6 +69,11 @@ tsManagerOptions =
<> help "Path to the tailscale executable"
<> value "tailscale"
<> showDefault)
<*> strOption (long "socket"
<> metavar "SOCKET_PATH"
<> help "Path to the tailscaled socket"
<> value "/var/run/tailscale/tailscaled.sock"
<> showDefault)
<*> option auto (long "interval"
<> metavar "INT"
<> help "Interval (in seconds) between runs. 0 means exit after running once."
Expand Down Expand Up @@ -128,7 +134,7 @@ runOnce options prevRoutes = do
let shrinkage = shrinkRatio prevRoutes newRoutes
if shrinkage < maxShrinkRatio options
then do
invokeTailscale $ ["set", "--advertise-routes=" ++ intercalate "," (map show $ S.toList newRoutes)] ++ tsExtraArgs config
invokeTailscale $ ["--socket=" ++ socketPath options, "set", "--advertise-routes=" ++ intercalate "," (map show $ S.toList newRoutes)] ++ tsExtraArgs config
logDelay
return newRoutes
else do
Expand Down

0 comments on commit 20eab40

Please sign in to comment.