Documentation
¶
Index ¶
- Variables
- type Account
- type AckEvent
- type AppSettingsPublish
- type AttributeMap
- type BigPipe
- type ChannelType
- type Client
- func (c *Client) Connect() error
- func (c *Client) CurrentPlatform() string
- func (c *Client) Disconnect()
- func (c *Client) GetCurrentAccount() (types.AccountInfo, error)
- func (c *Client) GetTaskId() int
- func (c *Client) IsAuthenticated() bool
- func (c *Client) IsConnected() bool
- func (c *Client) MakeRequest(url string, method string, headers http.Header, payload []byte, ...) (*http.Response, []byte, error)
- func (c *Client) NewConnectRequest(jsonData string, connectFlags uint8) ([]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) NewSocketClient() *Socket
- 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) SaveSession(path string) error
- func (c *Client) SendMercuryUploadRequest(medias []*MercuryUploadMedia) ([]*types.MercuryUploadResponse, error)
- func (c *Client) SetEventHandler(handler EventHandler)
- func (c *Client) SetProxy(proxy string) error
- type Configs
- type Connect
- type ConnectPayload
- type ConnectionCode
- type EventHandler
- type Event_Error
- type Event_PingResp
- type Event_PublishACK
- type Event_PublishResponse
- type Event_Ready
- type Event_SocketClosed
- type Event_SubscribeACK
- type FacebookMethods
- type FormTag
- type HttpQuery
- type InputTag
- type InstagramMethods
- func (ig *InstagramMethods) FetchHighlights(highlightIds []string) (*responses.ReelInfoResponse, error)
- func (ig *InstagramMethods) FetchMedia(mediaId string) (*responses.FetchMediaResponse, error)
- func (ig *InstagramMethods) FetchProfile(username string) (*responses.ProfileInfoResponse, error)
- func (ig *InstagramMethods) FetchReel(reelIds []string) (*responses.ReelInfoResponse, error)
- func (ig *InstagramMethods) Login(identifier, password string) (cookies.Cookies, error)
- type LinkTag
- type MediaType
- type MercuryUploadMedia
- type MessageBuilder
- func (m *MessageBuilder) Execute() (*table.LSTable, error)
- func (m *MessageBuilder) SetInitiatingSource(initatingSource table.InitiatingSource) *MessageBuilder
- func (m *MessageBuilder) SetLastReadWatermarkTs(ts int64) *MessageBuilder
- func (m *MessageBuilder) SetMedias(medias []*types.MercuryUploadResponse)
- func (m *MessageBuilder) SetReplyMetadata(replyMetadata *socket.ReplyMetaData) *MessageBuilder
- func (m *MessageBuilder) SetSkipUrlPreviewGen() *MessageBuilder
- func (m *MessageBuilder) SetSource(source table.ThreadSourceType) *MessageBuilder
- func (m *MessageBuilder) SetSyncGroup(syncGroup int64) *MessageBuilder
- func (m *MessageBuilder) SetText(text string) *MessageBuilder
- func (m *MessageBuilder) SetTextHasLinks() *MessageBuilder
- type Messages
- type ModuleData
- type ModuleParser
- func (m *ModuleParser) Bootloader_HandlePayload(payload interface{}, 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 interface{}) error
- func (m *ModuleParser) SetClientInstance(cli *Client)
- func (m *ModuleParser) SetTestData(data []byte)
- type NodeProcessor
- type Payload
- type PublishPayload
- type PublishResponseData
- 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 Threads
- type Topic
Constants ¶
This section is empty.
Variables ¶
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 ErrRedirectAttempted = errors.New("redirect attempted")
var GraphQLData = &graphql.GraphQLTable{}
var USER_AGENT = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"
var VersionId int64
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct {
// contains filtered or unexported fields
}
func (*Account) GetContacts ¶
func (a *Account) GetContacts(limit int64) ([]table.LSVerifyContactRowExists, error)
func (*Account) GetContactsFull ¶
func (a *Account) GetContactsFull(contactIds []int64) ([]table.LSDeleteThenInsertContact, error)
type AppSettingsPublish ¶
type AttributeMap ¶
type BigPipe ¶
type BigPipe struct {
JSMods *ModuleData `json:"jsmods,omitempty"`
}
type Client ¶
type Client struct { Account *Account Threads *Threads Messages *Messages Instagram *InstagramMethods Facebook *FacebookMethods Logger zerolog.Logger SyncManager *SyncManager // contains filtered or unexported fields }
func NewClient ¶
func NewClient(platform types.Platform, cookies cookies.Cookies, logger zerolog.Logger, proxy string) (*Client, error)
pass an empty zerolog.Logger{} for no logging
func (*Client) CurrentPlatform ¶
func (*Client) Disconnect ¶
func (c *Client) Disconnect()
func (*Client) GetCurrentAccount ¶
func (c *Client) GetCurrentAccount() (types.AccountInfo, error)
func (*Client) IsAuthenticated ¶
func (*Client) IsConnected ¶
func (*Client) MakeRequest ¶
func (*Client) NewConnectRequest ¶
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) NewSocketClient ¶
func (*Client) NewSubscribeRequest ¶
func (*Client) NewSyncManager ¶
func (c *Client) NewSyncManager() *SyncManager
func (*Client) NewTaskManager ¶
func (c *Client) NewTaskManager() *TaskManager
func (*Client) SaveSession ¶
func (*Client) SendMercuryUploadRequest ¶
func (c *Client) SendMercuryUploadRequest(medias []*MercuryUploadMedia) ([]*types.MercuryUploadResponse, error)
func (*Client) SetEventHandler ¶
func (c *Client) SetEventHandler(handler EventHandler)
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 ¶
func (*Configs) SetupConfigs ¶
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 []any `json:"st"` // mqttconfig subscribedTopics ([]) Pm []any `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 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) IsEnum ¶
func (c ConnectionCode) IsEnum()
func (ConnectionCode) ToString ¶
func (c ConnectionCode) ToString() string
type EventHandler ¶
type EventHandler func(evt interface{})
type Event_Error ¶
type Event_Error struct {
Err error
}
Event_Error is emitted whenever the library encounters/receives an error.
These errors can be for example: failed to send data, failed to read response data and so on.
func (*Event_Error) Finish ¶
func (e *Event_Error) Finish() ResponseData
func (*Event_Error) SetIdentifier ¶
func (pb *Event_Error) SetIdentifier(identifier int16)
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 int16)
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 int16)
type Event_PublishResponse ¶
type Event_PublishResponse struct { Topic string `lengthType:"uint16" endian:"big"` Data PublishResponseData `jsonString:"1"` Table table.LSTable MessageIdentifier int16 }
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 int16)
type Event_Ready ¶
type Event_Ready struct { IsNewSession bool ConnectionCode ConnectionCode CurrentUser types.AccountInfo `skip:"1"` Table *table.LSTable // 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 int16)
type Event_SocketClosed ¶
Event_SocketClosed is emitted whenever the websockets CloseHandler() is called.
This provides great flexability because the user can then decide whether the client should reconnect or not.
func (*Event_SocketClosed) Finish ¶
func (e *Event_SocketClosed) Finish() ResponseData
func (*Event_SocketClosed) SetIdentifier ¶
func (pb *Event_SocketClosed) SetIdentifier(identifier int16)
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 int16)
type FacebookMethods ¶
type FacebookMethods struct {
// contains filtered or unexported fields
}
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 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 }
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) 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 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) (*responses.ReelInfoResponse, error)
type LinkTag ¶
type LinkTag struct {
Attributes AttributeMap
}
type MercuryUploadMedia ¶
type MessageBuilder ¶
type MessageBuilder struct {
// contains filtered or unexported fields
}
func (*MessageBuilder) SetInitiatingSource ¶
func (m *MessageBuilder) SetInitiatingSource(initatingSource table.InitiatingSource) *MessageBuilder
func (*MessageBuilder) SetLastReadWatermarkTs ¶
func (m *MessageBuilder) SetLastReadWatermarkTs(ts int64) *MessageBuilder
func (*MessageBuilder) SetMedias ¶
func (m *MessageBuilder) SetMedias(medias []*types.MercuryUploadResponse)
func (*MessageBuilder) SetReplyMetadata ¶
func (m *MessageBuilder) SetReplyMetadata(replyMetadata *socket.ReplyMetaData) *MessageBuilder
func (*MessageBuilder) SetSkipUrlPreviewGen ¶
func (m *MessageBuilder) SetSkipUrlPreviewGen() *MessageBuilder
func (*MessageBuilder) SetSource ¶
func (m *MessageBuilder) SetSource(source table.ThreadSourceType) *MessageBuilder
func (*MessageBuilder) SetSyncGroup ¶
func (m *MessageBuilder) SetSyncGroup(syncGroup int64) *MessageBuilder
func (*MessageBuilder) SetText ¶
func (m *MessageBuilder) SetText(text string) *MessageBuilder
func (*MessageBuilder) SetTextHasLinks ¶
func (m *MessageBuilder) SetTextHasLinks() *MessageBuilder
type Messages ¶
type Messages struct {
// contains filtered or unexported fields
}
func (*Messages) DeleteMessage ¶
type ModuleData ¶
type ModuleData struct { Define [][]interface{} `json:"define,omitempty"` Instances [][]interface{} `json:"instances,omitempty"` Markup [][]interface{} `json:"markup,omitempty"` Elements [][]interface{} `json:"elements,omitempty"` Require [][]interface{} `json:"require,omitempty"` Contexts [][]interface{} `json:"contexts,omitempty"` }
type ModuleParser ¶
type ModuleParser struct { FormTags []FormTag LoginInputs []InputTag JSDatr string // contains filtered or unexported fields }
func (*ModuleParser) Bootloader_HandlePayload ¶
func (m *ModuleParser) Bootloader_HandlePayload(payload interface{}, 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 interface{}) error
func (*ModuleParser) SetClientInstance ¶
func (m *ModuleParser) SetClientInstance(cli *Client)
func (*ModuleParser) SetTestData ¶
func (m *ModuleParser) SetTestData(data []byte)
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 Response ¶
type Response struct { PacketByte uint8 RemainingLength uint32 `vlq:"true"` ResponseData ResponseData }
type ResponseData ¶
type ResponseData interface { Finish() ResponseData SetIdentifier(identifier int16) }
type ResponseHandler ¶
type ResponseHandler struct {
// contains filtered or unexported fields
}
func (*ResponseHandler) SetPacketTimeout ¶
func (p *ResponseHandler) SetPacketTimeout(d time.Duration)
type ScriptTag ¶
type ScriptTag struct { Attributes AttributeMap Content string }
type Socket ¶
type Socket struct {
// contains filtered or unexported fields
}
func (*Socket) BuildBrokerUrl ¶
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
type Threads ¶
type Threads struct {
// contains filtered or unexported fields
}
func (*Threads) FetchMessages ¶
func (*Threads) NewMessageBuilder ¶
func (t *Threads) NewMessageBuilder(threadId int64) *MessageBuilder