This commit is contained in:
spiritysdx
2024-06-30 20:51:03 +08:00
parent 861a8f46e4
commit 3c800b5193
4 changed files with 151 additions and 6 deletions

View File

@@ -13,6 +13,9 @@ import (
"github.com/oneclickvirt/ecs/unlocktest" "github.com/oneclickvirt/ecs/unlocktest"
"github.com/oneclickvirt/ecs/utils" "github.com/oneclickvirt/ecs/utils"
"github.com/oneclickvirt/portchecker/email" "github.com/oneclickvirt/portchecker/email"
"os"
"path/filepath"
"regexp"
"runtime" "runtime"
"sync" "sync"
"time" "time"
@@ -151,7 +154,31 @@ func main() {
fmt.Println("Unsupported language") fmt.Println("Unsupported language")
} }
}, tempOutput, output) }, tempOutput, output)
shorturl, err := utils.UploadText(output) // 创建文件
filePath := "goecs.txt"
file, err := os.Create(filePath)
if err != nil {
fmt.Println("Can not make file:", err)
return
}
defer file.Close()
// 将 output 写入文件
// 匹配 ANSI 转义序列
ansiRegex := regexp.MustCompile("\x1B\\[[0-9;]+[a-zA-Z]")
// 移除 ANSI 转义序列
cleanedOutput := ansiRegex.ReplaceAllString(output, "")
_, err = file.WriteString(cleanedOutput)
if err != nil {
fmt.Println("Can not write file:", err)
return
}
// 获取文件的绝对路径
absPath, err := filepath.Abs(filePath)
if err != nil {
fmt.Println("Get file absPath failed:", err)
return
}
shorturl, err := utils.UploadText(absPath)
if err != nil { if err != nil {
fmt.Println("Upload failed, can not generate short URL.") fmt.Println("Upload failed, can not generate short URL.")
fmt.Println(err.Error()) fmt.Println(err.Error())

108
goecs.txt Normal file
View File

@@ -0,0 +1,108 @@
---------------------------------------融合怪测试----------------------------------------
版本2024.06.30
测评频道: https://t.me/vps_reviews
Go项目地址https://github.com/oneclickvirt/ecs
Shell项目地址https://github.com/spiritLHLS/ecs
----------------------------------------基础信息----------------------------------------
CPU 型号 : AMD Ryzen 7 4700U with Radeon Graphics
CPU 数量 : 8 Physical CPU(s)
CPU 缓存 : L1: null / L2: 4.00 MB / L3: 8.00 MB
VM-x/AMD-V/Hyper-V : ❌ Disabled
内存 : 10.90 GB / 15.37 GB
Swap : 16.23 GB / 22.12 GB
硬盘空间 : 213.82 GB / 475.67 GB
启动盘路径 : C:
系统 : Microsoft Windows 11 Enterprise 10.0.22631 Build 22631 [x86_64]
系统在线时间 : 5 days, 02 hours, 41 minutes
时区 : (UTC+08:00) 北京,重庆,香港特别行政区,乌鲁木齐
负载 : 0.50 / 0.00 / 0.00
虚拟化架构 : Physical-Machine(Multiprocessor Free)
NAT类型 : Symmetric
IPV4 ASN : AS4538 China Education and Research Network Center
IPV4 Location : Guangzhou / Guangdong / China
IPV6 ASN : AS24357 CERNET2 IX at South China University of Technology
IPV6 Location : Guangzhou / Guangdong / China
---------------------------------CPU测试-通过sysbench测试---------------------------------
Detected host is Windows, using Winsat for testing.
CPU AES256 加密: 7421.91MB/s
CPU LZW 压缩: 664.76MB/s
---------------------------------内存测试-通过sysbench测试----------------------------------
Detected host is Windows, using Winsat for testing.
内存性能: 31643.60MB/s
------------------------------------硬盘测试-通过fio测试------------------------------------
测试的硬盘 随机写入[得分] 顺序读取[得分] 顺序写入[得分]
C: 202.43 MB/s[7.8] 2212.48 MB/s[9.1] 1709.12 MB/s[8.9]
--------------------------------------御三家流媒体解锁--------------------------------------
----------------Netflix-----------------
[IPV4]
Netflix在您的出口IP所在的国家不提供服务
[IPV6]
您的网络可能没有正常配置IPv6或者没有IPv6网络接入
----------------Youtube-----------------
[IPV4]
Youtube在您的出口IP所在的国家不提供服务
[IPV6]
Youtube在您的出口IP所在的国家不提供服务
---------------DisneyPlus---------------
[IPV4]
当前IPv4出口所在地区即将开通DisneyPlus
[IPV6]
DisneyPlus在您的出口IP所在的国家不提供服务
--------------------------------------跨国流媒体解锁---------------------------------------
IPV4:
============[ 跨国平台 ]============
Dazn NO (UNSUPPORTED_COUNTRY)
Disney+ NO (Can not get assertion)
Netflix Banned
Netflix CDN NO (IP Banned By Netflix)
YouTube Region NO (Network Err)
YouTube CDN NO (Network Err)
Amazon Prime Video NO (Region: CN)
Paramount+ YES [Via DNS]
TVBAnywhere+ NO
IQiYi YES (Region: CN) [Via DNS]
Viu.com YES [Via DNS]
Spotify Registration NO
Steam Store YES (Community Unavailable) (Region: CN)
ChatGPT NO
Wikipedia Editability NO (Network Err)
TikTok NO (Network Err)
Bing Region YES (Only cn.bing.com) (Region: CN)
Instagram Licensed Audio NO (Network Err)
KOCOWA NO
SonyLiv NO
OneTrust YES (Region: CN GUANGDONG) [Via DNS]
GoogleSearch NO (Network Err)
---------------------------------------IP质量检测---------------------------------------
---------------------------------------邮件端口检测---------------------------------------
Platform SMTP SMTPS POP3 POP3S IMAP IMAPS
LocalPort ✔ ✔ ✔ ✔ ✔ ✔
QQ ✔ ✔ ✔ ✘ ✔ ✘
163 ✔ ✔ ✔ ✘ ✔ ✘
Sohu ✔ ✔ ✘ ✘ ✔ ✘
Yandex ✔ ✔ ✔ ✘ ✔ ✘
Gmail ✘ ✘ ✘ ✘ ✘ ✘
Outlook ✔ ✘ ✔ ✘ ✔ ✘
Office365 ✔ ✘ ✔ ✘ ✔ ✘
Yahoo ✔ ✔ ✘ ✘ ✘ ✘
MailCOM ✔ ✔ ✔ ✘ ✔ ✘
MailRU ✔ ✔ ✘ ✘ ✔ ✘
AOL ✔ ✔ ✘ ✘ ✘ ✘
GMX ✔ ✘ ✔ ✘ ✔ ✘
Sina ✔ ✘ ✔ ✘ ✔ ✘
---------------------------------------就近节点测速---------------------------------------
位置 上传速度 下载速度 延迟 丢包率
Speedtest.net 4.32 Mbps 3.54 Mbps 12.205264ms 0.00% (Sent: 402/Dup: 0/Max: 401)
新加坡 18.50 Mbps 23.82 Mbps 51.944512ms N/A
洛杉矶 19.51 Mbps 8.51 Mbps 184.661804ms N/A
日本东京 1.47 Mbps 24.63 Mbps 201.89396ms N/A
法兰克福 19.22 Mbps 23.59 Mbps 245.545712ms N/A
联通Wu Xi -0.00 Mbps -0.00 Mbps 1s N/A
电信合肥5G 19.00 Mbps 24.51 Mbps 24.894272ms N/A
电信浙江 18.60 Mbps 23.93 Mbps 25.354408ms N/A
移动杭州5G 0.08 Mbps 23.74 Mbps 29.578304ms N/A
移动Beijing 18.70 Mbps 23.71 Mbps 40.95098ms N/A
------------------------------------------------------------------------------------
花费 : 7 分 53 秒
时间 : Sun Jun 30 20:47:15 CST 2024
------------------------------------------------------------------------------------

View File

@@ -3,6 +3,7 @@ package speedtest
import ( import (
"github.com/oneclickvirt/speedtest/model" "github.com/oneclickvirt/speedtest/model"
"github.com/oneclickvirt/speedtest/sp" "github.com/oneclickvirt/speedtest/sp"
"runtime"
"strings" "strings"
) )
@@ -11,7 +12,11 @@ func ShowHead(language string) {
} }
func NearbySP() { func NearbySP() {
if runtime.GOOS == "windows" || sp.OfficialAvailableTest() != nil {
sp.NearbySpeedTest() sp.NearbySpeedTest()
} else {
sp.OfficialNearbySpeedTest()
}
} }
func CustomSP(platform, operator string, num int) { func CustomSP(platform, operator string, num int) {
@@ -53,5 +58,9 @@ func CustomSP(platform, operator string, num int) {
} }
parseType = "id" parseType = "id"
} }
if runtime.GOOS == "windows" || sp.OfficialAvailableTest() != nil {
sp.CustomSpeedTest(url, parseType, num) sp.CustomSpeedTest(url, parseType, num)
} else {
sp.OfficialCustomSpeedTest(url, parseType, num)
}
} }

