Documentation ¶
Index ¶
- Constants
- Variables
- type AckEvent
- type AppSettingsPublish
- type AttributeMap
- type BBox
- type BBoxContainer
- type BigPipe
- type ChannelType
- type Client
- func (c *Client) Connect() error
- func (c *Client) Disconnect()
- func (c *Client) EnableSendingMessages()
- func (c *Client) ExecuteTasks(tasks ...socket.Task) (*table.LSTable, error)
- func (c *Client) GetCurrentAccount() (types.UserInfo, error)
- func (c *Client) GetTaskId() int
- func (c *Client) IsAuthenticated() bool
- func (c *Client) IsConnected() bool
- func (c *Client) LoadMessagesPage() (types.UserInfo, *table.LSTable, error)
- func (c *Client) MakeRequest(url string, method string, headers http.Header, payload []byte, ...) (*http.Response, []byte, error)
- func (c *Client) NewHttpQuery() *HttpQuery
- func (c *Client) NewMercuryMediaPayload(media *MercuryUploadMedia) ([]byte, string, error)
- func (c *Client) NewPublishRequest(topic Topic, jsonData string, packetByte byte, packetId uint16) ([]byte, uint16, error)
- func (c *Client) NewSubscribeRequest(topic Topic, qos packets.QoS) ([]byte, uint16, error)
- func (c *Client) NewSyncManager() *SyncManager
- func (c *Client) NewTaskManager() *TaskManager
- func (c *Client) PrepareE2EEClient() *whatsmeow.Client
- func (c *Client) RegisterE2EE(ctx context.Context, fbid int64) error
- func (c *Client) SaveSession(path string) error
- func (c *Client) SendMercuryUploadRequest(ctx context.Context, threadID int64, media *MercuryUploadMedia) (*types.MercuryUploadResponse, error)
- func (c *Client) SetDevice(dev *store.Device)
- func (c *Client) SetEventHandler(handler EventHandler)
- func (c *Client) SetProxy(proxyAddr string) error
- func (c *Client) UpdateProxy(reason string) bool
- func (c *Client) WaitUntilCanSendMessages(timeout time.Duration) error
- type Configs
- type Connect
- type ConnectPayload
- type ConnectPostMessage
- type ConnectionCode
- type EventHandler
- type Event_PermanentError
- type Event_PingResp
- type Event_PublishACK
- type Event_PublishResponse
- type Event_Ready
- type Event_Reconnected
- type Event_SocketError
- type Event_SubscribeACK
- type FacebookMethods
- type FormTag
- type HttpQuery
- type ICDCFetchResponse
- type ICDCRegisterResponse
- type InputTag
- type InstagramMethods
- func (ig *InstagramMethods) ExtractFBID(currentUser types.UserInfo, tbl *table.LSTable) (int64, error)
- func (ig *InstagramMethods) FetchHighlights(highlightIds []string) (*responses.ReelInfoResponse, error)
- func (ig *InstagramMethods) FetchMedia(mediaID, mediaShortcode string) (*responses.FetchMediaResponse, error)
- func (ig *InstagramMethods) FetchProfile(username string) (*responses.ProfileInfoResponse, error)
- func (ig *InstagramMethods) FetchReel(reelIds []string, mediaID string) (*responses.ReelInfoResponse, error)
- func (ig *InstagramMethods) Login(identifier, password string) (*cookies.Cookies, error)
- func (ig *InstagramMethods) RegisterPushNotifications(endpoint string, keys PushKeys) error
- type LinkTag
- type MercuryUploadMedia
- type ModuleEntry
- type ModuleParser
- func (m *ModuleParser) HandleBootloaderPayload(payload json.RawMessage, bootloaderConfig *types.BootLoaderConfig) error
- func (m *ModuleParser) HandleRawJSON(data []byte, id string) error
- func (m *ModuleParser) Load(page string) error
- func (m *ModuleParser) SSJSHandle(data json.RawMessage) error
- func (m *ModuleParser) SetClientInstance(cli *Client)
- type NodeProcessor
- type Payload
- type PublishPayload
- type PublishResponseData
- type PushKeys
- type RPSCBBox
- type RPSCBBoxContainer
- type RelayPrefetchedStreamCache
- type Request
- type Response
- type ResponseData
- type ResponseHandler
- type ScriptTag
- type Socket
- type SocketLSRequestPayload
- type SubscribePayload
- type SyncManager
- func (sm *SyncManager) EnsureSyncedSocket(databases []int64) error
- func (sm *SyncManager) GetCursor(db int64) string
- func (sm *SyncManager) SyncDataGraphQL(dbs []int64) (*table.LSTable, error)
- func (sm *SyncManager) SyncSocketData(databaseId int64, db *socket.QueryMetadata) (*table.LSTable, error)
- func (sm *SyncManager) SyncTransactions(transactions []*table.LSExecuteFirstBlockForSyncTransaction) error
- func (sm *SyncManager) UpdateDatabaseSyncParams(dbs []*socket.QueryMetadata) error
- type TaskManager
- type Topic
- type WaveformData
Constants ¶
const BrowserName = "Chrome"
const ChromeVersion = "129"
const ChromeVersionFull = ChromeVersion + ".0.6668.101"
const DPR = "1"
const MaxHTTPRetries = 5
const OSName = "Linux"
const OSVersion = "6.8.0"
const SecCHFullVersionList = `"Chromium";v="` + ChromeVersionFull + `", "Google Chrome";v="` + ChromeVersionFull + `", "Not-A.Brand";v="99.0.0.0"`
const SecCHMobile = "?0"
const SecCHModel = `""`
const SecCHPlatform = `"` + OSName + `"`
const SecCHPlatformVersion = `"` + OSVersion + `"`
const SecCHPrefersColorScheme = "light"
const SecCHUserAgent = `"Chromium";v="` + ChromeVersion + `", "Google Chrome";v="` + ChromeVersion + `", "Not-A.Brand";v="99"`
const UserAgent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/" + ChromeVersion + ".0.0.0 Safari/537.36"
Variables ¶
var ( ErrTokenInvalidated = errors.New("access token is no longer valid") ErrChallengeRequired = errors.New("challenge required") ErrConsentRequired = errors.New("consent required") ErrAccountSuspended = errors.New("account suspended") ErrRequestFailed = errors.New("failed to send request") ErrResponseReadFailed = errors.New("failed to read response body") ErrMaxRetriesReached = errors.New("maximum retries reached") ErrTooManyRedirects = errors.New("too many redirects") )
var ( ErrSocketClosed = errors.New("messagix-socket: socket is closed") ErrSocketAlreadyOpen = errors.New("messagix-socket: socket is already open") ErrNotAuthenticated = errors.New("messagix-socket: client has not been authenticated successfully yet") )
var DisableTLSVerification = false
var ErrChannelNotFound = fmt.Errorf("channel not found for packet")
var ErrConnectionClosed = fmt.Errorf("connection closed")
var ErrDial = errors.New("failed to dial socket")
var ErrInReadLoop = errors.New("error in read loop")
var ErrSendConnect = errors.New("failed to send connect packet")
var ErrTimeout = fmt.Errorf("timeout waiting for response")
Functions ¶
This section is empty.
Types ¶
type AppSettingsPublish ¶
type AttributeMap ¶
type BBox ¶
type BBox struct { Require []*ModuleEntry `json:"require"` Define []*ModuleEntry `json:"define"` }
type BBoxContainer ¶
type BBoxContainer struct {
BBox *BBox `json:"__bbox,omitempty"`
}
type Client ¶
type Client struct { Instagram *InstagramMethods Facebook *FacebookMethods Logger zerolog.Logger Platform types.Platform SyncManager *SyncManager GetNewProxy func(reason string) (string, error) // contains filtered or unexported fields }
func (*Client) Disconnect ¶
func (c *Client) Disconnect()
func (*Client) EnableSendingMessages ¶
func (c *Client) EnableSendingMessages()
func (*Client) ExecuteTasks ¶
func (*Client) IsAuthenticated ¶
func (*Client) IsConnected ¶
func (*Client) LoadMessagesPage ¶
func (*Client) MakeRequest ¶
func (*Client) NewHttpQuery ¶
func (*Client) NewMercuryMediaPayload ¶
func (c *Client) NewMercuryMediaPayload(media *MercuryUploadMedia) ([]byte, string, error)
returns payloadBytes, multipart content-type header
func (*Client) NewPublishRequest ¶
func (*Client) NewSubscribeRequest ¶
func (*Client) NewSyncManager ¶
func (c *Client) NewSyncManager() *SyncManager
func (*Client) NewTaskManager ¶
func (c *Client) NewTaskManager() *TaskManager
func (*Client) PrepareE2EEClient ¶
func (*Client) SaveSession ¶
func (*Client) SendMercuryUploadRequest ¶
func (c *Client) SendMercuryUploadRequest(ctx context.Context, threadID int64, media *MercuryUploadMedia) (*types.MercuryUploadResponse, error)
func (*Client) SetEventHandler ¶
func (c *Client) SetEventHandler(handler EventHandler)
func (*Client) UpdateProxy ¶
type Configs ¶
type Configs struct { LsdToken string CometReq string VersionId int64 Jazoest string WebSessionId string Bitmap *crypto.Bitmap CsrBitmap *crypto.Bitmap // contains filtered or unexported fields }
func (*Configs) LoadBitmaps ¶
(bitmap, csrBitmap)
func (*Configs) ParseFormInputs ¶
type Connect ¶
type Connect struct { AccountId string `json:"u"` // account id SessionId int64 `json:"s"` // randomly generated sessionid ClientCapabilities int `json:"cp"` // mqttconfig clientCapabilities (3) Capabilities int `json:"ecp"` // mqttconfig capabilities (10) ChatOn bool `json:"chat_on"` // mqttconfig chatVisibility (true) - not 100% sure Fg bool `json:"fg"` // idk what this is Cid string `json:"d"` // cid from html content ConnectionType string `json:"ct"` // connection type? facebook=websocket , insta=cookie_auth MqttSid string `json:"mqtt_sid"` // "" AppId int64 `json:"aid"` // mqttconfig appID (219994525426954) SubscribedTopics []string `json:"st"` // mqttconfig subscribedTopics ([]) PostMessage []ConnectPostMessage `json:"pm"` // only seen empty array Dc string `json:"dc"` // only seem empty string NoAutoFg bool `json:"no_auto_fg"` // only seen true Gas any `json:"gas"` // only seen null Pack []any `json:"pack"` // only seen empty arr HostNameOverride string `json:"php_override"` // mqttconfig hostNameOverride P any `json:"p"` // only seen null UserAgent string `json:"a"` // user agent Aids any `json:"aids"` // only seen null }
type ConnectPayload ¶
type ConnectPayload struct { ProtocolName string `lengthType:"uint16"` ProtocolLevel uint8 ConnectFlags uint8 KeepAliveTime uint16 ClientId string `lengthType:"uint16"` JSONData string `lengthType:"uint16"` }
func (*ConnectPayload) Write ¶
func (cp *ConnectPayload) Write() ([]byte, error)
type ConnectPostMessage ¶
type ConnectionCode ¶
type ConnectionCode uint8
const ( CONNECTION_ACCEPTED ConnectionCode = iota CONNECTION_REFUSED_UNACCEPTABLE_PROTOCOL_VERSION CONNECTION_REFUSED_IDENTIFIER_REJECTED CONNECTION_REFUSED_SERVER_UNAVAILABLE CONNECTION_REFUSED_BAD_USERNAME_OR_PASSWORD CONNECTION_REFUSED_UNAUTHORIZED )
func (ConnectionCode) Error ¶
func (c ConnectionCode) Error() string
func (ConnectionCode) IsEnum ¶
func (c ConnectionCode) IsEnum()
type EventHandler ¶
type EventHandler func(evt interface{})
type Event_PermanentError ¶
type Event_PermanentError struct{ Err error }
type Event_PingResp ¶
type Event_PingResp struct{}
func (*Event_PingResp) Finish ¶
func (e *Event_PingResp) Finish() ResponseData
func (*Event_PingResp) SetIdentifier ¶
func (pr *Event_PingResp) SetIdentifier(identifier uint16)
type Event_PublishACK ¶
type Event_PublishACK struct {
PacketId uint16
}
Event_PublishACK is never emitted, it only handles the acknowledgement after a PUBLISH packet has been sent.
func (*Event_PublishACK) Finish ¶
func (pb *Event_PublishACK) Finish() ResponseData
func (*Event_PublishACK) GetPacketId ¶
func (pb *Event_PublishACK) GetPacketId() uint16
func (*Event_PublishACK) SetIdentifier ¶
func (pb *Event_PublishACK) SetIdentifier(identifier uint16)
type Event_PublishResponse ¶
type Event_PublishResponse struct { Topic string `lengthType:"uint16" endian:"big"` Data PublishResponseData `jsonString:"1"` Table *table.LSTable MessageIdentifier uint16 }
Event_PublishResponse is emitted if the packetId/requestId from the websocket is 0 or nil
It will also be used for handling the responses after calling a function like GetContacts through the requestId
func (*Event_PublishResponse) Finish ¶
func (pb *Event_PublishResponse) Finish() ResponseData
func (*Event_PublishResponse) SetIdentifier ¶
func (pb *Event_PublishResponse) SetIdentifier(identifier uint16)
type Event_Ready ¶
type Event_Ready struct { IsNewSession bool ConnectionCode ConnectionCode // contains filtered or unexported fields }
Event_Ready represents the CONNACK packet's response.
The library provides the raw parsed data, so handle connection codes as needed for your application.
func (*Event_Ready) Finish ¶
func (e *Event_Ready) Finish() ResponseData
func (*Event_Ready) SetIdentifier ¶
func (pb *Event_Ready) SetIdentifier(identifier uint16)
type Event_Reconnected ¶
type Event_Reconnected struct{}
type Event_SocketError ¶
type Event_SubscribeACK ¶
Event_SubscribeACK is never emitted, it only handles the acknowledgement after a SUBSCRIBE packet has been sent.
func (*Event_SubscribeACK) Finish ¶
func (pb *Event_SubscribeACK) Finish() ResponseData
func (*Event_SubscribeACK) GetPacketId ¶
func (pb *Event_SubscribeACK) GetPacketId() uint16
func (*Event_SubscribeACK) SetIdentifier ¶
func (pb *Event_SubscribeACK) SetIdentifier(identifier uint16)
type FacebookMethods ¶
type FacebookMethods struct {
// contains filtered or unexported fields
}
func (*FacebookMethods) Login ¶
func (fb *FacebookMethods) Login(identifier, password string) (*cookies.Cookies, error)
func (*FacebookMethods) RegisterPushNotifications ¶
func (fb *FacebookMethods) RegisterPushNotifications(endpoint string, keys PushKeys) error
type FormTag ¶
type FormTag struct { Attributes AttributeMap Inputs []InputTag }
type HttpQuery ¶
type HttpQuery struct { AcceptOnlyEssential string `url:"accept_only_essential,omitempty"` Av string `url:"av,omitempty"` // not required User string `url:"__user,omitempty"` // not required A string `url:"__a,omitempty"` // 1 or 0 wether to include "suggestion_keys" or not in the response - no idea what this is Req string `url:"__req,omitempty"` // not required Hs string `url:"__hs,omitempty"` // not required Dpr string `url:"dpr,omitempty"` // not required Ccg string `url:"__ccg,omitempty"` // not required Rev string `url:"__rev,omitempty"` // not required S string `url:"__s,omitempty"` // not required Hsi string `url:"__hsi,omitempty"` // not required Dyn string `url:"__dyn,omitempty"` // not required Csr string `url:"__csr"` // not required CometReq string `url:"__comet_req,omitempty"` // not required but idk what this is FbDtsg string `url:"fb_dtsg,omitempty"` Jazoest string `url:"jazoest,omitempty"` // not required Lsd string `url:"lsd,omitempty"` // required SpinR string `url:"__spin_r,omitempty"` // not required SpinB string `url:"__spin_b,omitempty"` // not required SpinT string `url:"__spin_t,omitempty"` // not required Jssesw string `url:"__jssesw,omitempty"` // not required FbAPICallerClass string `url:"fb_api_caller_class,omitempty"` // not required FbAPIReqFriendlyName string `url:"fb_api_req_friendly_name,omitempty"` // not required Variables string `url:"variables,omitempty"` ServerTimestamps string `url:"server_timestamps,omitempty"` // "true" or "false" DocID string `url:"doc_id,omitempty"` D string `url:"__d,omitempty"` // for insta AppID string `url:"app_id,omitempty"` // not required PushEndpoint string `url:"push_endpoint,omitempty"` // not required SubscriptionKeys string `url:"subscription_keys,omitempty"` // not required DeviceToken string `url:"device_token,omitempty"` // not required DeviceType string `url:"device_type,omitempty"` // not required Mid string `url:"mid,omitempty"` // not required Aaid string `url:"__aaid,omitempty"` }
type ICDCFetchResponse ¶
type ICDCFetchResponse struct { DeviceIdentities []string `json:"device_identities"` ICDCSeq int `json:"icdc_seq"` Status int `json:"status"` }
func (*ICDCFetchResponse) DeviceIdentityBytes ¶
func (ifr *ICDCFetchResponse) DeviceIdentityBytes() (deviceIdentityBytes [][32]byte, err error)
type ICDCRegisterResponse ¶
type InputTag ¶
type InputTag struct {
Attributes AttributeMap
}
type InstagramMethods ¶
type InstagramMethods struct {
// contains filtered or unexported fields
}
specific methods for insta api, not socket related
func (*InstagramMethods) ExtractFBID ¶
func (*InstagramMethods) FetchHighlights ¶
func (ig *InstagramMethods) FetchHighlights(highlightIds []string) (*responses.ReelInfoResponse, error)
NOTE: ¶
Hightlight IDs are different, they come in the format: "highlight:17913397615055292"
func (*InstagramMethods) FetchMedia ¶
func (ig *InstagramMethods) FetchMedia(mediaID, mediaShortcode string) (*responses.FetchMediaResponse, error)
func (*InstagramMethods) FetchProfile ¶
func (ig *InstagramMethods) FetchProfile(username string) (*responses.ProfileInfoResponse, error)
func (*InstagramMethods) FetchReel ¶
func (ig *InstagramMethods) FetchReel(reelIds []string, mediaID string) (*responses.ReelInfoResponse, error)
func (*InstagramMethods) Login ¶
func (ig *InstagramMethods) Login(identifier, password string) (*cookies.Cookies, error)
func (*InstagramMethods) RegisterPushNotifications ¶
func (ig *InstagramMethods) RegisterPushNotifications(endpoint string, keys PushKeys) error
type LinkTag ¶
type LinkTag struct {
Attributes AttributeMap
}
type MercuryUploadMedia ¶
type MercuryUploadMedia struct { Filename string MimeType string MediaData []byte IsVoiceClip bool WaveformData *WaveformData }
type ModuleEntry ¶
type ModuleEntry struct { Name string Data []json.RawMessage }
func (*ModuleEntry) UnmarshalJSON ¶
func (me *ModuleEntry) UnmarshalJSON(data []byte) error
type ModuleParser ¶
type ModuleParser struct { FormTags []FormTag LoginInputs []InputTag JSDatr string LS *table.LSTable // contains filtered or unexported fields }
func (*ModuleParser) HandleBootloaderPayload ¶
func (m *ModuleParser) HandleBootloaderPayload(payload json.RawMessage, bootloaderConfig *types.BootLoaderConfig) error
func (*ModuleParser) HandleRawJSON ¶
func (m *ModuleParser) HandleRawJSON(data []byte, id string) error
func (*ModuleParser) Load ¶
func (m *ModuleParser) Load(page string) error
func (*ModuleParser) SSJSHandle ¶
func (m *ModuleParser) SSJSHandle(data json.RawMessage) error
func (*ModuleParser) SetClientInstance ¶
func (m *ModuleParser) SetClientInstance(cli *Client)
type NodeProcessor ¶
type PublishPayload ¶
type PublishPayload struct { Topic Topic `lengthType:"uint16"` PacketId uint16 JSONData string `lengthType:""` }
func (*PublishPayload) Write ¶
func (pb *PublishPayload) Write() ([]byte, error)
type PublishResponseData ¶
type RPSCBBox ¶
type RPSCBBox struct { Complete bool `json:"complete"` Result json.RawMessage `json:"result"` }
type RPSCBBoxContainer ¶
type RPSCBBoxContainer struct {
BBox *RPSCBBox `json:"__bbox"`
}
type RelayPrefetchedStreamCache ¶
type RelayPrefetchedStreamCache struct { PreloadID string BBox *RPSCBBoxContainer }
func (*RelayPrefetchedStreamCache) UnmarshalJSON ¶
func (rpsc *RelayPrefetchedStreamCache) UnmarshalJSON(data []byte) error
type Response ¶
type Response struct { PacketByte uint8 RemainingLength uint32 `vlq:"true"` ResponseData ResponseData }
func (*Response) PacketType ¶
type ResponseData ¶
type ResponseData interface { Finish() ResponseData SetIdentifier(identifier uint16) }
type ResponseHandler ¶
type ResponseHandler struct {
// contains filtered or unexported fields
}
func (*ResponseHandler) CancelAllRequests ¶
func (p *ResponseHandler) CancelAllRequests()
type ScriptTag ¶
type ScriptTag struct { Attributes AttributeMap Content string }
type Socket ¶
type Socket struct {
// contains filtered or unexported fields
}
func (*Socket) BuildBrokerUrl ¶
func (*Socket) CanConnect ¶
func (*Socket) Disconnect ¶
func (s *Socket) Disconnect()
func (*Socket) SafePacketId ¶
type SocketLSRequestPayload ¶
type SubscribePayload ¶
type SubscribePayload struct { PacketId uint16 Topic Topic `lengthType:"uint16"` QoSLevel packets.QoS }
func (*SubscribePayload) Write ¶
func (sb *SubscribePayload) Write() ([]byte, error)
type SyncManager ¶
type SyncManager struct {
// contains filtered or unexported fields
}
func (*SyncManager) EnsureSyncedSocket ¶
func (sm *SyncManager) EnsureSyncedSocket(databases []int64) error
func (*SyncManager) GetCursor ¶
func (sm *SyncManager) GetCursor(db int64) string
func (*SyncManager) SyncDataGraphQL ¶
func (sm *SyncManager) SyncDataGraphQL(dbs []int64) (*table.LSTable, error)
func (*SyncManager) SyncSocketData ¶
func (sm *SyncManager) SyncSocketData(databaseId int64, db *socket.QueryMetadata) (*table.LSTable, error)
func (*SyncManager) SyncTransactions ¶
func (sm *SyncManager) SyncTransactions(transactions []*table.LSExecuteFirstBlockForSyncTransaction) error
func (*SyncManager) UpdateDatabaseSyncParams ¶
func (sm *SyncManager) UpdateDatabaseSyncParams(dbs []*socket.QueryMetadata) error
type TaskManager ¶
type TaskManager struct {
// contains filtered or unexported fields
}
func (*TaskManager) AddNewTask ¶
func (tm *TaskManager) AddNewTask(task socket.Task)
func (*TaskManager) FinalizePayload ¶
func (tm *TaskManager) FinalizePayload() ([]byte, error)
func (*TaskManager) GetTaskId ¶
func (tm *TaskManager) GetTaskId() int64