Skip to content

Commit bb52fa6

Browse files
committed
Add packaging, update readme
1 parent 9c24615 commit bb52fa6

File tree

9 files changed

+102
-22
lines changed

9 files changed

+102
-22
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ dnstap-bgp
22
!deploy/dnstap-bgp
33
test*
44
vendor*
5+
*.deb
6+
*.rpm

Gopkg.lock

Lines changed: 17 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Makefile

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
NAME := dnstap-bgp
2+
MAINTAINER:= Igor Novgorodov <igor@novg.net>
3+
DESCRIPTION := DNSTap to BGP exporter
4+
LICENSE := MPLv2
5+
6+
GO ?= go
7+
DEP ?= dep
8+
VERSION := $(shell cat VERSION)
9+
OUT := .out
10+
PACKAGE := github.com/blind-oracle/$(NAME)
11+
ARCH := amd64
12+
13+
all: build
14+
15+
build:
16+
$(DEP) ensure
17+
rm -rf $(OUT)
18+
mkdir -p $(OUT)
19+
go build -ldflags "-s -w -X main.version=$(VERSION)"
20+
mv $(NAME) $(OUT)
21+
mkdir -p $(OUT)/root/etc/$(NAME)
22+
cp deploy/dnstap-bgp.conf $(OUT)/root/etc/$(NAME)/$(NAME).conf
23+
24+
deb:
25+
make build
26+
make build-deb
27+
28+
rpm:
29+
make build
30+
make build-rpm
31+
32+
build-deb:
33+
fpm -s dir -t deb -n $(NAME) -v $(VERSION) \
34+
--deb-priority optional \
35+
--category admin \
36+
--force \
37+
--url https://$(PACKAGE) \
38+
--description "$(DESCRIPTION)" \
39+
-m "$(MAINTAINER)" \
40+
--license "$(LICENSE)" \
41+
-a $(ARCH) \
42+
$(OUT)/$(NAME)=/usr/bin/$(NAME) \
43+
deploy/$(NAME).service=/usr/lib/systemd/system/$(NAME).service \
44+
deploy/$(NAME)=/etc/default/$(NAME) \
45+
$(OUT)/root/=/
46+
47+
build-rpm:
48+
fpm -s dir -t rpm -n $(NAME) -v $(VERSION) \
49+
--force \
50+
--rpm-compression bzip2 \
51+
--rpm-os linux \
52+
--url https://$(PACKAGE) \
53+
--description "$(DESCRIPTION)" \
54+
-m "$(MAINTAINER)" \
55+
--license "$(LICENSE)" \
56+
-a $(ARCH) \
57+
--config-files /etc/$(NAME)/$(NAME).conf \
58+
$(OUT)/$(NAME)=/usr/bin/$(NAME) \
59+
deploy/$(NAME).service=/usr/lib/systemd/system/$(NAME).service \
60+
deploy/$(NAME)=/etc/default/$(NAME) \
61+
$(OUT)/root/=/

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,21 @@ This daemon was created to solve the problem of manipulating traffic based on do
3434
* The domain list and IP cache are stored in memory for performance reasons, so there should be enough RAM
3535
* Logs only to stdout for now
3636

37+
## Installation
38+
### From packages
39+
Get *deb* or *rpm* packages from the releases page.
40+
41+
### From source
42+
You'll need Go environment set up and *dep* installed, then just run `make`
43+
44+
### Building packages
45+
To build a package you'll need *fpm* tool installed, then just run `make rpm` or `make deb`
46+
3747
## Configuration
38-
See *deploy/dnstap-bgp.toml* for an example configuration and description of parameters.
48+
See *deploy/dnstap-bgp.conf* for an example configuration and description of parameters.
3949

40-
## Examples
41-
DNSTap works in a client-server manner, where DNS server is *the client** and **dnstap-bgp** is a server.
50+
## DNS server examples
51+
DNSTap protocol works in a client-server manner, where DNS server is the client and **dnstap-bgp** is a server.
4252

4353
### Unbound
4454
Unbound seem to be able to work with DNSTap only through UNIX sockets.

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.0.0

deploy/dnstap-bgp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
CONFIG=/etc/dnstap-bgp.toml
1+
CONFIG=/etc/dnstap-bgp/dnstap-bgp.conf
File renamed without changes.

deploy/dnstap-bgp.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ After=network.target
77
Type=simple
88
Restart=on-failure
99
EnvironmentFile=/etc/default/dnstap-bgp
10-
ExecStart=/opt/dnstap-bgp -config ${CONFIG}
10+
ExecStart=/usr/bin/dnstap-bgp -config ${CONFIG}
1111
ExecReload=/bin/kill -HUP $MAINPID
1212
KillMode=control-group
1313

main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ type cfgRoot struct {
2525
Syncer *syncerCfg
2626
}
2727

28+
var (
29+
version string
30+
)
31+
2832
func main() {
2933
var (
3034
dTree *domainTree
@@ -37,6 +41,8 @@ func main() {
3741
shutdown = make(chan struct{})
3842
)
3943

44+
log.Printf("dnstap-bgp v%s", version)
45+
4046
config := flag.String("config", "", "Path to a config file")
4147
flag.Parse()
4248

0 commit comments

Comments
 (0)