go_fcm_receiver

package module
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2023 License: MIT Imports: 25 Imported by: 0

README

go-fcm-receiver

A library to subscribe to a GCM/FCM (Firebase Cloud Messaging) sender using protobuf.

The library was inspired by push-receiver and by this blog post.

The difference between this library and other libraries

  • This library receives FCM notifications the same way an Android device does. This library is an FCM client.
  • Other libraries (such as go-fcm) sends notifications via fcm, and does not receive notifications. Those libraries are an FCM server-side.

Install

import "github.com/morhaviv/go-fcm-receiver"

Requirements

  • Firebase sender id to receive notification

Usage

Creating a new device and listening
package main

import (
	go_fcm_receiver "github.com/morhaviv/go-fcm-receiver"
)

func main() {
	newDevice := go_fcm_receiver.FCMClient{
		SenderId:          845754665638,
		OnDataMessage: func(message []byte) {
			fmt.Println("Received a message:", string(message))
		},
	}
	privateKey, authSecret, err := newDevice.CreateNewKeys()
	if err != nil {
		panic(err)
	}
	fcmToken, gcmToken, androidId, securityToken, err := newDevice.Register()
	if err != nil {
		panic(err)
	}
	SaveDeviceDetails(fcmToken, gcmToken, androidId, securityToken, privateKey, authSecret)
	err = newDevice.StartListening()
	if err != nil {
		panic(err)
	}

}
Listening an existing device
package main

import (
	go_fcm_receiver "github.com/morhaviv/go-fcm-receiver"
)

func main() {
	oldDevice := go_fcm_receiver.FCMClient{
		SenderId:          845754665638, // Firebase Project ID
		GcmToken:          "<GCM_TOKEN>",
		FcmToken:          "<FCM_TOKEN>",
		AndroidId:         5240887932061714513, // The androidId returned when the device was created
		SecurityToken:     69534515778185919, // The securityToken returned when the device was created
		OnDataMessage: func(message []byte) {
			fmt.Println("Received a message:", string(message))
		},
	}
	
	err := oldDevice.LoadKeys("<PRIVATE_KEY_BASE64>", "<AUTH_SECRET_BASE64>")
	if err != nil {
		panic(err)
	}
	
	err = oldDevice.StartListening()
	if err != nil {
		panic(err)
	}
}

Documentation

Index

Constants

View Source
const (
	MCS_VERSION_TAG_AND_SIZE = 0
	MCS_TAG_AND_SIZE         = 1
	// Processing the size packet alone.
	MCS_SIZE = 2
	// Processing the protocol buffer bytes (for those messages with non-zero sizes).
	MCS_PROTO_BYTES = 3

	// # of bytes a MCS version packet consumes.
	KVersionPacketLen = 1
	// # of bytes a tag packet consumes.
	KTagPacketLen = 1
	// Max # of bytes a length packet consumes. A Varint32 can consume up to 5 bytes
	// (the msb in each byte is reserved for denoting whether more bytes follow).
	// Although the protocol only allows for 4KiB payloads currently, and the socket
	// stream buffer is only of size 8KiB, it's possible for certain applications to
	// have larger message sizes. When payload is larger than 4KiB, an temporary
	// in-memory buffer is used instead of the normal in-place socket stream buffer.
	KSizePacketLenMin = 1
	KSizePacketLenMax = 5

	// The current MCS protocol version.
	KMCSVersion = 41

	// MCS Message tags.
	// WARNING= the order of these tags must remain the same, as the tag values
	// must be consistent with those used on the server.
	KHeartbeatPingTag       = 0
	KHeartbeatAckTag        = 1
	KLoginRequestTag        = 2
	KLoginResponseTag       = 3
	KCloseTag               = 4
	KMessageStanzaTag       = 5
	KPresenceStanzaTag      = 6
	KIqStanzaTag            = 7
	KDataMessageStanzaTag   = 8
	KBatchPresenceStanzaTag = 9
	KStreamErrorStanzaTag   = 10
	KHttpRequestTag         = 11
	KHttpResponseTag        = 12
	KBindAccountRequestTag  = 13
	KBindAccountResponseTag = 14
	KTalkMetadataTag        = 15
	KNumProtoTypes          = 16
)

Processing the version, tag, and size packets (assuming minimum length size packet). Only used during the login handshake.

View Source
const AppIdBase = "wp:receiver.push.com#$%s"
View Source
const CheckInUrl = "https://android.clients.google.com/checkin"
View Source
const DefaultFcmMessageTtl = time.Hour * 24 * 28
View Source
const (
	Default_AndroidCheckinProto_Type = DeviceType_DEVICE_ANDROID_OS
)

Default values for AndroidCheckinProto fields.

View Source
const FcmEndpointUrl = "https://fcm.googleapis.com/fcm/send"
View Source
const FcmSocketAddress = "mtalk.google.com:5228"
View Source
const FcmSubscribeUrl = "https://fcm.googleapis.com/fcm/connect/subscribe"
View Source
const RegisterUrl = "https://android.clients.google.com/c2dm/register3"

Variables

View Source
var (
	DeviceType_name = map[int32]string{
		1: "DEVICE_ANDROID_OS",
		2: "DEVICE_IOS_OS",
		3: "DEVICE_CHROME_BROWSER",
		4: "DEVICE_CHROME_OS",
	}
	DeviceType_value = map[string]int32{
		"DEVICE_ANDROID_OS":     1,
		"DEVICE_IOS_OS":         2,
		"DEVICE_CHROME_BROWSER": 3,
		"DEVICE_CHROME_OS":      4,
	}
)

Enum value maps for DeviceType.

View Source
var (
	ChromeBuildProto_Platform_name = map[int32]string{
		1: "PLATFORM_WIN",
		2: "PLATFORM_MAC",
		3: "PLATFORM_LINUX",
		4: "PLATFORM_CROS",
		5: "PLATFORM_IOS",
		6: "PLATFORM_ANDROID",
	}
	ChromeBuildProto_Platform_value = map[string]int32{
		"PLATFORM_WIN":     1,
		"PLATFORM_MAC":     2,
		"PLATFORM_LINUX":   3,
		"PLATFORM_CROS":    4,
		"PLATFORM_IOS":     5,
		"PLATFORM_ANDROID": 6,
	}
)

Enum value maps for ChromeBuildProto_Platform.

View Source
var (
	ChromeBuildProto_Channel_name = map[int32]string{
		1: "CHANNEL_STABLE",
		2: "CHANNEL_BETA",
		3: "CHANNEL_DEV",
		4: "CHANNEL_CANARY",
		5: "CHANNEL_UNKNOWN",
	}
	ChromeBuildProto_Channel_value = map[string]int32{
		"CHANNEL_STABLE":  1,
		"CHANNEL_BETA":    2,
		"CHANNEL_DEV":     3,
		"CHANNEL_CANARY":  4,
		"CHANNEL_UNKNOWN": 5,
	}
)

Enum value maps for ChromeBuildProto_Channel.

View Source
var (
	ClientEvent_Type_name = map[int32]string{
		0: "UNKNOWN",
		1: "DISCARDED_EVENTS",
		2: "FAILED_CONNECTION",
		3: "SUCCESSFUL_CONNECTION",
	}
	ClientEvent_Type_value = map[string]int32{
		"UNKNOWN":               0,
		"DISCARDED_EVENTS":      1,
		"FAILED_CONNECTION":     2,
		"SUCCESSFUL_CONNECTION": 3,
	}
)

Enum value maps for ClientEvent_Type.

View Source
var (
	LoginRequest_AuthService_name = map[int32]string{
		2: "ANDROID_ID",
	}
	LoginRequest_AuthService_value = map[string]int32{
		"ANDROID_ID": 2,
	}
)

Enum value maps for LoginRequest_AuthService.

View Source
var (
	IqStanza_IqType_name = map[int32]string{
		0: "GET",
		1: "SET",
		2: "RESULT",
		3: "IQ_ERROR",
	}
	IqStanza_IqType_value = map[string]int32{
		"GET":      0,
		"SET":      1,
		"RESULT":   2,
		"IQ_ERROR": 3,
	}
)

Enum value maps for IqStanza_IqType.

View Source
var FcmServerKey = []byte{4, 51, 148, 247, 223, 161, 235, 177, 220, 3, 162, 94, 21, 113, 219, 72, 211, 46, 237, 237, 178, 52, 219, 183, 71, 58, 12, 143, 196, 204, 225, 111, 60, 140, 132, 223, 171, 182, 102, 62, 242, 12, 212, 139, 254, 227, 249, 118, 47, 20, 28, 99, 8, 106, 111, 45, 177, 26, 149, 176, 206, 55, 192, 156, 110}
View Source
var File_proto_android_checkin_proto protoreflect.FileDescriptor
View Source
var File_proto_checkin_proto protoreflect.FileDescriptor
View Source
var File_proto_mcs_proto protoreflect.FileDescriptor

Functions

func CreateAuthSecret

func CreateAuthSecret() ([]byte, error)

func CreateKeys

func CreateKeys() (*ecdsa.PrivateKey, *ecdsa.PublicKey, []byte, error)

