github.com/yinchengtsinghua/golang-Eos-dpos-Ethereum@v0.0.0-20190121132951-92cc4225ed8e/cmd/puppeth/wizard_nginx.go (about)

     1  
     2  //此源码被清华学神尹成大魔王专业翻译分析并修改
     3  //尹成QQ77025077
     4  //尹成微信18510341407
     5  //尹成所在QQ群721929980
     6  //尹成邮箱 yinc13@mails.tsinghua.edu.cn
     7  //尹成毕业于清华大学,微软区块链领域全球最有价值专家
     8  //https://mvp.microsoft.com/zh-cn/PublicProfile/4033620
     9  //版权所有2017 Go Ethereum作者
    10  //此文件是Go以太坊的一部分。
    11  //
    12  //Go以太坊是免费软件:您可以重新发布和/或修改它
    13  //根据GNU通用公共许可证的条款
    14  //自由软件基金会,或者许可证的第3版,或者
    15  //(由您选择)任何更高版本。
    16  //
    17  //Go以太坊的分布希望它会有用,
    18  //但没有任何保证;甚至没有
    19  //适销性或特定用途的适用性。见
    20  //GNU通用公共许可证了解更多详细信息。
    21  //
    22  //你应该已经收到一份GNU通用公共许可证的副本
    23  //一起去以太坊吧。如果没有,请参见<http://www.gnu.org/licenses/>。
    24  
    25  package main
    26  
    27  import (
    28  	"fmt"
    29  
    30  	"github.com/ethereum/go-ethereum/log"
    31  )
    32  
    33  //
    34  //
    35  //
    36  //
    37  //
    38  //
    39  func (w *wizard) ensureVirtualHost(client *sshClient, port int, def string) (string, error) {
    40  	proxy, _ := checkNginx(client, w.network)
    41  	if proxy != nil {
    42  //反向代理正在运行,如果端口匹配,我们需要一个虚拟主机
    43  		if proxy.port == port {
    44  			fmt.Println()
    45  			fmt.Printf("Shared port, which domain to assign? (default = %s)\n", def)
    46  			return w.readDefaultString(def), nil
    47  		}
    48  	}
    49  //
    50  	fmt.Println()
    51  	fmt.Println("Allow sharing the port with other services (y/n)? (default = yes)")
    52  	if w.readDefaultString("y") == "y" {
    53  		nocache := false
    54  		if proxy != nil {
    55  			fmt.Println()
    56  			fmt.Printf("Should the reverse-proxy be rebuilt from scratch (y/n)? (default = no)\n")
    57  			nocache = w.readDefaultString("n") != "n"
    58  		}
    59  		if out, err := deployNginx(client, w.network, port, nocache); err != nil {
    60  			log.Error("Failed to deploy reverse-proxy", "err", err)
    61  			if len(out) > 0 {
    62  				fmt.Printf("%s\n", out)
    63  			}
    64  			return "", err
    65  		}
    66  //已部署反向代理,请再次请求虚拟主机
    67  		fmt.Println()
    68  		fmt.Printf("Proxy deployed, which domain to assign? (default = %s)\n", def)
    69  		return w.readDefaultString(def), nil
    70  	}
    71  //
    72  	return "", nil
    73  }