Pass-It-On
A library that provides a simple notification client and server that receives messages and passes them on to endpoints.
Usage
This library was designed to enable the creation of processes that handle the business of when and what notification should be sent and then pass those notifications to the pass-it-on client which handles sending it across the configured interface to the pass-it-on server where the endpoints are configured. The idea is to allow a single instance of the server to handle messages from many clients which may or may not be going to the same endpoint.
Which notifications are go to a particular endpoint can be controlled by adding a notification name notifications
field in the server configuration
that matches the notification name that is used in the ClientReadyMessage
by the client.
Key Features
- A configurable server that monitors interfaces and passes notifications to endpoints.
- A configurable client to use as part of a binary to send notifications to the server.
- Traits to support extension of Interfaces and their inclusion in the configuration file.
- Interface
- InterfaceConfig
- Traits to support extension of Endpoints and their inclusion in the configuration file.
- Endpoint
- EndpointConfig
Interfaces
Interfaces can be used for both the server and the client.
Interface | Description |
---|---|
HTTP | Communication between the client and server using the HTTP protocol. |
Pipe | Communication between the client and server using a FIFO Named Pipe. (Unix Only) |
Endpoints
Endpoints are the destinations for notifications received by the server.
Endpoint | Description |
---|---|
Regular File | Write notifications to a file. |
Matrix | Send notifications to Matrix room(s). |
Configuration
The Server and Client support configuration via a TOML file. At least one interface must be setup for a Client and at least one interface and endpoint must be setup for the Server.
Server Configuration Example
[]
= "sdfsf4633ghf44dfhdfhQdhdfhewaasg"
[[]]
= "pipe"
= '/path/to/pipe.fifo'
= true
[[]]
= "http"
= 8080
[[]]
= "matrix"
= "example.com"
= "test1"
= "pass"
= '/path/to/session/store/matrix_store'
= "storepass123"
[[]]
= "!dfsdfsdf:example.com"
= ["notification_id1", "notification_id2"]
[[]]
= "#matrix-room:example.com"
= ["notification_id4"]
[[]]
= "file"
= '/test_data/file_endpoint.txt'
= ["notification_id1", "notification_id3"]
Client Configuration Example
[]
= "sdfsf4633ghf44dfhdfhQdhdfhewaasg"
[[]]
= "pipe"
= '/path/to/pipe.fifo'
= true
= true
[[]]
= "http"
= "192.168.1.2"
= 8080
Feature Flags
Feature | Description |
---|---|
client | Enables the client but not any particular interface. |
endpoints | Enables the Endpoint and EndpointConfig traits. |
file | Enables the regular file endpoint. |
http | Enables the HTTP interface client and server. |
http-client | Enables the HTTP interface for just client. |
http-server | Enables the HTTP interface for just server. |
interfaces | Enables the Interface and InterfaceConfig traits. |
matrix | Enables the matrix endpoint. |
parse-cfg | Enables parsing of client or server configurations from TOML when those features are also enabled. |
pipe | Enables the named pipe interface client and server. (Unix only) |
pipe-client | Enables the named pipe interface client. (Unix only) |
pipe-server | Enables the named pipe interface server. (Unix only) |
server | Enables the server but not any particular interface or endpoint. |
server-bin | Enables the building of the provided pass-it-on-server binary while not require any specific interface or endpoint |
vendored-tls | Enables vendored tls for reqwest. |
Future Plans
- Add Discord webhook endpoint
- Add Email endpoint
- Enable encryption support for Matrix endpoint
- Enable TLS support for the server
- Make the HTTP interface path configurable instead of the hardcoded /notification