Giter Site home page Giter Site logo

josegonzalez / go-avahi-register Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 84 KB

A tool for registering services against avahi/bonjour

License: MIT License

Makefile 34.71% Go 63.39% Shell 1.89%
avahi avahi-register avahi-service bonjour registering-services schema

go-avahi-register's Introduction

go-avahi-register build status

A tool for registering services against avahi/bonjour.

Requirements

  • A Linux distribution: This project may work on other systems, but has only been tested on Linux.
  • The avahi-daemon package: This may be installed on Debian-based systems via apt-get

Installation

Install it using the "go get" command:

go get github.com/josegonzalez/go-avahi-register

Configuration

go-avahi-register supports a single configuration file can be specified via the --config flag. By default, this value is set to /etc/avahi-register/config.$FORMAT, where $FORMAT is one of the following (detected in order):

  • json
  • yml
  • yaml

Create a config.yml file. This file will contain all services that will be registered to the current IP address. An example is as follows:

---
services:
- name: nodejs-express
  port: 80
  scheme: http
- name: personal-apt-repository
  port: 80
  scheme: apt
- name: awesome-ntp-server
  port: 123
  scheme: ntp
  protocol: udp

Service Schema

The schema for a service is as follows:

  • name: required
    • type: string
    • description: The name of the service to register.
  • port: optional
    • type: int
    • default: 80
    • description: The port on which the service is listening.
  • scheme: optional
    • type: string
    • default: http
    • description: A scheme that will be used to register an avahi service-type.
  • protocol: optional
    • type: string
    • default: tcp
    • description: A protocol that will be used to register an avahi service-type. If the scheme is http or http, the protocol must be tcp.

Usage

Running avahi-register

Using the above config file, avahi-register may be triggered as follows:

avahi-register run

By default, avahi-register will register against the first network interface with an IPv4 IP Address that is not a loopback device. In the case where this may be ambiguous or result in the wrong IP Address being selected, the value may be overriden with the -ip-address flag:

avahi-register run --ip-address 192.168.1.2

The avahi-register process responds to signals, and will reload the config file on SIGHUP or when the file is changed. Note that an invalid config file will result in a hard crash of avahi-register.

Adding a new entry

The add command can be used to add a new entry:

avahi-register add --name irc

See the avahi-register add --help output for more information.

Cat the config

The cat command can be used to display the config file:

avahi-register cat

See the avahi-register cat --help output for more information.

Initialize a config

The init command can be used to initialize a config file:

avahi-register init

See the avahi-register init --help output for more information.

Removing an entry

The remove command can be used to remove an entry:

avahi-register remove --name irc

See the avahi-register remove --help output for more information.

Showing the config

The show-config command can be used to display a human readable version of the config:

avahi-register show-config

See the avahi-register show-config --help output for more information.

go-avahi-register's People

Contributors

dependabot[bot] avatar josegonzalez avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.