|
2 | 2 |
|
3 | 3 | [](https://travis-ci.org/TheThingsNetwork/gateway-connector-bridge) [](https://coveralls.io/github/TheThingsNetwork/gateway-connector-bridge?branch=master)
|
4 | 4 |
|
5 |
| -## Getting Started |
| 5 | +## Installation |
| 6 | + |
| 7 | +Download precompiled binaries for [64 bit Linux][download-linux-amd64], [32 bit Linux][download-linux-386], [ARM Linux][download-linux-arm], [macOS][download-darwin-amd64], [64 bit Windows][download-windows-amd64], [32 bit Windows][download-windows-386]. |
| 8 | + |
| 9 | +[download-linux-amd64]: https://ttnreleases.blob.core.windows.net/gateway-connector-bridge/master/gateway-connector-bridge-linux-amd64.zip |
| 10 | +[download-linux-386]: https://ttnreleases.blob.core.windows.net/gateway-connector-bridge/master/gateway-connector-bridge-linux-386.zip |
| 11 | +[download-linux-arm]: https://ttnreleases.blob.core.windows.net/gateway-connector-bridge/master/gateway-connector-bridge-linux-arm.zip |
| 12 | +[download-darwin-amd64]: https://ttnreleases.blob.core.windows.net/gateway-connector-bridge/master/gateway-connector-bridge-darwin-amd64.zip |
| 13 | +[download-windows-amd64]: https://ttnreleases.blob.core.windows.net/gateway-connector-bridge/master/gateway-connector-bridge-windows-amd64.exe.zip |
| 14 | +[download-windows-386]: https://ttnreleases.blob.core.windows.net/gateway-connector-bridge/master/gateway-connector-bridge-windows-386.exe.zip |
| 15 | + |
| 16 | +Other requirements are: |
| 17 | + |
| 18 | +- [Redis](http://redis.io/download) |
| 19 | +- An MQTT Broker (see also the [Security](#security) section) |
| 20 | + |
| 21 | +## Usage |
| 22 | + |
| 23 | +``` |
| 24 | +Usage: |
| 25 | + gateway-connector-bridge [flags] |
| 26 | +
|
| 27 | +Flags: |
| 28 | + --account-server string Use an account server for exchanging access keys (default "https://account.thethingsnetwork.org") |
| 29 | + --amqp stringSlice AMQP Broker to connect to (user:pass@host:port; disable with "disable") |
| 30 | + --debug Print debug logs |
| 31 | + --http-debug-addr string The address of the HTTP debug server to start |
| 32 | + --id string ID of this bridge |
| 33 | + --log-file string Location of the log file |
| 34 | + --mqtt stringSlice MQTT Broker to connect to (user:pass@host:port; disable with "disable") (default [guest:guest@localhost:1883]) |
| 35 | + --redis Use Redis auth backend (default true) |
| 36 | + --redis-address string Redis host and port (default "localhost:6379") |
| 37 | + --redis-db int Redis database |
| 38 | + --redis-password string Redis password |
| 39 | + --root-ca-file string Location of the file containing Root CA certificates |
| 40 | + --status-addr string Address of the gRPC status server to start |
| 41 | + --ttn-router stringSlice TTN Router to connect to (default [discover.thethingsnetwork.org:1900/ttn-router-eu]) |
| 42 | + --workers int Number of parallel workers (default 1) |
| 43 | +``` |
| 44 | + |
| 45 | +For running in Docker, please refer to [`docker-compose.yml`](docker-compose.yml). |
| 46 | + |
| 47 | +## Protocol |
| 48 | + |
| 49 | +The Things Network's `gateway-connector` protocol sends protocol buffers over MQTT. |
| 50 | + |
| 51 | +- Connect to MQTT with your gateway's ID as username and Access Key as password. |
| 52 | + - On MQTT brokers that don't support authentication, you can connect without authentication. |
| 53 | +- After connect: send [`types.ConnectMessage`](types/types.proto) on topic `connect`. |
| 54 | + - Supply the gateway's ID and Access Key to authenticate with the backend |
| 55 | +- On disconnect: send [`types.DisconnectMessage`](types/types.proto) on topic `disconnect`. |
| 56 | + - Supply the same ID and Access Key as in the `ConnectMessage`. |
| 57 | + - Use the "will" feature of MQTT to send the `DisconnectMessage` when the gateway unexpectedly disconnects. |
| 58 | +- On uplink: send [`router.UplinkMessage`](https://github.com/TheThingsNetwork/ttn/blob/develop/api/router/router.proto) on topic `<gateway-id>/up`. |
| 59 | +- For downlink: subscribe to topic `<gateway-id>/down` and receive [`router.DownlinkMessage`](https://github.com/TheThingsNetwork/ttn/blob/develop/api/router/router.proto). |
| 60 | +- On status: send [`gateway.Status`](https://github.com/TheThingsNetwork/ttn/blob/develop/api/gateway/gateway.proto) on topic `<gateway-id>/status`. |
| 61 | + |
| 62 | +## Security |
| 63 | + |
| 64 | +⚠️ MQTT brokers should support authentication and access control: |
| 65 | + |
| 66 | +- The `connect`, `disconnect`, `<gateway-id>/up`, `<gateway-id>/status` topics **must only allow** |
| 67 | + - **publish** for authenticated gateways with `<gateway-id>`. |
| 68 | + - **subscribe** for the bridge. |
| 69 | +- The `<gateway-id>/down` topics **must only allow** |
| 70 | + - **publish** for the bridge. |
| 71 | + - **subscribe** for authenticated gateways with `<gateway-id>`. |
| 72 | + |
| 73 | +## Development |
6 | 74 |
|
7 | 75 | - Make sure you have [Go](https://golang.org) installed (version 1.7 or later).
|
8 |
| -- Set up your [Go environment](https://golang.org/doc/code.html#GOPATH) |
9 |
| -- Make sure you have [RabbitMQ](https://www.rabbitmq.com/download.html) and its [MQTT plugin](https://www.rabbitmq.com/mqtt.html) **installed** and **running**. |
| 76 | +- Set up your [Go environment](https://golang.org/doc/code.html#GOPATH). |
| 77 | +- Make sure you have [Redis](http://redis.io/download) **installed** and **running**. |
| 78 | +- Make sure you have [RabbitMQ](https://www.rabbitmq.com/download.html) and its [MQTT plugin](https://www.rabbitmq.com/mqtt.html) **installed** and **running**. |
10 | 79 | - Fork this repository on Github
|
11 | 80 | - `git clone git@github.com:YOURUSERNAME/gateway-connector-bridge.git $GOPATH/src/github.com/TheThingsNetwork/gateway-connector-bridge.git`
|
12 | 81 | - `cd $GOPATH/src/github.com/TheThingsNetwork/gateway-connector-bridge`
|
|
0 commit comments