Documentation
¶
Overview ¶
Package grpc implements a signaling backend using a central gRPC service
Index ¶
- Constants
- func NewBackend(cfg *signaling.BackendConfig, logger *log.Logger) (signaling.Backend, error)
- func NewServer(opts ...grpc.ServerOption) (*grpc.Server, error)
- func ParseURL(urlStr string) (string, []grpc.DialOption, error)
- type Backend
- func (b *Backend) Close() error
- func (b *Backend) Publish(ctx context.Context, kp *crypto.KeyPair, msg *signaling.Message) error
- func (b *Backend) Subscribe(ctx context.Context, kp *crypto.KeyPair, h signaling.MessageHandler) (bool, error)
- func (b *Backend) Type() signalingproto.BackendType
- func (b *Backend) Unsubscribe(ctx context.Context, kp *crypto.KeyPair, h signaling.MessageHandler) (bool, error)
- type BackendConfig
- type RelayAPIServer
- type RelayInfo
- type Server
- type Topic
Constants ¶
View Source
const (
DefaultRelayTTL = 1 * time.Hour
)
Variables ¶
This section is empty.
Functions ¶
func NewBackend ¶
Types ¶
type Backend ¶
type Backend struct {
signaling.SubscriptionsRegistry
// contains filtered or unexported fields
}
func (*Backend) Type ¶
func (b *Backend) Type() signalingproto.BackendType
type BackendConfig ¶
type BackendConfig struct {
signaling.BackendConfig
Target string
Options []grpc.DialOption
}
func (*BackendConfig) Parse ¶
func (c *BackendConfig) Parse(cfg *signaling.BackendConfig) (err error)
type RelayAPIServer ¶
type RelayAPIServer struct {
signalingproto.UnimplementedRelayRegistryServer
*grpc.Server
// contains filtered or unexported fields
}
func NewRelayAPIServer ¶
func NewRelayAPIServer(relays []RelayInfo, opts ...grpc.ServerOption) (*RelayAPIServer, error)
func (*RelayAPIServer) Close ¶
func (s *RelayAPIServer) Close() error
func (*RelayAPIServer) GetRelays ¶
func (s *RelayAPIServer) GetRelays(_ context.Context, params *signalingproto.GetRelaysParams) (*signalingproto.GetRelaysResp, error)
type RelayInfo ¶
type RelayInfo struct {
URL string
Realm string
Username string
Password string
TTL time.Duration
Secret string
}
func NewRelayInfo ¶
func NewRelayInfos ¶
type Server ¶
type Server struct {
signalingproto.UnimplementedSignalingServer
*grpc.Server
// contains filtered or unexported fields
}
func NewSignalingServer ¶
func NewSignalingServer(opts ...grpc.ServerOption) *Server
func (*Server) GetBuildInfo ¶
func (*Server) Subscribe ¶
func (s *Server) Subscribe(params *signalingproto.SubscribeParams, stream signalingproto.Signaling_SubscribeServer) error
type Topic ¶
type Topic struct {
// contains filtered or unexported fields
}
func (*Topic) Unsubscribe ¶
Click to show internal directories.
Click to hide internal directories.