Skip to content
Permalink
Browse files

Add more documentation. Migrate to Go modules.

  • Loading branch information...
brocaar committed Mar 7, 2019
1 parent 4f721aa commit 046bb70b9ac87ac9aa78417799d393afd68ec0d7
Showing with 194 additions and 253 deletions.
  1. +0 −3 .goreleaser.yml
  2. +3 −3 Dockerfile
  3. +1 −1 Dockerfile-devel
  4. +0 −220 Gopkg.lock
  5. +0 −19 Gopkg.toml
  6. +3 −6 Makefile
  7. +74 −0 README.md
  8. +1 −1 docker-compose.yml
  9. +17 −0 go.mod
  10. +86 −0 go.sum
  11. +9 −0 internal/tools/tools.go
@@ -1,6 +1,3 @@
git:
short_hash: true

project_name: lora-packet-multiplexer

builds:
@@ -1,6 +1,6 @@
FROM golang:1.11-alpine AS development

ENV PROJECT_PATH=/go/src/github.com/brocaar/lora-packet-multiplexer
ENV PROJECT_PATH=/lora-packet-multiplexer
ENV PATH=$PATH:$PROJECT_PATH/build
ENV CGO_ENABLED=0
ENV GO_EXTRA_BUILD_ARGS="-a -installsuffix cgo"
@@ -11,12 +11,12 @@ RUN mkdir -p $PROJECT_PATH
COPY . $PROJECT_PATH
WORKDIR $PROJECT_PATH

RUN make dev-requirements requirements
RUN make dev-requirements
RUN make

FROM alpine:latest AS production

WORKDIR /root/
RUN apk --no-cache add tzdata
COPY --from=development /go/src/github.com/brocaar/lora-packet-multiplexer/build/lora-packet-multiplexer .
COPY --from=development /lora-packet-multiplexer .
ENTRYPOINT ["./lora-packet-multiplexer"]
@@ -1,6 +1,6 @@
FROM golang:1.11-alpine

ENV PROJECT_PATH=/go/src/github.com/brocaar/lora-packet-multiplexer
ENV PROJECT_PATH=/lora-packet-multiplexer
ENV PATH=$PATH:$PROJECT_PATH/build
ENV CGO_ENABLED=0
ENV GO_EXTRA_BUILD_ARGS="-a -installsuffix cgo"

This file was deleted.

This file was deleted.

@@ -25,10 +25,7 @@ snapshot:
goreleaser --snapshot

dev-requirements:
go get -u golang.org/x/tools/cmd/stringer
go get -u github.com/golang/dep/cmd/dep
go get -u github.com/goreleaser/goreleaser
go get -u github.com/goreleaser/nfpm
go install golang.org/x/tools/cmd/stringer
go install github.com/goreleaser/goreleaser
go install github.com/goreleaser/nfpm

requirements:
dep ensure -v
@@ -3,3 +3,77 @@
The LoRa Packet Multiplexer utility forwards the [Semtech packet-forwarder](https://github.com/lora-net/packet_forwarder)
UDP data to multiple endpoints. It makes it possible to connect a single
LoRa gateway to multiple networks. It is part of the [LoRa Server project](https://www.loraserver.io).

## Building

### Binary

It is recommended to run the commands below inside a [Docker Compose](https://docs.docker.com/compose/)
environment.

```bash
docker-compose run --rm packetmultiplexer bash
```

```bash
# build binary
make
# create snapshot release
make snapshot
# run tests
make test
```

### Docker image

```bash
docker build -t IMAGENAME .
```

## Usage

Run `lora-packet-multiplexer --help` for usage information.

## Example configuration

Executing `lora-packet-multiplexer configfile` returns the following configuration
template:

```toml
[general]
# Log level
#
# debug=5, info=4, warning=3, error=2, fatal=1, panic=0
log_level=4
[packet_multiplexer]
# Bind
#
# The interface:port on which the packet-multiplexer will bind for receiving
# data from the packet-forwarder (UDP data).
bind="0.0.0.0:1700"
# Backends
#
# The backends to which the packet-multiplexer will forward the
# packet-forwarder UDP data.
#
# Example:
# [[packet_multiplexer.backend]]
# # Host
# #
# # The host:IP of the backend.
# host="192.16.1.5:1700"
#
# # Gateway IDs
# #
# # The Gateway IDs to forward data for.
# gateway_ids = [
# "0101010101010101",
# "0202020202020202",
# ]
```
@@ -5,4 +5,4 @@ services:
context: .
dockerfile: Dockerfile-devel
volumes:
- ./:/go/src/github.com/brocaar/lora-packet-multiplexer
- ./:/lora-packet-multiplexer
17 go.mod
@@ -0,0 +1,17 @@
module github.com/brocaar/lora-packet-multiplexer

require (
github.com/BurntSushi/toml v0.3.1 // indirect
github.com/goreleaser/goreleaser v0.102.0
github.com/goreleaser/nfpm v0.10.0
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/mitchellh/mapstructure v1.1.1 // indirect
github.com/pkg/errors v0.8.0
github.com/sirupsen/logrus v1.1.0
github.com/spf13/cobra v0.0.3
github.com/spf13/pflag v1.0.3 // indirect
github.com/spf13/viper v1.2.1
github.com/stretchr/testify v1.3.0
golang.org/x/crypto v0.0.0-20181001203147-e3636079e1a4 // indirect
golang.org/x/tools v0.0.0-20190306162903-69e0dcfa1121
)

0 comments on commit 046bb70

Please sign in to comment.
You can’t perform that action at this time.