Codebase Information
Project Overview
| Field |
Value |
| Name |
websocket-relay |
| Language |
Go 1.21 |
| Type |
WebSocket relay server |
| License |
Not specified |
| Repository |
Gitea-hosted |
Directory Structure
websocket-relay/
├── main.go # Application entry point
├── go.mod # Go module definition
├── go.sum # Dependency checksums
├── config.yaml # Runtime configuration
├── config.example.yaml # Example configuration with TLS enabled
├── Makefile # Build, test, release commands
├── cert.pem # TLS certificate (local dev)
├── key.pem # TLS private key (local dev)
├── README.md # Project readme
├── .gitignore # Git ignore rules
├── example/
│ └── index.html # Browser-based P2P chat demo
├── internal/
│ ├── config/
│ │ ├── config.go # YAML configuration loader
│ │ └── config_test.go # Config loader tests
│ ├── hub/
│ │ ├── hub.go # WebSocket hub (connection management + broadcast)
│ │ └── hub_test.go # Hub unit tests
│ └── metrics/
│ └── metrics.go # Prometheus metrics definitions
└── .gitea/
└── workflows/
├── ci.yml # CI pipeline (test + lint)
└── release.yml # Release pipeline (build + publish)
Technology Stack
| Category |
Technology |
Version |
| Runtime |
Go |
1.21 |
| WebSocket |
gorilla/websocket |
1.5.1 |
| Metrics |
prometheus/client_golang |
1.17.0 |
| Configuration |
gopkg.in/yaml.v3 |
3.0.1 |
| CI/CD |
Gitea Actions |
— |
| Linting |
golangci-lint |
latest |
Build Targets
| Command |
Description |
make build |
Build binary to build/websocket-relay |
make test |
Run all tests with verbose output |
make release |
Cross-compile for linux/amd64 and darwin/arm64 |
make clean |
Remove build artifacts |
make run |
Run from source |
make deps |
Tidy Go modules |
Key Metrics
| Metric |
Value |
| Total Go files |
5 (+ 2 test files) |
| Packages |
4 (main, config, hub, metrics) |
| Test files |
2 |
| CI Pipelines |
2 (CI + Release) |
| External dependencies |
3 direct, 9 indirect |