mirror of
https://github.com/boringproxy/boringproxy.git
synced 2025-02-25 18:55:29 -06:00
Use AdminDomain for ssh server address
This commit is contained in:
parent
8a37355bb6
commit
be91ff62ef
7
api.go
7
api.go
@ -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,
|
||||||
|
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user