Use AdminDomain for ssh server address

This commit is contained in:
Anders Pitman 2020-10-02 17:07:24 -06:00
parent 8a37355bb6
commit be91ff62ef
2 changed files with 5 additions and 4 deletions

7
api.go
View File

@ -9,6 +9,7 @@ import (
) )
type Api struct { type Api struct {
config *BoringProxyConfig
auth *Auth auth *Auth
tunMan *TunnelManager tunMan *TunnelManager
mux *http.ServeMux 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() mux := http.NewServeMux()
@ -69,7 +70,7 @@ func (a *Api) handleCreateTunnel(w http.ResponseWriter, r *http.Request) {
} }
response := &CreateTunnelResponse{ response := &CreateTunnelResponse{
ServerAddress: "anders.boringproxy.io", ServerAddress: a.config.AdminDomain,
ServerPort: 22, ServerPort: 22,
ServerPublicKey: "", ServerPublicKey: "",
TunnelPort: port, TunnelPort: port,

View File

@ -73,7 +73,7 @@ func NewBoringProxy() *BoringProxy {
p.handleAdminRequest(w, r) p.handleAdminRequest(w, r)
}) })
api := NewApi(auth, tunMan) api := NewApi(config, auth, tunMan)
http.Handle("/api/", http.StripPrefix("/api", api)) http.Handle("/api/", http.StripPrefix("/api", api))
go http.Serve(adminListener, nil) go http.Serve(adminListener, nil)