notify/clienttype.go

93 lines
3.8 KiB
Go
Raw Normal View History

2021-11-12 16:04:39 +08:00
package notify
import (
"context"
"net"
2021-11-12 16:04:39 +08:00
"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
SetBulkNetworkProfile(BulkNetworkProfile)
BulkNetworkProfile() BulkNetworkProfile
SetBulkDefaultOpenMode(BulkOpenMode)
BulkDefaultOpenMode() BulkOpenMode
SetBulkOpenTuning(BulkOpenTuning)
BulkOpenTuning() BulkOpenTuning
SetBulkDedicatedAttachConfig(BulkDedicatedAttachConfig)
BulkDedicatedAttachConfig() BulkDedicatedAttachConfig
SetFileReceiveDir(dir string) error
2021-11-12 16:04:39 +08:00
send(msg TransferMsg) (WaitMsg, error)
sendEnvelope(env Envelope) error
2021-11-12 16:04:39 +08:00
sendWait(msg TransferMsg, timeout time.Duration) (Message, error)
Send(key string, value MsgVal) error
SendWait(key string, value MsgVal, timeout time.Duration) (Message, error)
2022-01-07 15:07:24 +08:00
SendWaitObj(key string, value interface{}, timeout time.Duration) (Message, error)
2021-11-12 16:04:39 +08:00
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.
2021-11-12 16:04:39 +08:00
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.
2021-11-12 16:04:39 +08:00
SkipExchangeKey() bool
// Deprecated: SetSkipExchangeKey only controls the legacy RSA-based key exchange.
2021-11-12 16:04:39 +08:00
SetSkipExchangeKey(bool)
GetMsgEn() func([]byte, []byte) []byte
// Deprecated: SetMsgEn overrides the transport codec directly.
// Prefer UseModernPSKClient or UseLegacySecurityClient.
2021-11-12 16:04:39 +08:00
SetMsgEn(func([]byte, []byte) []byte)
GetMsgDe() func([]byte, []byte) []byte
// Deprecated: SetMsgDe overrides the transport codec directly.
// Prefer UseModernPSKClient or UseLegacySecurityClient.
2021-11-12 16:04:39 +08:00
SetMsgDe(func([]byte, []byte) []byte)
Heartbeat()
HeartbeatPeroid() time.Duration
SetHeartbeatPeroid(duration time.Duration)
GetSecretKey() []byte
// Deprecated: SetSecretKey injects a raw transport key directly.
// Prefer UseModernPSKClient or UseLegacySecurityClient.
2021-11-12 16:04:39 +08:00
SetSecretKey(key []byte)
// Deprecated: RsaPubKey exposes the legacy RSA handshake key. Prefer UseModernPSKClient.
2021-11-12 16:04:39 +08:00
RsaPubKey() []byte
// Deprecated: SetRsaPubKey configures the legacy RSA handshake key. Prefer UseModernPSKClient.
2021-11-12 16:04:39 +08:00
SetRsaPubKey([]byte)
Stop() error
StopMonitorChan() <-chan struct{}
Status() Status
2022-02-23 14:36:12 +08:00
ShowError(bool)
2022-05-20 09:27:19 +08:00
DebugMode(bool)
IsDebugMode() bool
2021-11-12 16:04:39 +08:00
GetSequenceEn() func(interface{}) ([]byte, error)
SetSequenceEn(func(interface{}) ([]byte, error))
GetSequenceDe() func([]byte) (interface{}, error)
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)
OpenSharedBulk(ctx context.Context, opt BulkOpenOptions) (Bulk, error)
OpenDedicatedBulk(ctx context.Context, opt BulkOpenOptions) (Bulk, error)
SendTransfer(ctx context.Context, opt TransferSendOptions) (TransferHandle, error)
SendFile(ctx context.Context, filePath string) error
2021-11-12 16:04:39 +08:00
}