func CreateLoginRequestRaw

func CreateLoginRequestRaw(androidId *uint64, securityToken *uint64, persistentIds []string) ([]byte, error)

func CreatePrivateKeyP256

func CreatePrivateKeyP256() (*ecdsa.PrivateKey, error)

func DecodePrivateKey

func DecodePrivateKey(key []byte) (*ecdsa.PrivateKey, error)

func DecryptMessage

func DecryptMessage(cryptoKey []byte, encryption []byte, rawData []byte, authSecret []byte, privateKey *ecdsa.PrivateKey) ([]byte, error)

func EncodePrivateKey

func EncodePrivateKey(key *ecdsa.PrivateKey) ([]byte, error)

func PubBytes

func PubBytes(pub *ecdsa.PublicKey) []byte

func ReadInt32

func ReadInt32(buf []byte) (int, int, error)

func ReadUint32

func ReadUint32(buf []byte) (int, int, error)

func StringsSliceContains

func StringsSliceContains(s []string, e string) bool

Types

type AndroidCheckinProto

type AndroidCheckinProto struct {

	// Miliseconds since the Unix epoch of the device's last successful checkin.
	LastCheckinMsec *int64 `protobuf:"varint,2,opt,name=last_checkin_msec,json=lastCheckinMsec" json:"last_checkin_msec,omitempty"`
	// The current MCC+MNC of the mobile device's current cell.
	CellOperator *string `protobuf:"bytes,6,opt,name=cell_operator,json=cellOperator" json:"cell_operator,omitempty"`
	// The MCC+MNC of the SIM card (different from operator if the
	// device is roaming, for instance).
	SimOperator *string `protobuf:"bytes,7,opt,name=sim_operator,json=simOperator" json:"sim_operator,omitempty"`
	// The device's current roaming state (reported starting in eclair builds).
	// Currently one of "{,not}mobile-{,not}roaming", if it is present at all.
	Roaming *string `protobuf:"bytes,8,opt,name=roaming" json:"roaming,omitempty"`
	// For devices supporting multiple user profiles (which may be
	// supported starting in jellybean), the ordinal number of the
	// profile that is checking in.  This is 0 for the primary profile
	// (which can't be changed without wiping the device), and 1,2,3,...
	// for additional profiles (which can be added and deleted freely).
	UserNumber *int32 `protobuf:"varint,9,opt,name=user_number,json=userNumber" json:"user_number,omitempty"`
	// Class of device.  Indicates the type of build proto
	// (IosBuildProto/ChromeBuildProto/AndroidBuildProto)
	// That is included in this proto
	Type *DeviceType `protobuf:"varint,12,opt,name=type,enum=proto.DeviceType,def=1" json:"type,omitempty"`
	// For devices running MCS on Chrome, build-specific characteristics
	// of the browser.  There are no hardware aspects (except for ChromeOS).
	// This will only be populated for Chrome builds/ChromeOS devices
	ChromeBuild *ChromeBuildProto `protobuf:"bytes,13,opt,name=chrome_build,json=chromeBuild" json:"chrome_build,omitempty"`
	// contains filtered or unexported fields
}

Information sent by the device in a "checkin" request.

func (*AndroidCheckinProto) Descriptor deprecated

func (*AndroidCheckinProto) Descriptor() ([]byte, []int)

Deprecated: Use AndroidCheckinProto.ProtoReflect.Descriptor instead.

func (*AndroidCheckinProto) GetCellOperator

func (x *AndroidCheckinProto) GetCellOperator() string

func (*AndroidCheckinProto) GetChromeBuild

func (x *AndroidCheckinProto) GetChromeBuild() *ChromeBuildProto

func (*AndroidCheckinProto) GetLastCheckinMsec

func (x *AndroidCheckinProto) GetLastCheckinMsec() int64

func (*AndroidCheckinProto) GetRoaming

func (x *AndroidCheckinProto) GetRoaming() string

func (*AndroidCheckinProto) GetSimOperator

func (x *AndroidCheckinProto) GetSimOperator() string

func (*AndroidCheckinProto) GetType

func (x *AndroidCheckinProto) GetType() DeviceType

func (*AndroidCheckinProto) GetUserNumber

func (x *AndroidCheckinProto) GetUserNumber() int32

func (*AndroidCheckinProto) ProtoMessage

func (*AndroidCheckinProto) ProtoMessage()

func (*AndroidCheckinProto) ProtoReflect

func (x *AndroidCheckinProto) ProtoReflect() protoreflect.Message

func (*AndroidCheckinProto) Reset

func (x *AndroidCheckinProto) Reset()

func (*AndroidCheckinProto) String

func (x *AndroidCheckinProto) String() string

type AndroidCheckinRequest

type AndroidCheckinRequest struct {

	// IMEI (used by GSM phones) is sent and stored as 15 decimal
	// digits; the 15th is a check digit.
	Imei *string `protobuf:"bytes,1,opt,name=imei" json:"imei,omitempty"` // IMEI, reported but not logged.
	// MEID (used by CDMA phones) is sent and stored as 14 hexadecimal
	// digits (no check digit).
	Meid *string `protobuf:"bytes,10,opt,name=meid" json:"meid,omitempty"` // MEID, reported but not logged.
	// MAC address (used by non-phone devices).  12 hexadecimal digits;
	// no separators (eg "0016E6513AC2", not "00:16:E6:51:3A:C2").
	MacAddr []string `protobuf:"bytes,9,rep,name=mac_addr,json=macAddr" json:"mac_addr,omitempty"` // MAC address, reported but not logged.
	// An array parallel to mac_addr, describing the type of interface.
	// Currently accepted values: "wifi", "ethernet", "bluetooth".  If
	// not present, "wifi" is assumed.
	MacAddrType []string `protobuf:"bytes,19,rep,name=mac_addr_type,json=macAddrType" json:"mac_addr_type,omitempty"`
	// Serial number (a manufacturer-defined unique hardware
	// identifier).  Alphanumeric, case-insensitive.
	SerialNumber *string `protobuf:"bytes,16,opt,name=serial_number,json=serialNumber" json:"serial_number,omitempty"`
	// Older CDMA networks use an ESN (8 hex digits) instead of an MEID.
	Esn       *string              `protobuf:"bytes,17,opt,name=esn" json:"esn,omitempty"`                              // ESN, reported but not logged
	Id        *int64               `protobuf:"varint,2,opt,name=id" json:"id,omitempty"`                                // Android device ID, not logged
	LoggingId *int64               `protobuf:"varint,7,opt,name=logging_id,json=loggingId" json:"logging_id,omitempty"` // Pseudonymous logging ID for Sawmill
	Digest    *string              `protobuf:"bytes,3,opt,name=digest" json:"digest,omitempty"`                         // Digest of device provisioning, not logged.
	Locale    *string              `protobuf:"bytes,6,opt,name=locale" json:"locale,omitempty"`                         // Current locale in standard (xx_XX) format
	Checkin   *AndroidCheckinProto `protobuf:"bytes,4,req,name=checkin" json:"checkin,omitempty"`
	// DEPRECATED, see AndroidCheckinProto.requested_group
	DesiredBuild *string `protobuf:"bytes,5,opt,name=desired_build,json=desiredBuild" json:"desired_build,omitempty"`
	// Blob of data from the Market app to be passed to Market API server
	MarketCheckin *string `protobuf:"bytes,8,opt,name=market_checkin,json=marketCheckin" json:"market_checkin,omitempty"`
	// SID cookies of any google accounts stored on the phone.  Not logged.
	AccountCookie []string `protobuf:"bytes,11,rep,name=account_cookie,json=accountCookie" json:"account_cookie,omitempty"`
	// Time zone.  Not currently logged.
	TimeZone *string `protobuf:"bytes,12,opt,name=time_zone,json=timeZone" json:"time_zone,omitempty"`
	// Security token used to validate the checkin request.
	// Required for android IDs issued to Froyo+ devices, not for legacy IDs.
	SecurityToken *uint64 `protobuf:"fixed64,13,opt,name=security_token,json=securityToken" json:"security_token,omitempty"`
	// Version of checkin protocol.
	//
	// There are currently two versions:
	//
	// - version field missing: android IDs are assigned based on
	//   hardware identifiers.  unsecured in the sense that you can
	//   "unregister" someone's phone by sending a registration request
	//   with their IMEI/MEID/MAC.
	//
	// - version=2: android IDs are assigned randomly.  The device is
	//   sent a security token that must be included in all future
	//   checkins for that android id.
	//
	// - version=3: same as version 2, but the 'fragment' field is
	//   provided, and the device understands incremental updates to the
	//   gservices table (ie, only returning the keys whose values have
	//   changed.)
	//
	// (version=1 was skipped to avoid confusion with the "missing"
	// version field that is effectively version 1.)
	Version *int32 `protobuf:"varint,14,opt,name=version" json:"version,omitempty"`
	// OTA certs accepted by device (base-64 SHA-1 of cert files).  Not
	// logged.
	OtaCert []string `protobuf:"bytes,15,rep,name=ota_cert,json=otaCert" json:"ota_cert,omitempty"`
	// A single CheckinTask on the device may lead to multiple checkin
	// requests if there is too much log data to upload in a single
	// request.  For version 3 and up, this field will be filled in with
	// the number of the request, starting with 0.
	Fragment *int32 `protobuf:"varint,20,opt,name=fragment" json:"fragment,omitempty"`
	// For devices supporting multiple users, the name of the current
	// profile (they all check in independently, just as if they were
	// multiple physical devices).  This may not be set, even if the
	// device is using multiuser.  (checkin.user_number should be set to
	// the ordinal of the user.)
	UserName *string `protobuf:"bytes,21,opt,name=user_name,json=userName" json:"user_name,omitempty"`
	// For devices supporting multiple user profiles, the serial number
	// for the user checking in.  Not logged.  May not be set, even if
	// the device supportes multiuser.  checkin.user_number is the
	// ordinal of the user (0, 1, 2, ...), which may be reused if users
	// are deleted and re-created.  user_serial_number is never reused
	// (unless the device is wiped).
	UserSerialNumber *int32 `protobuf:"varint,22,opt,name=user_serial_number,json=userSerialNumber" json:"user_serial_number,omitempty"`
	// contains filtered or unexported fields
}

