Documentation
¶
Index ¶
- Constants
- Variables
- func CompressionSavedBytes() int64
- func DecodeCategory(category string, d []byte) (any, error)
- func DecodeCommandPayload(role EndpointRole, cmd uint32, data []byte) (any, error)
- func DecodeRequestPayload(role EndpointRole, cmd uint32, data []byte) (any, error)
- func DecodeResponsePayload(role EndpointRole, cmd uint32, data []byte) (any, error)
- func EncodeCategory(category string, value any) ([]byte, error)
- func EncodeChrome(m ChromeDevtools) []byte
- func EncodeClientResponseDataFormat(cmd uint32, uuid string, value any) ([]byte, error)
- func EncodeCommandPayload(role EndpointRole, cmd uint32, value any) ([]byte, error)
- func EncodeCustom(m CustomMessage) []byte
- func EncodeDataFormat(v DataFormat) ([]byte, error)
- func EncodeDebugMessage(m DebugMessage) []byte
- func EncodeDeveloperOutgoingDataFormat(cmd uint32, uuid string, value any, parallelNotify bool) ([]byte, error)
- func EncodeGeneric(m GenericMessage) []byte
- func EncodeOutgoingDebugMessage(m DebugMessage) []byte
- func HasMessageType(name string) bool
- func MarshalMessage(v any) ([]byte, error)
- func MessageTypeCount() int
- func MessageTypes() []string
- func NewMessage(typeName string) (any, bool)
- func ResetCompressionStatistics()
- func SchemaFieldCount(name string) int
- func UnmarshalMessage(d []byte, out any) error
- func WrapData(data []byte, category string, algo CompressAlgo) ([]byte, uint32, error)
- func ZlibVersion() string
- type AddJsContext
- type BaseReq
- type BaseResp
- type Breakpoint
- type BreakpointProto
- type CallInterface
- type CallInterfaceProto
- type CallInterfaceResult
- type CallInterfaceResultProto
- type ChromeDevtools
- type ChromeDevtoolsProto
- type ChromeDevtoolsResultProto
- type CommReq
- type CommResp
- type CompressAlgo
- type ConnectJsContext
- type CustomMessage
- type CustomMessageProto
- type DataFormat
- type DebugMessage
- type DebugMessageProto
- type DevHeartBeatReq
- type DevHeartBeatResp
- type DevJoinRoomReq
- type DevJoinRoomResp
- type DevLoginReq
- type DevLoginResp
- type DevQuitRoomReq
- type DevQuitRoomResp
- type DevSyncMessageReq
- type DevSyncMessageResp
- type DeviceInfo
- type DomEvent
- type DomOp
- type EndpointRole
- type EvaluateJavascript
- type EvaluateJavascriptProto
- type EvaluateJavascriptResult
- type EvaluateJavascriptResultProto
- type EventNotify
- type EventNotifyResp
- type GenericMessage
- type JsContext
- type MessageNotify
- type MessageNotifyResp
- type MethodWithArgs
- type NetworkDebugAPI
- type NewSendDebugMessageReq
- type NewSendDebugMessageResp
- type Ping
- type PingProto
- type Pong
- type PongProto
- type ProtoUnknown
- type RegisterInterface
- type RemoveJsContext
- type RoomInfo
- type SendDebugMessageReq
- type SendDebugMessageResp
- type SetupContext
- type Unwrapped
- type WireField
- type WxHeartBeatReq
- type WxHeartBeatResp
- type WxJoinRoomReq
- type WxJoinRoomResp
- type WxLoginReq
- type WxLoginResp
- type WxQuitRoomReq
- type WxQuitRoomResp
- type WxSyncMessageReq
- type WxSyncMessageResp
Constants ¶
const ( CategorySetupContext = "setupContext" CategoryCallInterface = "callInterface" CategoryCallInterfaceResult = "callInterfaceResult" CategoryEvaluateJavascript = "evaluateJavascript" CategoryEvaluateJavascriptResult = "evaluateJavascriptResult" CategoryBreakpoint = "breakpoint" CategoryPing = "ping" CategoryPong = "pong" CategoryDomOp = "domOp" CategoryDomEvent = "domEvent" CategoryNetworkDebugAPI = "networkDebugAPI" CategoryChromeDevtools = "chromeDevtools" CategoryChromeDevtoolsResult = "chromeDevtoolsResult" CategoryAddJsContext = "addJsContext" CategoryRemoveJsContext = "removeJsContext" CategoryConnectJsContext = "connectJsContext" CategoryCustomMessage = "customMessage" )
const ( CmdClientHeartbeat uint32 = 1001 CmdClientLogin uint32 = 1002 CmdClientJoinRoom uint32 = 1003 CmdClientQuitRoom uint32 = 1004 CmdClientSyncMessage uint32 = 1005 CmdClientMessageNotify uint32 = 2000 CmdClientMessageNotifyParallel uint32 = 2006 CmdClientSendDebug uint32 = 1000 CmdClientSendDebugParallel uint32 = 1006 CmdDevHeartbeat uint32 = 2001 CmdDevLogin uint32 = 2002 CmdDevJoinRoom uint32 = 2003 CmdDevQuitRoom uint32 = 2004 CmdDevSyncMessage uint32 = 2005 CmdDevMessageNotify uint32 = 1000 CmdDevMessageNotifyParallel uint32 = 1006 CmdDevSendDebug uint32 = 2000 CmdDevSendDebugParallel uint32 = 2006 CmdEventBegin uint32 = 3001 CmdEventEnd uint32 = 3002 CmdEventBlock uint32 = 3003 )
Command values are the wire values from RemoteDebugConstants.js. The 100x range is the client side and 200x is the developer side of the same RPC.
const DefaultMaxDecompressedDebugMessageBytes = 16 << 20
DefaultMaxDecompressedDebugMessageBytes bounds one inflated WMPF debug message. It is intentionally much smaller than the native shim's process safety ceiling while leaving room for large CDP payloads.
Variables ¶
var ( // ErrDecompressedDebugMessageTooLarge reports a declared or actual output // larger than the active WMPF decompression limit. ErrDecompressedDebugMessageTooLarge = errors.New("wmpf: decompressed debug message exceeds limit") // ErrDecompressedDebugMessageSizeMismatch reports a non-zero OriginalSize // that does not match the inflated payload. ErrDecompressedDebugMessageSizeMismatch = errors.New("wmpf: decompressed debug message size mismatch") )
Functions ¶
func CompressionSavedBytes ¶
func CompressionSavedBytes() int64
func DecodeCommandPayload ¶
func DecodeCommandPayload(role EndpointRole, cmd uint32, data []byte) (any, error)
DecodeCommandPayload matches the two reference Codex unwrap entry points: client frames are requests and developer frames are responses. Unknown commands produce an empty object while the caller retains DataFormat.Data.
func DecodeRequestPayload ¶
func DecodeRequestPayload(role EndpointRole, cmd uint32, data []byte) (any, error)
func DecodeResponsePayload ¶
func DecodeResponsePayload(role EndpointRole, cmd uint32, data []byte) (any, error)
func EncodeChrome ¶
func EncodeChrome(m ChromeDevtools) []byte
func EncodeClientResponseDataFormat ¶
EncodeClientResponseDataFormat mirrors wrapClientResponseDataFormatToProto.
func EncodeCommandPayload ¶
func EncodeCommandPayload(role EndpointRole, cmd uint32, value any) ([]byte, error)
func EncodeCustom ¶
func EncodeCustom(m CustomMessage) []byte
func EncodeDataFormat ¶
func EncodeDataFormat(v DataFormat) ([]byte, error)
func EncodeDebugMessage ¶
func EncodeDebugMessage(m DebugMessage) []byte
func EncodeDeveloperOutgoingDataFormat ¶
func EncodeDeveloperOutgoingDataFormat(cmd uint32, uuid string, value any, parallelNotify bool) ([]byte, error)
EncodeDeveloperOutgoingDataFormat mirrors RemoteDebugCodex.wrapOutgoingToProto. Its debug-message list intentionally emits explicit zero compression fields and omits the schema's `after` field, matching the reference helper d().
func EncodeGeneric ¶
func EncodeGeneric(m GenericMessage) []byte
func EncodeOutgoingDebugMessage ¶
func EncodeOutgoingDebugMessage(m DebugMessage) []byte
EncodeOutgoingDebugMessage mirrors src/index.ts outData. The reference omits after entirely but explicitly supplies both zero-valued compression fields.
func HasMessageType ¶
func MarshalMessage ¶
func MessageTypeCount ¶
func MessageTypeCount() int
func MessageTypes ¶
func MessageTypes() []string
func NewMessage ¶
func ResetCompressionStatistics ¶
func ResetCompressionStatistics()
func SchemaFieldCount ¶
func UnmarshalMessage ¶
func ZlibVersion ¶
func ZlibVersion() string
Types ¶
type AddJsContext ¶
type AddJsContext struct {
ProtoUnknown
JscontextId string `pb:"1,string"`
JscontextName string `pb:"2,string"`
}
type BaseReq ¶
type BaseReq struct {
ProtoUnknown
ClientVersion uint32 `pb:"1,varint"`
}
type BaseResp ¶
type BaseResp struct {
ProtoUnknown
Errcode int32 `pb:"1,varint"`
Errmsg string `pb:"2,string"`
}
type Breakpoint ¶
type Breakpoint struct{ IsHit bool }
type BreakpointProto ¶
type BreakpointProto struct {
ProtoUnknown
IsHit bool `pb:"1,varint"`
}
type CallInterface ¶
type CallInterfaceProto ¶
type CallInterfaceProto struct {
ProtoUnknown
ObjName string `pb:"1,string"`
MethodName string `pb:"2,string"`
MethodArgs []string `pb:"3,string"`
CallId uint32 `pb:"4,varint"`
}
type CallInterfaceResult ¶
type CallInterfaceResultProto ¶
type CallInterfaceResultProto struct {
ProtoUnknown
Ret string `pb:"1,string"`
CallId uint32 `pb:"2,varint"`
DebugInfo string `pb:"3,string"`
}
type ChromeDevtools ¶
func DecodeChrome ¶
func DecodeChrome(d []byte) (ChromeDevtools, error)
type ChromeDevtoolsProto ¶
type ChromeDevtoolsProto struct {
ProtoUnknown
OpId uint64 `pb:"1,varint"`
Payload string `pb:"2,string"`
JscontextId string `pb:"3,string"`
}
type ChromeDevtoolsResultProto ¶
type ChromeDevtoolsResultProto = ChromeDevtoolsProto
type CommReq ¶
type CommReq struct {
ProtoUnknown
BaseRequest *BaseReq `pb:"1,msg"`
}
type CommResp ¶
type CommResp struct {
ProtoUnknown
BaseResponse *BaseResp `pb:"1,msg"`
}
type CompressAlgo ¶
type CompressAlgo uint32
const CompressNone CompressAlgo = 0
const CompressZlib CompressAlgo = 1
type ConnectJsContext ¶
type ConnectJsContext struct {
ProtoUnknown
JscontextId string `pb:"1,string"`
}
type CustomMessage ¶
func DecodeCustom ¶
func DecodeCustom(d []byte) (CustomMessage, error)
type CustomMessageProto ¶
type CustomMessageProto struct {
ProtoUnknown
Method string `pb:"1,string"`
Payload string `pb:"2,string"`
Raw []byte `pb:"3,bytes"`
}
type DataFormat ¶
type DataFormat struct {
ProtoUnknown
Cmd uint32 `pb:"1,varint"`
Uuid string `pb:"2,string"`
Data []byte `pb:"3,bytes"`
}
func DecodeDataFormat ¶
func DecodeDataFormat(data []byte) (DataFormat, error)
type DebugMessage ¶
type DebugMessage struct {
Seq, After uint32
Category string
Data []byte
CompressAlgo CompressAlgo
OriginalSize uint32
}
func DecodeDebugMessage ¶
func DecodeDebugMessage(d []byte) (DebugMessage, error)
type DebugMessageProto ¶
type DevHeartBeatReq ¶
type DevHeartBeatReq struct {
ProtoUnknown
BaseRequest *BaseReq `pb:"1,msg"`
RecvAck uint32 `pb:"2,varint"`
}
type DevHeartBeatResp ¶
type DevHeartBeatResp struct {
ProtoUnknown
BaseResponse *BaseResp `pb:"1,msg"`
}
type DevJoinRoomReq ¶
type DevJoinRoomReq struct {
ProtoUnknown
BaseRequest *BaseReq `pb:"1,msg"`
Appid string `pb:"2,string"`
RoomId string `pb:"3,string"`
WxpkgInfo string `pb:"4,string"`
}
type DevJoinRoomResp ¶
type DevJoinRoomResp struct {
ProtoUnknown
BaseResponse *BaseResp `pb:"1,msg"`
}
type DevLoginReq ¶
type DevLoginReq struct {
ProtoUnknown
BaseRequest *BaseReq `pb:"1,msg"`
Newticket string `pb:"2,string"`
Autodev uint32 `pb:"3,varint"`
}
type DevLoginResp ¶
type DevLoginResp struct {
ProtoUnknown
BaseResponse *BaseResp `pb:"1,msg"`
RoomInfo *RoomInfo `pb:"2,msg"`
}
type DevQuitRoomReq ¶
type DevQuitRoomReq struct {
ProtoUnknown
BaseRequest *BaseReq `pb:"1,msg"`
}
type DevQuitRoomResp ¶
type DevQuitRoomResp struct {
ProtoUnknown
BaseResponse *BaseResp `pb:"1,msg"`
}
type DevSyncMessageReq ¶
type DevSyncMessageReq struct {
ProtoUnknown
BaseRequest *BaseReq `pb:"1,msg"`
MinSeq uint32 `pb:"2,varint"`
MaxSeq uint32 `pb:"3,varint"`
}
type DevSyncMessageResp ¶
type DevSyncMessageResp struct {
ProtoUnknown
BaseResponse *BaseResp `pb:"1,msg"`
DebugMessageList []DebugMessageProto `pb:"2,msg"`
SendAck uint32 `pb:"3,varint"`
}
type DeviceInfo ¶
type DeviceInfo struct {
ProtoUnknown
DeviceName string `pb:"1,string"`
DeviceModel string `pb:"2,string"`
SystemVersion string `pb:"3,string"`
WechatVersion string `pb:"4,string"`
PublibVersion uint32 `pb:"5,varint"`
ScreenWidth float32 `pb:"6,fixed32"`
PixelRatio float32 `pb:"7,fixed32"`
UserAgent string `pb:"8,string"`
}
type DomEvent ¶
type DomEvent struct {
ProtoUnknown
Params string `pb:"1,string"`
WebviewId uint32 `pb:"2,varint"`
}
type DomOp ¶
type DomOp struct {
ProtoUnknown
Params string `pb:"1,string"`
WebviewId uint32 `pb:"2,varint"`
}
type EndpointRole ¶
type EndpointRole uint8
DecodeCommandPayload decodes the inner protobuf selected by a DataFormat command while retaining the direction-specific message type.
const ( RoleClient EndpointRole = iota RoleDeveloper )
type EvaluateJavascript ¶
type EvaluateJavascriptProto ¶
type EvaluateJavascriptProto struct {
ProtoUnknown
Script string `pb:"1,string"`
EvaluateId uint32 `pb:"2,varint"`
DebugInfo string `pb:"3,string"`
}
type EvaluateJavascriptResultProto ¶
type EvaluateJavascriptResultProto struct {
ProtoUnknown
Ret string `pb:"1,string"`
EvaluateId uint32 `pb:"2,varint"`
}
type EventNotify ¶
type EventNotify struct{ ProtoUnknown }
type EventNotifyResp ¶
type EventNotifyResp struct{ ProtoUnknown }
type GenericMessage ¶
func DecodeGeneric ¶
func DecodeGeneric(name string, data []byte) (GenericMessage, error)
type MessageNotify ¶
type MessageNotify struct {
ProtoUnknown
DebugMessageList []DebugMessageProto `pb:"1,msg"`
}
type MessageNotifyResp ¶
type MessageNotifyResp struct {
ProtoUnknown
RecvAck uint32 `pb:"1,varint"`
}
type MethodWithArgs ¶
type MethodWithArgs struct {
ProtoUnknown
MethodName string `pb:"1,string"`
MethodArgList []string `pb:"2,string"`
}
type NetworkDebugAPI ¶
type NetworkDebugAPI struct {
ProtoUnknown
ApiName string `pb:"1,string"`
TaskId string `pb:"2,string"`
RequestHeaders string `pb:"3,string"`
Timestamp uint64 `pb:"4,varint"`
}
type NewSendDebugMessageReq ¶
type NewSendDebugMessageReq struct {
ProtoUnknown
BaseRequest *BaseReq `pb:"1,msg"`
DebugMessageList []DebugMessageProto `pb:"2,msg"`
RecvAck uint32 `pb:"3,varint"`
}
type NewSendDebugMessageResp ¶
type NewSendDebugMessageResp struct {
ProtoUnknown
BaseResponse *BaseResp `pb:"1,msg"`
MinAck uint32 `pb:"2,varint"`
MaxAck uint32 `pb:"3,varint"`
}
type PingProto ¶
type PingProto struct {
ProtoUnknown
PingId uint64 `pb:"1,varint"`
Payload string `pb:"2,string"`
}
type PongProto ¶
type PongProto struct {
ProtoUnknown
PingId uint64 `pb:"1,varint"`
NetworkType uint32 `pb:"2,varint"`
Payload string `pb:"3,string"`
}
type ProtoUnknown ¶
type ProtoUnknown struct {
UnknownFields []byte `json:"-"`
}
type RegisterInterface ¶
type RegisterInterface struct {
ProtoUnknown
ObjName string `pb:"1,string"`
ObjMethodList []MethodWithArgs `pb:"2,msg"`
}
type RemoveJsContext ¶
type RemoveJsContext struct {
ProtoUnknown
JscontextId string `pb:"1,string"`
}
type SendDebugMessageReq ¶
type SendDebugMessageReq struct {
ProtoUnknown
BaseRequest *BaseReq `pb:"1,msg"`
DebugMessageList []DebugMessageProto `pb:"2,msg"`
RecvAck uint32 `pb:"3,varint"`
}
type SendDebugMessageResp ¶
type SendDebugMessageResp struct {
ProtoUnknown
BaseResponse *BaseResp `pb:"1,msg"`
SendAck uint32 `pb:"2,varint"`
}
type SetupContext ¶
type SetupContext struct {
ProtoUnknown
RegisterInterface *RegisterInterface `pb:"1,msg"`
DeviceInfo *DeviceInfo `pb:"2,msg"`
ConfigureJs string `pb:"3,string"`
PublicJsMd5 string `pb:"4,string"`
ThreeJsMd5 string `pb:"5,string"`
SupportCompressAlgo uint32 `pb:"6,varint"`
}
type Unwrapped ¶
type Unwrapped struct {
Seq, Delay uint32
Category string
Data any
CompressAlgo CompressAlgo
OriginalSize uint32
Raw []byte
}
func UnwrapDebugMessage ¶
func UnwrapDebugMessage(m DebugMessage) (Unwrapped, error)
func UnwrapDebugMessageWithLimit ¶ added in v0.0.2
func UnwrapDebugMessageWithLimit(m DebugMessage, maxOutput int) (Unwrapped, error)
UnwrapDebugMessageWithLimit unwraps a debug message with a caller-supplied maximum inflated payload size.
type WxHeartBeatReq ¶
type WxHeartBeatReq struct {
ProtoUnknown
BaseRequest *BaseReq `pb:"1,msg"`
RecvAck uint32 `pb:"2,varint"`
}
type WxHeartBeatResp ¶
type WxHeartBeatResp struct {
ProtoUnknown
BaseResponse *BaseResp `pb:"1,msg"`
}
type WxJoinRoomReq ¶
type WxJoinRoomReq struct {
ProtoUnknown
BaseRequest *BaseReq `pb:"1,msg"`
Username string `pb:"2,string"`
RoomId string `pb:"3,string"`
WxpkgInfo string `pb:"4,string"`
}
type WxJoinRoomResp ¶
type WxJoinRoomResp struct {
ProtoUnknown
BaseResponse *BaseResp `pb:"1,msg"`
}
type WxLoginReq ¶
type WxLoginReq struct {
ProtoUnknown
BaseRequest *BaseReq `pb:"1,msg"`
LoginTicket string `pb:"2,string"`
}
type WxLoginResp ¶
type WxLoginResp struct {
ProtoUnknown
BaseResponse *BaseResp `pb:"1,msg"`
RoomInfo *RoomInfo `pb:"2,msg"`
}
type WxQuitRoomReq ¶
type WxQuitRoomReq struct {
ProtoUnknown
BaseRequest *BaseReq `pb:"1,msg"`
}
type WxQuitRoomResp ¶
type WxQuitRoomResp struct {
ProtoUnknown
BaseResponse *BaseResp `pb:"1,msg"`
}
type WxSyncMessageReq ¶
type WxSyncMessageReq struct {
ProtoUnknown
BaseRequest *BaseReq `pb:"1,msg"`
MinSeq uint32 `pb:"2,varint"`
MaxSeq uint32 `pb:"3,varint"`
}
type WxSyncMessageResp ¶
type WxSyncMessageResp struct {
ProtoUnknown
BaseResponse *BaseResp `pb:"1,msg"`
DebugMessageList []DebugMessageProto `pb:"2,msg"`
SendAck uint32 `pb:"3,varint"`
}