feat(notify): 重构通信内核并补齐 stream/bulk/record/transfer 能力
- 引入 LogicalConn/TransportConn 分层,ClientConn 保留兼容适配层 - 新增 Stream、Bulk、RecordStream 三条数据面能力及对应控制路径 - 完成 transfer/file 传输内核与状态快照、诊断能力 - 补齐 reconnect、inbound dispatcher、modern psk 等基础模块 - 增加大规模回归、并发与基准测试覆盖 - 更新依赖库
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
package transport
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestNamedPipeNetworkAliases(t *testing.T) {
|
||||
tests := []struct {
|
||||
network string
|
||||
want bool
|
||||
}{
|
||||
{network: "npipe", want: true},
|
||||
{network: "pipe", want: true},
|
||||
{network: "namedpipe", want: true},
|
||||
{network: "named-pipe", want: true},
|
||||
{network: "tcp", want: false},
|
||||
{network: "unix", want: false},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
if got := IsNamedPipeNetwork(tt.network); got != tt.want {
|
||||
t.Fatalf("IsNamedPipeNetwork(%q) = %v, want %v", tt.network, got, tt.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestNormalizeNamedPipeAddr(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
addr string
|
||||
want string
|
||||
}{
|
||||
{name: "short-name", addr: "notify-demo", want: `\\.\pipe\notify-demo`},
|
||||
{name: "pipe-prefix", addr: `pipe\notify-demo`, want: `\\.\pipe\notify-demo`},
|
||||
{name: "slash-prefix", addr: "//./pipe/notify-demo", want: `\\.\pipe\notify-demo`},
|
||||
{name: "normalized", addr: `\\.\pipe\notify-demo`, want: `\\.\pipe\notify-demo`},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if got := NormalizeNamedPipeAddr(tt.addr); got != tt.want {
|
||||
t.Fatalf("NormalizeNamedPipeAddr(%q) = %q, want %q", tt.addr, got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user