feat(notify): 重构通信内核并补齐 stream/bulk/record/transfer 能力
- 引入 LogicalConn/TransportConn 分层,ClientConn 保留兼容适配层 - 新增 Stream、Bulk、RecordStream 三条数据面能力及对应控制路径 - 完成 transfer/file 传输内核与状态快照、诊断能力 - 补齐 reconnect、inbound dispatcher、modern psk 等基础模块 - 增加大规模回归、并发与基准测试覆盖 - 更新依赖库
This commit is contained in:
@@ -2,28 +2,50 @@ package notify
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Client interface {
|
||||
SetDefaultLink(func(message *Message))
|
||||
SetLink(string, func(*Message))
|
||||
SetFileHandler(func(FileEvent))
|
||||
SetStreamHandler(func(StreamAcceptInfo) error)
|
||||
SetRecordStreamHandler(func(RecordAcceptInfo) error)
|
||||
SetBulkHandler(func(BulkAcceptInfo) error)
|
||||
SetTransferHandler(func(TransferAcceptInfo) (TransferReceiveOptions, error))
|
||||
GetStreamConfig() StreamConfig
|
||||
SetStreamConfig(StreamConfig)
|
||||
SetTransferResumeStore(TransferResumeStore)
|
||||
RecoverTransferSnapshots(context.Context) error
|
||||
SetFileReceiveDir(dir string) error
|
||||
send(msg TransferMsg) (WaitMsg, error)
|
||||
sendEnvelope(env Envelope) error
|
||||
sendWait(msg TransferMsg, timeout time.Duration) (Message, error)
|
||||
Send(key string, value MsgVal) error
|
||||
SendWait(key string, value MsgVal, timeout time.Duration) (Message, error)
|
||||
SendWaitObj(key string, value interface{}, timeout time.Duration) (Message, error)
|
||||
SendCtx(ctx context.Context, key string, value MsgVal) (Message, error)
|
||||
Reply(m Message, value MsgVal) error
|
||||
// Deprecated: ExchangeKey drives the legacy RSA-based key exchange flow.
|
||||
// Prefer UseModernPSKClient.
|
||||
ExchangeKey(newKey []byte) error
|
||||
Connect(network string, addr string) error
|
||||
ConnectTimeout(network string, addr string, timeout time.Duration) error
|
||||
ConnectByConn(conn net.Conn) error
|
||||
ConnectByFactory(ctx context.Context, dialFn func(context.Context) (net.Conn, error)) error
|
||||
// Deprecated: SkipExchangeKey only controls the legacy RSA-based key exchange.
|
||||
SkipExchangeKey() bool
|
||||
// Deprecated: SetSkipExchangeKey only controls the legacy RSA-based key exchange.
|
||||
SetSkipExchangeKey(bool)
|
||||
|
||||
GetMsgEn() func([]byte, []byte) []byte
|
||||
// Deprecated: SetMsgEn overrides the transport codec directly.
|
||||
// Prefer UseModernPSKClient or UseLegacySecurityClient.
|
||||
SetMsgEn(func([]byte, []byte) []byte)
|
||||
GetMsgDe() func([]byte, []byte) []byte
|
||||
// Deprecated: SetMsgDe overrides the transport codec directly.
|
||||
// Prefer UseModernPSKClient or UseLegacySecurityClient.
|
||||
SetMsgDe(func([]byte, []byte) []byte)
|
||||
|
||||
Heartbeat()
|
||||
@@ -31,8 +53,12 @@ type Client interface {
|
||||
SetHeartbeatPeroid(duration time.Duration)
|
||||
|
||||
GetSecretKey() []byte
|
||||
// Deprecated: SetSecretKey injects a raw transport key directly.
|
||||
// Prefer UseModernPSKClient or UseLegacySecurityClient.
|
||||
SetSecretKey(key []byte)
|
||||
// Deprecated: RsaPubKey exposes the legacy RSA handshake key. Prefer UseModernPSKClient.
|
||||
RsaPubKey() []byte
|
||||
// Deprecated: SetRsaPubKey configures the legacy RSA handshake key. Prefer UseModernPSKClient.
|
||||
SetRsaPubKey([]byte)
|
||||
|
||||
Stop() error
|
||||
@@ -48,4 +74,9 @@ type Client interface {
|
||||
SetSequenceDe(func([]byte) (interface{}, error))
|
||||
SendObjCtx(ctx context.Context, key string, val interface{}) (Message, error)
|
||||
SendObj(key string, val interface{}) error
|
||||
OpenStream(ctx context.Context, opt StreamOpenOptions) (Stream, error)
|
||||
OpenRecordStream(ctx context.Context, opt RecordOpenOptions) (RecordStream, error)
|
||||
OpenBulk(ctx context.Context, opt BulkOpenOptions) (Bulk, error)
|
||||
SendTransfer(ctx context.Context, opt TransferSendOptions) (TransferHandle, error)
|
||||
SendFile(ctx context.Context, filePath string) error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user