# README
dbus
dbus is a simple library that implements native Go client bindings for the D-Bus message bus system.
Features
- Complete native implementation of the D-Bus message protocol
- Go-like API (channels for signals / asynchronous method calls, Goroutine-safe connections)
- Subpackages that help with the introspection / property interfaces
Installation
This packages requires Go 1.12 or later. It can be installed by running the command below:
go get github.com/godbus/dbus/v5
Usage
The complete package documentation and some simple examples are available at godoc.org. Also, the _examples directory gives a short overview over the basic usage.
Projects using godbus
- fyne a cross platform GUI in Go inspired by Material Design.
- fynedesk a full desktop environment for Linux/Unix using Fyne.
- go-bluetooth provides a bluetooth client over bluez dbus API.
- iwd go bindings for the internet wireless daemon "iwd".
- notify provides desktop notifications over dbus into a library.
- playerbm a bookmark utility for media players.
Please note that the API is considered unstable for now and may change without further notice.
License
go.dbus is available under the Simplified BSD License; see LICENSE for the full text.
Nearly all of the credit for this library goes to github.com/guelfey/go.dbus.
# Packages
Package introspect provides some utilities for dealing with the DBus introspection format.
Package prop provides the Properties struct which can be used to implement org.freedesktop.DBus.Properties.
# Functions
AuthAnonymous returns an Auth that uses the ANONYMOUS mechanism.
AuthCookieSha1 returns an Auth that authenticates as the given user with the DBUS_COOKIE_SHA1 mechanism.
AuthExternal returns an Auth that authenticates as the given user with the EXTERNAL mechanism.
Connect connects to the given address.
ConnectSessionBus connects to the session bus.
ConnectSystemBus connects to the system bus.
DecodeMessage tries to decode a single message in the D-Bus wire format from the given reader.
Dial establishes a new private connection to the message bus specified by address.
DialHandler establishes a new private connection to the message bus specified by address, using the supplied handlers.
EscapeBusAddressValue implements a requirement to escape the values in D-Bus server addresses, as defined by the D-Bus specification at https://dbus.freedesktop.org/doc/dbus-specification.html#addresses.
MakeVariant converts the given value to a Variant.
MakeVariantWithSignature converts the given value to a Variant.
NewConn creates a new private *Conn from an already established connection.
NewConnHandler creates a new private *Conn from an already established connection, using the supplied handlers.
NewDefaultHandler returns an instance of the defaultcall handler.
NewDefaultSignalHandler returns an instance of the defaultsignal handler.
NewSequentialSignalHandler returns an instance of a new signal handler that guarantees sequential processing of signals.
ParseSignature returns the signature represented by this string, or a SignatureError if the string is not a valid signature.
ParseSignatureMust behaves like ParseSignature, except that it panics if s is not valid.
ParseVariant parses the given string as a variant as described at https://developer.gnome.org/glib/stable/gvariant-text.html.
SessionBus returns a shared connection to the session bus, connecting to it if not already done.
SessionBusPrivate returns a new private connection to the session bus.
SessionBusPrivate returns a new private connection to the session bus.
SessionBusPrivate returns a new private connection to the session bus.
SignatureOf returns the concatenation of all the signatures of the given values.
SignatureOfType returns the signature of the given type.
Store copies the values contained in src to dest, which must be a slice of pointers.
SystemBus returns a shared connection to the system bus, connecting to it if not already done.
SystemBusPrivate returns a new private connection to the system bus.
SystemBusPrivateHandler returns a new private connection to the system bus, using the provided handlers.
UnescapeBusAddressValue unescapes values in D-Bus server addresses, as defined by the D-Bus specification at https://dbus.freedesktop.org/doc/dbus-specification.html#addresses.
WithAuth sets authentication methods for the auth conversation.
WithContext overrides the default context for the connection.
WithHandler overrides the default handler.
WithIncomingInterceptor sets the given interceptor for incoming messages.
WithMatchArg sets argN match option, range of N is 0 to 63.
WithMatchArg0Namespace sets arg0namespace match option.
WithMatchArgPath sets argN path match option, range of N is 0 to 63.
WithMatchDestination sets destination match option.
WithMatchEavesdrop sets eavesdrop match option.
WithMatchSender sets interface match option.
WithMatchMember sets member match option.
WithMatchObjectPath creates match option that filters events based on given path.
WithMatchOption creates match option with given key and value.
WithMatchPathNamespace sets path_namespace match option.
WithMatchSender sets sender match option.
WithOutgoingInterceptor sets the given interceptor for outgoing messages.
WithSerialGenerator overrides the default signals generator.
WithSignalHandler overrides the default signal handler.
# Constants
AuthContinue signals that additional data is needed; the next command from the server should be a DATA.
AuthError signals an error; the server sent invalid data or some other unexpected thing happened and the current authentication process should be aborted.
AuthOk signals that authentication is finished; the next command from the server should be an OK.
FlagAllowInteractiveAuthorization may be set on a method call message to inform the receiving side that the caller is prepared to wait for interactive authorization, which might take a considerable time to complete.
FlagNoAutoStart signals that the message bus should not automatically start an application when handling this message.
FlagNoReplyExpected signals that the message is not expected to generate a reply.
NoSequence indicates the absence of a sequence value.
# Variables
ErrClosed is the error returned by calls on a closed connection.
# Structs
Call represents a pending or completed method call.
Conn represents a connection to a message bus (usually, the system or session bus).
Error represents a D-Bus message of type Error.
An InvalidTypeError signals that a value which cannot be represented in the D-Bus wire format was passed to a function.
MatchOption specifies option for dbus routing match rule.
Message represents a single D-Bus message.
Object represents a remote object on which methods can be invoked.
Signal represents a D-Bus message of type Signal.
Signature represents a correct type signature as specified by the D-Bus specification.
A SignatureError indicates that a signature passed to a function or received on a connection is not a valid signature.
Variant represents the D-Bus variant type.
# Interfaces
An Argument Decoder can decode arguments using the non-standard mechanism
If a method implements this interface then the non-standard decoder will be used.
Auth defines the behaviour of an authentication mechanism.
BusObject is the interface of a remote object on which methods can be invoked.
A DBusError is used to convert a generic object to a D-Bus error.
Handler is the representation of a D-Bus Application.
An Interface is the representation of a D-Bus Interface.
A Method represents the exposed methods on D-Bus.
SerialGenerator is responsible for serials generation.
ServerObject is the representation of an D-Bus Object.
A SignalHandler is responsible for delivering a signal.
SignalRegistrar manages signal delivery channels.
Terminator allows a handler to implement a shutdown mechanism that is called when the connection terminates.
# Type aliases
AuthStatus represents the Status of an authentication mechanism.
ConnOption is a connection option.
Flags represents the possible flags of a D-Bus message.
A FormatError is an error in the wire format.
HeaderField represents the possible byte codes for the headers of a D-Bus message.
Interceptor intercepts incoming and outgoing messages.
An InvalidMessageError describes the reason why a D-Bus message is regarded as invalid.
An ObjectPath is an object path as defined by the D-Bus spec.
ReleaseNameReply is the reply to a ReleaseName call.
RequestNameFlags represents the possible flags for a RequestName call.
RequestNameReply is the reply to a RequestName call.
Sender is a type which can be used in exported methods to receive the message sender.
Sequence represents the value of a monotonically increasing counter.
Type represents the possible types of a D-Bus message.
A UnixFD is a Unix file descriptor sent over the wire.
A UnixFDIndex is the representation of a Unix file descriptor in a message.