Skip to content

Commit

Permalink
fix: parse highway server
Browse files Browse the repository at this point in the history
  • Loading branch information
Redmomn committed Apr 21, 2024
1 parent bd8115b commit c9520d2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
11 changes: 6 additions & 5 deletions client/highway.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down
11 changes: 5 additions & 6 deletions packets/highway/HighWayUrl.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion packets/pb/action/action.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packets/pb/action/action.proto
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ message HttpConnResponse {

message ServerAddr {
uint32 Type = 1;
uint32 IP = 2;
fixed32 IP = 2;
uint32 Port = 3;
uint32 Area = 4;
}
Expand Down

0 comments on commit c9520d2

Please sign in to comment.