Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lacion/iothub
IoT Hub for things
https://github.com/lacion/iothub
Last synced: 4 days ago
JSON representation
IoT Hub for things
- Host: GitHub
- URL: https://github.com/lacion/iothub
- Owner: lacion
- Created: 2016-12-20T02:26:38.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2016-12-25T00:52:33.000Z (almost 8 years ago)
- Last Synced: 2024-08-01T13:30:25.700Z (3 months ago)
- Language: Go
- Size: 17.6 KB
- Stars: 17
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-ccamel - lacion/iothub - IoT Hub for things (Go)
README
# iothub
IoT Hub for things
this project is a multiroom echo server using websockets, you could have
any sensor sending data to a room and have any other device join that room to read
the data in realtime## Getting started
This project requires Go to be installed. On OS X with Homebrew you can just run `brew install go`.
Running it then should be as simple as:
```console
$ make
$ ./bin/iothub
```Running with -version will get you the current version and git commit hash for the binary
```console
$ ./bin/iothub -version
```### Configuration
IoT Hub uses environment variables for configuration all of them are prefixed with IOTHUB.
- IOTHUB_JSON_LOGS defaults to false, if true it will output log in json format.
- IOTHUB_LOGLEVEL defaults to debug
- IOTHUB_MODE this sets the gin mode, defaults to debug, other options are release and test
- IOTHUB_LISTEN_ADDRESS defaults to ":5000"
- IOTHUB_SECRET defaults to "887yff9898yfhuiew3489fy3hewfuig239f8ghew32yfh" it is higly recomended to change this
- IOTHUB_SECURE defaults to false (this will enable SSL and requires to have cert_file and key_files set)
- IOTHUB_READ_TIMEOUT defaults to 10 seconds "0m10s"
- IOTHUB_WRITE_TIMEOUT defaults to 10 seconds "0m10s"
- IOTHUB_MAX_HEADER_BYTES defaults to 1mb 1048576 byteswhen IOTHUB_SECRET is set to true the following is also required
- IOTHUB_CERT_FILE SSL certificate file path
- IOTHUB_KEY_FILE SSL Key file patha note on logging, debug is very verbose as it outputs all the messages the server receives
### SSL
you can generate your certificates using [lego](github.com/xenolf/lego)
```console
$ openssl req -nodes -new -x509 -newkey rsa:4096 -keyout ssl/server.key -out ssl/server.crt
```### Testing
``make test``
## Features
- base project created with [cookiecutter-golang](https://github.com/lacion/cookiecutter-golang)
- Uses [gin](https://github.com/gin-gonic/gin) for http/s
- Uses [melody](github.com/olahol/melody) for websockets
- Uses [logrus](https://github.com/Sirupsen/logrus) for logging
- Uses [viper](https://github.com/spf13/viper) for config