session

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 27, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallbacksMap

type CallbacksMap struct {
	// contains filtered or unexported fields
}

func NewCallbacksMap

func NewCallbacksMap() *CallbacksMap

func (*CallbacksMap) Close

func (c *CallbacksMap) Close()

func (*CallbacksMap) Delete

func (c *CallbacksMap) Delete(key string)

func (*CallbacksMap) Get

func (c *CallbacksMap) Get(key string) (UploadCallback, bool)

func (*CallbacksMap) Len

func (c *CallbacksMap) Len() int

func (*CallbacksMap) Set

func (c *CallbacksMap) Set(key string, value UploadCallback, ttl time.Duration) *CallbacksMap

type Context

type Context interface {
	UID() string
	IMEI() string
	UserAgent() string
	Language() string

	APIType() uint
	APIVersion() uint

	Options() OptionsSnapshot
	IsLogging() bool
	LogLevel() uint8
	CheckUpdate() bool
	GetImageMetadata(path string) (model.AttachmentMetadata, string, error)

	CookieJar() http.CookieJar
	SecretKey() SecretKey
	LoginInfo() *LoginInfo
	Settings() *Settings
	ExtraVer() *ExtraVer
	UploadCallback() *CallbacksMap

	ZPWWebsocket() []string
	WSPingInterval() time.Duration

	ZPWServiceMap() *ZpwServiceMap
	GetZpwService(service string) []string
}

type ExtraVer

type ExtraVer struct {
	Phonebook              uint   `json:"phonebook"`
	ConvLabel              string `json:"conv_label"`
	Friend                 string `json:"friend"`
	VerStickerGiphySuggest uint   `json:"ver_sticker_giphy_suggest"`
	VerGiphyCate           uint   `json:"ver_giphy_cate"`
	Alias                  string `json:"alias"`
	VerStickerCateList     uint   `json:"ver_sticker_cate_list"`
	BlockFriend            string `json:"block_friend"`
}

type Features

type Features struct {
	ShareFile ShareFileSettings `json:"sharefile"`
	Socket    SocketSettings    `json:"socket"`
}

type ImageMetadataGetter

type ImageMetadataGetter func(filePath string) (model.AttachmentMetadata, error)

type KeepaliveSettings

type KeepaliveSettings struct {
	AlwaysKeepalive   uint `json:"alway_keepalive"`
	KeepaliveDuration uint `json:"keepalive_duration"`
	TimeDeactive      uint `json:"time_deactive"`
}

type LoginInfo

type LoginInfo struct {
	UID         string `json:"uid"`
	ZPWEnk      string `json:"zpw_enk"`
	HasPCClient uint   `json:"haspcclient"`
	PublicIP    string `json:"public_ip"`
	Language    string `json:"language"`
	Send2meID   string `json:"send2me_id"`

	ZpwWebsocket    []string        `json:"zpw_ws"`
	ZpwServiceMapV3 ZpwServiceMapV3 `json:"zpw_service_map_v3"`
}

type MutableContext

type MutableContext interface {
	Context

	SealLogin(seal Seal) // one-shot finalization

	Client() *http.Client
	Proxy() func(*http.Request) (*url.URL, error)

	SetIMEI(imei string)
	SetUserAgent(ua string)
	SetLanguage(lang string)

	SetCookieJar(j http.CookieJar)

	AsReadOnly() Context
}

func NewContext

func NewContext(optFns ...Option) MutableContext

type OfflineMonitor

type OfflineMonitor struct {
	Enable bool `json:"enable"`
}

type OneOrMany

type OneOrMany[T any] struct {
	Values []T
}

func (OneOrMany[T]) MarshalJSON

func (o OneOrMany[T]) MarshalJSON() ([]byte, error)

func (OneOrMany[T]) Single

func (o OneOrMany[T]) Single() (T, bool)

func (OneOrMany[T]) Slice

func (o OneOrMany[T]) Slice() []T

func (*OneOrMany[T]) UnmarshalJSON

func (o *OneOrMany[T]) UnmarshalJSON(b []byte) error

type Option

type Option func(*options)

func WithAPIType

func WithAPIType(t uint) Option

func WithAPIVersion

func WithAPIVersion(v uint) Option

func WithCheckUpdate

func WithCheckUpdate(v bool) Option

func WithHTTPClient

func WithHTTPClient(c *http.Client) Option

func WithImageMetadataGetter

func WithImageMetadataGetter(f ImageMetadataGetter) Option

func WithLogLevel

func WithLogLevel(level uint8) Option

func WithLogging

func WithLogging(v bool) Option

func WithSelfListen

func WithSelfListen(v bool) Option

type OptionsSnapshot

type OptionsSnapshot struct {
	SelfListen          bool
	CheckUpdate         bool
	Logging             bool
	LogLevel            uint8
	APIType             uint
	APIVersion          uint
	Client              *http.Client
	ImageMetadataGetter ImageMetadataGetter
}

type QueueCtrlActionIDMap

type QueueCtrlActionIDMap struct {
	CMD_611_0 string `json:"611_0"`
	CMD_610_1 string `json:"610_1"`
	CMD_610_0 string `json:"610_0"`
	CMD_603_0 string `json:"603_0"`
	CMD_611_1 string `json:"611_1"`
}

type Seal

