# scionproto/scion architecture

> Architecture diagram of the GitHub repository scionproto/scion, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/scionproto/scion
- Repository: https://github.com/scionproto/scion
- Video tour (about a minute): https://gitdiagram.com/scionproto/scion/video

## Overview

SCION is an implementation of a next-generation network architecture for controlled, failure-isolated communication with explicit trust. The user-facing flow is an application using the SCION client/network APIs to send traffic; the daemon supplies path and service information, while routers forward packets and control services distribute routing information. The repository also includes a gateway for IP connectivity and scion-pki tools for certificate/TRC operations. The sampled source shows daemon assembly and engine responsibilities, plus gateway engine replacement; several cross-service links are architectural rather than verified calls.

Main entry points: [`control/cmd/control/main.go`](https://github.com/scionproto/scion/blob/master/control/cmd/control/main.go) (Control service), [`daemon/grpc/server.go`](https://github.com/scionproto/scion/blob/master/daemon/grpc/server.go) (Daemon gRPC API), [`pkg/daemon/private/engine/engine.go`](https://github.com/scionproto/scion/blob/master/pkg/daemon/private/engine/engine.go) (Daemon engine), [`router/cmd/router/main.go`](https://github.com/scionproto/scion/blob/master/router/cmd/router/main.go) (SCION router)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_host["Host connectivity"]
  node_scion_cli["SCION CLI<br/>[main.go]"]
  node_snet["SCION networking<br/>[snet.go]"]
  node_daemon["Daemon service<br/>[main.go]"]
  node_daemon_api["Daemon gRPC API<br/>[server.go]"]
  node_daemon_engine["Daemon engine<br/>[engine.go]"]
end

subgraph group_control["Control plane"]
  node_control_service["Control service<br/>[main.go]"]
  node_beaconing["Beaconing<br/>[handler.go]"]
  node_segment_handling["Segment handling<br/>[seghandler.go]"]
  node_segment_storage["Segment storage<br/>[storage.go]"]
  node_drkey_service["DRKey service<br/>[service_engine.go]"]
end

subgraph group_forward["Packet forwarding"]
  node_router["SCION router<br/>[main.go]"]
  node_router_dataplane["Router dataplane<br/>[dataplane.go]"]
  node_dispatcher["Packet dispatcher<br/>[main.go]"]
end

subgraph group_gateway["IP gateway"]
  node_gateway["Gateway service<br/>[main.go]"]
  node_gateway_controller["Session controller"]
  node_gateway_engine["Forwarding engine<br/>[engine.go]"]
  node_gateway_dataplane["Gateway dataplane<br/>[worker.go]"]
end

subgraph group_security["Trust and storage"]
  node_storage[("Persistent storage<br/>[storage.go]")]
  node_trust["Trust engine<br/>[engine.go]"]
  node_pki["PKI tools<br/>[main.go]"]
end

node_application(("Application"))

node_application -.->|"sends traffic"| node_snet
node_scion_cli -.->|"provides commands"| node_application
node_daemon -->|"registers API"| node_daemon_api
node_daemon_api -->|"delegates requests"| node_daemon_engine
node_daemon_engine -.->|"fetches paths"| node_control_service
node_control_service -->|"runs beaconing"| node_beaconing
node_control_service -->|"configures DRKey"| node_drkey_service
node_segment_handling -->|"stores segments"| node_segment_storage
node_control_service -.->|"configures stores"| node_storage
node_router -.->|"runs forwarding"| node_router_dataplane
node_dispatcher -.->|"delivers packets"| node_router
node_gateway -.->|"configures sessions"| node_gateway_controller
node_gateway_controller -->|"replaces engine"| node_gateway_engine
node_gateway_engine -.->|"runs workers"| node_gateway_dataplane
node_pki -.->|"manages trust material"| node_trust

click node_scion_cli "https://github.com/scionproto/scion/blob/master/scion/cmd/scion/main.go"
click node_snet "https://github.com/scionproto/scion/blob/master/pkg/snet/snet.go"
click node_daemon "https://github.com/scionproto/scion/blob/master/daemon/cmd/daemon/main.go"
click node_daemon_api "https://github.com/scionproto/scion/blob/master/daemon/grpc/server.go"
click node_daemon_engine "https://github.com/scionproto/scion/blob/master/pkg/daemon/private/engine/engine.go"
click node_control_service "https://github.com/scionproto/scion/blob/master/control/cmd/control/main.go"
click node_beaconing "https://github.com/scionproto/scion/blob/master/control/beaconing/handler.go"
click node_segment_handling "https://github.com/scionproto/scion/blob/master/private/segment/seghandler/seghandler.go"
click node_segment_storage "https://github.com/scionproto/scion/blob/master/private/segment/seghandler/storage.go"
click node_drkey_service "https://github.com/scionproto/scion/blob/master/control/drkey/service_engine.go"
click node_router "https://github.com/scionproto/scion/blob/master/router/cmd/router/main.go"
click node_router_dataplane "https://github.com/scionproto/scion/blob/master/router/dataplane.go"
click node_dispatcher "https://github.com/scionproto/scion/blob/master/dispatcher/cmd/dispatcher/main.go"
click node_gateway "https://github.com/scionproto/scion/blob/master/gateway/cmd/gateway/main.go"
click node_gateway_controller "https://github.com/scionproto/scion/blob/master/gateway/control/enginecontroller.go"
click node_gateway_engine "https://github.com/scionproto/scion/blob/master/gateway/control/engine.go"
click node_gateway_dataplane "https://github.com/scionproto/scion/blob/master/gateway/dataplane/worker.go"
click node_storage "https://github.com/scionproto/scion/blob/master/private/storage/storage.go"
click node_trust "https://github.com/scionproto/scion/blob/master/private/trust/engine.go"
click node_pki "https://github.com/scionproto/scion/blob/master/scion-pki/cmd/scion-pki/main.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_scion_cli,node_snet,node_daemon,node_daemon_api,node_daemon_engine toneBlue
class node_control_service,node_beaconing,node_segment_handling,node_segment_storage,node_drkey_service toneAmber
class node_router,node_router_dataplane,node_dispatcher toneMint
class node_gateway,node_gateway_controller,node_gateway_engine,node_gateway_dataplane toneRose
class node_storage,node_trust,node_pki,node_application toneIndigo
```

## Components

### Host connectivity

- [SCION CLI](https://github.com/scionproto/scion/blob/master/scion/cmd/scion/main.go): `scion/cmd/scion/main.go`
- [SCION networking](https://github.com/scionproto/scion/blob/master/pkg/snet/snet.go): `pkg/snet/snet.go`
- [Daemon service](https://github.com/scionproto/scion/blob/master/daemon/cmd/daemon/main.go): `daemon/cmd/daemon/main.go`
- [Daemon gRPC API](https://github.com/scionproto/scion/blob/master/daemon/grpc/server.go): `daemon/grpc/server.go`
- [Daemon engine](https://github.com/scionproto/scion/blob/master/pkg/daemon/private/engine/engine.go): `pkg/daemon/private/engine/engine.go`

### Control plane

- [Control service](https://github.com/scionproto/scion/blob/master/control/cmd/control/main.go): `control/cmd/control/main.go`
- [Beaconing](https://github.com/scionproto/scion/blob/master/control/beaconing/handler.go): `control/beaconing/handler.go`
- [Segment handling](https://github.com/scionproto/scion/blob/master/private/segment/seghandler/seghandler.go): `private/segment/seghandler/seghandler.go`
- [Segment storage](https://github.com/scionproto/scion/blob/master/private/segment/seghandler/storage.go): `private/segment/seghandler/storage.go`
- [DRKey service](https://github.com/scionproto/scion/blob/master/control/drkey/service_engine.go): `control/drkey/service_engine.go`

### Packet forwarding

- [SCION router](https://github.com/scionproto/scion/blob/master/router/cmd/router/main.go): `router/cmd/router/main.go`
- [Router dataplane](https://github.com/scionproto/scion/blob/master/router/dataplane.go): `router/dataplane.go`
- [Packet dispatcher](https://github.com/scionproto/scion/blob/master/dispatcher/cmd/dispatcher/main.go): `dispatcher/cmd/dispatcher/main.go`

### IP gateway

- [Gateway service](https://github.com/scionproto/scion/blob/master/gateway/cmd/gateway/main.go): `gateway/cmd/gateway/main.go`
- [Session controller](https://github.com/scionproto/scion/blob/master/gateway/control/enginecontroller.go): `gateway/control/enginecontroller.go`
- [Forwarding engine](https://github.com/scionproto/scion/blob/master/gateway/control/engine.go): `gateway/control/engine.go`
- [Gateway dataplane](https://github.com/scionproto/scion/blob/master/gateway/dataplane/worker.go): `gateway/dataplane/worker.go`

### Trust and storage

- [Persistent storage](https://github.com/scionproto/scion/blob/master/private/storage/storage.go): `private/storage/storage.go`
- [Trust engine](https://github.com/scionproto/scion/blob/master/private/trust/engine.go): `private/trust/engine.go`
- [PKI tools](https://github.com/scionproto/scion/blob/master/scion-pki/cmd/scion-pki/main.go): `scion-pki/cmd/scion-pki/main.go`

### Other components

- **Application**

## Connections

- Application → SCION networking: sends traffic (evidence: `README.md`)
- SCION CLI → Application: provides commands (evidence: `scion/cmd/scion/main.go`)
- Daemon service → Daemon gRPC API: registers API (evidence: `daemon/cmd/daemon/main.go`)
- Daemon gRPC API → Daemon engine: delegates requests (evidence: `daemon/grpc/server.go`)
- Daemon engine → Control service: fetches paths
- Control service → Beaconing: runs beaconing (evidence: `control/cmd/control/main.go`)
- Control service → DRKey service: configures DRKey (evidence: `control/cmd/control/main.go`)
- Segment handling → Segment storage: stores segments (evidence: `private/segment/seghandler/storage.go`)
- Control service → Persistent storage: configures stores
- SCION router → Router dataplane: runs forwarding
- Packet dispatcher → SCION router: delivers packets
- Gateway service → Session controller: configures sessions
- Session controller → Forwarding engine: replaces engine (evidence: `gateway/control/enginecontroller.go`)
- Forwarding engine → Gateway dataplane: runs workers
- PKI tools → Trust engine: manages trust material
