Skip to content

Commit 8a9f773

Browse files
committed
update docs
1 parent 52efd9a commit 8a9f773

7 files changed

Lines changed: 106 additions & 3 deletions

File tree

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ Routing & Tunnel Management
88

99
## 📖 Table of Contents
1010

11-
[🚀 Quick Start](#-quick-start)
11+
[🚀 Quick Start](#-quick-start)\
12+
[🏗️ Architecture](docs/architecture.md)\
13+
[⚙️ Config](docs/config.md)
1214

1315
## 🚀 Quick Start
1416

docs/architecture.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
🏗️ Architecture
2+
3+
This document provides a high-level overview of the components that make up Dino and how they interact to provide dynamic routing and tunneling.
4+
5+
📐 System Diagram
6+
7+
![Diagram](assets/architecture.png)
8+
9+
⌨️ CLI (Command Line Interface)
10+
11+
The Dino CLI is a statically linked Go binary that acts as the primary administrative tool. It communicates with the Server via gRPC to:
12+
13+
Provision and de-provision tunnels.\
14+
Configure hostname-to-service routing rules.\
15+
Monitor real-time tunnel health and throughput metrics.
16+
17+
🔌 API (Server)
18+
19+
The core of Dino is a high-performance H2C (HTTP/2 Cleartext) server. It serves as the single point of truth for the system state.
20+
21+
Dependency Injection: Built using uber-go/fx for a modular, testable lifecycle.\
22+
Persistence: Manages the state of routes and tunnels (via the Service layer you saw in the code).\
23+
Protocols: Uses gRPC for type-safe, low-latency communication between the CLI and the backend.
24+
25+
󰔚 Tunnel Management
26+
27+
Tunnel Management handles the "Physical" layer of the connection. It abstracts the complexity of different network interfaces into a unified logical tunnel_id.
28+
29+
Isolation: Ensures that traffic arriving on one tunnel cannot "hop" to another unless explicitly routed.\
30+
Lifecycle: Manages the handshake, keep-alives, and clean teardown of network pipes.\
31+
Abstraction: Provides a common interface for Dino to interact with local TUN/TAP devices or remote overlay peers.
32+
33+
󰄱 Proxy (Data Plane)
34+
35+
The Proxy is the engine that moves bits. It is responsible for the actual "forwarding" decision based on the configuration received from the API.
36+
37+
Host-Based Routing: Inspects the SNI or Host header of incoming requests to match them against the active routing table.\
38+
Protocol Translation: Supports mapping incoming traffic to various destination protocols (as defined in dest_protocol).\
39+
Flow Control: Handles the stream multiplexing between a single tunnel entry-point and multiple internal microservices.

docs/assets/architecture.png

109 KB
Loading

docs/config.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# ⚙️ Config
2+
3+
servers and tunnels can be configured using environment variables. this page will serve a dictionary for all variables and their purpose.
4+
5+
## Server
6+
7+
`LOG_LEVEL` `DEBUG` global log level
8+
9+
`SERVER_HOST` `127.0.0.1` server api bind host\
10+
`SERVER_PORT` `50051` server api bind port
11+
12+
`DB_USERNAME` `dino` database user\
13+
`DB_PASSWORD` `dino` database user password\
14+
`DB_HOST` `postgres` database host\
15+
`DB_PORT` `5432` database port\
16+
`DB_NAME` `dino` database name\
17+
`DB_EXRA_PARAMS` `sslmode=disable` pgxpool dial string params
18+
19+
`AUTH_JWT_DURATION` `-1` jwt duration\
20+
`AUTH_JWT_ISSUER` `dino.local` jwt issuer\
21+
`AUTH_JWT_AUD` `dino` jwt audience (`,` split list)
22+
23+
## Tunnel
24+
25+
`TUNNEL_ID` tunnel id\
26+
`TUNNEL_TOKEN` tunnel token\
27+
`TUNNEL_ENDPOINT` `tunnel.dino.local:4222` tunnel endpoint

docs/route.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,19 @@
11
# Route
2+
3+
This document serves as a breakdown of Dino Route.
4+
5+
## Core Concepts
6+
7+
Dino Routes are used when routing tunnel traffic after exiting the tunnel. The routing table will match based on Route `hostname` and dial the destination provided at Route creation.
8+
9+
example Route creation using Dino CLI.
10+
11+
```bash
12+
dino route add \
13+
-a localhost:8888 \ # local address
14+
-p whoami.dino.local \ # hostname
15+
-r http \ # protocol
16+
-x hello \ # route name
17+
-t api.dino.local:50051 # api server endpoint
18+
```
19+

docs/tunnel.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
1-
# Tunnel
1+
# 🛤️ Tunnel
2+
3+
This document explains how Dino maps incoming tunnel traffic to internal destinations.
4+
5+
## Core Concept
6+
7+
Dino operates a control plane for network tunnels. Functionality is different from wireguard as it does not interact with physical devices. Instead it manages the routing table that dictates where traffic goes once it exits the tunnel.
8+
9+
example tunnel creation using Dino CLi.
10+
```bash
11+
dino tunnel add hello -t api.dino.local:50051
12+
```
13+
14+
## Authentication
15+
16+
17+

setup/config.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ type Server struct {
5959
KeyPath string `env:"SSL_KEY_PATH"`
6060
}
6161

62+
// JWT
6263
type JWT struct {
6364
Duration int64 `env:"DURATION, default=-1"` // jwt token duration in seconds
6465
Issuer string `env:"ISSUER, default=dino.local"`
@@ -74,7 +75,7 @@ type Authenticator struct {
7475
type Tunnel struct {
7576
ID string `env:"ID"`
7677
Token string `env:"TOKEN"`
77-
Endpoint string `env:"ENDPOINT"`
78+
Endpoint string `env:"ENDPOINT, default=tunnel.dino.local:4242"`
7879
}
7980

8081
// Configs

0 commit comments

Comments
 (0)