Skip to content

Commit

Permalink
Update SCION Dispatcher-less (#243)
Browse files Browse the repository at this point in the history
* Go vet.

* Have `make` less verbose in its output.

* Update scionproto to last (dispatcherless).

* Use new dispatcher-less scion.

* Adapt test.

* Remove spurious test file.

* Fix CI.
  • Loading branch information
juagargi authored Jun 19, 2024
1 parent 1e8d706 commit 8e9ef27
Show file tree
Hide file tree
Showing 72 changed files with 920 additions and 1,312 deletions.
31 changes: 15 additions & 16 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,17 @@ jobs:

integration:
machine:
image: ubuntu-2004:202111-02 # using go1.17.3
image: ubuntu-2004:202111-02 # contains go1.17.3

steps:
- checkout
# Use different Go version to build everything.
- run:
name: Install Go 1.21.10
command: |
wget https://go.dev/dl/go1.21.10.linux-amd64.tar.gz
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go1.21.10.linux-amd64.tar.gz
- run:
name: Checkout SCION
command: |
Expand All @@ -53,7 +60,7 @@ jobs:
# So we pin it to an older version that matches the integration tests
# It should not matter if we build SCION binaries with different version than the apps
# as long as there are no major breaks
scion_commit=5883c725f748 # Previously: v0.6.1-0.20220202161514-5883c725f748; Now: v0.8.1-0.20231010074308-1774cbfccb4c
scion_commit=50b971ca2 # Previously: v0.8.1-0.20231010074308-1774cbfccb4c; ; Now: v0.11.1-0.20240610170620-50b971ca2d4b
git clone ${scion_repo} ~/scion
cd ~/scion
git checkout --quiet ${scion_commit}
Expand All @@ -70,36 +77,28 @@ jobs:
python3 --version
cd ~/scion
for service in "posix-router" "cs" "dispatcher" "scion-pki" "daemon"; do
go build -o ./bin/ ./go/${service}/ && echo "Built ${service}";
for service in "router" "control" "dispatcher" "scion-pki" "daemon"; do
go build -o ./bin/ ./${service}/... && echo "Built ${service}";
done
pip3 install -U wheel setuptools
pip3 install -r ~/scion/env/pip3/requirements.txt
pip3 install -r ~/scion/tools/env/pip3/requirements.txt
- run:
name: Configure and start local SCION AS
command: |
cd ~/scion
export PYTHONPATH=python/:.
# Generate tiny.topo
printf '#!/bin/bash\necho "0.0.0.0"' > tools/docker-ip # Some hackery to make topo scripts run
python3 python/topology/generator.py -c ./topology/tiny4.topo
python3 tools/topogen.py -c ./topology/tiny4.topo
mkdir gen-cache
# Start one AS only (1-ff00:0:110 is referenced explicitly from the integration tests)
supervisor/supervisor.sh reload
supervisor/supervisor.sh start \
tools/supervisor.sh reload
tools/supervisor.sh start \
dispatcher \
as1-ff00_0_110:cs1-ff00_0_110-1 \
as1-ff00_0_110:sd1-ff00_0_110
# Use different Go version to build scion-apps
- run:
name: Install Go 1.21.3 to build scion-apps
command: |
wget https://go.dev/dl/go1.21.3.linux-amd64.tar.gz
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go1.21.3.linux-amd64.tar.gz
- run:
name: Integration tests
command: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ _testmain.go
/cmd/zonepub/data/newZonefile.txt
internal/pkg/keyManager/testdata/test_pub.pem
internal/pkg/keyManager/testdata/test_sec.pem
internal/pkg/util/test/test.gob

#test coverage files
*coverage.out
Expand Down
32 changes: 16 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,49 +9,49 @@ LDFLAGS = -ldflags "-X main.buildinfo_hostname=${HOSTNAME} -X main.buildinfo_com
all: clean rainsd zonepub rdig keymanager

clean:
rm -rf ${BUILD_PATH}
mkdir ${BUILD_PATH}
@rm -rf ${BUILD_PATH}
@mkdir ${BUILD_PATH}

rainsd: vet
go build ${LDFLAGS} -o ${BUILD_PATH}/rainsd github.com/netsec-ethz/rains/cmd/rainsd
@go build ${LDFLAGS} -o ${BUILD_PATH}/rainsd github.com/netsec-ethz/rains/cmd/rainsd

zonepub: vet
go build ${LDFLAGS} -o ${BUILD_PATH}/publisher github.com/netsec-ethz/rains/cmd/zonepub
@go build ${LDFLAGS} -o ${BUILD_PATH}/publisher github.com/netsec-ethz/rains/cmd/zonepub

rdig: vet
go build ${LDFLAGS} -o ${BUILD_PATH}/rdig github.com/netsec-ethz/rains/cmd/rdig
@go build ${LDFLAGS} -o ${BUILD_PATH}/rdig github.com/netsec-ethz/rains/cmd/rdig

keymanager: vet
go build ${LDFLAGS} -o ${BUILD_PATH}/keymanager github.com/netsec-ethz/rains/cmd/keyManager
@go build ${LDFLAGS} -o ${BUILD_PATH}/keymanager github.com/netsec-ethz/rains/cmd/keyManager

vet:
go fmt ./...
go vet ./internal/...
go vet ./cmd/...
go vet ./test/...
@go fmt ./...
@go vet ./internal/...
@go vet ./cmd/...
@go vet ./test/...

generate: internal/pkg/zonefile/zoneFileParser.go go_generate

internal/pkg/zonefile/zoneFileParser.go: internal/pkg/zonefile/zoneFileParser.y
$(if $(which goyacc), go install golang.org/x/tools/cmd/goyacc)
goyacc -p "ZFP" -o $@ $<
@goyacc -p "ZFP" -o $@ $<

go_generate:
$(if $(which stringer), go install golang.org/x/tools/cmd/stringer)
# XXX: not running github.com/campoy/jsonenums as its currently broken with modules!
go generate -run stringer ./...
@go generate -run stringer ./...

test: vet unit integration

unit:
go test ./internal/pkg/...
@go test ./internal/pkg/...

integration: rainsd rdig zonepub
go test -v -tags=integration ./test/integration/
@go test -tags=integration ./test/integration/

cover:
go test -coverprofile=coverage.out -coverpkg=./internal/pkg/... ./internal/pkg/... ./test/...
go tool cover -html=coverage.out -o coverage.html
@go test -coverprofile=coverage.out -coverpkg=./internal/pkg/... ./internal/pkg/... ./test/...
@go tool cover -html=coverage.out -o coverage.html
firefox coverage.html

.PHONY: all clean rainsd zonepub rdig zoneman keymanager vet generate go_generate test unit integration
10 changes: 5 additions & 5 deletions cmd/rainsd/rainsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var zoneKeyCheckPointInterval time.Duration
var checkPointPath string
var preLoadCaches bool

//switchboard
// switchboard
var serverAddress addressFlag
var rootServerAddress addressFlag
var maxConnections int
Expand All @@ -35,7 +35,7 @@ var tcpTimeout time.Duration
var tlsCertificateFile string
var tlsPrivateKeyFile string

//inbox
// inbox
var prioBufferSize int
var normalBufferSize int
var notificationBufferSize int
Expand All @@ -45,7 +45,7 @@ var notificationWorkerCount int
var capabilitiesCacheSize int
var capabilities string

//verify
// verify
var zoneKeyCacheSize int
var zoneKeyCacheWarnSize int
var maxPublicKeysPerZone int
Expand All @@ -54,7 +54,7 @@ var delegationQueryValidity time.Duration
var reapZoneKeyCacheInterval time.Duration
var reapPendingKeyCacheInterval time.Duration

//engine
// engine
var assertionCacheSize int
var negativeAssertionCacheSize int
var pendingQueryCacheSize int
Expand Down Expand Up @@ -215,7 +215,7 @@ func main() {
}
}

