Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions share/generate_share.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,12 @@
if len(qp.BrutalDown) > 0 {
query = addQuery(query, "down", string(qp.BrutalDown))
}
if qp.UdpHop.PortList != nil {
var portList string
if json.Unmarshal(qp.UdpHop.PortList, &portList) == nil && len(portList) > 0 {
query = addQuery(query, "ports", portList)
if len(qp.UdpHop.PortList.Range) > 0 {

Check failure on line 248 in share/generate_share.go

View workflow job for this annotation

GitHub Actions / test

qp.UdpHop.PortList.Range undefined (type "encoding/json".RawMessage has no field or method Range)
if jsonData, err := json.Marshal(qp.UdpHop.PortList.Range); err == nil {

Check failure on line 249 in share/generate_share.go

View workflow job for this annotation

GitHub Actions / test

qp.UdpHop.PortList.Range undefined (type "encoding/json".RawMessage has no field or method Range)
query = addQuery(query, "ports", string(jsonData))
}
}
if qp.UdpHop.Interval != nil {
if qp.UdpHop.Interval.From >= 5 {
query = addQuery(query, "hop-interval", strconv.FormatInt(int64(qp.UdpHop.Interval.From), 10))
}
}
Expand Down
7 changes: 4 additions & 3 deletions share/hysteria_mask.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@
quicParams.BrutalDown = conf.Bandwidth(down)
}
if ports != "" {
var portList conf.PortList
udpHop := conf.UdpHop{}
portListJSON, err := json.Marshal(ports)
err := json.Unmarshal([]byte(ports), &portList)
if err != nil {
return nil, err
}
udpHop.PortList = portListJSON
udpHop.PortList = portList

Check failure on line 30 in share/hysteria_mask.go

View workflow job for this annotation

GitHub Actions / test

cannot use portList (variable of struct type conf.PortList) as "encoding/json".RawMessage value in assignment
if hopInterval != nil {
i := *hopInterval
udpHop.Interval = &conf.Int32Range{Left: i, Right: i, From: i, To: i}
udpHop.Interval = conf.Int32Range{Left: i, Right: i, From: i, To: i}

Check failure on line 33 in share/hysteria_mask.go

View workflow job for this annotation

GitHub Actions / test

cannot use conf.Int32Range{…} (value of struct type conf.Int32Range) as *conf.Int32Range value in assignment
}
quicParams.UdpHop = udpHop
}
Expand Down
Loading