-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mdns: add mdns for local network routing (#511)
This PR implements [mDNS](https://en.wikipedia.org/wiki/Multicast_DNS) for vere, significantly improving Urbit routing inside local networks. On startup vere will now broadcast a service with the format `dinleb-rambep._ames._udp.local`. Vere will also listen for any services on the local network with the signature of `_ames._udp`. Whenever new services are found vere will send the lane to arvo. On macOS we can use [Bonjour](https://developer.apple.com/bonjour/) and don't need to pull down any dependencies at all. On Linux we can use [Avahi](https://www.avahi.org/), specifically the bonjour compatibility layer. The header we're using is [dns_sd.h](https://github.com/lathiat/avahi/blob/master/avahi-compat-libdns_sd/dns_sd.h), [documented here](https://developer.apple.com/library/archive/documentation/Networking/Conceptual/dns_discovery_api/Introduction.html#//apple_ref/doc/uid/TP40002475-SW1). Tested on macos aarch64 and linux x86_64 so far. To try it out, build vere from this PR, start a fakezod and observe: ``` # macos dns-sd -B _ames._udp # linux avahi-browse -r _ames._udp ``` You can also start another fake ship on the same network and do `|ames-verb %rcv %odd` to see your fakeships find eachother. For this second part you need the companion arvo PR, here's a pill that has it already: ``` ./urbit -F zod -u https://urbit-foundation.s3.us-east-2.amazonaws.com/dear.pill ```
- Loading branch information
Showing
13 changed files
with
2,102 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make") | ||
|
||
filegroup( | ||
name = "all", | ||
srcs = glob(["**"]), | ||
) | ||
|
||
cc_library( | ||
name = "dns-sd", | ||
hdrs = ["dns_sd.h"], | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
configure_make( | ||
name = "avahi", | ||
args = select({ | ||
"@platforms//os:macos": ["--jobs=`sysctl -n hw.logicalcpu`"], | ||
"//conditions:default": ["--jobs=`nproc`"], | ||
}), | ||
configure_options = ["--with-dbus-system-address='unix:path=/var/run/dbus/system_bus_socket' --with-xml=none --disable-libevent --disable-glib --disable-gobject --disable-gdbm --disable-qt3 --disable-qt4 --disable-qt5 --disable-gtk --disable-gtk3 --disable-mono --disable-monodoc --disable-python --disable-libdaemon --enable-compat-libdns_sd --disable-rpath"], | ||
lib_source = ":all", | ||
# out_include_dir = "avahi-compat-libdns_sd", | ||
deps = ["@dbus"], | ||
configure_in_place = True, | ||
autogen = True, | ||
autoconf = True, | ||
autogen_command = "bootstrap.sh", | ||
out_static_libs = ["libdns_sd.a", "libavahi-client.a", "libavahi-common.a"], | ||
visibility = ["//visibility:public"], | ||
) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make") | ||
|
||
filegroup( | ||
name = "all", | ||
srcs = glob(["**"]), | ||
) | ||
|
||
configure_make( | ||
name = "dbus", | ||
lib_name = "libdbus-1", | ||
args = select({ | ||
"@platforms//os:macos": ["--jobs=`sysctl -n hw.logicalcpu`"], | ||
"//conditions:default": ["--jobs=`nproc`"], | ||
}), | ||
copts = ["-O3"], | ||
configure_options = ["--disable-selinux --without-x --disable-tests"], | ||
lib_source = ":all", | ||
configure_in_place = True, | ||
deps = ["@expat"], | ||
visibility = ["//visibility:public"], | ||
) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make") | ||
|
||
filegroup( | ||
name = "all", | ||
srcs = glob(["**"]), | ||
) | ||
|
||
configure_make( | ||
name = "expat", | ||
args = select({ | ||
"@platforms//os:macos": ["--jobs=`sysctl -n hw.logicalcpu`"], | ||
"//conditions:default": ["--jobs=`nproc`"], | ||
}), | ||
copts = ["-O3"], | ||
lib_source = ":all", | ||
out_static_libs = ["libexpat.a"], | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.