feat(notify): 重构通信内核并补齐 stream/bulk/record/transfer 能力
- 引入 LogicalConn/TransportConn 分层,ClientConn 保留兼容适配层 - 新增 Stream、Bulk、RecordStream 三条数据面能力及对应控制路径 - 完成 transfer/file 传输内核与状态快照、诊断能力 - 补齐 reconnect、inbound dispatcher、modern psk 等基础模块 - 增加大规模回归、并发与基准测试覆盖 - 更新依赖库
This commit is contained in:
@@ -7,32 +7,86 @@ import (
|
||||
)
|
||||
|
||||
type Server interface {
|
||||
// Deprecated: SetDefaultCommEncode overrides the transport codec directly.
|
||||
// Prefer UseModernPSKServer or UseLegacySecurityServer.
|
||||
SetDefaultCommEncode(func([]byte, []byte) []byte)
|
||||
// Deprecated: SetDefaultCommDecode overrides the transport codec directly.
|
||||
// Prefer UseModernPSKServer or UseLegacySecurityServer.
|
||||
SetDefaultCommDecode(func([]byte, []byte) []byte)
|
||||
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(c *ClientConn, msg TransferMsg) (WaitMsg, error)
|
||||
sendEnvelope(c *ClientConn, env Envelope) error
|
||||
sendWait(c *ClientConn, msg TransferMsg, timeout time.Duration) (Message, error)
|
||||
OpenStreamLogical(ctx context.Context, c *LogicalConn, opt StreamOpenOptions) (Stream, error)
|
||||
OpenStreamTransport(ctx context.Context, t *TransportConn, opt StreamOpenOptions) (Stream, error)
|
||||
OpenRecordStreamLogical(ctx context.Context, c *LogicalConn, opt RecordOpenOptions) (RecordStream, error)
|
||||
OpenRecordStreamTransport(ctx context.Context, t *TransportConn, opt RecordOpenOptions) (RecordStream, error)
|
||||
OpenBulkLogical(ctx context.Context, c *LogicalConn, opt BulkOpenOptions) (Bulk, error)
|
||||
OpenBulkTransport(ctx context.Context, t *TransportConn, opt BulkOpenOptions) (Bulk, error)
|
||||
SendTransferLogical(ctx context.Context, c *LogicalConn, opt TransferSendOptions) (TransferHandle, error)
|
||||
SendTransferTransport(ctx context.Context, t *TransportConn, opt TransferSendOptions) (TransferHandle, error)
|
||||
SendObjCtxLogical(ctx context.Context, c *LogicalConn, key string, val interface{}) (Message, error)
|
||||
SendObjLogical(c *LogicalConn, key string, val interface{}) error
|
||||
SendLogical(c *LogicalConn, key string, value MsgVal) error
|
||||
SendWaitLogical(c *LogicalConn, key string, value MsgVal, timeout time.Duration) (Message, error)
|
||||
SendWaitObjLogical(c *LogicalConn, key string, value interface{}, timeout time.Duration) (Message, error)
|
||||
SendCtxLogical(ctx context.Context, c *LogicalConn, key string, value MsgVal) (Message, error)
|
||||
SendObjCtxTransport(ctx context.Context, t *TransportConn, key string, val interface{}) (Message, error)
|
||||
SendObjTransport(t *TransportConn, key string, val interface{}) error
|
||||
SendTransport(t *TransportConn, key string, value MsgVal) error
|
||||
SendWaitTransport(t *TransportConn, key string, value MsgVal, timeout time.Duration) (Message, error)
|
||||
SendWaitObjTransport(t *TransportConn, key string, value interface{}, timeout time.Duration) (Message, error)
|
||||
SendCtxTransport(ctx context.Context, t *TransportConn, key string, value MsgVal) (Message, error)
|
||||
// Deprecated: prefer the LogicalConn/TransportConn variants.
|
||||
SendObjCtx(ctx context.Context, c *ClientConn, key string, val interface{}) (Message, error)
|
||||
// Deprecated: prefer the LogicalConn/TransportConn variants.
|
||||
SendObj(c *ClientConn, key string, val interface{}) error
|
||||
// Deprecated: prefer the LogicalConn/TransportConn variants.
|
||||
Send(c *ClientConn, key string, value MsgVal) error
|
||||
// Deprecated: prefer the LogicalConn/TransportConn variants.
|
||||
SendWait(c *ClientConn, key string, value MsgVal, timeout time.Duration) (Message, error)
|
||||
// Deprecated: prefer the LogicalConn/TransportConn variants.
|
||||
SendWaitObj(c *ClientConn, key string, value interface{}, timeout time.Duration) (Message, error)
|
||||
// Deprecated: prefer the LogicalConn/TransportConn variants.
|
||||
SendCtx(ctx context.Context, c *ClientConn, key string, value MsgVal) (Message, error)
|
||||
Reply(m Message, value MsgVal) error
|
||||
pushMessage([]byte, string)
|
||||
removeLogical(logical *LogicalConn)
|
||||
removeClient(client *ClientConn)
|
||||
Listen(network string, addr string) error
|
||||
ListenByListener(listener net.Listener) error
|
||||
Stop() error
|
||||
StopMonitorChan() <-chan struct{}
|
||||
Status() Status
|
||||
|
||||
GetSecretKey() []byte
|
||||
// Deprecated: SetSecretKey injects a raw transport key directly.
|
||||
// Prefer UseModernPSKServer or UseLegacySecurityServer.
|
||||
SetSecretKey(key []byte)
|
||||
// Deprecated: RsaPrivKey exposes the legacy RSA handshake key. Prefer UseModernPSKServer.
|
||||
RsaPrivKey() []byte
|
||||
// Deprecated: SetRsaPrivKey configures the legacy RSA handshake key. Prefer UseModernPSKServer.
|
||||
SetRsaPrivKey([]byte)
|
||||
|
||||
GetLogicalConn(id string) *LogicalConn
|
||||
GetLogicalConnList() []*LogicalConn
|
||||
GetCurrentTransportConn(id string) *TransportConn
|
||||
GetCurrentTransportConnByLogical(c *LogicalConn) *TransportConn
|
||||
GetCurrentTransportConnList() []*TransportConn
|
||||
// Deprecated: prefer GetLogicalConn.
|
||||
GetClient(id string) *ClientConn
|
||||
// Deprecated: prefer GetLogicalConnList.
|
||||
GetClientLists() []*ClientConn
|
||||
GetClientAddrs() []net.Addr
|
||||
|
||||
@@ -46,4 +100,10 @@ type Server interface {
|
||||
|
||||
HeartbeatTimeoutSec() int64
|
||||
SetHeartbeatTimeoutSec(int64)
|
||||
DetachedClientKeepSec() int64
|
||||
SetDetachedClientKeepSec(int64)
|
||||
SendFileLogical(ctx context.Context, c *LogicalConn, filePath string) error
|
||||
SendFileTransport(ctx context.Context, t *TransportConn, filePath string) error
|
||||
// Deprecated: prefer SendFileLogical or SendFileTransport.
|
||||
SendFile(ctx context.Context, c *ClientConn, filePath string) error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user