Devices send this every few hours to tell us how they're doing.

func CreateCheckInRequest

func CreateCheckInRequest(androidId *int64, securityToken *uint64) *AndroidCheckinRequest

func (*AndroidCheckinRequest) Descriptor deprecated

func (*AndroidCheckinRequest) Descriptor() ([]byte, []int)

Deprecated: Use AndroidCheckinRequest.ProtoReflect.Descriptor instead.

func (*AndroidCheckinRequest) GetAccountCookie

func (x *AndroidCheckinRequest) GetAccountCookie() []string

func (*AndroidCheckinRequest) GetCheckin

func (x *AndroidCheckinRequest) GetCheckin() *AndroidCheckinProto

func (*AndroidCheckinRequest) GetDesiredBuild

func (x *AndroidCheckinRequest) GetDesiredBuild() string

func (*AndroidCheckinRequest) GetDigest

func (x *AndroidCheckinRequest) GetDigest() string

func (*AndroidCheckinRequest) GetEsn

func (x *AndroidCheckinRequest) GetEsn() string

func (*AndroidCheckinRequest) GetFragment

func (x *AndroidCheckinRequest) GetFragment() int32

func (*AndroidCheckinRequest) GetId

func (x *AndroidCheckinRequest) GetId() int64

func (*AndroidCheckinRequest) GetImei

func (x *AndroidCheckinRequest) GetImei() string

func (*AndroidCheckinRequest) GetLocale

func (x *AndroidCheckinRequest) GetLocale() string

func (*AndroidCheckinRequest) GetLoggingId

func (x *AndroidCheckinRequest) GetLoggingId() int64

func (*AndroidCheckinRequest) GetMacAddr

func (x *AndroidCheckinRequest) GetMacAddr() []string

func (*AndroidCheckinRequest) GetMacAddrType

func (x *AndroidCheckinRequest) GetMacAddrType() []string

func (*AndroidCheckinRequest) GetMarketCheckin

func (x *AndroidCheckinRequest) GetMarketCheckin() string

func (*AndroidCheckinRequest) GetMeid

func (x *AndroidCheckinRequest) GetMeid() string

func (*AndroidCheckinRequest) GetOtaCert

func (x *AndroidCheckinRequest) GetOtaCert() []string

func (*AndroidCheckinRequest) GetSecurityToken

func (x *AndroidCheckinRequest) GetSecurityToken() uint64

func (*AndroidCheckinRequest) GetSerialNumber

func (x *AndroidCheckinRequest) GetSerialNumber() string

func (*AndroidCheckinRequest) GetTimeZone

func (x *AndroidCheckinRequest) GetTimeZone() string

func (*AndroidCheckinRequest) GetUserName

func (x *AndroidCheckinRequest) GetUserName() string

func (*AndroidCheckinRequest) GetUserSerialNumber

func (x *AndroidCheckinRequest) GetUserSerialNumber() int32

func (*AndroidCheckinRequest) GetVersion

func (x *AndroidCheckinRequest) GetVersion() int32

func (*AndroidCheckinRequest) ProtoMessage

func (*AndroidCheckinRequest) ProtoMessage()

func (*AndroidCheckinRequest) ProtoReflect

func (x *AndroidCheckinRequest) ProtoReflect() protoreflect.Message

func (*AndroidCheckinRequest) Reset

func (x *AndroidCheckinRequest) Reset()

func (*AndroidCheckinRequest) String

func (x *AndroidCheckinRequest) String() string

type AndroidCheckinResponse

type AndroidCheckinResponse struct {
	StatsOk  *bool  `protobuf:"varint,1,req,name=stats_ok,json=statsOk" json:"stats_ok,omitempty"`    // Whether statistics were recorded properly.
	TimeMsec *int64 `protobuf:"varint,3,opt,name=time_msec,json=timeMsec" json:"time_msec,omitempty"` // Time of day from server (Java epoch).
	// Provisioning is sent if the request included an obsolete digest.
	//
	// For version <= 2, 'digest' contains the digest that should be
	// sent back to the server on the next checkin, and 'setting'
	// contains the entire gservices table (which replaces the entire
	// current table on the device).
	//
	// for version >= 3, 'digest' will be absent.  If 'settings_diff'
	// is false, then 'setting' contains the entire table, as in version
	// 2.  If 'settings_diff' is true, then 'delete_setting' contains
	// the keys to delete, and 'setting' contains only keys to be added
	// or for which the value has changed.  All other keys in the
	// current table should be left untouched.  If 'settings_diff' is
	// absent, don't touch the existing gservices table.
	//
	Digest        *string             `protobuf:"bytes,4,opt,name=digest" json:"digest,omitempty"`
	SettingsDiff  *bool               `protobuf:"varint,9,opt,name=settings_diff,json=settingsDiff" json:"settings_diff,omitempty"`
	DeleteSetting []string            `protobuf:"bytes,10,rep,name=delete_setting,json=deleteSetting" json:"delete_setting,omitempty"`
	Setting       []*GservicesSetting `protobuf:"bytes,5,rep,name=setting" json:"setting,omitempty"`
	MarketOk      *bool               `protobuf:"varint,6,opt,name=market_ok,json=marketOk" json:"market_ok,omitempty"`                 // If Market got the market_checkin data OK.
	AndroidId     *uint64             `protobuf:"fixed64,7,opt,name=android_id,json=androidId" json:"android_id,omitempty"`             // From the request, or newly assigned
	SecurityToken *uint64             `protobuf:"fixed64,8,opt,name=security_token,json=securityToken" json:"security_token,omitempty"` // The associated security token
	VersionInfo   *string             `protobuf:"bytes,11,opt,name=version_info,json=versionInfo" json:"version_info,omitempty"`        // NEXT TAG: 12
	// contains filtered or unexported fields
}

The response to the device.

func (*AndroidCheckinResponse) Descriptor deprecated

func (*AndroidCheckinResponse) Descriptor() ([]byte, []int)

Deprecated: Use AndroidCheckinResponse.ProtoReflect.Descriptor instead.

func (*AndroidCheckinResponse) GetAndroidId

func (x *AndroidCheckinResponse) GetAndroidId() uint64

func (*AndroidCheckinResponse) GetDeleteSetting

func (x *AndroidCheckinResponse) GetDeleteSetting() []string

func (*AndroidCheckinResponse) GetDigest

func (x *AndroidCheckinResponse) GetDigest() string

func (*AndroidCheckinResponse) GetMarketOk

func (x *AndroidCheckinResponse) GetMarketOk() bool

func (*AndroidCheckinResponse) GetSecurityToken

func (x *AndroidCheckinResponse) GetSecurityToken() uint64

func (*AndroidCheckinResponse) GetSetting

func (x *AndroidCheckinResponse) GetSetting() []*GservicesSetting

func (*AndroidCheckinResponse) GetSettingsDiff

func (x *AndroidCheckinResponse) GetSettingsDiff() bool

func (*AndroidCheckinResponse) GetStatsOk

func (x *AndroidCheckinResponse) GetStatsOk() bool

func (*AndroidCheckinResponse) GetTimeMsec

func (x *AndroidCheckinResponse) GetTimeMsec() int64

func (*AndroidCheckinResponse) GetVersionInfo

func (x *AndroidCheckinResponse) GetVersionInfo() string

func (*AndroidCheckinResponse) ProtoMessage

func (*AndroidCheckinResponse) ProtoMessage()

func (*AndroidCheckinResponse) ProtoReflect

func (x *AndroidCheckinResponse) ProtoReflect() protoreflect.Message

func (*AndroidCheckinResponse) Reset

func (x *AndroidCheckinResponse) Reset()

func (*AndroidCheckinResponse) String

func (x *AndroidCheckinResponse) String() string

type AppData