//updateConfig overrides config with the provided cmd line flags
// updateConfig overrides config with the provided cmd line flags
func updateConfig(config *rainsd.Config) {
if rootCmd.Flag("rootZonePublicKeyPath").Changed {
config.RootZonePublicKeyPath = rootZonePublicKeyPath
Expand Down
8 changes: 4 additions & 4 deletions cmd/rdig/rdig.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
flag "github.com/spf13/pflag"
)

//Options
// Options
var port = flag.UintP("port", "p", 55553,
"is the port number that rdig will send its queries to.")
var keyPhase = flag.IntP("keyphase", "k", 0,
Expand All @@ -30,7 +30,7 @@ var insecureTLS = flag.BoolP("insecureTLS", "i", false,
var tok = flag.StringP("token", "t", "",
"specifies a token to be used in the query instead of using a randomly generated one.")

//Query Options
// Query Options
var minEE = flag.BoolP("minEE", "1", false, "Query option: Minimize end-to-end latency")
var minAS = flag.BoolP("minAS", "2", false, "Query option: Minimize last-hop answer size (bandwidth)")
var minIL = flag.BoolP("minIL", "3", false, "Query option: Minimize information leakage beyond first hop")
Expand Down Expand Up @@ -116,8 +116,8 @@ func parseAllQueryOptions() []query.Option {
return qOptions
}

//handleArgs stores the cmd line argument with prefix '@' in srvAddr and additional arguments in
//name and qType. It returns false when no name was specified
// handleArgs stores the cmd line argument with prefix '@' in srvAddr and additional arguments in
// name and qType. It returns false when no name was specified
func handleArgs(srvAddr, name *string, args ...string) (types []object.Type, noName bool) {
nameSet := false
typeMap := make(map[object.Type]bool)
Expand Down
4 changes: 2 additions & 2 deletions cmd/zonepub/zonepub.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func init() {
"size is not exceeded.")
}

//main initializes rainspub
// main initializes rainspub
func main() {
if err := rootCmd.Execute(); err != nil {
log.Fatal(err)
Expand All @@ -165,7 +165,7 @@ func main() {
}
}

//updateConfig overrides config with the provided cmd line flags
// updateConfig overrides config with the provided cmd line flags
func updateConfig(config *publisher.Config) {
if rootCmd.Flag("zonefilePath").Changed {
config.ZonefilePath = zonefilePath
Expand Down
85 changes: 41 additions & 44 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,68 +1,65 @@
module github.com/netsec-ethz/rains

go 1.21
go 1.21.10

toolchain go1.21.11

require (
github.com/britram/borat v0.0.0-20181011130314-f891bcfcfb9b
github.com/inconshreveable/log15 v0.0.0-20180818164646-67afb5ed74ec
github.com/scionproto/scion v0.8.1-0.20231010074308-1774cbfccb4c
github.com/spf13/cobra v1.6.1
github.com/scionproto/scion v0.11.1-0.20240610170620-50b971ca2d4b
github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.3
golang.org/x/crypto v0.9.0
github.com/stretchr/testify v1.9.0
golang.org/x/crypto v0.23.0
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dchest/cmac v1.0.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gopacket v1.1.19 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mattn/go-sqlite3 v1.14.17 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-sqlite3 v1.14.22 // indirect
github.com/ncruces/go-strftime v0.1.9 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.14.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.19.1 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.53.0 // indirect
github.com/prometheus/procfs v0.14.0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/uber/jaeger-client-go v2.30.0+incompatible // indirect
github.com/uber/jaeger-lib v2.0.0+incompatible // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/mod v0.10.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sync v0.2.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/tools v0.9.1 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230815205213-6bfd019c3878 // indirect
google.golang.org/grpc v1.57.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240509183442-62759503f434 // indirect
google.golang.org/grpc v1.63.2 // indirect
google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/d4l3k/messagediff.v1 v1.2.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
lukechampine.com/uint128 v1.2.0 // indirect
modernc.org/cc/v3 v3.40.0 // indirect
modernc.org/ccgo/v3 v3.16.13 // indirect
modernc.org/libc v1.22.5 // indirect
modernc.org/mathutil v1.5.0 // indirect
modernc.org/memory v1.5.0 // indirect
modernc.org/opt v0.1.3 // indirect
modernc.org/sqlite v1.24.0 // indirect
modernc.org/strutil v1.1.3 // indirect
modernc.org/token v1.0.1 // indirect
modernc.org/gc/v3 v3.0.0-20240304020402-f0dba7c97c2b // indirect
modernc.org/libc v1.50.5 // indirect
modernc.org/mathutil v1.6.0 // indirect
modernc.org/memory v1.8.0 // indirect
modernc.org/sqlite v1.29.9 // indirect
modernc.org/strutil v1.2.0 // indirect
modernc.org/token v1.1.0 // indirect
)
Loading

0 comments on commit 8e9ef27

Please sign in to comment.