From bbe951f4aa5c1771d62428c590577c7fe87c3b81 Mon Sep 17 00:00:00 2001 From: Louis Poinsignon Date: Wed, 20 Mar 2019 21:29:42 -0700 Subject: [PATCH] Moves to go mod (#17). Updated README to give more build details. --- Dockerfile.gortr | 6 ++-- Dockerfile.gortr.prod | 3 +- Dockerfile.rtrdump | 6 ++-- Gopkg.lock | 84 ------------------------------------------- Gopkg.toml | 33 ----------------- README.md | 10 +++++- go.mod | 8 +++++ go.sum | 32 +++++++++++++++++ 8 files changed, 55 insertions(+), 127 deletions(-) delete mode 100644 Gopkg.lock delete mode 100644 Gopkg.toml create mode 100644 go.mod create mode 100644 go.sum diff --git a/Dockerfile.gortr b/Dockerfile.gortr index bce9750..8df9eba 100644 --- a/Dockerfile.gortr +++ b/Dockerfile.gortr @@ -1,4 +1,4 @@ -ARG src_dir="/go/src/github.com/cloudflare/gortr" +ARG src_dir="/gortr" FROM golang:alpine as builder ARG src_dir @@ -9,9 +9,7 @@ RUN apk --update --no-cache add git && \ WORKDIR ${src_dir} COPY . . -RUN go get -u github.com/golang/dep/cmd/dep && \ - dep ensure && \ - go build cmd/gortr/gortr.go +RUN go build cmd/gortr/gortr.go FROM alpine:latest ARG src_dir diff --git a/Dockerfile.gortr.prod b/Dockerfile.gortr.prod index a4d6b78..0484798 100644 --- a/Dockerfile.gortr.prod +++ b/Dockerfile.gortr.prod @@ -13,5 +13,6 @@ RUN apk --update --no-cache add ca-certificates && \ adduser -S -D -H -h / rtr USER rtr -COPY --from=builder /go/bin/gortr /go/src/${src_uri}/cf.pub / +COPY --from=builder /go/bin/gortr / +COPY cmd/gortr/cf.pub / ENTRYPOINT ["./gortr"] diff --git a/Dockerfile.rtrdump b/Dockerfile.rtrdump index 6f52883..e3cd48c 100644 --- a/Dockerfile.rtrdump +++ b/Dockerfile.rtrdump @@ -1,4 +1,4 @@ -ARG src_dir="/go/src/github.com/cloudflare/gortr" +ARG src_dir="/rtrdump" FROM golang:alpine as builder ARG src_dir @@ -9,9 +9,7 @@ RUN apk --update --no-cache add git && \ WORKDIR ${src_dir} COPY . . -RUN go get -u github.com/golang/dep/cmd/dep && \ - dep ensure && \ - go build cmd/rtrdump/rtrdump.go +RUN go build cmd/rtrdump/rtrdump.go FROM alpine:latest ARG src_dir diff --git a/Gopkg.lock b/Gopkg.lock deleted file mode 100644 index 528db2f..0000000 --- a/Gopkg.lock +++ /dev/null @@ -1,84 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[[projects]] - branch = "master" - name = "github.com/beorn7/perks" - packages = ["quantile"] - revision = "3a771d992973f24aa725d07868b467d1ddfceafb" - -[[projects]] - name = "github.com/golang/protobuf" - packages = ["proto"] - revision = "aa810b61a9c79d51363740d207bb46cf8e620ed5" - version = "v1.2.0" - -[[projects]] - name = "github.com/matttproud/golang_protobuf_extensions" - packages = ["pbutil"] - revision = "c12348ce28de40eed0136aa2b644d0ee0650e56c" - version = "v1.0.1" - -[[projects]] - name = "github.com/prometheus/client_golang" - packages = [ - "prometheus", - "prometheus/promhttp" - ] - revision = "c5b7fccd204277076155f10851dad72b76a49317" - version = "v0.8.0" - -[[projects]] - branch = "master" - name = "github.com/prometheus/client_model" - packages = ["go"] - revision = "5c3871d89910bfb32f5fcab2aa4b9ec68e65a99f" - -[[projects]] - branch = "master" - name = "github.com/prometheus/common" - packages = [ - "expfmt", - "internal/bitbucket.org/ww/goautoneg", - "model" - ] - revision = "c7de2306084e37d54b8be01f3541a8464345e9a5" - -[[projects]] - branch = "master" - name = "github.com/prometheus/procfs" - packages = [ - ".", - "internal/util", - "nfs", - "xfs" - ] - revision = "05ee40e3a273f7245e8777337fc7b46e533a9a92" - -[[projects]] - name = "github.com/sirupsen/logrus" - packages = ["."] - revision = "c155da19408a8799da419ed3eeb0cb5db0ad5dbc" - version = "v1.0.5" - -[[projects]] - branch = "master" - name = "golang.org/x/crypto" - packages = ["ssh/terminal"] - revision = "a49355c7e3f8fe157a85be2f77e6e269a0f89602" - -[[projects]] - branch = "master" - name = "golang.org/x/sys" - packages = [ - "unix", - "windows" - ] - revision = "151529c776cdc58ddbe7963ba9af779f3577b419" - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - inputs-digest = "d0da4d774651afcd4a32fc217319dbe23714098bb56ec45c3bfa1a2b03159328" - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml deleted file mode 100644 index 04b1e81..0000000 --- a/Gopkg.toml +++ /dev/null @@ -1,33 +0,0 @@ -# Gopkg.toml example -# -# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md -# for detailed Gopkg.toml documentation. -# -# required = ["github.com/user/thing/cmd/thing"] -# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] -# -# [[constraint]] -# name = "github.com/user/project" -# version = "1.0.0" -# -# [[constraint]] -# name = "github.com/user/project2" -# branch = "dev" -# source = "github.com/myfork/project2" -# -# [[override]] -# name = "github.com/x/y" -# version = "2.4.0" -# -# [prune] -# non-go = false -# go-tests = true -# unused-packages = true - -[[constraint]] - name = "github.com/sirupsen/logrus" - version = "1.0.5" - -[prune] - go-tests = true - unused-packages = true diff --git a/README.md b/README.md index ef07260..4c05cfa 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ GoRTR is an open-source implementation of RPKI to Router protocol (RFC 6810) usi * `/lib` contains a library to create your own server and client. * `/prefixfile` contains the structure of a JSON export file and signing capabilities. * `/cmd/gortr/gortr.go` is a simple implementation that fetches a list and offers it to a router. +* `/cmd/rtrdump/rtrdump.go` allows. ## Disclaimer @@ -32,7 +33,9 @@ _This software comes with no warranty._ * TLS ## To start developing + You need a working [Go environment](https://golang.org/doc/install) (1.10 or newer). +This project also uses [Go Modules](https://github.com/golang/go/wiki/Modules). ```bash $ git clone git@github.com:cloudflare/gortr.git && cd gortr @@ -62,6 +65,9 @@ $ openssl ec -in private.pem -pubout -outform pem > public.pem ## Run it +Once you have a binary, from either the `~/go/bin/` (if you did `go get` or `go build`) +or the [Releases page](https://github.com/cloudflare/gortr/releases): + ```bash $ ./gortr -bind 127.0.0.1:8282 ``` @@ -90,7 +96,7 @@ Use your own validator, as long as the JSON source follows the following schema: } ``` -* [**Cloudflare**](https://rpki.cloudflare.com/rpki.json) *(list curated, signed, compressed and cached in +150 PoPs)* +* [**Cloudflare**](https://rpki.cloudflare.com/rpki.json) *(list curated, signed, compressed and cached in +160 PoPs)* * **Third-party RIPE Validators:** * [NTT](https://rpki.gin.ntt.net/api/export.json) * [RIPE](http://localcert.ripe.net:8088/export.json) @@ -99,6 +105,8 @@ Use your own validator, as long as the JSON source follows the following schema: To use a data source that do not contains signatures or validity information, pass: `-verify=false -checktime=false` +Cloudflare's prefix list removes duplicates and entries that are not routed on the Internet (>/24 IPv4 and >/48 IPv6). + ### Configure on Juniper Configure a session to the RTR server diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..ce90023 --- /dev/null +++ b/go.mod @@ -0,0 +1,8 @@ +module github.com/cloudflare/gortr + +go 1.12 + +require ( + github.com/prometheus/client_golang v0.9.2 + github.com/sirupsen/logrus v1.4.0 +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..19a8e62 --- /dev/null +++ b/go.sum @@ -0,0 +1,32 @@ +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v0.9.2 h1:awm861/B8OKDd2I/6o1dy3ra4BamzKhYOiGItCeZ740= +github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 h1:idejC8f05m9MGOsuEi1ATq9shN03HrxNkD/luQvxCv8= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/common v0.0.0-20181126121408-4724e9255275 h1:PnBWHBf+6L0jOqq0gIVUe6Yk0/QMZ640k6NvkxcBf+8= +github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a h1:9a8MnZMP0X2nLJdBg+pBmGgkJlSaKC2KaQmTCk1XDtE= +github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/sirupsen/logrus v1.4.0 h1:yKenngtzGh+cUSSh6GWbxW2abRqhYUSR/t/6+2QqNvE= +github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 h1:u+LnwYTOOW7Ukr/fppxEb1Nwz0AtPflrblfvUudpo+I= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f h1:Bl/8QSvNqXvPGPGXa2z5xUTmV7VDcZyvRZ+QQXkXTZQ= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 h1:I6FyU15t786LL7oL/hn43zqTuEGr4PN7F4XJ1p4E3Y8= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=