https://github.com/m-lab/speed-proxy
Client-Integration Registration Token-Exchange Proxy Service
https://github.com/m-lab/speed-proxy
Last synced: 6 months ago
JSON representation
Client-Integration Registration Token-Exchange Proxy Service
- Host: GitHub
- URL: https://github.com/m-lab/speed-proxy
- Owner: m-lab
- Created: 2026-01-21T17:00:32.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2026-01-21T20:24:28.000Z (6 months ago)
- Last Synced: 2026-01-22T05:19:53.857Z (6 months ago)
- Language: Go
- Homepage: https://www.measurementlab.net/
- Size: 18.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# speed-proxy
[](https://github.com/m-lab/speed-proxy/actions/workflows/test.yml)
[](https://coveralls.io/github/m-lab/speed-proxy?branch=main)
[](https://goreportcard.com/report/github.com/m-lab/speed-proxy)
[](https://go.dev/)
[](https://pkg.go.dev/github.com/m-lab/speed-proxy)
[](https://deepwiki.com/m-lab/speed-proxy)
Integrator backend service for speed.measurementlab.net. This service acts as a
security boundary between the frontend client and M-Lab's token exchange
service.
## Overview
The service provides a single endpoint that:
1. Exchanges the M-Lab API key for a short-lived JWT token via M-Lab's token exchange service
2. Returns the JWT to the frontend client
The frontend then uses this JWT to access M-Lab's Locate API at
`/v2/priority/nearest`.
## Configuration
| Flag | Environment Variable | Default | Description |
|------|---------------------|---------|-------------|
| `-listen-addr` | `LISTEN_ADDR` | `:8080` | Address to listen on |
| `-api-key` | `API_KEY` | (required) | M-Lab API key for token exchange |
| `-token-exchange-url` | `TOKEN_EXCHANGE_URL` | `https://auth.mlab-sandbox.measurementlab.net/v0/token/integration` | URL of the token exchange service |
| `-allowed-origin` | `ALLOWED_ORIGIN` | `https://speed.measurementlab.net` | Allowed CORS origin |
## API
### GET /v0/token
Returns a JWT token for authenticating with M-Lab's Locate API.
**Response:**
```json
{
"token": ""
}
```
### GET /health
Health check endpoint. Returns `200 OK` with body `ok`.
## Deployment
### Deploy to Cloud Run
```bash
gcloud run deploy speed-proxy \
--source . \
--region us-central1 \
--set-env-vars "API_KEY=mlabk.ki_xxx.secret" \
--allow-unauthenticated
```
## Local Development
```bash
API_KEY="mlabk.ki_xxx.secret" go run . -allowed-origin="http://localhost:3000"
```
## Docker
```bash
# Build
docker build -t speed-proxy .
# Run
export API_KEY="mlabk.ki_xxx.secret"
docker run -p 8080:8080 -e API_KEY speed-proxy
```