Skip to content

Commit 046bb70

Browse files
committed
Add more documentation. Migrate to Go modules.
1 parent 4f721aa commit 046bb70

File tree

11 files changed

+194
-253
lines changed

11 files changed

+194
-253
lines changed

.goreleaser.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
git:
2-
short_hash: true
3-
41
project_name: lora-packet-multiplexer
52

63
builds:

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM golang:1.11-alpine AS development
22

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

14-
RUN make dev-requirements requirements
14+
RUN make dev-requirements
1515
RUN make
1616

1717
FROM alpine:latest AS production
1818

1919
WORKDIR /root/
2020
RUN apk --no-cache add tzdata
21-
COPY --from=development /go/src/github.com/brocaar/lora-packet-multiplexer/build/lora-packet-multiplexer .
21+
COPY --from=development /lora-packet-multiplexer .
2222
ENTRYPOINT ["./lora-packet-multiplexer"]

Dockerfile-devel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM golang:1.11-alpine
22

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

Gopkg.lock

Lines changed: 0 additions & 220 deletions
This file was deleted.

Gopkg.toml

Lines changed: 0 additions & 19 deletions
This file was deleted.

Makefile

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@ snapshot:
2525
goreleaser --snapshot
2626

2727
dev-requirements:
28-
go get -u golang.org/x/tools/cmd/stringer
29-
go get -u github.com/golang/dep/cmd/dep
30-
go get -u github.com/goreleaser/goreleaser
31-
go get -u github.com/goreleaser/nfpm
28+
go install golang.org/x/tools/cmd/stringer
29+
go install github.com/goreleaser/goreleaser
30+
go install github.com/goreleaser/nfpm
3231

33-
requirements:
34-
dep ensure -v

README.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,77 @@
33
The LoRa Packet Multiplexer utility forwards the [Semtech packet-forwarder](https://github.com/lora-net/packet_forwarder)
44
UDP data to multiple endpoints. It makes it possible to connect a single
55
LoRa gateway to multiple networks. It is part of the [LoRa Server project](https://www.loraserver.io).
6+
7+
## Building
8+
9+
### Binary
10+
11+
It is recommended to run the commands below inside a [Docker Compose](https://docs.docker.com/compose/)
12+
environment.
13+
14+
```bash
15+
docker-compose run --rm packetmultiplexer bash
16+
```
17+
18+
```bash
19+
# build binary
20+
make
21+
22+
# create snapshot release
23+
make snapshot
24+
25+
# run tests
26+
make test
27+
```
28+
29+
### Docker image
30+
31+
```bash
32+
docker build -t IMAGENAME .
33+
```
34+
35+
## Usage
36+
37+
Run `lora-packet-multiplexer --help` for usage information.
38+
39+
## Example configuration
40+
41+
Executing `lora-packet-multiplexer configfile` returns the following configuration
42+
template:
43+
44+
```toml
45+
[general]
46+
# Log level
47+
#
48+
# debug=5, info=4, warning=3, error=2, fatal=1, panic=0
49+
log_level=4
50+
51+
52+
[packet_multiplexer]
53+
# Bind
54+
#
55+
# The interface:port on which the packet-multiplexer will bind for receiving
56+
# data from the packet-forwarder (UDP data).
57+
bind="0.0.0.0:1700"
58+
59+
60+
# Backends
61+
#
62+
# The backends to which the packet-multiplexer will forward the
63+
# packet-forwarder UDP data.
64+
#
65+
# Example:
66+
# [[packet_multiplexer.backend]]
67+
# # Host
68+
# #
69+
# # The host:IP of the backend.
70+
# host="192.16.1.5:1700"
71+
#
72+
# # Gateway IDs
73+
# #
74+
# # The Gateway IDs to forward data for.
75+
# gateway_ids = [
76+
# "0101010101010101",
77+
# "0202020202020202",
78+
# ]
79+
```

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ services:
55
context: .
66
dockerfile: Dockerfile-devel
77
volumes:
8-
- ./:/go/src/github.com/brocaar/lora-packet-multiplexer
8+
- ./:/lora-packet-multiplexer

go.mod

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module github.com/brocaar/lora-packet-multiplexer
2+
3+
require (
4+
github.com/BurntSushi/toml v0.3.1 // indirect
5+
github.com/goreleaser/goreleaser v0.102.0
6+
github.com/goreleaser/nfpm v0.10.0
7+
github.com/inconshreveable/mousetrap v1.0.0 // indirect
8+
github.com/mitchellh/mapstructure v1.1.1 // indirect
9+
github.com/pkg/errors v0.8.0
10+
github.com/sirupsen/logrus v1.1.0
11+
github.com/spf13/cobra v0.0.3
12+
github.com/spf13/pflag v1.0.3 // indirect
13+
github.com/spf13/viper v1.2.1
14+
github.com/stretchr/testify v1.3.0
15+
golang.org/x/crypto v0.0.0-20181001203147-e3636079e1a4 // indirect
16+
golang.org/x/tools v0.0.0-20190306162903-69e0dcfa1121
17+
)

0 commit comments

Comments
 (0)