Skip to content

Commit ded036f

Browse files
committed
fix: github actions
1 parent 7609a7d commit ded036f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

internal/derperer/derp_endpoint.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func (d DerpEndpoints) Convert() *DERPMap {
8888
type DerpQueryParams struct {
8989
Status DerpStatus `query:"status" json:"status" enums:"alive,error,all"`
9090
LatencyLimit time.Duration `query:"latency-limit" json:"latency_limit"`
91-
BandwidthLimit float64 `query:"bandwidth-limit" json:"bandwidth_limit"`
91+
BandwidthLimit string `query:"bandwidth-limit" json:"bandwidth_limit"`
9292
}
9393

9494
func (d DerpEndpoints) Query(params *DerpQueryParams) DerpEndpoints {
@@ -100,8 +100,14 @@ func (d DerpEndpoints) Query(params *DerpQueryParams) DerpEndpoints {
100100
if params.LatencyLimit != 0 && endpoint.Latency > params.LatencyLimit {
101101
continue
102102
}
103-
if params.BandwidthLimit != 0 && endpoint.Bandwidth.Value < params.BandwidthLimit {
104-
continue
103+
if params.BandwidthLimit != "" {
104+
bandwidthLimit, err := speedtest.ParseUnit(params.BandwidthLimit, "bps")
105+
if err != nil {
106+
continue
107+
}
108+
if endpoint.Bandwidth.Value < bandwidthLimit.Value {
109+
continue
110+
}
105111
}
106112
res = append(res, endpoint)
107113
}

0 commit comments

Comments
 (0)