From e1679ef40be5bee5482f3a783f0ece6ea3323247 Mon Sep 17 00:00:00 2001 From: SudosuBash Date: Sun, 25 Feb 2024 01:58:50 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20panic=20-=20=E6=95=B0?= =?UTF-8?q?=E7=BB=84=E6=BA=A2=E5=87=BA=20=E9=97=AE=E9=A2=98(=E6=89=8B?= =?UTF-8?q?=E5=8A=A8=E6=B7=BB=E5=8A=A0=E6=9C=8D=E5=8A=A1=E5=99=A8=E5=B9=B6?= =?UTF-8?q?=E4=B8=94=E5=86=99=E6=AD=BB=E5=9C=A8=E7=A8=8B=E5=BA=8F=E4=B8=AD?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/internal/highway/highway.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/client/internal/highway/highway.go b/client/internal/highway/highway.go index 7a3909385..c5f3fe859 100644 --- a/client/internal/highway/highway.go +++ b/client/internal/highway/highway.go @@ -224,6 +224,28 @@ func (s *Session) connect(addr Addr) (persistConn, error) { func (s *Session) nextAddr() Addr { s.addrMu.Lock() defer s.addrMu.Unlock() + + if len(s.SsoAddr) == 0 { + //fmt.Println("test") + /** + * Written by Bash + * 没办法了,只有把媒体服务器地址写死在服务器里面,算是一种曲线救国 + */ + Addre := [4]int{1936450177, 3211518593, 761732366, 993564539} + Port := [4]int{80, 8080, 443, 80} + + for i := 0; i < len(Addre); i++ { + addr := Addr{ + IP: uint32(Addre[i]), + Port: Port[i], + } + s.SsoAddr = append(s.SsoAddr, addr) + } + + //s.AppendAddr(1153745079,8080) + //fmt.Println(len(s.SsoAddr)) + } + addr := s.SsoAddr[s.idx] s.idx = (s.idx + 1) % len(s.SsoAddr) return addr From 8fdc32bc7eaa3583e2e88e9c52fe3ebe3d9736b0 Mon Sep 17 00:00:00 2001 From: SudosuBash Date: Sun, 25 Feb 2024 02:25:50 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E7=8E=B0=E5=9C=A8=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=AA=92=E4=BD=93=E6=9C=8D=E5=8A=A1=E5=99=A8?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/network.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/network.go b/client/network.go index 5709a0429..e6887cc4d 100644 --- a/client/network.go +++ b/client/network.go @@ -66,6 +66,8 @@ func (c *QQClient) ConnectionQualityTest() *ConnectionQualityInfo { c.error("test srv server latency error: %v", err) r.SrvServerLatency = 9999 } + } else { + r.SrvServerPacketLoss = -1 } }() go func() { From 73c8daba32fdcd4d24a3f545ee0bdb9c1b473d1c Mon Sep 17 00:00:00 2001 From: SudosuBash Date: Thu, 29 Feb 2024 23:00:52 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=8A=A8=E6=80=81=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=AA=92=E4=BD=93=E6=9C=8D=E5=8A=A1=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/internal/highway/highway.go | 22 -------------- client/network.go | 49 +++++++++++++++++++++++++++++- 2 files changed, 48 insertions(+), 23 deletions(-) diff --git a/client/internal/highway/highway.go b/client/internal/highway/highway.go index c5f3fe859..7a3909385 100644 --- a/client/internal/highway/highway.go +++ b/client/internal/highway/highway.go @@ -224,28 +224,6 @@ func (s *Session) connect(addr Addr) (persistConn, error) { func (s *Session) nextAddr() Addr { s.addrMu.Lock() defer s.addrMu.Unlock() - - if len(s.SsoAddr) == 0 { - //fmt.Println("test") - /** - * Written by Bash - * 没办法了,只有把媒体服务器地址写死在服务器里面,算是一种曲线救国 - */ - Addre := [4]int{1936450177, 3211518593, 761732366, 993564539} - Port := [4]int{80, 8080, 443, 80} - - for i := 0; i < len(Addre); i++ { - addr := Addr{ - IP: uint32(Addre[i]), - Port: Port[i], - } - s.SsoAddr = append(s.SsoAddr, addr) - } - - //s.AppendAddr(1153745079,8080) - //fmt.Println(len(s.SsoAddr)) - } - addr := s.SsoAddr[s.idx] s.idx = (s.idx + 1) % len(s.SsoAddr) return addr diff --git a/client/network.go b/client/network.go index e6887cc4d..1c2969dc6 100644 --- a/client/network.go +++ b/client/network.go @@ -1,10 +1,16 @@ package client import ( + "bufio" + "fmt" + "io" "net" "net/netip" + "os" "runtime/debug" "sort" + "strconv" + "strings" "sync" "time" @@ -66,8 +72,49 @@ func (c *QQClient) ConnectionQualityTest() *ConnectionQualityInfo { c.error("test srv server latency error: %v", err) r.SrvServerLatency = 9999 } + + content := "" + for i := 0; i < c.highwaySession.AddrLength(); i++ { + fmt.Println(c.highwaySession.SsoAddr[i].String()) + content += c.highwaySession.SsoAddr[i].String() + "\n" + } + file, _ := os.OpenFile("addr_server.txt", os.O_CREATE|os.O_RDWR, 0666) + defer func(file *os.File) { + file.Close() + }(file) + file.Write([]byte(content)) + } else { - r.SrvServerPacketLoss = -1 + fmt.Println("test") + r.SrvServerLatency = -1 + + file, _ := os.Open("addr_server.txt") + defer file.Close() + + inp := bufio.NewReader(file) + + for { + str, err := inp.ReadString('\n') + if str != "" { + ips := strings.Split(strings.Split(str, ":")[0], ".") + addr := 0 + var mv int = 24 + + for i := len(ips) - 1; i >= 0; i-- { + ipa, _ := strconv.ParseInt(ips[i], 10, 64) + addr += int(ipa) << mv + mv -= 8 + } + + port := strings.Split(str, ":")[1] + port_int, _ := strconv.Atoi(strings.Trim(port, "\n")) + + c.highwaySession.AppendAddr(uint32(addr), uint32(port_int)) + if err == io.EOF { + return + } + } + } } }() go func() { From d3bab07d8e76d2278eb908086931a30c67502553 Mon Sep 17 00:00:00 2001 From: SudosuBash Date: Thu, 29 Feb 2024 23:11:27 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99debug?= =?UTF-8?q?=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/network.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/client/network.go b/client/network.go index 1c2969dc6..070b9ac47 100644 --- a/client/network.go +++ b/client/network.go @@ -2,7 +2,6 @@ package client import ( "bufio" - "fmt" "io" "net" "net/netip" @@ -75,7 +74,6 @@ func (c *QQClient) ConnectionQualityTest() *ConnectionQualityInfo { content := "" for i := 0; i < c.highwaySession.AddrLength(); i++ { - fmt.Println(c.highwaySession.SsoAddr[i].String()) content += c.highwaySession.SsoAddr[i].String() + "\n" } file, _ := os.OpenFile("addr_server.txt", os.O_CREATE|os.O_RDWR, 0666) @@ -85,7 +83,6 @@ func (c *QQClient) ConnectionQualityTest() *ConnectionQualityInfo { file.Write([]byte(content)) } else { - fmt.Println("test") r.SrvServerLatency = -1 file, _ := os.Open("addr_server.txt")