Discussion:
[avahi] {foo,bar}.local
Kai Hendry
2016-09-23 02:48:57 UTC
Permalink
Hi guys,

I'm looking to create several .local addresses that all resolve to my
own machine so I can host different named Web applications. Especially
useful for mobile dev from an iPhone.

E.g. https://github.com/kaihendry/myresponder

Could someone please let me know how I can achieve this? Many thanks!
jbagg
2016-09-23 12:51:50 UTC
Permalink
If you want to write minimal code, I suggest you use my Qt / c++ class
that wraps avahi-client

QZeroConf serviceA, serviceB, serviceC;

serviceA.startServicePublish("Service A", "_servicea._tcp", "local", 12345);
serviceB.startServicePublish("Service B", "_serviceb._tcp", "local", 12346);
serviceC.startServicePublish("Service C", "_servicec._tcp", "local",
12347);


https://github.com/jbagg/QtZeroConf

Jon
Post by Kai Hendry
Hi guys,
I'm looking to create several .local addresses that all resolve to my
own machine so I can host different named Web applications. Especially
useful for mobile dev from an iPhone.
E.g. https://github.com/kaihendry/myresponder
Could someone please let me know how I can achieve this? Many thanks!
_______________________________________________
avahi mailing list
https://lists.freedesktop.org/mailman/listinfo/avahi
--
Jonathan Bagg
Embedded Systems Developer
NAD Electronics | Lenbrook Industries Limited
633 Granite Court, Pickering, Ontario, Canada L1W 3K1 | 905-831-0799 ext 4478 | http://www.nadelectronics.com
Kai Hendry
2016-09-23 13:50:00 UTC
Permalink
Hi Jon,

Ideally I don't want to write any code. Isn't it simply a question of
writing some files to /etc/avahi/services ?

Cheers,
jbagg
2016-09-23 14:58:47 UTC
Permalink
Try this in a file under /etc/avahi/services/

<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name>Some Service</name>
<service>
<type>_test._tcp</type>
<port>11000</port>
</service>
</service-group>
Post by Kai Hendry
Hi Jon,
Ideally I don't want to write any code. Isn't it simply a question of
writing some files to /etc/avahi/services ?
Cheers,
_______________________________________________
avahi mailing list
https://lists.freedesktop.org/mailman/listinfo/avahi
--
Jonathan Bagg
Embedded Systems Developer
NAD Electronics | Lenbrook Industries Limited
633 Granite Court, Pickering, Ontario, Canada L1W 3K1 | 905-831-0799 ext 4478 | http://www.nadelectronics.com
Kai Hendry
2016-09-24 10:45:24 UTC
Permalink
Seems to create a new service in /etc/avahi/services/, but not a new
hostname, e.g. "foo.teefour.local" like I want.

After some trial and error, I figured out:

avahi-publish -a -R foo.teefour.local 192.168.1.25

and I guess I could put this in /etc/systemd/system but I hoped I
could define this stuff simply in /etc/avahi/services/
Figuring out one's IP address is a PITA for example.


I have now stumbled upon https://github.com/lathiat/avahi/issues/40
and https://gist.github.com/gdamjan/3168336
Also: https://github.com/airtonix/avahi-aliases &
https://github.com/jinnko/avahi-alias/blob/master/avahi-alias

There also seems to be references to
http://www.avahi.org/wiki/Examples/PythonPublishAlias which is 404
now.


Still I hoped this would be simpler. What a mess. Why isn't this
feature easier to use from Avahi?!

Loading...