mirror of
https://github.com/nestriness/nestri.git
synced 2025-12-11 00:05:36 +02:00
150 lines
3.4 KiB
Protocol Buffer
150 lines
3.4 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
option go_package = "relay/internal/proto";
|
|
|
|
package proto;
|
|
|
|
/* Mouse messages */
|
|
|
|
// MouseMove message
|
|
message ProtoMouseMove {
|
|
int32 x = 1;
|
|
int32 y = 2;
|
|
}
|
|
|
|
// MouseMoveAbs message
|
|
message ProtoMouseMoveAbs {
|
|
int32 x = 1;
|
|
int32 y = 2;
|
|
}
|
|
|
|
// MouseWheel message
|
|
message ProtoMouseWheel {
|
|
int32 x = 1;
|
|
int32 y = 2;
|
|
}
|
|
|
|
// MouseKeyDown message
|
|
message ProtoMouseKeyDown {
|
|
int32 key = 1;
|
|
}
|
|
|
|
// MouseKeyUp message
|
|
message ProtoMouseKeyUp {
|
|
int32 key = 1;
|
|
}
|
|
|
|
/* Keyboard messages */
|
|
|
|
// KeyDown message
|
|
message ProtoKeyDown {
|
|
int32 key = 1;
|
|
}
|
|
|
|
// KeyUp message
|
|
message ProtoKeyUp {
|
|
int32 key = 1;
|
|
}
|
|
|
|
/* Controller messages */
|
|
|
|
// ControllerAttach message
|
|
message ProtoControllerAttach {
|
|
string id = 1; // One of the following enums: "ps", "xbox" or "switch"
|
|
int32 session_slot = 2; // Session specific slot number (0-3)
|
|
string session_id = 3; // Session ID of the client
|
|
}
|
|
|
|
// ControllerDetach message
|
|
message ProtoControllerDetach {
|
|
int32 session_slot = 1; // Session specific slot number (0-3)
|
|
string session_id = 2; // Session ID of the client
|
|
}
|
|
|
|
// ControllerRumble message
|
|
message ProtoControllerRumble {
|
|
int32 session_slot = 1; // Session specific slot number (0-3)
|
|
string session_id = 2; // Session ID of the client
|
|
int32 low_frequency = 3; // Low frequency rumble (0-65535)
|
|
int32 high_frequency = 4; // High frequency rumble (0-65535)
|
|
int32 duration = 5; // Duration in milliseconds
|
|
}
|
|
|
|
// ControllerStateBatch - single message containing full or partial controller state
|
|
message ProtoControllerStateBatch {
|
|
int32 session_slot = 1; // Session specific slot number (0-3)
|
|
string session_id = 2; // Session ID of the client
|
|
|
|
enum UpdateType {
|
|
FULL_STATE = 0; // Complete controller state
|
|
DELTA = 1; // Only changed fields
|
|
}
|
|
UpdateType update_type = 3;
|
|
|
|
// Sequence number for packet loss detection
|
|
uint32 sequence = 4;
|
|
|
|
// Button state map (Linux event codes)
|
|
map<int32, bool> button_changed_mask = 5;
|
|
|
|
// Analog inputs
|
|
optional int32 left_stick_x = 6; // -32768 to 32767
|
|
optional int32 left_stick_y = 7; // -32768 to 32767
|
|
optional int32 right_stick_x = 8; // -32768 to 32767
|
|
optional int32 right_stick_y = 9; // -32768 to 32767
|
|
optional int32 left_trigger = 10; // -32768 to 32767
|
|
optional int32 right_trigger = 11; // -32768 to 32767
|
|
optional int32 dpad_x = 12; // -1, 0, or 1
|
|
optional int32 dpad_y = 13; // -1, 0, or 1
|
|
|
|
// Bitmask indicating which fields have changed
|
|
// Bit 0: button_changed_mask, Bit 1: left_stick_x, Bit 2: left_stick_y, etc.
|
|
optional uint32 changed_fields = 14;
|
|
}
|
|
|
|
/* WebRTC + signaling */
|
|
|
|
message RTCIceCandidateInit {
|
|
string candidate = 1;
|
|
optional uint32 sdpMLineIndex = 2;
|
|
optional string sdpMid = 3;
|
|
optional string usernameFragment = 4;
|
|
}
|
|
|
|
message RTCSessionDescriptionInit {
|
|
string sdp = 1;
|
|
string type = 2;
|
|
}
|
|
|
|
// ProtoICE message
|
|
message ProtoICE {
|
|
RTCIceCandidateInit candidate = 1;
|
|
}
|
|
|
|
// ProtoSDP message
|
|
message ProtoSDP {
|
|
RTCSessionDescriptionInit sdp = 1;
|
|
}
|
|
|
|
// ProtoRaw message
|
|
message ProtoRaw {
|
|
string data = 1;
|
|
}
|
|
|
|
// ProtoClientRequestRoomStream message
|
|
message ProtoClientRequestRoomStream {
|
|
string room_name = 1;
|
|
string session_id = 2;
|
|
}
|
|
|
|
// ProtoClientDisconnected message
|
|
message ProtoClientDisconnected {
|
|
string session_id = 1;
|
|
repeated int32 controller_slots = 2;
|
|
}
|
|
|
|
// ProtoServerPushStream message
|
|
message ProtoServerPushStream {
|
|
string room_name = 1;
|
|
}
|