| Package | Purpose | Start reading |
|---|---|---|
| cmd | Main+Tools | cmd/proxy/main.go |
| proxy | Service top-level and service handlers | proxy/proxy.go proxy/adminservice.go |
| auth | ACL implementation | access_control.go |
| interceptor | Translation and ACL interceptor implementations |
interceptor/translation_interceptor.go |
| transport | Mux and TCP implementation | transport/mux/mux_manager.go |
| testserver | Local integration test fakes | testserver/echo_server.go |
| config | Config YAML parsing and model | config/config.go |
| metrics | Prometheus metric defs+utils | metrics/prometheus_defs.go |
OS: Linux, macOS Arch: amd64, arm64
- Go Lang (minimum version required listed in
go.modfile):- Install on macOS with
brew install go. - Install on Ubuntu with
sudo apt install golang.
- Install on macOS with
- Download and run Temporal server locally.
- Install Temporal CLI.
Build all
makeBuild binaries without running tests with:
make binsRun tests
make test
Build and push docker image
make docker-login AWS_ECR_REGION=${region} AWS_ECR_PROFILE=${profile} DOCKER_REPO=${ecr_repro}
make docker-build-push AWS_ECR_REGION=${region} AWS_ECR_PROFILE=${profile} DOCKER_REPO=${ecr_repro}
Start Temporal server with sample configs
cd ${temporal_server_folder}
make start-dependencies
make bins
./temporal-server --config ${s2s_proxy_folder}/develop/config --env cluster-a --allow-no-auth start
Start s2s-proxy
./bins/s2s-proxy start --config develop/config/cluster-a-tcp-inbound-proxy.yaml
Run
temporal operator --address 127.0.0.1:6233 cluster describe
Request will be forwarded from proxy (port :6233) to local server (port :7233).
In multiplexing mode, one proxy establishes a TCP connection to the other proxy, and Temporal server connections are multiplexed over that single connection. Start servers
./temporal-server --config ${s2s_proxy_folder}/develop/config --env cluster-a --allow-no-auth start
./temporal-server --config ${s2s_proxy_folder}/develop/config --env cluster-b --allow-no-auth start
Start proxies
./bins/s2s-proxy start --config develop/config/cluster-a-mux-client-proxy.yaml
./bins/s2s-proxy start --config develop/config/cluster-b-mux-server-proxy.yaml
Run make generate-rpcwrappers to re-generate the clients
This uses the cmd/tools/genrpcwrappers tool to generates frontend and admin clients.
The proxy supports automatically repairing invalid UTF-8 strings in Temporal protobuf messages.
Background: Invalid UTF-8 strings could appear in protobuf messages in older versions of Temporal (<=1.22) which used gogo/protobuf. Newer versions of Temporal use google.golang.org/protobuf which validates UTF-8 strings during serialization. This means any messages with invalid UTF-8 strings cannot be processed by s2s-proxy or by newer Temporal server versions. To fix this, s2s-proxy automatically repairs invalid UTF-8 strings by rewriting messages as the pass through the proxy. It does this by including a copy of the old gogo-based protos and when an invalid UTF-8 error is seen during protobuf deserialization, it can use the gogo-based protos to deserialize the message and repair the invalid UTF-8 string.
Code generation is used to generate functions to handle all possible cases:
make generate-rpcwrappersto re-generates type conversion functionsmake genvisitorre-generates the invalid UTF-8 repair functions
Both of these code generation tools are based on protobuf reflection.
MIT License, please see LICENSE for details.