v2.6.3
v2.6.3
This commit is contained in:
parent
be9d76fcbf
commit
d954e3331e
80
main.go
80
main.go
@ -6,8 +6,8 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
"os/signal"
|
||||
"os/exec"
|
||||
"strings"
|
||||
// "os/exec"
|
||||
// "strings"
|
||||
"syscall"
|
||||
_ "unsafe"
|
||||
|
||||
@ -131,22 +131,22 @@ func resetSetting() {
|
||||
|
||||
func showSetting(show bool) {
|
||||
// 执行 shell 命令获取 IPv4 地址
|
||||
cmdIPv4 := exec.Command("sh", "-c", "curl -s4m8 ip.p3terx.com -k | sed -n 1p")
|
||||
outputIPv4, err := cmdIPv4.Output()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
// cmdIPv4 := exec.Command("sh", "-c", "curl -s4m8 ip.p3terx.com -k | sed -n 1p")
|
||||
// outputIPv4, err := cmdIPv4.Output()
|
||||
// if err != nil {
|
||||
// log.Fatal(err)
|
||||
// }
|
||||
|
||||
// 执行 shell 命令获取 IPv6 地址
|
||||
cmdIPv6 := exec.Command("sh", "-c", "curl -s6m8 ip.p3terx.com -k | sed -n 1p")
|
||||
outputIPv6, err := cmdIPv6.Output()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
// cmdIPv6 := exec.Command("sh", "-c", "curl -s6m8 ip.p3terx.com -k | sed -n 1p")
|
||||
// outputIPv6, err := cmdIPv6.Output()
|
||||
// if err != nil {
|
||||
// log.Fatal(err)
|
||||
// }
|
||||
|
||||
// 去除命令输出中的换行符
|
||||
ipv4 := strings.TrimSpace(string(outputIPv4))
|
||||
ipv6 := strings.TrimSpace(string(outputIPv6))
|
||||
// ipv4 := strings.TrimSpace(string(outputIPv4))
|
||||
// ipv6 := strings.TrimSpace(string(outputIPv6))
|
||||
// 定义转义字符,定义不同颜色的转义字符
|
||||
const (
|
||||
Reset = "\033[0m"
|
||||
@ -212,33 +212,33 @@ func showSetting(show bool) {
|
||||
fmt.Println("")
|
||||
fmt.Println("--------------------------------------------------")
|
||||
// 根据条件打印带颜色的字符串
|
||||
if ipv4 != "" {
|
||||
fmt.Println("")
|
||||
formattedIPv4 := fmt.Sprintf("%s %s%s:%d%s" + Reset,
|
||||
Green+"面板 IPv4 访问地址------>>",
|
||||
Yellow+"http://",
|
||||
ipv4,
|
||||
port,
|
||||
Yellow+webBasePath + Reset)
|
||||
fmt.Println(formattedIPv4)
|
||||
fmt.Println("")
|
||||
}
|
||||
// if ipv4 != "" {
|
||||
// fmt.Println("")
|
||||
// formattedIPv4 := fmt.Sprintf("%s %s%s:%d%s" + Reset,
|
||||
// Green+"面板 IPv4 访问地址------>>",
|
||||
// Yellow+"http://",
|
||||
// ipv4,
|
||||
// port,
|
||||
// Yellow+webBasePath + Reset)
|
||||
// fmt.Println(formattedIPv4)
|
||||
// fmt.Println("")
|
||||
// }
|
||||
|
||||
if ipv6 != "" {
|
||||
fmt.Println("")
|
||||
formattedIPv6 := fmt.Sprintf("%s %s[%s%s%s]:%d%s%s",
|
||||
Green+"面板 IPv6 访问地址------>>", // 绿色的提示信息
|
||||
Yellow+"http://", // 黄色的 http:// 部分
|
||||
Yellow, // 黄色的[ 左方括号
|
||||
ipv6, // IPv6 地址
|
||||
Yellow, // 黄色的] 右方括号
|
||||
port, // 端口号
|
||||
Yellow+webBasePath, // 黄色的 Web 基础路径
|
||||
Reset) // 重置颜色
|
||||
fmt.Println(formattedIPv6)
|
||||
fmt.Println("")
|
||||
}
|
||||
fmt.Println(Green + ">>>>>>>>注:若您安装了〔证书〕,请把IP换成您的域名用https方式登录" + Reset)
|
||||
// if ipv6 != "" {
|
||||
// fmt.Println("")
|
||||
// formattedIPv6 := fmt.Sprintf("%s %s[%s%s%s]:%d%s%s",
|
||||
// Green+"面板 IPv6 访问地址------>>", // 绿色的提示信息
|
||||
// Yellow+"http://", // 黄色的 http:// 部分
|
||||
// Yellow, // 黄色的[ 左方括号
|
||||
// ipv6, // IPv6 地址
|
||||
// Yellow, // 黄色的] 右方括号
|
||||
// port, // 端口号
|
||||
// Yellow+webBasePath, // 黄色的 Web 基础路径
|
||||
// Reset) // 重置颜色
|
||||
// fmt.Println(formattedIPv6)
|
||||
// fmt.Println("")
|
||||
// }
|
||||
fmt.Println(Green + ">>>>>>>>注:若您安装了〔证书〕,请使用您的域名用https方式登录" + Reset)
|
||||
fmt.Println("")
|
||||
fmt.Println("--------------------------------------------------")
|
||||
fmt.Println("↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user