Language bindings for the PAN (Path Aware Networking) library of the SCION Internet architecture project. The PAN library and other SCION demo applications (in Go) can be found in the scion-apps repository: https://github.com/netsec-ethz/scion-apps
More information on SCION: https://www.scion.org/
Most of the open-source implementation of SCION is written in Go. The bindings in this repository use Cgo to export the Go functions to C. The exported C functions can then be called from the C++ and Python wrappers. Therefore you will need the Go compiler in addition to a C and C++ compiler. The Python bindings require an installation of Python 3.
Since PAN depends on quic-go and quic-go only supports a narrow range of Go
versions with each release, your system-wide installation of Go might be too old
or too new to compile PAN. The current release of pan-bindings has been tested
with Go 1.24.4. If you have an unsupported version of Go installed, you can
download a separate copy of Go and specify the absolute path the to go binary
in the CMake cache variable GO_BINARY (defaults to go). Go itself can
install additional version, e.g.:
go install golang.org/dl/go1.24.4@latest
# Go will usually install the new go binary in `~/go/bin/`. Add this directory
# to PATH or use the full path for the next command.
go1.24.4 download
# Run cmake with -D GO_BINARY=$(which go1.24.4)Building the C++ bindings requires standalone (non-boost) Asio. The C++ examples require ncurses on Linux.
CMake is used as Makefile generator.
Release:
mkdir -p build/release
cmake -D CMAKE_BUILD_TYPE=Release -D BUILD_SHARED_LIBS=ON -B build/release
cmake --build build/releaseDebug:
mkdir -p build/debug
cmake -D CMAKE_BUILD_TYPE=Debug -D BUILD_SHARED_LIBS=ON -B build/debug
cmake --build build/debugInstallation (by default to /usr/local):
sudo cmake --install build/release
sudo ldconfigThis will install the following files:
${CMAKE_INSTALL_PREFIX}/include/pan/pan.h
${CMAKE_INSTALL_PREFIX}/include/pan/pan_cdefs.h
${CMAKE_INSTALL_PREFIX}/lib/libpan.so.1.1.1
${CMAKE_INSTALL_PREFIX}/lib/libpan.so.1
${CMAKE_INSTALL_PREFIX}/lib/libpan.so
${CMAKE_INSTALL_PREFIX}/lib/libpancpp.so.1.1.1
${CMAKE_INSTALL_PREFIX}/lib/libpancpp.so.1
${CMAKE_INSTALL_PREFIX}/lib/libpancpp.so
${CMAKE_INSTALL_PREFIX}/include/pan/pan.hpp
${CMAKE_INSTALL_PREFIX}/include/pan/go_handle.hpp
${CMAKE_INSTALL_PREFIX}/bin/scion-echo
${CMAKE_INSTALL_PREFIX}/bin/scion-echo-async
The debug versions of the libraries have a d suffix and can be installed in
parallel to the release version.
Install MSYS2 and Go. The following MSYS2 packets are required:
pacman -Sy
pacman -S \
  mingw-w64-ucrt-x86_64-gcc   \
  mingw-w64-ucrt-x86_64-cmake \
  mingw-w64-ucrt-x86_64-ninja \
  mingw-w64-ucrt-x86_64-asioOpen an MSYS2 UCRT64 environment and navigate to the project root (Windows drive
letters are available as /c and so on).
mkdir build
cmake -D BUILD_SHARED_LIBS=ON -D GO_BINARY="$PROGRAMFILES/Go/bin/go.exe" -G 'Ninja Multi-Config' -B build
# Release:
cmake --build build --config Release
# Debug:
cmake --build build --config DebugHeaders and binaries can be installed as well:
cmake --install build --config Release --prefix /usr/localYou can generate API documentation in docs/gen by running doxygen in the
project's root directory.
For C:
- Include pan/pan.hand link with-lpan.
For C++:
- Include pan/pan.hppand link with-lpancpp.
For Python:
- Make sure Python can find the contents of the pythondirectory, e.g., by adding it toPYTHONPATHand import the module (import pan)
The examples directory contains simple echo servers/clients demonstrating both
blocking and non-blocking IO.
Usage example (assuming the tiny4.topo topology from the SCION repository):
# Server
export SCION_DAEMON_ADDRESS=127.0.0.19:30255
scion-echo --local 127.0.0.1:31000       # blocking
scion-echo-async --local 127.0.0.1:31000 # non-blocking
# Client
export SCION_DAEMON_ADDRESS=127.0.0.27:30255
scion-echo --remote 1-ff00:0:111,127.0.0.1:31000       # blocking
scion-echo-async --remote 1-ff00:0:111,127.0.0.1:31000 # non-blockingPython version:
# Install PAN in a venv as an editable package
python3 -m venv .venv
. .venv/bin/activate
python -m pip install -e ./python
# Server
export SCION_DAEMON_ADDRESS=127.0.0.19:30255
examples/python/echo.py --local 127.0.0.1:31000         # blocking
examples/python/echo.py --async --local 127.0.0.1:31000 # non-blocking
# Client
export SCION_DAEMON_ADDRESS=127.0.0.27:30255
examples/python/echo.py --remote 1-ff00:0:111,127.0.0.1:31000         # blocking
examples/python/echo.py --async --remote 1-ff00:0:111,127.0.0.1:31000 # non-blocking