Skip to content

Commit

Permalink
v0.0.10 - 优化拼接输出
Browse files Browse the repository at this point in the history
  • Loading branch information
spiritLHLS committed Jun 30, 2024
1 parent 4c12518 commit aff8448
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
run: |
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
TAG="v0.0.9-$(date +'%Y%m%d%H%M%S')"
TAG="v0.0.10-$(date +'%Y%m%d%H%M%S')"
git tag $TAG
git push origin $TAG
env:
Expand Down
6 changes: 3 additions & 3 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ func main() {
}
if uts.IPV4 {
fmt.Println(Blue("IPV4:"))
uts.RunTests(client, "ipv4", language, useBar)
fmt.Printf(uts.RunTests(client, "ipv4", language, useBar))
}
if uts.IPV6 {
fmt.Println(Blue("IPV6:"))
if mode == 6 {
uts.RunTests(client, "ipv6", language, useBar)
fmt.Printf(uts.RunTests(client, "ipv6", language, useBar))
} else {
uts.RunTests(utils.Ipv6HttpClient, "ipv6", language, useBar)
fmt.Printf(uts.RunTests(utils.Ipv6HttpClient, "ipv6", language, useBar))
}
}
}
24 changes: 13 additions & 11 deletions uts/uts.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func PrintCenteredMessage(message string, totalLength int) string {
return (leftPadding + message + rightPadding + "\n")
}

func FormarPrint(message string) {
func FormarPrint(message string) string {
Length := 25
for _, r := range R {
if len(r.Name) > Length {
Expand Down Expand Up @@ -188,11 +188,11 @@ func FormarPrint(message string) {
}
// 去重
tempList = RemoveDuplicates(tempList)
// 打印整体文本
var res strings.Builder
for _, i := range tempList {
fmt.Printf(i)
res.WriteString(i)
}

return res.String()
}

func Excute(F func(c *http.Client) model.Result, c *http.Client, useProgressBar bool) {
Expand Down Expand Up @@ -545,7 +545,8 @@ func IPV6Multination() [](func(c *http.Client) model.Result) {
return FuncList
}

func finallyPrintResult(language, netType string) {
func finallyPrintResult(language, netType string) string {
var result string
getPlatformName := func(multi bool, TW, HK, JP, KR, NA, SA, EU, AFR, OCEA, SPORT bool) string {
if multi {
if TW && !HK && !JP && !KR && !NA && !SA && !EU && !AFR && !OCEA && !SPORT {
Expand Down Expand Up @@ -604,9 +605,9 @@ func finallyPrintResult(language, netType string) {

if language == "zh" {
if netType == "ipv4" || netType == "" {
FormarPrint(platformName)
result += FormarPrint(platformName)
} else if netType == "ipv6" {
FormarPrint("跨国平台")
result += FormarPrint("跨国平台")
}
} else if language == "en" {
if netType == "ipv4" || netType == "" {
Expand Down Expand Up @@ -634,11 +635,12 @@ func finallyPrintResult(language, netType string) {
"体育平台": "Sports",
"所有平台": "All Platform",
}
FormarPrint(enPlatformName[platformName])
result += FormarPrint(enPlatformName[platformName])
} else if netType == "ipv6" {
FormarPrint("Global")
result += FormarPrint("Global")
}
}
return result
}

func SwitchOptions(c string) {
Expand Down Expand Up @@ -807,7 +809,7 @@ func getFuncList() [](func(c *http.Client) model.Result) {
return funcList
}

func RunTests(client *http.Client, ipVersion, language string, useProgressBar bool) {
func RunTests(client *http.Client, ipVersion, language string, useProgressBar bool) string {
Names = []string{}
total = 0
wg = &sync.WaitGroup{}
Expand All @@ -823,7 +825,7 @@ func RunTests(client *http.Client, ipVersion, language string, useProgressBar bo
if useProgressBar {
bar.Finish()
}
finallyPrintResult(language, ipVersion)
return finallyPrintResult(language, ipVersion)
}

func SetupInterface(Iface string) {
Expand Down
2 changes: 1 addition & 1 deletion uts/version.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package uts

const UnlockTestsVersion = "v0.0.9"
const UnlockTestsVersion = "v0.0.10"

0 comments on commit aff8448

Please sign in to comment.