type AppData struct {
	Key   *string `protobuf:"bytes,1,req,name=key" json:"key,omitempty"`
	Value *string `protobuf:"bytes,2,req,name=value" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*AppData) Descriptor deprecated

func (*AppData) Descriptor() ([]byte, []int)

Deprecated: Use AppData.ProtoReflect.Descriptor instead.

func (*AppData) GetKey

func (x *AppData) GetKey() string

func (*AppData) GetValue

func (x *AppData) GetValue() string

func (*AppData) ProtoMessage

func (*AppData) ProtoMessage()

func (*AppData) ProtoReflect

func (x *AppData) ProtoReflect() protoreflect.Message

func (*AppData) Reset

func (x *AppData) Reset()

func (*AppData) String

func (x *AppData) String() string

type ChromeBuildProto

type ChromeBuildProto struct {

	// The platform of the device.
	Platform *ChromeBuildProto_Platform `protobuf:"varint,1,opt,name=platform,enum=proto.ChromeBuildProto_Platform" json:"platform,omitempty"`
	// The Chrome instance's version.
	ChromeVersion *string `protobuf:"bytes,2,opt,name=chrome_version,json=chromeVersion" json:"chrome_version,omitempty"`
	// The Channel (build type) of Chrome.
	Channel *ChromeBuildProto_Channel `protobuf:"varint,3,opt,name=channel,enum=proto.ChromeBuildProto_Channel" json:"channel,omitempty"`
	// contains filtered or unexported fields
}

Build characteristics unique to the Chrome browser, and Chrome OS

func (*ChromeBuildProto) Descriptor deprecated

func (*ChromeBuildProto) Descriptor() ([]byte, []int)

Deprecated: Use ChromeBuildProto.ProtoReflect.Descriptor instead.

func (*ChromeBuildProto) GetChannel

func (*ChromeBuildProto) GetChromeVersion

func (x *ChromeBuildProto) GetChromeVersion() string

func (*ChromeBuildProto) GetPlatform

func (*ChromeBuildProto) ProtoMessage

func (*ChromeBuildProto) ProtoMessage()

func (*ChromeBuildProto) ProtoReflect

func (x *ChromeBuildProto) ProtoReflect() protoreflect.Message

func (*ChromeBuildProto) Reset

func (x *ChromeBuildProto) Reset()

func (*ChromeBuildProto) String

func (x *ChromeBuildProto) String() string

type ChromeBuildProto_Channel

type ChromeBuildProto_Channel int32
const (
	ChromeBuildProto_CHANNEL_STABLE  ChromeBuildProto_Channel = 1
	ChromeBuildProto_CHANNEL_BETA    ChromeBuildProto_Channel = 2
	ChromeBuildProto_CHANNEL_DEV     ChromeBuildProto_Channel = 3
	ChromeBuildProto_CHANNEL_CANARY  ChromeBuildProto_Channel = 4
	ChromeBuildProto_CHANNEL_UNKNOWN ChromeBuildProto_Channel = 5 // for tip of tree or custom builds
)

func (ChromeBuildProto_Channel) Descriptor

func (ChromeBuildProto_Channel) Enum

func (ChromeBuildProto_Channel) EnumDescriptor deprecated

func (ChromeBuildProto_Channel) EnumDescriptor() ([]byte, []int)

Deprecated: Use ChromeBuildProto_Channel.Descriptor instead.

func (ChromeBuildProto_Channel) Number

func (ChromeBuildProto_Channel) String

func (x ChromeBuildProto_Channel) String() string

func (ChromeBuildProto_Channel) Type

func (*ChromeBuildProto_Channel) UnmarshalJSON deprecated

func (x *ChromeBuildProto_Channel) UnmarshalJSON(b []byte) error

Deprecated: Do not use.

type ChromeBuildProto_Platform

type ChromeBuildProto_Platform int32
const (
	ChromeBuildProto_PLATFORM_WIN   ChromeBuildProto_Platform = 1
	ChromeBuildProto_PLATFORM_MAC   ChromeBuildProto_Platform = 2
	ChromeBuildProto_PLATFORM_LINUX ChromeBuildProto_Platform = 3
	ChromeBuildProto_PLATFORM_CROS  ChromeBuildProto_Platform = 4
	ChromeBuildProto_PLATFORM_IOS   ChromeBuildProto_Platform = 5
	// Just a placeholder. Likely don't need it due to the presence of the
	// Android GCM on phone/tablet devices.
	ChromeBuildProto_PLATFORM_ANDROID ChromeBuildProto_Platform = 6
)

func (ChromeBuildProto_Platform) Descriptor

func (ChromeBuildProto_Platform) Enum

func (ChromeBuildProto_Platform) EnumDescriptor deprecated

func (ChromeBuildProto_Platform) EnumDescriptor() ([]byte, []int)

Deprecated: Use ChromeBuildProto_Platform.Descriptor instead.

func (ChromeBuildProto_Platform) Number

func (ChromeBuildProto_Platform) String

func (x ChromeBuildProto_Platform) String() string

func (ChromeBuildProto_Platform) Type

func (*ChromeBuildProto_Platform) UnmarshalJSON deprecated

func (x *ChromeBuildProto_Platform) UnmarshalJSON(b []byte) error

Deprecated: Do not use.

type ClientEvent

type ClientEvent struct {

	// Common fields [1-99]
	Type *ClientEvent_Type `protobuf:"varint,1,opt,name=type,enum=proto.ClientEvent_Type" json:"type,omitempty"`
	// Fields for DISCARDED_EVENTS messages [100-199]
	NumberDiscardedEvents *uint32 `protobuf:"varint,100,opt,name=number_discarded_events,json=numberDiscardedEvents" json:"number_discarded_events,omitempty"`
	// Fields for FAILED_CONNECTION and SUCCESSFUL_CONNECTION messages [200-299]
	// Network type is a value in net::NetworkChangeNotifier::ConnectionType.
	NetworkType             *int32  `protobuf:"varint,200,opt,name=network_type,json=networkType" json:"network_type,omitempty"`
	TimeConnectionStartedMs *uint64 `` /* 130-byte string literal not displayed */
	TimeConnectionEndedMs   *uint64 `protobuf:"varint,203,opt,name=time_connection_ended_ms,json=timeConnectionEndedMs" json:"time_connection_ended_ms,omitempty"`
	// Error code should be a net::Error value.
	ErrorCode *int32 `protobuf:"varint,204,opt,name=error_code,json=errorCode" json:"error_code,omitempty"`
	// Fields for SUCCESSFUL_CONNECTION messages [300-399]
	TimeConnectionEstablishedMs *uint64 `` /* 142-byte string literal not displayed */
	// contains filtered or unexported fields
}

ClientEvents are used to inform the server of failed and successful connections.

func (*ClientEvent) Descriptor deprecated

func (*ClientEvent) Descriptor() ([]byte, []int)

Deprecated: Use ClientEvent.ProtoReflect.Descriptor instead.

func (*ClientEvent) GetErrorCode

func (x *ClientEvent) GetErrorCode() int32

func (*ClientEvent) GetNetworkType

func (x *ClientEvent) GetNetworkType() int32

func (*ClientEvent) GetNumberDiscardedEvents

func (x *ClientEvent) GetNumberDiscardedEvents() uint32

func (*ClientEvent) GetTimeConnectionEndedMs

func (x *ClientEvent) GetTimeConnectionEndedMs() uint64

func (*ClientEvent) GetTimeConnectionEstablishedMs

func (x *ClientEvent) GetTimeConnectionEstablishedMs() uint64

func (*ClientEvent) GetTimeConnectionStartedMs

func (x *ClientEvent) GetTimeConnectionStartedMs() uint64

func (*ClientEvent) GetType

func (x *ClientEvent) GetType() ClientEvent_Type

func (*ClientEvent) ProtoMessage

func (*ClientEvent) ProtoMessage()

func (*ClientEvent) ProtoReflect

func (x *ClientEvent) ProtoReflect() protoreflect.Message

func (*ClientEvent) Reset

func (x *ClientEvent) Reset()

func (*ClientEvent) String

func (x *ClientEvent) String() string

type ClientEvent_Type

type ClientEvent_Type int32
const (
	ClientEvent_UNKNOWN ClientEvent_Type = 0
	// Count of discarded events if the buffer filled up and was trimmed.
	ClientEvent_DISCARDED_EVENTS ClientEvent_Type = 1
	// Failed connection event: the connection failed to be established or we
	// had a login error.
	ClientEvent_FAILED_CONNECTION ClientEvent_Type = 2
	// Successful connection event: information about the last successful
	// connection, including the time at which it was established.
	ClientEvent_SUCCESSFUL_CONNECTION ClientEvent_Type = 3
)

func (ClientEvent_Type) Descriptor

func (ClientEvent_Type) Enum

func (ClientEvent_Type) EnumDescriptor deprecated

func (ClientEvent_Type) EnumDescriptor() ([]byte, []int)

Deprecated: Use ClientEvent_Type.Descriptor instead.

func (ClientEvent_Type) Number

func (ClientEvent_Type) String

func (x ClientEvent_Type) String() string

func (ClientEvent_Type) Type

func (*ClientEvent_Type) UnmarshalJSON deprecated

func (x *ClientEvent_Type) UnmarshalJSON(b []byte) error

Deprecated: Do not use.

type Close

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

* TAG: 4

func DecodeClose

func DecodeClose(data []byte) (*Close, error)

func (*Close) Descriptor deprecated

func (*Close) Descriptor() ([]byte, []int)

Deprecated: Use Close.ProtoReflect.Descriptor instead.

func (*Close) ProtoMessage

func (*Close) ProtoMessage()

func (*Close) ProtoReflect

func (x *Close) ProtoReflect() protoreflect.Message

func (*Close) Reset

func (x *Close) Reset()

func (*Close) String

func (x *Close) String() string

type DataMessageStanza

type DataMessageStanza struct {

	// This is the message ID, set by client, DMP.9 (message_id)
	Id *string `protobuf:"bytes,2,opt,name=id" json:"id,omitempty"`
	// Project ID of the sender, DMP.1
	From *string `protobuf:"bytes,3,req,name=from" json:"from,omitempty"`
	// Part of DMRequest - also the key in DataMessageProto.
	To *string `protobuf:"bytes,4,opt,name=to" json:"to,omitempty"`
	// Package name. DMP.2
	Category *string `protobuf:"bytes,5,req,name=category" json:"category,omitempty"`
	// The collapsed key, DMP.3
	Token *string `protobuf:"bytes,6,opt,name=token" json:"token,omitempty"`
	// User data + GOOGLE. prefixed special entries, DMP.4
	AppData []*AppData `protobuf:"bytes,7,rep,name=app_data,json=appData" json:"app_data,omitempty"`
	// Not used.
	FromTrustedServer *bool `protobuf:"varint,8,opt,name=from_trusted_server,json=fromTrustedServer" json:"from_trusted_server,omitempty"`
	// Part of the ACK protocol, returned in DataMessageResponse on server side.
	// It's part of the key of DMP.
	PersistentId *string `protobuf:"bytes,9,opt,name=persistent_id,json=persistentId" json:"persistent_id,omitempty"`
	// In-stream ack. Increments on each message sent - a bit redundant
	// Not used in DMP/DMR.
	StreamId             *int32 `protobuf:"varint,10,opt,name=stream_id,json=streamId" json:"stream_id,omitempty"`
	LastStreamIdReceived *int32 `protobuf:"varint,11,opt,name=last_stream_id_received,json=lastStreamIdReceived" json:"last_stream_id_received,omitempty"`
	// Sent by the device shortly after registration.
	RegId *string `protobuf:"bytes,13,opt,name=reg_id,json=regId" json:"reg_id,omitempty"`
	// serial number of the target user, DMP.8
	// It is the 'serial number' according to user manager.
	DeviceUserId *int64 `protobuf:"varint,16,opt,name=device_user_id,json=deviceUserId" json:"device_user_id,omitempty"`
	// Time to live, in seconds.
	Ttl *int32 `protobuf:"varint,17,opt,name=ttl" json:"ttl,omitempty"`
	// Timestamp ( according to client ) when message was sent by app, in seconds
	Sent *int64 `protobuf:"varint,18,opt,name=sent" json:"sent,omitempty"`
	// How long has the message been queued before the flush, in seconds.
	// This is needed to account for the time difference between server and
	// client: server should adjust 'sent' based on its 'receive' time.
	Queued *int32 `protobuf:"varint,19,opt,name=queued" json:"queued,omitempty"`
	Status *int64 `protobuf:"varint,20,opt,name=status" json:"status,omitempty"`
	// Optional field containing the binary payload of the message.
	RawData []byte `protobuf:"bytes,21,opt,name=raw_data,json=rawData" json:"raw_data,omitempty"`
	// If set the server requests immediate ack. Used for important messages and
	// for testing.
	ImmediateAck *bool `protobuf:"varint,24,opt,name=immediate_ack,json=immediateAck" json:"immediate_ack,omitempty"`
	// contains filtered or unexported fields
}

* TAG: 8

func DecodeDataMessageStanza

func DecodeDataMessageStanza(data []byte) (*DataMessageStanza, error)

func (*DataMessageStanza) Descriptor deprecated

func (*DataMessageStanza) Descriptor() ([]byte, []int)

Deprecated: Use DataMessageStanza.ProtoReflect.Descriptor instead.

func (*DataMessageStanza) GetAppData

func (x *DataMessageStanza) GetAppData() []*AppData

func (*DataMessageStanza) GetCategory

func (x *DataMessageStanza) GetCategory() string

func (*DataMessageStanza) GetDeviceUserId

func (x *DataMessageStanza) GetDeviceUserId() int64

func (*DataMessageStanza) GetFrom

func (x *DataMessageStanza) GetFrom() string

func (*DataMessageStanza) GetFromTrustedServer

func (x *DataMessageStanza) GetFromTrustedServer() bool

func (*DataMessageStanza) GetId

func (x *DataMessageStanza) GetId() string

func (*DataMessageStanza) GetImmediateAck

func (x *DataMessageStanza) GetImmediateAck() bool

func (*DataMessageStanza) GetLastStreamIdReceived

func (x *DataMessageStanza) GetLastStreamIdReceived() int32

func (*DataMessageStanza) GetPersistentId

func (x *DataMessageStanza) GetPersistentId() string

func (*DataMessageStanza) GetQueued

func (x *DataMessageStanza) GetQueued() int32

func (*DataMessageStanza) GetRawData

func (x *DataMessageStanza) GetRawData() []byte

func (*DataMessageStanza) GetRegId

func (x *DataMessageStanza) GetRegId() string

func (*DataMessageStanza) GetSent

func (x *DataMessageStanza) GetSent() int64

func (*DataMessageStanza) GetStatus

func (x *DataMessageStanza) GetStatus() int64

func (*DataMessageStanza) GetStreamId

func (x *DataMessageStanza) GetStreamId() int32

func (*DataMessageStanza) GetTo

func (x *DataMessageStanza) GetTo() string

func (*DataMessageStanza) GetToken

func (x *DataMessageStanza) GetToken() string

func (*DataMessageStanza) GetTtl

func (x *DataMessageStanza) GetTtl() int32

func (*DataMessageStanza) ProtoMessage

func (*DataMessageStanza) ProtoMessage()

func (*DataMessageStanza) ProtoReflect

func (x *DataMessageStanza) ProtoReflect() protoreflect.Message

func (*DataMessageStanza) Reset

func (x *DataMessageStanza) Reset()

func (*DataMessageStanza) String

func (x *DataMessageStanza) String() string

type DeviceType

type DeviceType int32

enum values correspond to the type of device. Used in the AndroidCheckinProto and Device proto.

const (
	// Android Device
	DeviceType_DEVICE_ANDROID_OS DeviceType = 1
	// Apple IOS device
	DeviceType_DEVICE_IOS_OS DeviceType = 2
	// Chrome browser - Not Chrome OS.  No hardware records.
	DeviceType_DEVICE_CHROME_BROWSER DeviceType = 3
	// Chrome OS
	DeviceType_DEVICE_CHROME_OS DeviceType = 4
)

func (DeviceType) Descriptor

func (DeviceType) Descriptor() protoreflect.EnumDescriptor

func (DeviceType) Enum

func (x DeviceType) Enum() *DeviceType

func (DeviceType) EnumDescriptor deprecated

func (DeviceType) EnumDescriptor() ([]byte, []int)

Deprecated: Use DeviceType.Descriptor instead.

func (DeviceType) Number

func (x DeviceType) Number() protoreflect.EnumNumber

func (DeviceType) String

func (x DeviceType) String() string

func (DeviceType) Type

func (*DeviceType) UnmarshalJSON deprecated

func (x *DeviceType) UnmarshalJSON(b []byte) error

Deprecated: Do not use.

type ErrorInfo

type ErrorInfo struct {
	Code      *int32     `protobuf:"varint,1,req,name=code" json:"code,omitempty"`
	Message   *string    `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"`
	Type      *string    `protobuf:"bytes,3,opt,name=type" json:"type,omitempty"`
	Extension *Extension `protobuf:"bytes,4,opt,name=extension" json:"extension,omitempty"`
	// contains filtered or unexported fields
}

