diff --git a/client/highway.go b/client/highway.go index 3a860f46..9cd9931a 100644 --- a/client/highway.go +++ b/client/highway.go @@ -4,15 +4,16 @@ import ( "bytes" binary2 "encoding/binary" "fmt" + "io" + "net/http" + "net/url" + "strconv" + highway2 "github.com/LagrangeDev/LagrangeGo/packets/highway" "github.com/LagrangeDev/LagrangeGo/packets/pb/service/highway" "github.com/LagrangeDev/LagrangeGo/utils" "github.com/LagrangeDev/LagrangeGo/utils/binary" "github.com/RomiChan/protobuf/proto" - "io" - "net/http" - "net/url" - "strconv" ) type UpBlock struct { @@ -35,7 +36,7 @@ func (c *QQClient) GetServiceServer() ([]byte, map[uint32][]string) { if err != nil { return nil, nil } - payload, err := c.SendUniPacketAndAwait("HttpConn.0x6ff_501", packet.Data()) + payload, err := c.SendUniPacketAndAwait("HttpConn.0x6ff_501", packet) if err != nil { networkLogger.Errorf("Failed to get highway server: %v", err) return nil, nil diff --git a/packets/highway/HighWayUrl.go b/packets/highway/HighWayUrl.go index 3fd2f540..18200d4c 100644 --- a/packets/highway/HighWayUrl.go +++ b/packets/highway/HighWayUrl.go @@ -2,12 +2,13 @@ package highway import ( "encoding/hex" + + "github.com/LagrangeDev/LagrangeGo/utils/proto" + "github.com/LagrangeDev/LagrangeGo/packets/pb/action" - "github.com/LagrangeDev/LagrangeGo/utils/binary" - "github.com/RomiChan/protobuf/proto" ) -func BuildHighWayUrlReq(tgt []byte) (*binary.Builder, error) { +func BuildHighWayUrlReq(tgt []byte) ([]byte, error) { tgtHex := hex.EncodeToString(tgt) body := &action.HttpConn0X6Ff_501{ HttpConn: &action.HttpConn{ @@ -24,12 +25,10 @@ func BuildHighWayUrlReq(tgt []byte) (*binary.Builder, error) { Ver: "1.0.1", }, } - packet := binary.NewBuilder(nil) - marshal, err := proto.Marshal(body) + packet, err := proto.Marshal(body) if err != nil { return nil, err } - packet.WriteBytes(marshal, false) return packet, nil } diff --git a/packets/pb/action/action.pb.go b/packets/pb/action/action.pb.go index 8a2d2228..7462fadd 100644 --- a/packets/pb/action/action.pb.go +++ b/packets/pb/action/action.pb.go @@ -118,7 +118,7 @@ type HttpConnResponse struct { type ServerAddr struct { Type uint32 `protobuf:"varint,1,opt"` - IP uint32 `protobuf:"varint,2,opt"` + IP uint32 `protobuf:"fixed32,2,opt"` Port uint32 `protobuf:"varint,3,opt"` Area uint32 `protobuf:"varint,4,opt"` _ [0]func() diff --git a/packets/pb/action/action.proto b/packets/pb/action/action.proto index a1803591..c2f4065b 100644 --- a/packets/pb/action/action.proto +++ b/packets/pb/action/action.proto @@ -107,7 +107,7 @@ message HttpConnResponse { message ServerAddr { uint32 Type = 1; - uint32 IP = 2; + fixed32 IP = 2; uint32 Port = 3; uint32 Area = 4; }