scott-ainsworth / avahi-aliases-rs Goto Github PK
View Code? Open in Web Editor NEWAnnounce Avahi aliases (CNAMEs) on your local network.
License: GNU Lesser General Public License v2.1
Announce Avahi aliases (CNAMEs) on your local network.
License: GNU Lesser General Public License v2.1
Currently, avahi-alias-deamon
polls for changes to /etc/avahi/avahi-aliases
, which is primitive and inefficient. Two possibilities for change detection are subscribing to file system events, signalling, and service restart.
Event subscription: File system event subscription is efficient. However, it varies by operating system and can fail (e.g., due to capacity limits). Thus, a fall back is needed. The fall back could be polling or signaling.
Signalling: Sending a daemon a HUP signal is a long-standing method to have a daemon reload data. However, it only notifies under limited circumstances. In this case, when avahi-alias
makes changes. Editing the aliases files directly will not send a signal to the daemon. Thus, a fall back is needed. This is likely to be service restart.
Service Restart: This is built in to both systemd and init.d.
Moving unit tests into submodules eliminates false "not used" messages.
options
unit testslines
unit testsThe visibility and naming of modules, structs, functions, etc. in the avahi-aliases library evolved somewhat randomly over time.
Currently, the library is a mix of specialized support for the binaries (avahi-alias
and avahi-alias-daemon
) and a rudimentary Avahi D-Bus client. Separating the Avahi D-Bus client code will simplify using a third-party library of generated code. Additionally, the generated D-Bus code should be a submodule of the Avahi D-Bus client.
Testing line coverage on the library is spotty.
For the daemon, the option to send log entries to syslog (vice the console) is needed.
init_syslog()
The syslog
module can generate multiple error types.
LoggingError
enum to manage the error types.LoggingError
is the original error wrapper and is now OBE. Merge it into ErrorWrapper
.
SyslogError
and SetLoggerError
into ErrorWrapper
.new_...
functions.LoggingError
.avahi-alias
.avahi-alias-daemon
(if needed).Currently, a Makefile file is to strip release binaries. However, Cargo now has this built in (requires +nightly
).
Requirements
Currently avahi-alias-daemon
checks for alias file changes every 5 seconds.
--poll-interval
command line option.avahi-alias
could signal a change (HUP?) #37avahi-alias
does not set exit status. Set exit status to 0 on success and 1 on error.
The avahi-alias
command displays error message (e.g., "No such file or directory") in debug form. They should be displayed in a more human-friendly form.
The messaging
lacks unit tests.
compute_log_level()
function.Functionality
--ttl
option to the daemon #46--timeout
options to the daemon #47avahi-alias
#53--poling-interval,
--timeout, and
--ttl` #56Process and Delivery
avahi-alias
Command Line Utility Requirementsavahi-alias
command).avahi-alias-daemon
Requirements--poll-time
option, default: 5 sec.). #36README.md
. #1--file
option, default: /etc/avahi/avahi-aliases)--verbose
option or --quiet
option, default: false)--debug
option, default: false)Currently, an alias comprises all provided characters less leading and trailing whitespace. This can yield invalid aliases (e.g., my alias.local
)
avahi-alias list
must flag invalid aliases in the alias listing.avahi-alias add
must make no changes when invalid aliases are found on the command line or in the aliases file.avahi-alias remove
must make no changes when invalid aliases are found on the command line.avahi-alias remove
must make no changes when invalid aliases are found in the aliases files unless the --remove-invalid
option is specified.avahi-alias remove --force
must remove all invalid aliases from the aliases file.avahi-alias-daemon
must log and ignore invalid aliases found in the aliases file..local
CNAMES are allowed by the specification or in practical application. Since RFC 6762 indicates that using Multicast DNS for non-.local
domains is a fail-over option that should be disabled by default, version 1 will only allow .local
CNAMES.When the avahi-aliases
file is empty, avahi-aliases-daemon
attempts to commit the Avahi entry group anyway. The commit returns an is-empty status, which is interpreted as a failure. Instead, a warning should be logged and the daemon should continue to execute.
Some other implementations of avahi-aliases support loading additional aliases from files in /etc/avahi/avahi-aliases.d
. Although avahi-alias
supports editing these files (using the --file option), avahi-alias-daemon
does not use them.
avahi-alias-daemon
to load aliases from files in /etc/avahi/avahi-aliases.d
.Logging for avahi-aliases
and avahi-aliases-daemon
differs only in the destination of the log entries. This difference can be handled through two separate initializations.
messaging
to logging
logging
into the libraryinit()
to init_console()
.Background
The D-Bus connection timeout is is currently fixed at 60 seconds.
Requirements
Currently there are no integration tests for the alias managers (avahi-alias
) or daemon (avahi-alias-daemon
).
Requirements
Determine which license(s) to allow. MIT and Apache are popular. Avahi itself is GNU Lesser.
Background
The time-to-live (TTL) for CNAMEs is currently fixed at 60 seconds.
Requirements
Write the initial README.md:
The aliases
module has only two structs yet the module is in a subdirectory. Consider moving the structs directly under src/
.
Upgrade the
sysinfo
package to 0.22.2 andsyslog
package to 6.0.0.Note: syslog
changes the type of syslog::Formatter3164::pid
from i32 to u32, while sysinfo::get_current_pid()
still return i32.
Currently, binaries must use AliasesFile
via its module (i.e., use aliases::AliasesFile
). Since the library is simple, exposing AliasesFile
directly.
Problem
Currently the --polling-interval
, --timeout
, and --ttl
options accept any u64
value.
Requirements
--polling-interval
: 10 – 60 seconds.--timeout
: 10 – 300 seconds.--ttl
: 0 – 231-1 seconds.Currently, lints are handled using the nightly version of Rust and enables lints only available in the nightly version. Additionally, many normally-allowed lints are enabled by adding #![warn(...)]
lines to the source (which is ugly).
Requirements
.cargo/config.toml
.The binaries (avahi-alias
and avahi-alias-daemon
) seem much larger than their functionality should require. There is much discussion of this, but no solutions for distribution that achieve anything comparable to C with shared libraries.
Currently, error::ErrorWrapper
borrows most string values. Since ErrorWrapper
needs to be passed up the stack for handling in user-aware code, this leads to nearly-impossible-to-resolve lifetime issues.
ErrorWrapper
enum variants to make copies of references.Technically, an alias is a CNAME. However, in Avahi CNAMEs have been called aliases for long enough for the term to stick. Thus, instead of using alias vice CNAME reduces the learning/communication curve.
The way CNAMEs are currently published is a hack inherited from the origin Python example. Modify the code to follow the rules.
The command-line options code originated in avahi-alias
. Parts are now duplicated in avahi-alias-daemon
. Achieve DRY principles by refactoring the code into the library:
options
module into the library.options
.options.Args
to options.CommandOpts
.CommonOpts
, Command
, and CommandOpts
.avahi-alias
to use CommandOpts
.avahi-alias-daemon
to use CommonOpts
.Requirements
AliasesFile
is central to the correct operation of both avahi-alias
and avahi-alias-daemon
. However, it lacks unit tests.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.