mirror of
https://github.com/status-im/status-go.git
synced 2025-01-11 07:07:24 +00:00
e4cbce12c4
* Update `github.com/ethereum/go-ethereum` package to 1.8.1 branch. Part of #638 * Fix code due to some signature changes. Part of #638 * use upstream for whisper backend * Add patch to downgrade usage of Whisper v6 to v5 in some geth 1.8.1 vendor files. Part of #638 * Take into account the DNS rebinding protection introduced in 1.8.0 by adding exception for localhost. Part of #638 * Add patches required for cross-compiled builds starting with geth 1.8.0. Only applied during build. Part of #638 * Update expected JSON result in `TestRegressionGetTransactionReceipt()` and `TestCallRawResultGetTransactionReceipt()`. Part of #665 * Fix some failing e2e tests. Part of #638 * Address comments in PR #702. Part of #638
66 lines
2.3 KiB
Go
66 lines
2.3 KiB
Go
// Copyright 2017 The go-ethereum Authors
|
|
// This file is part of go-ethereum.
|
|
//
|
|
// go-ethereum is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// go-ethereum is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/ethereum/go-ethereum/log"
|
|
)
|
|
|
|
// ensureVirtualHost checks whether a reverse-proxy is running on the specified
|
|
// host machine, and if yes requests a virtual host from the user to host a
|
|
// specific web service on. If no proxy exists, the method will offer to deploy
|
|
// one.
|
|
//
|
|
// If the user elects not to use a reverse proxy, an empty hostname is returned!
|
|
func (w *wizard) ensureVirtualHost(client *sshClient, port int, def string) (string, error) {
|
|
proxy, _ := checkNginx(client, w.network)
|
|
if proxy != nil {
|
|
// Reverse proxy is running, if ports match, we need a virtual host
|
|
if proxy.port == port {
|
|
fmt.Println()
|
|
fmt.Printf("Shared port, which domain to assign? (default = %s)\n", def)
|
|
return w.readDefaultString(def), nil
|
|
}
|
|
}
|
|
// Reverse proxy is not running, offer to deploy a new one
|
|
fmt.Println()
|
|
fmt.Println("Allow sharing the port with other services (y/n)? (default = yes)")
|
|
if w.readDefaultString("y") == "y" {
|
|
nocache := false
|
|
if proxy != nil {
|
|
fmt.Println()
|
|
fmt.Printf("Should the reverse-proxy be rebuilt from scratch (y/n)? (default = no)\n")
|
|
nocache = w.readDefaultString("n") != "n"
|
|
}
|
|
if out, err := deployNginx(client, w.network, port, nocache); err != nil {
|
|
log.Error("Failed to deploy reverse-proxy", "err", err)
|
|
if len(out) > 0 {
|
|
fmt.Printf("%s\n", out)
|
|
}
|
|
return "", err
|
|
}
|
|
// Reverse proxy deployed, ask again for the virtual-host
|
|
fmt.Println()
|
|
fmt.Printf("Proxy deployed, which domain to assign? (default = %s)\n", def)
|
|
return w.readDefaultString(def), nil
|
|
}
|
|
// Reverse proxy not requested, deploy as a standalone service
|
|
return "", nil
|
|
}
|