func (*ErrorInfo) Descriptor deprecated

func (*ErrorInfo) Descriptor() ([]byte, []int)

Deprecated: Use ErrorInfo.ProtoReflect.Descriptor instead.

func (*ErrorInfo) GetCode

func (x *ErrorInfo) GetCode() int32

func (*ErrorInfo) GetExtension

func (x *ErrorInfo) GetExtension() *Extension

func (*ErrorInfo) GetMessage

func (x *ErrorInfo) GetMessage() string

func (*ErrorInfo) GetType

func (x *ErrorInfo) GetType() string

func (*ErrorInfo) ProtoMessage

func (*ErrorInfo) ProtoMessage()

func (*ErrorInfo) ProtoReflect

func (x *ErrorInfo) ProtoReflect() protoreflect.Message

func (*ErrorInfo) Reset

func (x *ErrorInfo) Reset()

func (*ErrorInfo) String

func (x *ErrorInfo) String() string

type Extension

type Extension struct {

	// 12: SelectiveAck
	// 13: StreamAck
	Id   *int32 `protobuf:"varint,1,req,name=id" json:"id,omitempty"`
	Data []byte `protobuf:"bytes,2,req,name=data" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*Extension) Descriptor deprecated

func (*Extension) Descriptor() ([]byte, []int)

Deprecated: Use Extension.ProtoReflect.Descriptor instead.

func (*Extension) GetData

func (x *Extension) GetData() []byte

func (*Extension) GetId

func (x *Extension) GetId() int32

func (*Extension) ProtoMessage

func (*Extension) ProtoMessage()

func (*Extension) ProtoReflect

func (x *Extension) ProtoReflect() protoreflect.Message

func (*Extension) Reset

func (x *Extension) Reset()

func (*Extension) String

func (x *Extension) String() string

type FCMClient

type FCMClient struct {
	SenderId   int64
	HttpClient http.Client

	GcmToken      string
	FcmToken      string
	AndroidId     uint64
	SecurityToken uint64

	PersistentIds []string

	HeartbeatInterval time.Duration

	OnDataMessage func(message []byte)
	// contains filtered or unexported fields
}

FCMClient structure

func (*FCMClient) Close added in v1.0.4

func (f *FCMClient) Close()

func (*FCMClient) CreateAppId

func (f *FCMClient) CreateAppId() string

func (*FCMClient) CreateNewKeys

func (f *FCMClient) CreateNewKeys() (string, string, error)

CreateNewKeys returns the newly created privateKey (base64), authSecret (base64), err

func (*FCMClient) GetAuthSecretBase64

func (f *FCMClient) GetAuthSecretBase64() string

func (*FCMClient) GetPrivateKeyBase64

func (f *FCMClient) GetPrivateKeyBase64() (string, error)

func (*FCMClient) LoadKeys

func (f *FCMClient) LoadKeys(privateKeyBase64 string, authSecretBase64 string) error

func (*FCMClient) Register

func (f *FCMClient) Register() (string, string, uint64, uint64, error)

Register should be called only for a new device. returns the newly created FcmToken, GcmToken, AndroidId, SecurityToken, err

func (*FCMClient) RemovePersistentId added in v1.0.2

func (f *FCMClient) RemovePersistentId(id string)

func (*FCMClient) SendCheckInRequest

func (f *FCMClient) SendCheckInRequest(requestBody *AndroidCheckinRequest) (*AndroidCheckinResponse, error)

func (*FCMClient) SendRegisterRequest

func (f *FCMClient) SendRegisterRequest() (string, error)

func (*FCMClient) SendSubscribeRequest

func (f *FCMClient) SendSubscribeRequest() (*FCMSubscribeResponse, error)

func (*FCMClient) StartListening

func (f *FCMClient) StartListening() error

type FCMSocketHandler

type FCMSocketHandler struct {
	Socket            *tls.Conn
	HeartbeatInterval time.Duration
	IsAlive           bool

	OnMessage func(messageTag int, messageObject interface{}) error
	// contains filtered or unexported fields
}

func (*FCMSocketHandler) Init

func (f *FCMSocketHandler) Init()

func (*FCMSocketHandler) SendHeartbeatPing

func (f *FCMSocketHandler) SendHeartbeatPing() error

func (*FCMSocketHandler) StartSocketHandler

func (f *FCMSocketHandler) StartSocketHandler() error

type FCMSubscribeResponse

type FCMSubscribeResponse struct {
	Token   string `json:"token"`
	PushSet string `json:"pushSet"`
}

type GservicesSetting

type GservicesSetting struct {
	Name  []byte `protobuf:"bytes,1,req,name=name" json:"name,omitempty"`
	Value []byte `protobuf:"bytes,2,req,name=value" json:"value,omitempty"`
	// contains filtered or unexported fields
}

A concrete name/value pair sent to the device's Gservices database.

func (*GservicesSetting) Descriptor deprecated

func (*GservicesSetting) Descriptor() ([]byte, []int)

Deprecated: Use GservicesSetting.ProtoReflect.Descriptor instead.

func (*GservicesSetting) GetName

func (x *GservicesSetting) GetName() []byte

func (*GservicesSetting) GetValue

func (x *GservicesSetting) GetValue() []byte

func (*GservicesSetting) ProtoMessage

func (*GservicesSetting) ProtoMessage()

func (*GservicesSetting) ProtoReflect

func (x *GservicesSetting) ProtoReflect() protoreflect.Message

func (*GservicesSetting) Reset

func (x *GservicesSetting) Reset()

func (*GservicesSetting) String

func (x *GservicesSetting) String() string

type HeartbeatAck

type HeartbeatAck struct {
	StreamId             *int32 `protobuf:"varint,1,opt,name=stream_id,json=streamId" json:"stream_id,omitempty"`
	LastStreamIdReceived *int32 `protobuf:"varint,2,opt,name=last_stream_id_received,json=lastStreamIdReceived" json:"last_stream_id_received,omitempty"`
	Status               *int64 `protobuf:"varint,3,opt,name=status" json:"status,omitempty"`
	// contains filtered or unexported fields
}

* TAG: 1

func DecodeHeartbeatAck

func DecodeHeartbeatAck(data []byte) (*HeartbeatAck, error)

func (*HeartbeatAck) Descriptor deprecated

func (*HeartbeatAck) Descriptor() ([]byte, []int)

Deprecated: Use HeartbeatAck.ProtoReflect.Descriptor instead.

func (*HeartbeatAck) GetLastStreamIdReceived

func (x *HeartbeatAck) GetLastStreamIdReceived() int32

func (*HeartbeatAck) GetStatus

func (x *HeartbeatAck) GetStatus() int64

func (*HeartbeatAck) GetStreamId

func (x *HeartbeatAck) GetStreamId() int32

func (*HeartbeatAck) ProtoMessage

func (*HeartbeatAck) ProtoMessage()

func (*HeartbeatAck) ProtoReflect

func (x *HeartbeatAck) ProtoReflect() protoreflect.Message

func (*HeartbeatAck) Reset

func (x *HeartbeatAck) Reset()

func (*HeartbeatAck) String

func (x *HeartbeatAck) String() string

type HeartbeatConfig

type HeartbeatConfig struct {
	UploadStat *bool   `protobuf:"varint,1,opt,name=upload_stat,json=uploadStat" json:"upload_stat,omitempty"`
	Ip         *string `protobuf:"bytes,2,opt,name=ip" json:"ip,omitempty"`
	IntervalMs *int32  `protobuf:"varint,3,opt,name=interval_ms,json=intervalMs" json:"interval_ms,omitempty"`
	// contains filtered or unexported fields
}

func (*HeartbeatConfig) Descriptor deprecated

func (*HeartbeatConfig) Descriptor() ([]byte, []int)

Deprecated: Use HeartbeatConfig.ProtoReflect.Descriptor instead.

func (*HeartbeatConfig) GetIntervalMs

func (x *HeartbeatConfig) GetIntervalMs() int32

func (*HeartbeatConfig) GetIp

func (x *HeartbeatConfig) GetIp() string

func (*HeartbeatConfig) GetUploadStat

func (x *HeartbeatConfig) GetUploadStat() bool

func (*HeartbeatConfig) ProtoMessage

func (*HeartbeatConfig) ProtoMessage()

func (*HeartbeatConfig) ProtoReflect

func (x *HeartbeatConfig) ProtoReflect() protoreflect.Message

func (*HeartbeatConfig) Reset

func (x *HeartbeatConfig) Reset()

func (*HeartbeatConfig) String

func (x *HeartbeatConfig) String() string

type HeartbeatPing

type HeartbeatPing struct {
	StreamId             *int32 `protobuf:"varint,1,opt,name=stream_id,json=streamId" json:"stream_id,omitempty"`
	LastStreamIdReceived *int32 `protobuf:"varint,2,opt,name=last_stream_id_received,json=lastStreamIdReceived" json:"last_stream_id_received,omitempty"`
	Status               *int64 `protobuf:"varint,3,opt,name=status" json:"status,omitempty"`
	// contains filtered or unexported fields
}

* TAG: 0

func DecodeHeartbeatPing

func DecodeHeartbeatPing(data []byte) (*HeartbeatPing, error)

func (*HeartbeatPing) Descriptor deprecated

func (*HeartbeatPing) Descriptor() ([]byte, []int)

Deprecated: Use HeartbeatPing.ProtoReflect.Descriptor instead.

func (*HeartbeatPing) GetLastStreamIdReceived

func (x *HeartbeatPing) GetLastStreamIdReceived() int32

func (*HeartbeatPing) GetStatus

func (x *HeartbeatPing) GetStatus() int64

func (*HeartbeatPing) GetStreamId

func (x *HeartbeatPing) GetStreamId() int32

func (*HeartbeatPing) ProtoMessage

func (*HeartbeatPing) ProtoMessage()

func (*HeartbeatPing) ProtoReflect

func (x *HeartbeatPing) ProtoReflect() protoreflect.Message

func (*HeartbeatPing) Reset

func (x *HeartbeatPing) Reset()

func (*HeartbeatPing) String

func (x *HeartbeatPing) String() string

type HeartbeatStat

type HeartbeatStat struct {
	Ip         *string `protobuf:"bytes,1,req,name=ip" json:"ip,omitempty"`
	Timeout    *bool   `protobuf:"varint,2,req,name=timeout" json:"timeout,omitempty"`
	IntervalMs *int32  `protobuf:"varint,3,req,name=interval_ms,json=intervalMs" json:"interval_ms,omitempty"`
	// contains filtered or unexported fields
}

func (*HeartbeatStat) Descriptor deprecated

func (*HeartbeatStat) Descriptor() ([]byte, []int)

Deprecated: Use HeartbeatStat.ProtoReflect.Descriptor instead.

func (*HeartbeatStat) GetIntervalMs

func (x *HeartbeatStat) GetIntervalMs() int32

func (*HeartbeatStat) GetIp

func (x *HeartbeatStat) GetIp() string

func (*HeartbeatStat) GetTimeout

func (x *HeartbeatStat) GetTimeout() bool

func (*HeartbeatStat) ProtoMessage

func (*HeartbeatStat) ProtoMessage()

func (*HeartbeatStat) ProtoReflect

func (x *HeartbeatStat) ProtoReflect() protoreflect.Message

func (*HeartbeatStat) Reset

func (x *HeartbeatStat) Reset()

func (*HeartbeatStat) String

func (x *HeartbeatStat) String() string

type IqStanza

type IqStanza struct {
	RmqId *int64           `protobuf:"varint,1,opt,name=rmq_id,json=rmqId" json:"rmq_id,omitempty"`
	Type  *IqStanza_IqType `protobuf:"varint,2,req,name=type,enum=proto.IqStanza_IqType" json:"type,omitempty"`
	Id    *string          `protobuf:"bytes,3,req,name=id" json:"id,omitempty"`
	From  *string          `protobuf:"bytes,4,opt,name=from" json:"from,omitempty"`
	To    *string          `protobuf:"bytes,5,opt,name=to" json:"to,omitempty"`
	Error *ErrorInfo       `protobuf:"bytes,6,opt,name=error" json:"error,omitempty"`
	// Only field used in the 38+ protocol (besides common last_stream_id_received, status, rmq_id)
	Extension            *Extension `protobuf:"bytes,7,opt,name=extension" json:"extension,omitempty"`
	PersistentId         *string    `protobuf:"bytes,8,opt,name=persistent_id,json=persistentId" json:"persistent_id,omitempty"`
	StreamId             *int32     `protobuf:"varint,9,opt,name=stream_id,json=streamId" json:"stream_id,omitempty"`
	LastStreamIdReceived *int32     `protobuf:"varint,10,opt,name=last_stream_id_received,json=lastStreamIdReceived" json:"last_stream_id_received,omitempty"`
	AccountId            *int64     `protobuf:"varint,11,opt,name=account_id,json=accountId" json:"account_id,omitempty"`
	Status               *int64     `protobuf:"varint,12,opt,name=status" json:"status,omitempty"`
	// contains filtered or unexported fields
}

* TAG: 7 IqRequest must contain a single extension. IqResponse may contain 0 or 1 extensions.

func DecodeIqStanza

func DecodeIqStanza(data []byte) (*IqStanza, error)

func (*IqStanza) Descriptor deprecated

func (*IqStanza) Descriptor() ([]byte, []int)

Deprecated: Use IqStanza.ProtoReflect.Descriptor instead.

func (*IqStanza) GetAccountId

func (x *IqStanza) GetAccountId() int64

func (*IqStanza) GetError

func (x *IqStanza) GetError() *ErrorInfo

func (*IqStanza) GetExtension

func (x *IqStanza) GetExtension() *Extension

func (*IqStanza) GetFrom

func (x *IqStanza) GetFrom() string

func (*IqStanza) GetId

func (x *IqStanza) GetId() string

func (*IqStanza) GetLastStreamIdReceived

func (x *IqStanza) GetLastStreamIdReceived() int32

func (*IqStanza) GetPersistentId

func (x *IqStanza) GetPersistentId() string

func (*IqStanza) GetRmqId

func (x *IqStanza) GetRmqId() int64

func (*IqStanza) GetStatus

func (x *IqStanza) GetStatus() int64

func (*IqStanza) GetStreamId

func (x *IqStanza) GetStreamId() int32

func (*IqStanza) GetTo

func (x *IqStanza) GetTo() string

func (*IqStanza) GetType

func (x *IqStanza) GetType() IqStanza_IqType

func (*IqStanza) ProtoMessage

func (*IqStanza) ProtoMessage()

func (*IqStanza) ProtoReflect

func (x *IqStanza) ProtoReflect() protoreflect.Message

func (*IqStanza) Reset

func (x *IqStanza) Reset()

func (*IqStanza) String

func (x *IqStanza) String() string

type IqStanza_IqType

type IqStanza_IqType int32
const (
	IqStanza_GET      IqStanza_IqType = 0
	IqStanza_SET      IqStanza_IqType = 1
	IqStanza_RESULT   IqStanza_IqType = 2
	IqStanza_IQ_ERROR IqStanza_IqType = 3
)

func (IqStanza_IqType) Descriptor

func (IqStanza_IqType) Enum

func (x IqStanza_IqType) Enum() *IqStanza_IqType

func (IqStanza_IqType) EnumDescriptor deprecated

func (IqStanza_IqType) EnumDescriptor() ([]byte, []int)

Deprecated: Use IqStanza_IqType.Descriptor instead.

func (IqStanza_IqType) Number

func (IqStanza_IqType) String

func (x IqStanza_IqType) String() string

func (IqStanza_IqType) Type

func (*IqStanza_IqType) UnmarshalJSON deprecated

func (x *IqStanza_IqType) UnmarshalJSON(b []byte) error

Deprecated: Do not use.

type LoginRequest

type LoginRequest struct {
	Id *string `protobuf:"bytes,1,req,name=id" json:"id,omitempty"` // Must be present ( proto required ), may be empty
	// string.
	// mcs.android.com.
	Domain *string `protobuf:"bytes,2,req,name=domain" json:"domain,omitempty"`
	// Decimal android ID
	User     *string `protobuf:"bytes,3,req,name=user" json:"user,omitempty"`
	Resource *string `protobuf:"bytes,4,req,name=resource" json:"resource,omitempty"`
	// Secret
	AuthToken *string `protobuf:"bytes,5,req,name=auth_token,json=authToken" json:"auth_token,omitempty"`
	// Format is: android-HEX_DEVICE_ID
	// The user is the decimal value.
	DeviceId *string `protobuf:"bytes,6,opt,name=device_id,json=deviceId" json:"device_id,omitempty"`
	// RMQ1 - no longer used
	LastRmqId *int64     `protobuf:"varint,7,opt,name=last_rmq_id,json=lastRmqId" json:"last_rmq_id,omitempty"`
	Setting   []*Setting `protobuf:"bytes,8,rep,name=setting" json:"setting,omitempty"`
	//optional int32 compress = 9;
	ReceivedPersistentId []string       `protobuf:"bytes,10,rep,name=received_persistent_id,json=receivedPersistentId" json:"received_persistent_id,omitempty"`
	AdaptiveHeartbeat    *bool          `protobuf:"varint,12,opt,name=adaptive_heartbeat,json=adaptiveHeartbeat" json:"adaptive_heartbeat,omitempty"`
	HeartbeatStat        *HeartbeatStat `protobuf:"bytes,13,opt,name=heartbeat_stat,json=heartbeatStat" json:"heartbeat_stat,omitempty"`
	// Must be true.
	UseRmq2   *bool  `protobuf:"varint,14,opt,name=use_rmq2,json=useRmq2" json:"use_rmq2,omitempty"`
	AccountId *int64 `protobuf:"varint,15,opt,name=account_id,json=accountId" json:"account_id,omitempty"`
	// ANDROID_ID = 2
	AuthService *LoginRequest_AuthService `protobuf:"varint,16,opt,name=auth_service,json=authService,enum=proto.LoginRequest_AuthService" json:"auth_service,omitempty"`
	NetworkType *int32                    `protobuf:"varint,17,opt,name=network_type,json=networkType" json:"network_type,omitempty"`
	Status      *int64                    `protobuf:"varint,18,opt,name=status" json:"status,omitempty"`
	// Events recorded on the client after the last successful connection.
	ClientEvent []*ClientEvent `protobuf:"bytes,22,rep,name=client_event,json=clientEvent" json:"client_event,omitempty"`
	// contains filtered or unexported fields
}

* TAG: 2

func DecodeLoginRequest

func DecodeLoginRequest(data []byte) (*LoginRequest, error)

func (*LoginRequest) Descriptor deprecated

func (*LoginRequest) Descriptor() ([]byte, []int)

Deprecated: Use LoginRequest.ProtoReflect.Descriptor instead.

func (*LoginRequest) GetAccountId

func (x *LoginRequest) GetAccountId() int64

func (*LoginRequest) GetAdaptiveHeartbeat

func (x *LoginRequest) GetAdaptiveHeartbeat() bool

func (*LoginRequest) GetAuthService

func (x *LoginRequest) GetAuthService() LoginRequest_AuthService

func (*LoginRequest) GetAuthToken

func (x *LoginRequest) GetAuthToken() string

func (*LoginRequest) GetClientEvent

func (x *LoginRequest) GetClientEvent() []*ClientEvent

func (*LoginRequest) GetDeviceId

func (x *LoginRequest) GetDeviceId() string

func (*LoginRequest) GetDomain

func (x *LoginRequest) GetDomain() string

func (*LoginRequest) GetHeartbeatStat

func (x *LoginRequest) GetHeartbeatStat() *HeartbeatStat

func (*LoginRequest) GetId

func (x *LoginRequest) GetId() string

func (*LoginRequest) GetLastRmqId

func (x *LoginRequest) GetLastRmqId() int64

func (*LoginRequest) GetNetworkType

func (x *LoginRequest) GetNetworkType() int32

func (*LoginRequest) GetReceivedPersistentId

func (x *LoginRequest) GetReceivedPersistentId() []string

func (*LoginRequest) GetResource

func (x *LoginRequest) GetResource() string

func (*LoginRequest) GetSetting

func (x *LoginRequest) GetSetting() []*Setting

func (*LoginRequest) GetStatus

func (x *LoginRequest) GetStatus() int64

func (*LoginRequest) GetUseRmq2

func (x *LoginRequest) GetUseRmq2() bool

func (*LoginRequest) GetUser

func (x *LoginRequest) GetUser() string

func (*LoginRequest) ProtoMessage

func (*LoginRequest) ProtoMessage()

func (*LoginRequest) ProtoReflect

func (x *LoginRequest) ProtoReflect() protoreflect.Message

func (*LoginRequest) Reset

func (x *LoginRequest) Reset()

func (*LoginRequest) String

func (x *LoginRequest) String() string

type LoginRequest_AuthService

type LoginRequest_AuthService int32
const (
	LoginRequest_ANDROID_ID LoginRequest_AuthService = 2
)

func (LoginRequest_AuthService) Descriptor

func (LoginRequest_AuthService) Enum

func (LoginRequest_AuthService) EnumDescriptor deprecated

func (LoginRequest_AuthService) EnumDescriptor() ([]byte, []int)

Deprecated: Use LoginRequest_AuthService.Descriptor instead.

func (LoginRequest_AuthService) Number

func (LoginRequest_AuthService) String

func (x LoginRequest_AuthService) String() string

func (LoginRequest_AuthService) Type

func (*LoginRequest_AuthService) UnmarshalJSON deprecated

func (x *LoginRequest_AuthService) UnmarshalJSON(b []byte) error

Deprecated: Do not use.

type LoginResponse

type LoginResponse struct {
	Id *string `protobuf:"bytes,1,req,name=id" json:"id,omitempty"`
	// Not used.
	Jid *string `protobuf:"bytes,2,opt,name=jid" json:"jid,omitempty"`
	// Null if login was ok.
	Error    *ErrorInfo `protobuf:"bytes,3,opt,name=error" json:"error,omitempty"`
	Setting  []*Setting `protobuf:"bytes,4,rep,name=setting" json:"setting,omitempty"`
	StreamId *int32     `protobuf:"varint,5,opt,name=stream_id,json=streamId" json:"stream_id,omitempty"`
	// Should be "1"
	LastStreamIdReceived *int32           `protobuf:"varint,6,opt,name=last_stream_id_received,json=lastStreamIdReceived" json:"last_stream_id_received,omitempty"`
	HeartbeatConfig      *HeartbeatConfig `protobuf:"bytes,7,opt,name=heartbeat_config,json=heartbeatConfig" json:"heartbeat_config,omitempty"`
	// used by the client to synchronize with the server timestamp.
	ServerTimestamp *int64 `protobuf:"varint,8,opt,name=server_timestamp,json=serverTimestamp" json:"server_timestamp,omitempty"`
	// contains filtered or unexported fields
}

* TAG: 3

func DecodeLoginResponse

func DecodeLoginResponse(data []byte) (*LoginResponse, error)

func (*LoginResponse) Descriptor deprecated

func (*LoginResponse) Descriptor() ([]byte, []int)

Deprecated: Use LoginResponse.ProtoReflect.Descriptor instead.

func (*LoginResponse) GetError

func (x *LoginResponse) GetError() *ErrorInfo

func (*LoginResponse) GetHeartbeatConfig

func (x *LoginResponse) GetHeartbeatConfig() *HeartbeatConfig

func (*LoginResponse) GetId

func (x *LoginResponse) GetId() string

func (*LoginResponse) GetJid

func (x *LoginResponse) GetJid() string

func (*LoginResponse) GetLastStreamIdReceived

func (x *LoginResponse) GetLastStreamIdReceived() int32

func (*LoginResponse) GetServerTimestamp

func (x *LoginResponse) GetServerTimestamp() int64

func (*LoginResponse) GetSetting

func (x *LoginResponse) GetSetting() []*Setting

func (*LoginResponse) GetStreamId

func (x *LoginResponse) GetStreamId() int32

func (*LoginResponse) ProtoMessage

func (*LoginResponse) ProtoMessage()

func (*LoginResponse) ProtoReflect

func (x *LoginResponse) ProtoReflect() protoreflect.Message

func (*LoginResponse) Reset

func (x *LoginResponse) Reset()

func (*LoginResponse) String

func (x *LoginResponse) String() string

type SelectiveAck

type SelectiveAck struct {
	Id []string `protobuf:"bytes,1,rep,name=id" json:"id,omitempty"`
	// contains filtered or unexported fields
}

* Included in IQ sent after LoginResponse from server with ID 12.

func (*SelectiveAck) Descriptor deprecated

func (*SelectiveAck) Descriptor() ([]byte, []int)

Deprecated: Use SelectiveAck.ProtoReflect.Descriptor instead.

func (*SelectiveAck) GetId

func (x *SelectiveAck) GetId() []string

func (*SelectiveAck) ProtoMessage

func (*SelectiveAck) ProtoMessage()

func (*SelectiveAck) ProtoReflect

func (x *SelectiveAck) ProtoReflect() protoreflect.Message

func (*SelectiveAck) Reset

func (x *SelectiveAck) Reset()

func (*SelectiveAck) String

func (x *SelectiveAck) String() string

type Setting

type Setting struct {
	Name  *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"`
	Value *string `protobuf:"bytes,2,req,name=value" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*Setting) Descriptor deprecated

func (*Setting) Descriptor() ([]byte, []int)

Deprecated: Use Setting.ProtoReflect.Descriptor instead.

func (*Setting) GetName

func (x *Setting) GetName() string

func (*Setting) GetValue

func (x *Setting) GetValue() string

func (*Setting) ProtoMessage

func (*Setting) ProtoMessage()

func (*Setting) ProtoReflect

func (x *Setting) ProtoReflect() protoreflect.Message

func (*Setting) Reset

func (x *Setting) Reset()

func (*Setting) String

func (x *Setting) String() string

type StreamAck

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

* Included in IQ with ID 13, sent from client or server after 10 unconfirmed messages.

func (*StreamAck) Descriptor deprecated

func (*StreamAck) Descriptor() ([]byte, []int)

Deprecated: Use StreamAck.ProtoReflect.Descriptor instead.

func (*StreamAck) ProtoMessage

func (*StreamAck) ProtoMessage()

func (*StreamAck) ProtoReflect

func (x *StreamAck) ProtoReflect() protoreflect.Message

func (*StreamAck) Reset

func (x *StreamAck) Reset()

func (*StreamAck) String

func (x *StreamAck) String() string

type StreamErrorStanza

type StreamErrorStanza struct {
	Type *string `protobuf:"bytes,1,req,name=type" json:"type,omitempty"`
	Text *string `protobuf:"bytes,2,opt,name=text" json:"text,omitempty"`
	// contains filtered or unexported fields
}

func DecodeStreamErrorStanza

func DecodeStreamErrorStanza(data []byte) (*StreamErrorStanza, error)

func (*StreamErrorStanza) Descriptor deprecated

func (*StreamErrorStanza) Descriptor() ([]byte, []int)

Deprecated: Use StreamErrorStanza.ProtoReflect.Descriptor instead.

func (*StreamErrorStanza) GetText

func (x *StreamErrorStanza) GetText() string

func (*StreamErrorStanza) GetType

func (x *StreamErrorStanza) GetType() string

func (*StreamErrorStanza) ProtoMessage

func (*StreamErrorStanza) ProtoMessage()

func (*StreamErrorStanza) ProtoReflect

func (x *StreamErrorStanza) ProtoReflect() protoreflect.Message

func (*StreamErrorStanza) Reset

func (x *StreamErrorStanza) Reset()

func (*StreamErrorStanza) String

func (x *StreamErrorStanza) String() string

Jump to

Keyboard shortcuts

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