Struct varlink::Connection[][src]

pub struct Connection {
    pub reader: Option<BufReader<Box<Read + Send + Sync>>>,
    pub writer: Option<Box<Write + Send + Sync>>,
    // some fields omitted
}

A client connection builder to a varlink service.

Fields

Methods

impl Connection
[src]

Create a connection with a varlink URI

see with_address

Create a connection with a varlink URI

following the varlink [address specification](https: //github.com/varlink/documentation/wiki#address).

Currently supported address URIs are:

  • TCP tcp:127.0.0.1:12345 hostname/IP address and port
  • UNIX socket unix:/run/org.example.ftl
  • UNIX abstract namespace socket unix:@org.example.ftl (on Linux only)

Examples

This example is not tested
let connection = Connection::with_address("unix:/tmp/org.example.myservice");
let connection = Connection::with_address("tcp:127.0.0.1:12345");

Create a connection to a service, which is executed in the background.

Create a connection to a service, which is started with command and passed a socket pair via socket activation. The address of the unix socket is set in the environment variable VARLINK_ADDRESS. Additionally the socket activation variables LISTEN_FDS=1, LISTEN_FDNAMES=varlink and LISTEN_PID are set.

Examples

This example is not tested
let connection = Connection::with_activate("myservice --varlink=$VARLINK_ADDRESS");

Create a connection to a service via stdin/stdout of a specified command.

Create a "bridge" to e.g. another host via ssh or other connection commands. On the remote side varlink bridge is typically started. The connection will go through stdin/stdout of the command and the remote bridge command will multiplex to the wanted varlink services.

Of course with ssh there are better options, like unix socket forwarding -L local_socket:remote_socket.

Examples

This example is not tested
let connection = Connection::with_bridge("ssh my.example.org -- varlink bridge");

Return the address used by the connection.

Only useful, if you want to clone a connection built with_activate or with_address

Trait Implementations

impl Default for Connection
[src]

Returns the "default value" for a type. Read more

impl Drop for Connection
[src]

Executes the destructor for this type. Read more

Auto Trait Implementations

impl Send for Connection

impl Sync for Connection