Raw calls¶
Source ยท Depends on the socket
A 70-line varlinkctl call: invoke any method with JSON parameters, with
-more for streams and -oneway for fire-and-forget. It exercises every call
shape of the core package with json.RawMessage in and out.
Run it¶
go run ./examples/raw-call /run/systemd/journal/io.systemd.journal org.varlink.service.GetInfo
go run ./examples/raw-call -more /run/systemd/userdb/io.systemd.Multiplexer \
io.systemd.UserDatabase.GetUserRecord '{"service":"io.systemd.Multiplexer"}'
Output (real, systemd-journald v255)
{
"vendor": "The systemd Project",
"product": "systemd (systemd-journald)",
"version": "255 (255.4-1ubuntu8.17)",
"url": "https://systemd.io/",
"interfaces": [
"io.systemd",
"io.systemd.Journal",
"org.varlink.service"
]
}
The code¶
How it works¶
json.RawMessagein and out. Parameters pass through untouched, and replies decode intojson.RawMessage, so the tool works with any method.- Three call shapes:
Call(one reply),Stream(setsmore, yields*varlink.Reply),Oneway(no reply). r.Close()releases any file descriptors a streamed reply carried, since this tool never decodes them.- Errors print their qualified name and raw parameters from
*varlink.Error.