chore(release): 发布 v1.9.2
CI / verify (push) Canceled after 0s
Docker Release / build-and-push (amd64, linux/amd64) (push) Canceled after 0s
Docker Release / build-and-push (arm64, linux/arm64) (push) Canceled after 0s
GitHub Release / release (push) Canceled after 0s
Docker Release / create-manifest (push) Canceled after 0s
CI / verify (push) Canceled after 0s
Docker Release / build-and-push (amd64, linux/amd64) (push) Canceled after 0s
Docker Release / build-and-push (arm64, linux/arm64) (push) Canceled after 0s
GitHub Release / release (push) Canceled after 0s
Docker Release / create-manifest (push) Canceled after 0s
- 「公网服务端」新增 Nginx 启停控制(Agent 0.15.2,停止带二次确认) - frps 启动失败不再误报成功,并增强启动诊断 - frps vhost 端口禁止 80/443,避免与 VPS 上 Nginx 冲突 - 旧服务端配置的 tcp_mux / login_fail_exit 默认值补齐 - 新增安全审查、页面布局方案与场景操作文档
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
package frp
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strconv"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestFetchLegacyRouteProxiesUsesBoundedConcurrency(t *testing.T) {
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
name := strings.TrimPrefix(r.URL.Path, "/api/proxies/")
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
_, _ = fmt.Fprintf(w, `{"name":%q,"todayTrafficIn":1,"todayTrafficOut":2,"curConns":3}`, name)
|
||||
}))
|
||||
defer server.Close()
|
||||
|
||||
host, portText, err := net.SplitHostPort(strings.TrimPrefix(server.URL, "http://"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
port, err := strconv.Atoi(portText)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
client := newFRPSTrafficClient()
|
||||
names := []string{"a", "b", "c", "d", "e", "f", "g", "h"}
|
||||
started := time.Now()
|
||||
result := client.fetchLegacyRouteProxies(context.Background(), Server{
|
||||
ID: 1,
|
||||
Options: ServerOptions{
|
||||
DashboardAddr: host,
|
||||
DashboardPort: port,
|
||||
},
|
||||
}, "", names)
|
||||
elapsed := time.Since(started)
|
||||
|
||||
if !result.OK || len(result.Proxies) != len(names) {
|
||||
t.Fatalf("逐条查询结果不完整: ok=%v proxies=%d", result.OK, len(result.Proxies))
|
||||
}
|
||||
if elapsed >= time.Second {
|
||||
t.Fatalf("并发查询耗时 %v,仍接近串行等待", elapsed)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user