From 9a48de7db3cff7f1e9615e8581b9f2b47c279ec1 Mon Sep 17 00:00:00 2001 From: Robert Swain Date: Wed, 7 Jun 2017 18:28:04 +0200 Subject: [PATCH] common/test/server: Add StartProxy to create a reverse proxy --- .../matrix-org/dendrite/common/test/server.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/github.com/matrix-org/dendrite/common/test/server.go b/src/github.com/matrix-org/dendrite/common/test/server.go index 5075b71fd..6e670d372 100644 --- a/src/github.com/matrix-org/dendrite/common/test/server.go +++ b/src/github.com/matrix-org/dendrite/common/test/server.go @@ -98,3 +98,17 @@ func StartServer(serverType string, serverArgs []string, suffix, configFilename, serverArgs, ) } + +// StartProxy creates a reverse proxy +func StartProxy(bindAddr, syncAddr, clientAddr, mediaAddr string) (*exec.Cmd, chan error) { + proxyArgs := []string{ + "--bind-address", bindAddr, + "--sync-api-server-url", syncAddr, + "--client-api-server-url", clientAddr, + "--media-api-server-url", mediaAddr, + } + return CreateBackgroundCommand( + filepath.Join(filepath.Dir(os.Args[0]), "client-api-proxy"), + proxyArgs, + ) +}