Skip to content

Commit

Permalink
Bump scion and rains dependencies (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcfrei committed Dec 8, 2020
1 parent b082b9e commit 8a0d048
Show file tree
Hide file tree
Showing 21 changed files with 934 additions and 213 deletions.
32 changes: 15 additions & 17 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2
jobs:
build:
docker:
- image: circleci/golang:1.13
- image: circleci/golang:1.14

steps:
- run:
Expand Down Expand Up @@ -31,9 +31,9 @@ jobs:
- "/go/pkg"

integration:
docker:
- image: circleci/golang:1.13-stretch
resource_class: medium
machine:
image: ubuntu-1604:202007-01

steps:
- checkout
# The following step are shared with netsec-ethz/rains
Expand All @@ -57,41 +57,39 @@ jobs:
- run:
name: Build SCION services and install python3 dependencies
command: |
# Log tool versions provided by CircleCi
go version
python3 --version
cd ~/scion
for service in "border" "cs" "godispatcher" "sciond" "tools/scion-pki"; do
for service in "posix-router" "cs" "dispatcher" "scion-pki" "sciond"; do
go build -o ./bin/ ./go/${service}/ && echo "Built ${service}";
done
sudo apt-get update && sudo apt-get install --assume-yes python3 python3-pip
pip3 install -U wheel setuptools
pip3 install -r ~/scion/env/pip3/requirements.txt
- run:
name: Configure and start local SCION AS
command: |
export PYTHONPATH=~/scion/python/
cd ~/scion
export PYTHONPATH=python/:.
# Generate Tiny.topo
# Generate tiny4.topo
printf '#!/bin/bash\necho "0.0.0.0"' > tools/docker-ip # Some hackery to make topo scripts run
# Use IPv4 addresses for this test
python/topology/generator.py -c ./topology/Tiny4.topo
python3 python/topology/generator.py -c ./topology/tiny4.topo
# Link the gen directory containing sciond_addresses.json and as_list.json
ln -s ~/scion/gen /home/circleci/project/gen
# Generate gen-certs
mkdir gen-certs gen-cache
openssl genrsa -out "gen-certs/tls.key" 2048
openssl req -new -x509 -key "gen-certs/tls.key" -out "gen-certs/tls.pem" -days 3650 -subj /CN=scion_def_srv
mkdir gen-cache
sudo mkdir /run/shm -m 777
# Start all AS Tiny.topo
# Start all AS tiny4.topo
supervisor/supervisor.sh reload
supervisor/supervisor.sh start all
- run:
name: Prepare integration test
command: |
# Handle the two special ones
make setup_lint
make setup_lint
sudo apt-get update && sudo apt-get install -y libpam0g-dev
- run:
name: Integration tests
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ BIN = bin
# environment as returned by go env, and uses the "Default Values" parameter
# expansion ${variable:-default} to implement the fallback sequence:
# $GOBIN, else $GOPATH/bin, else $HOME/go/bin
DESTDIR = $(shell set -a; eval $$( go env ); echo $${GOBIN:-$${GOPATH:-$${HOME}/go}/bin})
# If there are multiple entries in GOPATH, take the first.
DESTDIR = $(shell set -a; eval $$( go env ); gopath=$${GOPATH%:*}; echo $${GOBIN:-$${gopath:-$${HOME}/go}/bin})

# HINT: build with TAGS=norains to build without rains support
TAGS =
Expand All @@ -31,7 +32,7 @@ test: lint

setup_lint:
@# Install golangci-lint (as dumb as this looks, this is the recommended way to install)
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $$(go env GOPATH)/bin v1.26.0
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b ${DESTDIR} v1.31.0

lint:
@type golangci-lint > /dev/null || ( echo "golangci-lint not found. Install it manually or by running 'make setup_lint'."; exit 1 )
Expand Down
52 changes: 40 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ sudo apt install scion-apps-*

### Build:

1. Install go 1.13
1. Install go 1.14

See e.g. https://github.com/golang/go/wiki/Ubuntu

Expand All @@ -28,7 +28,7 @@ sudo apt install scion-apps-*
```shell
sudo apt-get install -y libpam0g-dev
```

1. Clone this repository

```shell
Expand All @@ -41,7 +41,7 @@ sudo apt install scion-apps-*
```shell
make setup_lint
```

1. Run `make` to build all projects (and run linters). Run `make -j` to use multiple jobs to build.

1. Run `make test` to run the linters and unit tests.
Expand All @@ -56,6 +56,7 @@ SCION dispatcher and SCION daemon.
Please refer to the [SCIONLab tutorials](https://docs.scionlab.org) to get
started.


#### Environment

The dispatcher and sciond sockets are assumed to be at default locations, but
Expand All @@ -70,7 +71,7 @@ When running multiple local ASes, e.g. during development, the address of the
sciond corresponding to the desired AS needs to be specified in the
`SCION_DAEMON_ADDRESS` environment variable.
In this case, the different sciond addresses can be found in their
corresponding `sd.toml` configuration files in the `gen/ISDx/ASy/endhost`
corresponding `sd.toml` configuration files in the `gen/ASx`
directory, or summarized in the file `gen/sciond_addresses.json`.


Expand All @@ -90,38 +91,65 @@ This configuration file needs to contain the SCION address of the RAINS
resolver, in the form `<ISD>-<AS>,[<IP>]`.


## _examples

The directory _examples contains a minimal "hello, world" application using SCION that sends one packet from a client to a server. The directory also contains small example programs that show how HTTP can be used over SCION/QUIC for servers, proxies, and clients.

More documentation is available in the [helloworld README](_examples/helloworld/README.md) and in the [shttp README](_examples/shttp/README.md).


## bat

bat is a cURL-like tool for testing, debugging, and generally interacting with HTTP servers over SCION/QUIC. Documentation of the code is available in the [README.md](bat/README.md).
bat is a cURL-like tool for testing, debugging, and generally interacting with HTTP servers over SCION/QUIC. Documentation of the code is available in the [bat README](bat/README.md).

Installation and usage information is available on the [SCION Tutorials web page for bat](https://docs.scionlab.org/content/apps/bat.html).


## bwtester

The bandwidth testing application bwtester enables a variety of bandwidth tests on the SCION network. Documentation of the code and protocol are described in the [bwtester README](bwtester/README.md).

Installation and usage information is available on the [SCION Tutorials web page for bwtester](https://docs.scionlab.org/content/apps/bwtester.html).


## camerapp

Camerapp contains image fetcher and server applications, using the SCION network. Documentation of the code is available in the [README.md](https://github.com/netsec-ethz/scion-apps/blob/master/camerapp/README.md).
Camerapp contains image fetcher and server applications, using the SCION network. Documentation of the code is available in the [camerapp README](camerapp/README.md).

Installation and usage information is available on the [SCION Tutorials web page for camerapp](https://docs.scionlab.org/content/apps/access_camera.html).


## netcat

netcat contains a SCION port of the netcat application. See the [netcat README](netcat/README.md) for more information.


## pkg

Pkg contains underlaying library code for scion-apps.

- appnet: simplified and functionally extended wrapper interfaces for the SCION core libraries
- appquic: a simple interface to use QUIC over SCION
- shttp: a client/server implementation of HTTP/3 over SCION/QUIC
- integration: a simple framework to support intergration testing for the demo applications in this repository


## sensorapp

Sensorapp contains fetcher and server applications for sensor readings, using the SCION network.

Installation and usage information is available on the [SCION Tutorials web page for sensorapp](https://docs.scionlab.org/content/apps/fetch_sensor_readings.html).


## bwtester
## ssh

The bandwidth testing application `bwtester` enables a variety of bandwidth tests on the SCION network.
Directory ssh contains a SSH client and server running over SCION network.

Documentation of the code and protocol are described in the [bwtester README](bwtester/README.md).

Installation and usage information is available on the [SCION Tutorials web page for bwtester](https://docs.scionlab.org/content/apps/bwtester.html).
More documentation is available in the [ssh README](ssh/README.md).


## webapp

Webapp is a Go application that will serve up a static web portal to make it easy to experiment with SCIONLab test apps on a virtual machine.

Installation and usage information is available on the [SCION Tutorials web page for webapp](https://docs.scionlab.org/content/apps/as_visualization/webapp.html).
Installation and usage information is available on the [SCION Tutorials web page for webapp](https://docs.scionlab.org/content/apps/as_visualization/webapp.html) and in the [webapp README](webapp/README.md).
19 changes: 11 additions & 8 deletions _examples/helloworld/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,20 @@ Client:
go run helloworld.go -remote 17-ffaa:1:a,[127.0.0.1]:1234
```

Replace `17-ffaa:1:a` with your local AS address printed by the server.
Replace `17-ffaa:1:a` with the address of the AS in which the server is running.

## Walkthrough:

This SCION application is very simple, and it demonstrates what is needed to send data using SCION:

1. Parse addresses from string to binary structures.
2. Initialize the SCION library.
3. Obtain a path manager.
4. Obtain paths from source to destination.
5. Obtain a connection using one of these paths.
6. Use that connection to send the data.
1. Validate command-line arguments.

You can find these items in the comments of the code.
Server:
2. Open listener connection (appnet.ListenPort).
3. Read packets from connection.
4. Close listener connection.

Client:
2. Open client connection (appnet.Dial).
3. Write packet to connection.
4. Close client connection.
130 changes: 130 additions & 0 deletions _examples/shttp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# Examples for HTTP over SCION/QUIC

This directory contains small example programs that show how HTTP can be used over SCION/QUIC for servers, proxies, and clients:

- fileserver: a server that serves the files from its working directory
- proxy: a proxy server that can translate between HTTP and HTTP-over-SCION
- server: a server with friendly greetings and other examples
- client: a client that talks to the example server

See also the package [shttp](../../pkg/shttp/README.md) for the underlaying library code.

## Build:

Clone the repository netsec-ethz/scion-apps and build the eaxample applications:

```
git clone https://github.com/netsec-ethz/scion-apps.git
cd scion-apps
make example-shttp-fileserver \
example-shttp-proxy \
example-shttp-server \
example-shttp-client
```

## Running:

All examples require a running SCION endhost stack, i.e. a running SCION dispatcher and SCION daemon. Please refer to '[Running](../../README.md#Running)' in this repository's main README and the [SCIONLab tutorials](https://docs.scionlab.org) to get started.

### Generic file server example

Run `example-shttp-fileserver`:

```
bin/example-shttp-fileserver
```

See '[Environment](../../README.md#Environment)' on how to set the dispatcher and sciond environment variables in the server's AS.

Build `scion-bat` as a client for `example-shttp-fileserver`:

```
make scion-bat
```

See also the application '[bat](../../bat/README.md)' for more details on the cURL-like CLI tool `scion-bat`.

Access `example-shttp-fileserver` with `scion-bat`:

```
bin/scion-bat 17-ffaa:1:a,[127.0.0.1]:443/
```

Replace '17-ffaa:1:a' with your server's ISD and AS numbers and see '[Environment](../../README.md#Environment)' on how to set the dispatcher and sciond environment variables in the client's (or proxy's) AS.

Run `example-shttp-proxy` to provide `example-shttp-fileserver` functionality via HTTP:

```
bin/example-shttp-proxy --remote=17-ffaa:1:a,[127.0.0.1]:443 --local=0.0.0.0:8080
```

Access `example-shttp-fileserver` via HTTP with `cURL`:

```
curl -v http://127.0.0.1:8080/
```

(Or navigate to http://127.0.0.1:8080/ in a web browser.)

`example-shttp-proxy` can also be used as a proxy from SCION to HTTP, from SCION to SCION, and from HTTP to HTTP. See package [shttp](../../pkg/shttp/README.md) for more details.

### Simple shttp-based server example

Open a shell in the root of the scion-apps repository and run `example-shttp-server`:

```
cd _examples/shttp/server
go run .
```

Open a new shell in the scion-apps repository and access `example-shttp-server` with `scion-bat`:

```
bin/scion-bat 17-ffaa:1:a,[127.0.0.1]:443/hello
```

or

```
bin/scion-bat 17-ffaa:1:a,[127.0.0.1]:443/json
```

or

```
bin/scion-bat -f 17-ffaa:1:a,[127.0.0.1]:443/form foo=bar
```

Run the custom `example-shttp-client` for `example-shttp-server`:

```
bin/example-shttp-client -s 17-ffaa:1:a,[127.0.0.1]:443
```

Run `example-shttp-proxy` to provide `bin/example-shttp-server` functionality via HTTP:

```
bin/example-shttp-proxy --remote=17-ffaa:1:a,[127.0.0.1]:443 --local=0.0.0.0:8080
```

Access `example-shttp-server` via HTTP with `cURL`:

```
curl http://127.0.0.1:8080/hello
```

or

```
curl http://127.0.0.1:8080/json
```

or

```
curl -d foo=bar http://127.0.0.1:8080/form
```

And, finally, to see the cute dog picture:

Navigate to http://127.0.0.1:8080/image in a web browser.
2 changes: 1 addition & 1 deletion bwtester/bwtestclient/bwtestclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ func main() {

// update default packet size to max MTU on the selected path
if path != nil {
InferedPktSize = int64(path.MTU())
InferedPktSize = int64(path.Metadata().MTU)
} else {
// use default packet size when within same AS and pathEntry is not set
InferedPktSize = DefaultPktSize
Expand Down
Loading

0 comments on commit 8a0d048

Please sign in to comment.