type Seal struct {
	UID       string
	IMEI      string
	UserAgent string
	Language  string

	SecretKey SecretKey
	LoginInfo *LoginInfo
	Settings  *Settings
	ExtraVer  *ExtraVer
	Jar       http.CookieJar
}

type SecretKey

type SecretKey string

func (SecretKey) Bytes

func (s SecretKey) Bytes() []byte

func (SecretKey) IsValid

func (s SecretKey) IsValid() bool

type ServerInfo

type ServerInfo struct {
	Settings *Settings `json:"settings"`
	ExtraVer *ExtraVer `json:"extra_ver"`
}

func (*ServerInfo) UnmarshalJSON

func (s *ServerInfo) UnmarshalJSON(data []byte) error

type Settings

type Settings struct {
	Features  Features          `json:"features"`
	Keepalive KeepaliveSettings `json:"keepalive"`
}

type ShareFileSettings

type ShareFileSettings struct {
	BigFileDomainList     []string `json:"big_file_domain_list"`
	MaxSizeShareFileV2    int64    `json:"max_size_share_file_v2"`
	MaxSizeShareFileV3    int64    `json:"max_size_share_file_v3"`
	FileUploadShowIcon1GB bool     `json:"file_upload_show_icon_1GB"`
	RestrictedExt         string   `json:"restricted_ext"`
	NextFileTime          int      `json:"next_file_time"`
	MaxFile               int      `json:"max_file"`
	MaxSizePhoto          int      `json:"max_size_photo"`
	MaxSizeShareFile      int      `json:"max_size_share_file"`
	MaxSizeResizePhoto    int      `json:"max_size_resize_photo"`
	MaxSizeGif            int      `json:"max_size_gif"`
	MaxSizeOriginalPhoto  int      `json:"max_size_original_photo"`
	ChunkSizeFile         int64    `json:"chunk_size_file"`
	RestrictedExtFile     []string `json:"restricted_ext_file"`
}

type SocketDebug

type SocketDebug struct {
	Enable bool `json:"enable"`
}

type SocketRetryConfig

type SocketRetryConfig struct {
	Max   *int           `json:"max,omitempty"`
	Times OneOrMany[int] `json:"times"`
}

type SocketSettings

type SocketSettings struct {
	RotateErrorCodes []int                        `json:"rotate_error_codes"`
	Retries          map[string]SocketRetryConfig `json:"retries"`
	Debug            SocketDebug                  `json:"debug"`
	PingInterval     int                          `json:"ping_interval"`
	ResetEndpoint    uint                         `json:"reset_endpoint"`
	QueueCtrlAction  QueueCtrlActionIDMap         `json:"queue_ctrl_actionid_map"`
	CloseAndRetry    []int                        `json:"close_and_retry_codes"`
	MaxMsgSize       uint                         `json:"max_msg_size"`
	EnableCtrlSocket bool                         `json:"enable_ctrl_socket"`
	ReconnectAfterFB bool                         `json:"reconnect_after_fallback"`
	EnableChatSocket bool                         `json:"enable_chat_socket"`
	SubmitWssLog     bool                         `json:"submit_wss_log"`
	DisableLP        bool                         `json:"disable_lp"`
	OfflineMonitor   OfflineMonitor               `json:"offline_monitor"`
}

type UploadCallback

type UploadCallback = func(data model.UploadAttachment)

type ZpwServiceMap

type ZpwServiceMap = ZpwServiceMapV3

type ZpwServiceMapV3

type ZpwServiceMapV3 struct {
	OtherContact       []string `json:"other_contact"`
	ChatE2E            []string `json:"chat_e2e"`
	Workspace          []string `json:"workspace"`
	Catalog            []string `json:"catalog"`
	Boards             []string `json:"boards"`
	DownloadStickerUrl []string `json:"download_sticker_url"`
	SpContact          []string `json:"sp_contact"`
	ZcloudUpFile       []string `json:"zcloud_up_file"`
	MediaStoreSend2me  []string `json:"media_store_send2me"`
	PushAct            []string `json:"push_act"`
	Aext               []string `json:"aext"`
	Zfamily            []string `json:"zfamily"`
	GroupPoll          []string `json:"group_poll"`
	GroupCloudMessage  []string `json:"group_cloud_message"`
	MediaStore         []string `json:"media_store"`
	File               []string `json:"file"`
	AutoReply          []string `json:"auto_reply"`
	SyncAction         []string `json:"sync_action"`
	FriendLan          []string `json:"friend_lan"`
	Friend             []string `json:"friend"`
	Alias              []string `json:"alias"`
	Zimsg              []string `json:"zimsg"`
	GroupBoard         []string `json:"group_board"`
	Conversation       []string `json:"conversation"`
	Group              []string `json:"group"`
	FallbackLP         []string `json:"fallback_LP"`
	FriendBoard        []string `json:"friend_board"`
	UpFile             []string `json:"up_file"`
	Zavi               []string `json:"zavi"`
	Reaction           []string `json:"reaction"`
	VoiceCall          []string `json:"voice_call"`
	Profile            []string `json:"profile"`
	Sticker            []string `json:"sticker"`
	Label              []string `json:"label"`
	Consent            []string `json:"consent"`
	Zcloud             []string `json:"zcloud"`
	Chat               []string `json:"chat"`
	TodoUrl            []string `json:"todoUrl"`
	RecentSearch       []string `json:"recent_search"`
	GroupE2E           []string `json:"group_e2e"`
	QuickMessage       []string `json:"quick_message"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL