67 lines
2.2 KiB
Markdown
67 lines
2.2 KiB
Markdown
# TSParams
|
|
|
|
A simple Python utility to reconstruct the `tailscale up` command arguments based on the current system preferences. It reads the output of `tailscale debug prefs` and generates the corresponding command string, handling specific logic for routes, DNS settings, and exit nodes.
|
|
|
|
## Features
|
|
|
|
The script currently parses and handles the following Tailscale parameters:
|
|
|
|
| CLI Value | Default |
|
|
| --- | --- |
|
|
| `--accept-routes` | `false` |
|
|
| `--accept-dns=false` | `true` |
|
|
| `--advertise-routes` | `[]` |
|
|
| `--advertise-exit-node` | `false` |
|
|
|
|
## Installation
|
|
|
|
### Arch Linux (AUR)
|
|
The package is available in the Arch User Repository.<br>
|
|
https://aur.archlinux.org/packages/tsparams<br>
|
|
You can install it using your preferred AUR helper, for example:
|
|
```bash
|
|
yay -S tsparams
|
|
```
|
|
More installation methods to come.
|
|
|
|
### Manual Installation
|
|
Since this is a Python script, it does not require compilation.
|
|
|
|
1. Download the script `tsparams.py`.
|
|
2. Rename it to `tsparams` (optional, but recommended for command usage).
|
|
3. Make it executable: `chmod +x tsparams`
|
|
4. Place it in a directory included in your `$PATH` variable.
|
|
|
|
System-wide installation:
|
|
```bash
|
|
sudo cp tsparams /usr/bin/tsparams
|
|
```
|
|
Local installation (recommended for non-root users):
|
|
```bash
|
|
mkdir -p ~/.local/bin
|
|
cp tsparams ~/.local/bin/tsparams
|
|
```
|
|
|
|
Ensure `~/.local/bin` is in your PATH.
|
|
|
|
## Building
|
|
|
|
This project is a pure Python script. No building or compilation steps are required. Simply ensure the file has execute permissions and is placed in a directory accessible by your shell. Refer to the [Installation](#installation) section for details.
|
|
|
|
## Usage
|
|
|
|
Run the command directly. It will execute `tailscale debug prefs` internally, parse the JSON output, and print the reconstructed command string to stdout.
|
|
```bash
|
|
tsparams
|
|
```
|
|
Example Output:
|
|
|
|
If your current Tailscale preferences have `CorpDNS` set to false and are advertising the route `192.168.1.0/24`, the output will look like this:
|
|
```bash
|
|
tailscale up --accept-dns=false --advertise-routes=192.168.1.0/24
|
|
```
|
|
If you are advertising an exit node (`0.0.0.0/0`) and a specific route:
|
|
```bash
|
|
tailscale up --advertise-exit-node --advertise-routes=192.168.1.0/24
|
|
```
|