This guide explains how to build and run the masque-vpn server for educational and research purposes.
- Go 1.25 or later
- OpenSSL (for certificate generation)
- Linux, macOS, or Windows
- Administrative privileges (for TUN device creation)
For developers interested in the codebase:
vpn_server/: Server entry point (main.go) and modular server implementation.vpn_server/internal/server/: Core server logic split into modules:server.go: Main server and initializationapi_server.go: REST API server for managementmasque_handler.go: MASQUE CONNECT-IP request handlerpacket_processor.go: TUN device packet processingmetrics.go: Prometheus metricstls_config.go: TLS configuration
vpn_client/: Client implementation with MASQUE CONNECT-IP support.common/: Shared utilities and custom MASQUE implementation:masque_connectip.go: Custom MASQUE CONNECT-IP clientmasque_proxy.go: IP packet tunneling functionserrors.go: Centralized error handling system
cd vpn_server
go build -o vpn-server .This will create a vpn-server executable in the vpn_server directory.
cd vpn_client
go build -o vpn-client .Before starting the server, you need to generate TLS certificates:
cd cert
# For Linux/macOS
./generate-test-certs.sh
# For Windows
powershell -ExecutionPolicy Bypass -File generate-certs.ps1This will create the following files in the cert/ directory:
ca.crt- CA certificateca.key- CA private keyserver.crt- Server certificateserver.key- Server private keyclient.crt- Client certificateclient.key- Client private key
Use the provided local configuration:
cd vpn_server
# Use config.server.local.toml for local testingKey configuration settings in config.server.local.toml:
listen_addr = "127.0.0.1:4433"- Server listening addressassign_cidr = "10.0.0.0/24"- IP range for VPN clientstun_name = ""- TUN device disabled for local testingapi_server.listen_addr = "127.0.0.1:8080"- API server address
The API server is configured in the [api_server] section:
[api_server]
listen_addr = "127.0.0.1:8080"
static_dir = "../admin_webui/dist"
database_path = "masque_admin.db"Metrics are configured in the [metrics] section:
[metrics]
enabled = true
listen_addr = "127.0.0.1:9090"cd vpn_server
./vpn-server -c config.server.local.tomlThe server will start several services:
- MASQUE VPN Server - Listens on
127.0.0.1:4433 - REST API Server - Available at
http://127.0.0.1:8080 - Prometheus Metrics - Available at
http://127.0.0.1:8080/metrics
You should see output like:
2025-12-21T03:57:31.297+0300 INFO Starting MASQUE VPN Server
2025/12/21 03:57:31 TUN device disabled (empty tun_name)
2025/12/21 03:57:31 MASQUE VPN Server listening on 127.0.0.1:4433
2025/12/21 03:57:31 API Server will start on 127.0.0.1:8080
Check health status:
curl http://127.0.0.1:8080/healthCheck server status:
curl http://127.0.0.1:8080/api/v1/statusCheck metrics:
curl http://127.0.0.1:8080/metricsConfigure the client for local testing:
cd vpn_client
# Edit config.client.toml to use server_addr = "127.0.0.1:4433"Start the client:
./vpn-client -c config.client.tomlRun the included connection test:
go run test_masque_connection.goThis will test basic MASQUE protocol functionality without requiring TUN devices.
Check connected clients:
curl http://127.0.0.1:8080/api/v1/clientsView server statistics:
curl http://127.0.0.1:8080/api/v1/statsIf you get permission errors when creating TUN devices:
# Linux/macOS
sudo ./vpn-server -c config.server.local.toml
sudo ./vpn-client -c config.client.toml
# Windows (run as Administrator)
.\vpn-server.exe -c config.server.local.toml
.\vpn-client.exe -c config.client.tomlMake sure certificates are generated and paths are correct:
ls -la cert/
# Should show: ca.crt, ca.key, server.crt, server.key, client.crt, client.keyIf you get "address already in use" error:
- Check if another instance is running:
ps aux | grep vpn-server - Change ports in configuration files
- On Linux:
sudo netstat -tulpn | grep 4433
- Verify firewall settings allow traffic on configured ports
- Check that client uses correct server address
- Ensure certificates are valid and not expired
- Review server logs for detailed error messages
# Test common package
cd common && go test -v
# Test server components
cd vpn_server && go test -v ./...
# Test client
cd vpn_client && go test -v# Run integration tests
cd tests/integration && go test -v
# Run load tests
cd tests/load && go test -v# Local testing script
./scripts/test-local.sh
# Docker testing script
./scripts/test-docker.shAfter the server is running:
- Test basic MASQUE protocol functionality with
test_masque_connection.go - Experiment with different network conditions using
tc(Linux) - Monitor performance using Prometheus metrics
- Study the custom MASQUE implementation in
common/masque_connectip.go - Explore the modular server architecture in
vpn_server/internal/server/
This implementation is designed for educational and research purposes:
- Protocol Study: Learn MASQUE CONNECT-IP implementation details
- Performance Analysis: Use built-in metrics for performance studies
- Network Research: Test behavior under various network conditions
- Code Analysis: Study modern Go networking patterns and QUIC usage
See Student Guide for detailed research scenarios and lab exercises.