Documentation ¶
Index ¶
- func Execute(ctx context.Context, cfg config.Config) error
- func GetMountpoint(r *http.Request) string
- func IdentifierMiddleware(next http.Handler) http.Handler
- func ToUTF8(ctx context.Context, charset, meta string) string
- type EventHandler
- type Identifier
- type Metadata
- type MetadataWriter
- type Mount
- func (m *Mount) AddSource(ctx context.Context, source *SourceClient)
- func (m *Mount) Close() error
- func (m *Mount) RemoveSource(ctx context.Context, id SourceID)
- func (m *Mount) RunMountSourceClient(ctx context.Context, msc *MountSourceClient)
- func (m *Mount) SendMetadata(ctx context.Context, meta *Metadata)
- func (m *Mount) Write(b []byte) (n int, err error)
- type MountMetadataWriter
- func (mmw *MountMetadataWriter) GetLive() bool
- func (mmw *MountMetadataWriter) SendMetadata(ctx context.Context, meta *Metadata)
- func (mmw *MountMetadataWriter) SetLive(ctx context.Context, live bool)
- func (mmw *MountMetadataWriter) SetWriter(new io.Writer)
- func (mmw *MountMetadataWriter) Write(p []byte) (n int, err error)
- type MountSourceClient
- type ProxyManager
- func (pm *ProxyManager) AddSourceClient(source *SourceClient) error
- func (pm *ProxyManager) MarshalJSON() ([]byte, error)
- func (pm *ProxyManager) Metadata(identifier Identifier) *Metadata
- func (pm *ProxyManager) RemoveMount(mount *Mount)
- func (pm *ProxyManager) SendMetadata(ctx context.Context, metadata *Metadata) error
- func (pm *ProxyManager) UnmarshalJSON(b []byte) error
- type Server
- func (s *Server) Close() error
- func (s *Server) GetListClients(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetMetadata(w http.ResponseWriter, r *http.Request)
- func (s *Server) PutSource(w http.ResponseWriter, r *http.Request)
- func (srv *Server) Start(ctx context.Context, fdstorage *fdstore.Store) error
- type SourceClient
- type SourceID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetMountpoint ¶
Types ¶
type EventHandler ¶
type EventHandler struct {
// contains filtered or unexported fields
}
func NewEventHandler ¶
func NewEventHandler(ctx context.Context, cfg config.Config) *EventHandler
type Identifier ¶
type Identifier uint64
func IdentFromRequest ¶
func IdentFromRequest(r *http.Request) Identifier
type MetadataWriter ¶
type Mount ¶
type Mount struct { // ContentType of this mount, this can only be set during creation and all // future clients afterwards will use the same content type ContentType string `json:"content-type"` // Name of the mountpoint Name string `json:"name"` // Conn is the conn to the icecast server Conn *util.TypedValue[net.Conn] `json:"-"` // Sources is the different sources of audio data, the mount // broadcasts the data of the first entry and voids the others SourcesMu *sync.RWMutex `json:"-"` Sources []*MountSourceClient `json:"-"` // contains filtered or unexported fields }
func (*Mount) RunMountSourceClient ¶
func (m *Mount) RunMountSourceClient(ctx context.Context, msc *MountSourceClient)
func (*Mount) SendMetadata ¶
SendMetadata finds the source associated with this metadata and updates their internal metadata. This does no transmission of metadata to the master server.
type MountMetadataWriter ¶
type MountMetadataWriter struct { // metadata is the last metadata we send (or tried to send) Metadata string // live indicates if we are the live writer, actually writing to the master Live bool // out is the writer we write into Out io.Writer // contains filtered or unexported fields }
func (*MountMetadataWriter) GetLive ¶
func (mmw *MountMetadataWriter) GetLive() bool
func (*MountMetadataWriter) SendMetadata ¶
func (mmw *MountMetadataWriter) SendMetadata(ctx context.Context, meta *Metadata)
func (*MountMetadataWriter) SetLive ¶
func (mmw *MountMetadataWriter) SetLive(ctx context.Context, live bool)
func (*MountMetadataWriter) SetWriter ¶
func (mmw *MountMetadataWriter) SetWriter(new io.Writer)
type MountSourceClient ¶
type MountSourceClient struct { // Source is the SourceClient we're handling, should not be mutated by // anything once the MountSourceClient is made Source *SourceClient // Priority is the Priority for live-ness determination // lower is higher Priority Priority uint // MW is the writer this source is writing to MW *MountMetadataWriter // contains filtered or unexported fields }
MountSourceClient is a SourceClient with extra fields for mount-specific bookkeeping
func (*MountSourceClient) GoLive ¶
func (msc *MountSourceClient) GoLive(ctx context.Context, out MetadataWriter)
type ProxyManager ¶
type ProxyManager struct {
// contains filtered or unexported fields
}
func NewProxyManager ¶
func NewProxyManager(ctx context.Context, cfg config.Config, uss radio.UserStorageService, eh *EventHandler) (*ProxyManager, error)
func (*ProxyManager) AddSourceClient ¶
func (pm *ProxyManager) AddSourceClient(source *SourceClient) error
func (*ProxyManager) MarshalJSON ¶
func (pm *ProxyManager) MarshalJSON() ([]byte, error)
func (*ProxyManager) Metadata ¶
func (pm *ProxyManager) Metadata(identifier Identifier) *Metadata
func (*ProxyManager) RemoveMount ¶
func (pm *ProxyManager) RemoveMount(mount *Mount)
func (*ProxyManager) SendMetadata ¶
func (pm *ProxyManager) SendMetadata(ctx context.Context, metadata *Metadata) error
func (*ProxyManager) UnmarshalJSON ¶
func (pm *ProxyManager) UnmarshalJSON(b []byte) error
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(ctx context.Context, cfg config.Config, manager radio.ManagerService, uss radio.UserStorageService) (*Server, error)
func (*Server) GetListClients ¶
func (s *Server) GetListClients(w http.ResponseWriter, r *http.Request)
func (*Server) GetMetadata ¶
func (s *Server) GetMetadata(w http.ResponseWriter, r *http.Request)
type SourceClient ¶
type SourceClient struct { ID SourceID // UserAgent is the User-Agent HTTP header passed by the client UserAgent string // ContentType is the Content-Type HTTP header passed by the client ContentType string // MountName is the mount this client is trying to stream to MountName string // User is the user that is trying to stream User radio.User // Identifier is an identifier that should be the same between two // different requests, but same mountpoint and user. This is to match-up // metadata information Identifier Identifier // Metadata is a pointer to the last Metadata received for this client Metadata *atomic.Pointer[Metadata] // contains filtered or unexported fields }
func NewSourceClient ¶
func NewSourceClient(id SourceID, ua, ct, mount string, conn net.Conn, user radio.User, identifier Identifier, metadata *Metadata) *SourceClient
Source Files ¶
Click to show internal directories.
Click to hide internal directories.