[Cmii][ImageSync] - DCU part ok

This commit is contained in:
zeaslity
2024-04-11 14:45:15 +08:00
parent 87ea6d57e7
commit 3aa329a7b5
3 changed files with 65 additions and 35 deletions

View File

@@ -1,10 +1,12 @@
package main
import (
"fmt"
"io"
"net/http"
"net/url"
"os"
"strings"
)
func BasicDownloadFileHTTP(downloadUrl string, proxyUrl string, proxyUser string, proxyPass string, desFile string) (downloadOk bool, resultLog []string) {
@@ -69,24 +71,42 @@ func BasicDownloadFileHTTP(downloadUrl string, proxyUrl string, proxyUser string
return true, resultLog
}
// quick sort function
func splitTest() {
bucketName := "123"
suffix := ""
if strings.Contains(bucketName, "/") {
splitN := strings.SplitN(bucketName, "/", 2)
bucketName = splitN[0]
if !strings.HasSuffix(splitN[1], "/") {
splitN[1] = splitN[1] + "/"
}
suffix = splitN[1]
}
fmt.Println(bucketName)
fmt.Println(suffix)
}
func main() {
splitTest()
//socksProxyUrl := "socks5://192.168.35.71:22888"
httpProxyUrl := "http://192.168.35.71:22808"
downloadOk, resultLog := BasicDownloadFileHTTP(
"https://happybirthday.107421.xyz/octopus-agent/octopus-agent_linux_amd64_2024-03-29-17-47-14",
httpProxyUrl,
"zeaslity",
"password",
"octopus-agent_linux_1232",
)
if downloadOk {
println("File downloaded successfully")
} else {
for _, log := range resultLog {
println(log)
}
}
//httpProxyUrl := "http://192.168.35.71:22808"
//downloadOk, resultLog := BasicDownloadFileHTTP(
// "https://happybirthday.107421.xyz/octopus-agent/octopus-agent_linux_amd64_2024-03-29-17-47-14",
// httpProxyUrl,
// "zeaslity",
// "password",
// "octopus-agent_linux_1232",
//)
//if downloadOk {
// println("File downloaded successfully")
//} else {
// for _, log := range resultLog {
// println(log)
// }
//}
}