diff --git a/api.go b/api.go index af1ce6e..0d59a0a 100644 --- a/api.go +++ b/api.go @@ -9,6 +9,7 @@ import ( ) type Api struct { + config *BoringProxyConfig auth *Auth tunMan *TunnelManager mux *http.ServeMux @@ -23,9 +24,9 @@ type CreateTunnelResponse struct { } -func NewApi(auth *Auth, tunMan *TunnelManager) *Api { +func NewApi(config *BoringProxyConfig, auth *Auth, tunMan *TunnelManager) *Api { - api := &Api{auth, tunMan, nil} + api := &Api{config, auth, tunMan, nil} mux := http.NewServeMux() @@ -69,7 +70,7 @@ func (a *Api) handleCreateTunnel(w http.ResponseWriter, r *http.Request) { } response := &CreateTunnelResponse{ - ServerAddress: "anders.boringproxy.io", + ServerAddress: a.config.AdminDomain, ServerPort: 22, ServerPublicKey: "", TunnelPort: port, diff --git a/boringproxy.go b/boringproxy.go index 38ec1e7..14d5cb6 100644 --- a/boringproxy.go +++ b/boringproxy.go @@ -73,7 +73,7 @@ func NewBoringProxy() *BoringProxy { p.handleAdminRequest(w, r) }) - api := NewApi(auth, tunMan) + api := NewApi(config, auth, tunMan) http.Handle("/api/", http.StripPrefix("/api", api)) go http.Serve(adminListener, nil)