powerline-tailscale


Namepowerline-tailscale JSON
Version 1.0.2 PyPI version JSON
download
home_page
SummaryA Powerline segment for showing the status of Tailscale
upload_time2023-09-22 11:30:12
maintainer
docs_urlNone
authorÜllar Seerme
requires_python>=3.9
licenseMIT
keywords powerline tailscale
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # Powerline Tailscale

<p align="center">
    <em>A Powerline segment for showing the status of Tailscale</em>
</p>
<p align="center">
    <a href="https://pypi.org/project/powerline-tailscale" target="_blank">
        <img src="https://img.shields.io/pypi/v/powerline-tailscale?color=%2334D058&label=pypi%20package" alt="Package version">
    </a>
    <a href="https://pypi.org/project/powerline-tailscale" target="_blank">
        <img src="https://img.shields.io/pypi/pyversions/powerline-tailscale.svg?color=%2334D058" alt="Supported Python versions">
    </a>
</p>

![Powerline Tailscale - animated GIF demo](examples/demo.gif)

Since Tailscale doesn't (seemingly) have a configuration file where it reads and stores state, this segment implementation relies on the `tailscaled` API server. I haven't found any official documentation regarding it, but its capabilities are available [here](https://github.com/tailscale/tailscale/blob/c08cf2a9c6209e4fdef896921af66bbe737b8a24/ipn/localapi/localapi.go). There exists a Python library to interact with this API in limited form called ['tailscale-localapi'](https://github.com/apognu/tailscale-localapi), though I decided against using it because I didn't want to introduce any Python-specific dependencies; this is something I may reconsider in the future keeping in mind that the current implementation relies on `curl` instead.

## Requirements

Besides having Tailscale installed according to the [official documentation](https://tailscale.com/kb/installation/), it is also necessary to install `curl` at either 7.40.0 or above, which is when the `--unix-socket` flag was introduced. You can check your version of `curl` with the `--version` flag:

```console
$ curl --version
curl 7.85.0 (x86_64-redhat-linux-gnu) libcurl/7.85.0 OpenSSL/3.0.9 zlib/1.2.12 brotli/1.0.9 libidn2/2.3.4 libpsl/0.21.1 (+libidn2/2.3.3) libssh/0.10.5/openssl/zlib nghttp2/1.51.0
Release-Date: 2022-08-31
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL threadsafe TLS-SRP UnixSockets
```

If `curl` or Tailscale isn't installed or `tailscaled` isn't running, then installing and configuring this segment will have no effect.

## Installation

Using Pip:

```bash
pip install powerline-tailscale
```

## Configuration

Only three highlight groups are necessary to be defined in order for `powerline-tailscale` to work. These can be set up in `~/.config/powerline/colorschemes/default.json`. You are free to choose any colors you want.

```json
{
  "name": "Default",
    "groups": {
      "tailscale":                 { "fg": "white", "bg": "gray2","attrs": [] },
      "tailscale_exitnode":        { "fg": "white", "bg": "steelblue","attrs": [] },
      "tailscale:divider":         { "fg": "white", "bg": "steelblue", "attrs": [] }
    }
}
```

After that, add the segment's configuration by modifying the relevant Powerline theme. If you are using the default, then in `~/.config/powerline/themes/shell/default.json`:

```json
{
  "function": "powerline_tailscale.tailscale",
    "args": {
      "show_profile_name": true,
      "show_exit_node_status": false,
      "show_exit_node": true
  }
}
```

Now, just reload Powerline using `powerline-daemon --replace`.

### Options

* `show_profile_name` shows either:
  * "logged out" if `tailscaled` is running, but no account is logged in;
  * "default" if no profile is created, i.e. the log-in hasn't been done with `tailscale login --nickname=<name>`;
  * or the name of the profile itself;
* `show_exit_node_status` shows a boolean "exit node (y)" or "exit node (n)" depending on whether connected to an exit node through `tailscale up --exit-node="<IP>"`
* `show_exit_node` shows the actual IP address of the exit node as given to `tailscale up --exit-node="<IP>"`
  * the `show_exit_node_status` option needs to be set to `false` when this option is set to `true`
  * if not connected to an exit node, then "exit node (n)" is shown

### Disabling

By default the segment will always be displayed, but you may wish to toggle it instead. This can be done through a Bash function, which unsets or sets an environment variable that the segment reads:

```bash
function plts() {
  if [[ $POWERLINE_TAILSCALE = "0" ]]; then
    unset POWERLINE_TAILSCALE
  else
    export POWERLINE_TAILSCALE=0
  fi
}
```

You can add this function to your `~/.bashrc` file, source it using `source ~/.bashrc`, and then toggle the segment using `plts` or whatever you chose for the name of the function. This function name can also be Tab-completed.

If you want to start your shell sessions _without_ having this segment, then add `export POWERLINE_TAILSCALE="0"` somewhere in `~/.bashrc`.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "powerline-tailscale",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "powerline,tailscale",
    "author": "\u00dcllar Seerme",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/4a/a2/7055226794d722e2c638bc5a5f785bafead7303ebd97aad3c3c0b9005788/powerline-tailscale-1.0.2.tar.gz",
    "platform": null,
    "description": "# Powerline Tailscale\n\n<p align=\"center\">\n    <em>A Powerline segment for showing the status of Tailscale</em>\n</p>\n<p align=\"center\">\n    <a href=\"https://pypi.org/project/powerline-tailscale\" target=\"_blank\">\n        <img src=\"https://img.shields.io/pypi/v/powerline-tailscale?color=%2334D058&label=pypi%20package\" alt=\"Package version\">\n    </a>\n    <a href=\"https://pypi.org/project/powerline-tailscale\" target=\"_blank\">\n        <img src=\"https://img.shields.io/pypi/pyversions/powerline-tailscale.svg?color=%2334D058\" alt=\"Supported Python versions\">\n    </a>\n</p>\n\n![Powerline Tailscale - animated GIF demo](examples/demo.gif)\n\nSince Tailscale doesn't (seemingly) have a configuration file where it reads and stores state, this segment implementation relies on the `tailscaled` API server. I haven't found any official documentation regarding it, but its capabilities are available [here](https://github.com/tailscale/tailscale/blob/c08cf2a9c6209e4fdef896921af66bbe737b8a24/ipn/localapi/localapi.go). There exists a Python library to interact with this API in limited form called ['tailscale-localapi'](https://github.com/apognu/tailscale-localapi), though I decided against using it because I didn't want to introduce any Python-specific dependencies; this is something I may reconsider in the future keeping in mind that the current implementation relies on `curl` instead.\n\n## Requirements\n\nBesides having Tailscale installed according to the [official documentation](https://tailscale.com/kb/installation/), it is also necessary to install `curl` at either 7.40.0 or above, which is when the `--unix-socket` flag was introduced. You can check your version of `curl` with the `--version` flag:\n\n```console\n$ curl --version\ncurl 7.85.0 (x86_64-redhat-linux-gnu) libcurl/7.85.0 OpenSSL/3.0.9 zlib/1.2.12 brotli/1.0.9 libidn2/2.3.4 libpsl/0.21.1 (+libidn2/2.3.3) libssh/0.10.5/openssl/zlib nghttp2/1.51.0\nRelease-Date: 2022-08-31\nProtocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp \nFeatures: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL threadsafe TLS-SRP UnixSockets\n```\n\nIf `curl` or Tailscale isn't installed or `tailscaled` isn't running, then installing and configuring this segment will have no effect.\n\n## Installation\n\nUsing Pip:\n\n```bash\npip install powerline-tailscale\n```\n\n## Configuration\n\nOnly three highlight groups are necessary to be defined in order for `powerline-tailscale` to work. These can be set up in `~/.config/powerline/colorschemes/default.json`. You are free to choose any colors you want.\n\n```json\n{\n  \"name\": \"Default\",\n    \"groups\": {\n      \"tailscale\":                 { \"fg\": \"white\", \"bg\": \"gray2\",\"attrs\": [] },\n      \"tailscale_exitnode\":        { \"fg\": \"white\", \"bg\": \"steelblue\",\"attrs\": [] },\n      \"tailscale:divider\":         { \"fg\": \"white\", \"bg\": \"steelblue\", \"attrs\": [] }\n    }\n}\n```\n\nAfter that, add the segment's configuration by modifying the relevant Powerline theme. If you are using the default, then in `~/.config/powerline/themes/shell/default.json`:\n\n```json\n{\n  \"function\": \"powerline_tailscale.tailscale\",\n    \"args\": {\n      \"show_profile_name\": true,\n      \"show_exit_node_status\": false,\n      \"show_exit_node\": true\n  }\n}\n```\n\nNow, just reload Powerline using `powerline-daemon --replace`.\n\n### Options\n\n* `show_profile_name` shows either:\n  * \"logged out\" if `tailscaled` is running, but no account is logged in;\n  * \"default\" if no profile is created, i.e. the log-in hasn't been done with `tailscale login --nickname=<name>`;\n  * or the name of the profile itself;\n* `show_exit_node_status` shows a boolean \"exit node (y)\" or \"exit node (n)\" depending on whether connected to an exit node through `tailscale up --exit-node=\"<IP>\"`\n* `show_exit_node` shows the actual IP address of the exit node as given to `tailscale up --exit-node=\"<IP>\"`\n  * the `show_exit_node_status` option needs to be set to `false` when this option is set to `true`\n  * if not connected to an exit node, then \"exit node (n)\" is shown\n\n### Disabling\n\nBy default the segment will always be displayed, but you may wish to toggle it instead. This can be done through a Bash function, which unsets or sets an environment variable that the segment reads:\n\n```bash\nfunction plts() {\n  if [[ $POWERLINE_TAILSCALE = \"0\" ]]; then\n    unset POWERLINE_TAILSCALE\n  else\n    export POWERLINE_TAILSCALE=0\n  fi\n}\n```\n\nYou can add this function to your `~/.bashrc` file, source it using `source ~/.bashrc`, and then toggle the segment using `plts` or whatever you chose for the name of the function. This function name can also be Tab-completed.\n\nIf you want to start your shell sessions _without_ having this segment, then add `export POWERLINE_TAILSCALE=\"0\"` somewhere in `~/.bashrc`.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Powerline segment for showing the status of Tailscale",
    "version": "1.0.2",
    "project_urls": {
        "Documentation": "https://github.com/usrme/powerline-tailscale",
        "Homepage": "https://github.com/usrme/powerline-tailscale",
        "Repository": "https://github.com/usrme/powerline-tailscale"
    },
    "split_keywords": [
        "powerline",
        "tailscale"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "af38aa3523b289eba8bdfd947b044438a53e3a6cf0077f884dd8973cbd772eda",
                "md5": "f23a7a00ca57a362b0139df0539107f8",
                "sha256": "a3adee64b224b82e3ab5963d43b4f8035526fa8658fbfb593333529cbfafff34"
            },
            "downloads": -1,
            "filename": "powerline_tailscale-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f23a7a00ca57a362b0139df0539107f8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 6334,
            "upload_time": "2023-09-22T11:30:10",
            "upload_time_iso_8601": "2023-09-22T11:30:10.948819Z",
            "url": "https://files.pythonhosted.org/packages/af/38/aa3523b289eba8bdfd947b044438a53e3a6cf0077f884dd8973cbd772eda/powerline_tailscale-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4aa27055226794d722e2c638bc5a5f785bafead7303ebd97aad3c3c0b9005788",
                "md5": "f5c5e67c86c2ca99ee0581cbe12f7dfc",
                "sha256": "f53001e664a858f1b4201a62f92b5cb496ee844209d1cdfc558948fdfe13eb13"
            },
            "downloads": -1,
            "filename": "powerline-tailscale-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "f5c5e67c86c2ca99ee0581cbe12f7dfc",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 6522,
            "upload_time": "2023-09-22T11:30:12",
            "upload_time_iso_8601": "2023-09-22T11:30:12.398589Z",
            "url": "https://files.pythonhosted.org/packages/4a/a2/7055226794d722e2c638bc5a5f785bafead7303ebd97aad3c3c0b9005788/powerline-tailscale-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-22 11:30:12",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "usrme",
    "github_project": "powerline-tailscale",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "powerline-tailscale"
}
        
Elapsed time: 0.13223s