Skip to content

Commit

Permalink
docs: remove repeats
Browse files Browse the repository at this point in the history
  • Loading branch information
grishy committed Aug 8, 2023
1 parent 3108382 commit 0873a49
Showing 1 changed file with 21 additions and 51 deletions.
72 changes: 21 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,12 @@

It is a simple and lightweight project that allows you to publish CNAME records pointing to the local host over multicast DNS using the **Avahi** daemon, which is widely available in most Linux distributions. This means that you can access your local host using different names from any device on the same network, as long as they support Apple’s Bonjour protocol, which is compatible with Avahi.

## TLDR
## TL;DR

Forward all subdomains from machine to machine( `*.hostname.local` -> `hostname.local`)
Forward all subdomains current to machine( `*.hostname.local` -> `hostname.local`)

1. _Binary_ `./go-avahi-cname subdomain`
2. _Docker_ `docker run -d -v "/var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket" ghcr.io/grishy/go-avahi-cname:v2.0.0`

## Modes

- **Subdomain reply** - _I think you want this._ We listen to the traffic and if someone asks `*.hostname.local` (example: `name1.hostname.local`), we "redirect" to `hostname.local`.
- **Interval publishing** - With some frequency, we send out information about all `name1.hostname.local`, `name2.hostname.local`...
2. _Docker_ `docker run -d --network host -v "/var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket" ghcr.io/grishy/go-avahi-cname:v2.0.0`

## Goals

Expand All @@ -30,6 +25,11 @@ Here are some of the benefits of using go-avahi-cname:
- **✅ Support x86_64 and ARM**
- **✅ Install as binaries or containers**

## Modes

- **Subdomain reply** - _I think you want this._ We listen to the traffic and if someone asks `*.hostname.local` (example: `name1.hostname.local`), we "redirect" to `hostname.local`.
- **Interval publishing** - With some frequency, we send out information about all `name1.hostname.local`, `name2.hostname.local`...

---

# How does it work?
Expand Down Expand Up @@ -102,58 +102,29 @@ This will create three CNAME records pointing to your local host:

You can then access your local host using any of these names from other devices on the same network.

## How to use and install?

You can specify any number of CNAMEs as arguments when running go-avahi-cname, with no length limit.
You can use either just the name (`name1`), which will create a record as a subdomain for the current machine, or you can write the full FQDN (`name1.hostname.local.` domain with a dot on the end) format.

For example, if your machine’s hostname is lab, you can run:

```plain
> ./go-avahi-cname git photo.local. example.lab.local.
2023/07/27 08:37:14 Creating publisher
2023/07/27 08:37:14 Formating CNAMEs:
2023/07/27 08:37:14 > 'git.lab.local.' (added current FQDN)
2023/07/27 08:37:14 > 'photo.local.'
2023/07/27 08:37:14 > 'example.lab.local.'
2023/07/27 08:37:14 Publishing every 5m0s and CNAME TTL=600s.
^C
2023/07/27 08:37:16 Closing publisher...
```

This will create three CNAME records pointing to your local host:

- `git.lab.local.`
- `photo.local.`
- `example.lab.local.`

You can then access your local host using any of these names from other devices on the same network.

### Installation options
## Installation options

There are two ways to install and run go-avahi-cname:

#### Binary
### Binary

Binary files can be taken as artifacts for [the Release](https://github.com/grishy/go-avahi-cname/releases). In this case, it would be better to create a systemd service.

#### Container
### Container

The images for each version are in [the Packages section](https://github.com/grishy/go-avahi-cname/pkgs/container/go-avahi-cname).
You need to provide the `/var/run/dbus/system_bus_socket` file to the container to be able to communicate with the host's Avahi daemon.

One-liner to run the container `v0.3.1`:
Docker Composer example:

```bash
> docker run --restart=unless-stopped -d -v /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket ghcr.io/grishy/go-avahi-cname:v0.3.1 name1 name2.lab.local.
5a19790e06cca93016af6651d7af4046c24095a6909ace2fe26c3451fb98ceee

> docker logs 5a19790e06cca93016af6651d7af4046c24095a6909ace2fe26c3451fb98ceee
2023/07/27 08:49:02 Creating publisher
2023/07/27 08:49:02 Formating CNAMEs:
2023/07/27 08:49:02 > 'name1.lab.local.' (added current FQDN)
2023/07/27 08:49:02 > 'name2.lab.local.'
2023/07/27 08:49:02 Publishing every 5m0s ans CNAME TTL=600s.
```yaml
version: "3.3"
services:
go-avahi-cname:
network_mode: host
volumes:
- "/var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket"
image: "ghcr.io/grishy/go-avahi-cname:v2.0.0"
```
Ansible task to run the container:
Expand All @@ -162,11 +133,10 @@ Ansible task to run the container:
- name: go-avahi-cname | Start container
community.docker.docker_container:
name: "go-avahi-cname"
image: "ghcr.io/grishy/go-avahi-cname:v0.3.1"
image: "ghcr.io/grishy/go-avahi-cname:v2.0.0"
restart_policy: unless-stopped
volumes:
- "/var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket" # access to avahi-daemon
command: "name1 name2 git"
```
## Source of inspiration
Expand Down

0 comments on commit 0873a49

Please sign in to comment.