Documentation ¶
Index ¶
- func Dial(stream proto.DRPCPeerBroker_NegotiateConnectionClient, ...) (*peer.Conn, error)
- func ProxyDial(client proto.DRPCPeerBrokerClient, options ProxyOptions) (io.Closer, error)
- func ProxyListen(ctx context.Context, connListener net.Listener, options ProxyOptions) error
- type ICEServersFunc
- type Listener
- type ProxyOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dial ¶
func Dial(stream proto.DRPCPeerBroker_NegotiateConnectionClient, iceServers []webrtc.ICEServer, opts *peer.ConnOptions) (*peer.Conn, error)
Dial consumes the PeerBroker gRPC connection negotiation stream to produce a WebRTC peered connection.
func ProxyDial ¶
func ProxyDial(client proto.DRPCPeerBrokerClient, options ProxyOptions) (io.Closer, error)
ProxyDial writes client negotiation streams over PubSub.
PubSub is used to geodistribute WebRTC handshakes. All negotiation messages are small in size (<=8KB), and we don't require delivery guarantees because connections can always be renegotiated.
┌────────────────────┐ ┌─────────────────────────────┐ │ coderd │ │ coderd │
┌─────────────────────┐ │/<agent-id>/connect │ │ /<agent-id>/listen │ │ client │ │ │ │ │ ┌─────┐ │ ├──►│Creates a stream ID │◄─►│Subscribe() to the <agent-id>│◄──┤agent│ │NegotiateConnection()│ │and Publish() to the│ │channel. Parse the stream ID │ └─────┘ └─────────────────────┘ │<agent-id> channel: │ │from payloads to create new │
│ │ │NegotiateConnection() streams│ │<stream-id><payload>│ │or write to existing ones. │ └────────────────────┘ └─────────────────────────────┘
func ProxyListen ¶
ProxyListen accepts client negotiation streams over PubSub and writes them to the listener as new NegotiateConnection() streams.
Types ¶
type ICEServersFunc ¶
ICEServersFunc returns ICEServers when a new connection is requested.
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
func Listen ¶
func Listen(connListener net.Listener, iceServersFunc ICEServersFunc, opts *peer.ConnOptions) (*Listener, error)
Listen consumes the transport as the server-side of the PeerBroker dRPC service. The Accept function must be serviced, or new connections will hang.