9 releases

new 0.5.5 Jun 12, 2024
0.5.4 May 30, 2024
0.4.4 May 18, 2024

#1821 in Network programming

Download history 460/week @ 2024-05-17 113/week @ 2024-05-24 44/week @ 2024-05-31 102/week @ 2024-06-07

719 downloads per month

MIT license

47KB
814 lines

Crates.io MIT licensed Build Status

krossbar-hub

Krossbar bus hub

The binary acts as a hub for service connections. On request it makes a UDS pair and sends corresponding sockets to each of the peers, which afterward use the pair for communication. The only known point of rendezvous fot the services is the hub socket.

The hub uses krossbar_bus_common::DEFAULT_HUB_SOCKET_PATH for hub socket path and krossbar_bus_common::DEFAULT_SERVICE_FILES_DIR for service files dir by default. These can be changed using cmd args.

Created socket has 0o666 file permission to allow service connections.

Service files

During service registration and later for all connection requests the hub uses permission system to check if the service is allowed to do what it's trying to do.

Service file filename identifies client service name. The file itself contains executable glob for which it's allowed to register the service, and a list of client names, who are allowed to connect to the service.

Basic service file com.example.echo.service may look like the following:

{
"exec": "/data/krossbar/*",
"incoming_connections": ["**"]
}

See lib examples directory for service files examples.

Building

Build manually or use cargo install krossbar-bus-hub to install.

Usage:

Krossbar bus hub

Usage: krossbar-bus-hub [OPTIONS]
Options:
  -l, --log-level <LOG_LEVEL>
          Log level: OFF, ERROR, WARN, INFO, DEBUG, TRACE [default: TRACE]
  -a, --additional-service-dirs <ADDITIONAL_SERVICE_DIRS>
          Additional service files directories [default: []]
  -s, --socket-path <SOCKET_PATH>
          Hub socket path [default: /var/run/krossbar.bus.socket]
  -h, --help
          Print help
  -V, --version
          Print version

Dependencies

~13–27MB
~366K SLoC