Documentation ¶
Overview ¶
Package service contains various gRPC service implementations used by the voip server. Each one should implement both the generated and server.Service interfaces to be registered against the gRPC server.
Index ¶
- type Audio
- type Auth
- type ChannelRepository
- type Channels
- func (svc *Channels) Create(ctx context.Context, r *channel.CreateRequest) (*channel.CreateResponse, error)
- func (svc *Channels) Delete(ctx context.Context, r *channel.DeleteRequest) (*channel.DeleteResponse, error)
- func (svc *Channels) Join(ctx context.Context, r *channel.JoinRequest) (*channel.JoinResponse, error)
- func (svc *Channels) Leave(ctx context.Context, _ *channel.LeaveRequest) (*channel.LeaveResponse, error)
- func (svc *Channels) List(ctx context.Context, _ *channel.ListRequest) (*channel.ListResponse, error)
- func (svc *Channels) Register(svr *grpc.Server)
- func (svc *Channels) Users(ctx context.Context, r *channel.UsersRequest) (*channel.UsersResponse, error)
- type Switchboard
- type TokenManager
- type UserRepository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Audio ¶
type Audio struct {
// contains filtered or unexported fields
}
The Audio type is a server.Service implementation that handles streaming of audio to/from clients.
func NewAudioService ¶
func NewAudioService(sb Switchboard, channels ChannelRepository) *Audio
NewAudioService creates a new Audio instance that will use the provided switchboard implementation to direct audio data among clients.
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
The Auth type is a server.Service implementation that handles inbound gRPC calls regarding authorization of users.
func NewAuthService ¶
func NewAuthService(users UserRepository, tokens TokenManager) *Auth
NewAuthService creates a new Auth instance that uses the provided interface implementations to manage user data and generate authorization tokens.
func (*Auth) CreateUser ¶
func (svc *Auth) CreateUser(ctx context.Context, r *auth.CreateUserRequest) (*auth.CreateUserResponse, error)
CreateUser handles an inbound gRPC request that attempts to create a new user.
type ChannelRepository ¶
type ChannelRepository interface { List(ctx context.Context) ([]string, error) Create(ctx context.Context, name string) error Exists(ctx context.Context, name string) (bool, error) Delete(ctx context.Context, name string) error GetUserChannel(ctx context.Context, name string) (string, error) Users(ctx context.Context, name string) ([]string, error) Join(ctx context.Context, name, channel string) error Leave(ctx context.Context, user, name string) error }
The ChannelRepository interface describes types that can manage and query channels.
type Channels ¶
type Channels struct {
// contains filtered or unexported fields
}
The Channels type is a server.Service implementation that handles inbound gRPC request to manage audio channels that clients can use.
func NewChannelService ¶
func NewChannelService(channels ChannelRepository) *Channels
NewChannelService creates a new Channel instance that uses the provided repository implementation to persist/query channel data.
func (*Channels) Create ¶
func (svc *Channels) Create(ctx context.Context, r *channel.CreateRequest) (*channel.CreateResponse, error)
Create handles an inbound gRPC request to create a new channel.
func (*Channels) Delete ¶
func (svc *Channels) Delete(ctx context.Context, r *channel.DeleteRequest) (*channel.DeleteResponse, error)
Delete handles an inbound gRPC request to delete a channel.
func (*Channels) Join ¶
func (svc *Channels) Join(ctx context.Context, r *channel.JoinRequest) (*channel.JoinResponse, error)
Join handles an inbound gRPC request to move a user to a channel. This updates the servers reference of who is where, in order to move fully, the client must disconnect and reconnect their audio stream.
func (*Channels) Leave ¶
func (svc *Channels) Leave(ctx context.Context, _ *channel.LeaveRequest) (*channel.LeaveResponse, error)
Leave handles an inbound gRPC request to remove a user from a channel. On a successful response, the audio stream should be stopped by the client.
func (*Channels) List ¶
func (svc *Channels) List(ctx context.Context, _ *channel.ListRequest) (*channel.ListResponse, error)
List handles an inbound gRPC request to list all available channels.
type Switchboard ¶
type Switchboard interface {
Channel(name string) (*switchboard.Channel, error)
}
The Switchboard interface describes types that handle the in-memory switchboard to route audio data between clients.
type TokenManager ¶
The TokenManager interface describes types that can generate JWT tokens for use in client authorization.