add: signal server

This commit is contained in:
Charles Hathaway
2023-09-20 22:09:15 -07:00
parent 922ba64a84
commit 9bbe917e59
25 changed files with 5097 additions and 3 deletions
+60 -1
View File
@@ -1,6 +1,9 @@
syntax = "proto3";
package signaler;
service SignalerService {
rpc CreateAuthToken(CreateAuthTokenRequest) returns (AuthToken);
rpc ListCameras(ListCamerasRequest) returns (ListCamerasResponse);
// CreateSession creates a new session that can be seen bv the provided Camera and Peer.
@@ -15,6 +18,34 @@ service SignalerService {
// TODO: it would be better if we could alert a camera to poll for sessions
// i.e., with websockets (or streaming RPCs).
rpc ListSessions(ListSessionsRequest) returns (ListSessionsResponse);
// CreateIceCandidate adds the provided candidate to the list of candidates.
rpc CreateIceCandidate(CreateIceCandidateRequest) returns (IceCandidate);
// PopIceCandidate delete a candidate from the list of candidates and returns it.
//
// If there are no candidates, this blocks until one becomes available.
rpc PopIceCandidate(PopIceCandidateRequest) returns (IceCandidate);
rpc CreateIceSessionDescription(CreateIceSessionDescriptionRequest) returns (IceSessionDescription);
rpc PopIceSessionDescription(PopIceSessionDescriptionRequest) returns (IceSessionDescription);
}
message CreateAuthTokenRequest{
// Homes this auth token should be registered too.
string home = 1;
message Camera {
// Used to uniquely identifier this camera so clients can open
// sessions with it.
string id = 1;
}
message Client {}
oneof type {
Camera camera = 2;
Client client = 3;
}
}
message ListCamerasRequest {}
@@ -41,6 +72,30 @@ message UpdateSessionRequest {
bool wait_for_update = 2;
}
message ListSessionsRequest {}
message ListSessionsResponse {
repeated Session sessions = 1;
}
message CreateIceCandidateRequest {
Session.Identifier session_identifier = 1;
IceCandidate candidate = 2;
}
message PopIceCandidateRequest {
Session.Identifier session_identifier = 1;
}
message CreateIceSessionDescriptionRequest {
Session.Identifier session_identifier = 1;
IceSessionDescription description = 2;
}
message PopIceSessionDescriptionRequest {
Session.Identifier session_identifier = 1;
}
message Camera {
message Identifier {
string id = 1;
@@ -58,7 +113,7 @@ message IceCandidate {
message IceSessionDescription {
// Copied from https://pkg.go.dev/github.com/pion/webrtc/v4#SessionDescription
int sdp_type = 1;
int64 sdp_type = 1;
string sdp = 2;
}
@@ -73,4 +128,8 @@ message Session {
IceSessionDescription camera_offer = 5;
IceSessionDescription client_answer = 6;
}
message AuthToken {
string token = 1;
}