Files
coder/peerbroker/proto/peerbroker.proto
T
Kyle Carberry 9db5fb0952 refactor: Improve handshake resiliency of peer (#95)
* fix: Synchronize peer logging with a channel

We were depending on the close mutex to properly
report connection state. This ensures the RTC
connection is properly closed before returning.

* Disable pion logging

* Remove buffer

* Try ICE servers

* Remove flushed

* Add diagram explaining handshake

* Fix candidate accept ordering

* Add debug logging to peerbroker

* Fix send ordering

* Lock adding ICE candidate

* Add test for negotiating out of order

* Reduce connection to a single negotiation channel

* Improve test times by pre-installing Terraform

* Lock remote session description being applied

* Organize conn

* Revert to multi-channel setup

* Properly close ICE gatherer

* Improve comments

* Try removing buffered candidates

* Buffer local and remote messages

* Log dTLS transport state

* Add pion logging
2022-01-30 20:11:18 -06:00

48 lines
1.4 KiB
Protocol Buffer

syntax = "proto3";
option go_package = "github.com/coder/coder/peerbroker/proto";
package peerbroker;
message WebRTCSessionDescription {
int32 sdp_type = 1;
string sdp = 2;
}
message WebRTCICEServer {
repeated string urls = 1;
string username = 2;
string credential = 3;
int32 credential_type = 4;
}
message WebRTCICEServers {
repeated WebRTCICEServer servers = 1;
}
message NegotiateConnection {
message ClientToServer {
oneof message {
WebRTCICEServers servers = 1;
WebRTCSessionDescription offer = 2;
string ice_candidate = 3;
}
}
message ServerToClient {
oneof message {
WebRTCSessionDescription answer = 1;
string ice_candidate = 2;
}
}
}
// PeerBroker mediates WebRTC connection signaling.
service PeerBroker {
// NegotiateConnection establishes a bidirectional stream to negotiate a new WebRTC connection.
// 1. Client sends WebRTCSessionDescription and WebRTCICEServers to the server.
// 2. Server sends WebRTCSessionDescription to the client, exchanging encryption keys.
// 3. Client<->Server exchange ICE Candidates to establish a peered connection.
//
// See: https://davekilian.com/webrtc-the-hard-way.html
rpc NegotiateConnection(stream NegotiateConnection.ClientToServer) returns (stream NegotiateConnection.ServerToClient);
}