mirror of
https://github.com/FloatTech/zbpdata.git
synced 2025-06-08 07:10:51 +09:00
feat: support multi-addrs
This commit is contained in:
parent
ca3652920a
commit
74c5464a0b
48
main.go
48
main.go
@ -9,6 +9,7 @@ import (
|
|||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"unicode"
|
"unicode"
|
||||||
@ -57,30 +58,37 @@ func main() {
|
|||||||
*(*unsafe.Pointer)(unsafe.Pointer(&md5s[i])) = unsafe.Pointer(&buf)
|
*(*unsafe.Pointer)(unsafe.Pointer(&md5s[i])) = unsafe.Pointer(&buf)
|
||||||
*(*uintptr)(unsafe.Add(unsafe.Pointer(&md5s[i]), unsafe.Sizeof(uintptr(0)))) = uintptr(16)
|
*(*uintptr)(unsafe.Add(unsafe.Pointer(&md5s[i]), unsafe.Sizeof(uintptr(0)))) = uintptr(16)
|
||||||
}
|
}
|
||||||
r := registry.NewRegedit("reilia.fumiama.top:32664", "", "fumiama", os.Getenv("REILIA_SPS"))
|
names, err := net.LookupAddr("reilia.fumiama.top")
|
||||||
err = r.Connect()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
for i, fn := range files {
|
for _, nm := range names {
|
||||||
for c := 0; c < 16; c++ {
|
fmt.Println("推送到:", nm)
|
||||||
err = r.Set("data/"+fn, md5s[i])
|
r := registry.NewRegedit(net.JoinHostPort(nm, "32664"), "", "fumiama", os.Getenv("REILIA_SPS"))
|
||||||
fmt.Println("set", "data/"+fn, "=", hex.EncodeToString(helper.StringToBytes(md5s[i])))
|
err = r.Connect()
|
||||||
if err == nil {
|
if err != nil {
|
||||||
break
|
panic(err)
|
||||||
}
|
}
|
||||||
if c >= 15 {
|
for i, fn := range files {
|
||||||
panic("ERROR:" + err.Error() + ", max retry times exceeded")
|
for c := 0; c < 16; c++ {
|
||||||
} else {
|
err = r.Set("data/"+fn, md5s[i])
|
||||||
fmt.Println("ERROR:", err, ", retry times:", c)
|
fmt.Println("set", "data/"+fn, "=", hex.EncodeToString(helper.StringToBytes(md5s[i])))
|
||||||
}
|
if err == nil {
|
||||||
_ = r.Close()
|
break
|
||||||
process.SleepAbout1sTo2s()
|
}
|
||||||
err = r.Connect()
|
if c >= 15 {
|
||||||
if err != nil {
|
panic("ERROR:" + err.Error() + ", max retry times exceeded")
|
||||||
panic(err)
|
} else {
|
||||||
|
fmt.Println("ERROR:", err, ", retry times:", c)
|
||||||
|
}
|
||||||
|
_ = r.Close()
|
||||||
|
process.SleepAbout1sTo2s()
|
||||||
|
err = r.Connect()
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_ = r.Close()
|
||||||
}
|
}
|
||||||
_ = r.Close()
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user