View File

@@ -151,10 +151,11 @@ func PrintAndCapture(f func(), tempOutput, output string) string {
} }
// UploadText 上传文本内容到指定URL // UploadText 上传文本内容到指定URL
func UploadText(textContent string) (string, error) { func UploadText(absPath string) (string, error) {
url := "https://paste.spiritlhl.net/api/upload" url := "https://paste.spiritlhl.net/api/upload"
token := network.SecurityUploadToken token := network.SecurityUploadToken
client := req.C().SetTimeout(10 * 1000 * 1000) // 10 seconds timeout client := req.DefaultClient()
file, _ := os.Open(absPath)
resp, err := client.R(). resp, err := client.R().
SetHeader("Authorization", token). SetHeader("Authorization", token).
SetHeader("Format", "RANDOM"). SetHeader("Format", "RANDOM").
@@ -162,7 +163,7 @@ func UploadText(textContent string) (string, error) {
SetHeader("UploadText", "true"). SetHeader("UploadText", "true").
SetHeader("Content-Type", "multipart/form-data"). SetHeader("Content-Type", "multipart/form-data").
SetHeader("No-JSON", "true"). SetHeader("No-JSON", "true").
SetBodyString(textContent). SetFileReader("file", "goecs.txt", file).
Post(url) Post(url)
if err != nil { if err != nil {
return "", err return "", err