Kosmos handles communication with Iridium's Short Burst Data DirectIP service, and turns these messages into HTTP webhooks.
The DirectIP server opens a TCP socket to accept connections from Iridium's ground stations.
kosmos_server --db-url postgres://localhost/kosmos --amqp-addr amqp://localhost --listen_addr [::]:10800
Optionally the flag --nat64-prefix
can be passed to allow the ACL to work correctly on an IPv6 only network.
All configuration options can also be passed as environment variables. Run with --help
for more information.
The API server accepts HTTP requests to send MT messages to Iridium.
kosmos_http --db-url postgres://localhost/kosmos --amqp-addr amqp://localhost --listen_addr [::]:8080
All configuration options can also be passed as environment variables. Run with --help
for more information.
The worker forwards messages to HTTP endpoints, and implements retries on these deliveries. Messages that can't be delivered for 24 hours will be marked as failed.
The worker also talks to Iridium to deliver MT messages. Its IP address will have to be added to Iridium's firewall.
kosmos_worker --db-url postgres://localhost/kosmos --amqp-addr amqp://localhost
All configuration options can also be passed as environment variables. Run with --help
for more information.
Messages are sent as HTTP POST JSON with the following format:
{
"type": "mo_message",
"id": "UUID",
"header": {
"imei": "000000000000000",
"cdr_reference": 0,
"session_status": "normal/too_large/unacceptable_location",
"mo_msn": 0,
"mt_msn": 0,
"time_of_session": "RFC3339 datetime"
},
"location_information": {
"latitude": 0.0,
"longitude": 0.0,
"cep_radius": 0,
},
"payload": "base64 encoded data"
}
Updates on the delivery status of MT messages have the following format
{
"type": "mt_message_status",
"id": "UUID",
"status": "delivered/invalid_imei/payload_size_exceeded/message_queue_full/resources_unavailable"
}
All webhook requests contain a Kosmos-MAC
header which is a Base64 encoded SHA-256 HMAC over the POST body using
the target's MAC key.
POST /submit_mt
Kosmos-Target-ID: UUID
Kosmos-MAC: Base64 encoded SHA-256 MAC
Content-Type: application/json
{
"imei": "000000000000000",
"payload": "base64 encoded data",
"priority": 5
}
All requests must contain a Kosmos-MAC
header which is a Base64 encoded SHA-256 HMAC over the POST body using
the target's MAC key. The Kosmos-Target-ID
header is used to identify which target signed this request.
priority
is an option field, when present its value must be between 1 and 5.
The API server will return the message ID as a UUID in a text/plain
body.
Two tables will be created on startup during the database migration process: targets
and devices
This table contains the HTTP endpoints to which webhooks can be delivered. Its fields are:
id
- a UUIDendpoint
- the HTTP(S) URL to deliver messages tohmac_key
- a binary field containing the HMAC key to use for signing requests
This table maps IMEIs to webhooks. Its fields are:
id
- a UUIDimei
- text representation of the modem IMEItarget
- UUID referencing a target webhook