tracker

package
v0.0.0-...-e61f6d1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2025 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UpdateListenersTickrate is the period between two UpdateListeners
	// calls done to the manager
	UpdateListenersTickrate = time.Second * 10
	// SyncListenersTickrate is the period between two sync operations
	SyncListenersTickrate = time.Minute * 10

	RemoveStaleTickrate = time.Hour * 24
	RemoveStalePeriod   = time.Minute * 5

	HttpLn      = "tracker.http"
	GrpcLn      = "tracker.grpc"
	TrackerFile = "tracker.listeners"

	ICECAST_AUTH_HEADER         = "icecast-auth-user"
	ICECAST_CLIENTID_FIELD_NAME = "client"
)

Variables

This section is empty.

Functions

func Execute

func Execute(ctx context.Context, cfg config.Config) error

func GetIcecastListClients

func GetIcecastListClients(ctx context.Context, cfg config.Config) ([]radio.Listener, error)

func IcecastRealIP

func IcecastRealIP(r *http.Request) string

IcecastRealIP recovers the clients real ip address from the request

This looks for X-Forwarded-For, X-Real-IP and True-Client-IP

func ListenerAdd

func ListenerAdd(ctx context.Context, recorder *Recorder) http.HandlerFunc

func ListenerRemove

func ListenerRemove(ctx context.Context, recorder *Recorder) http.HandlerFunc

func NewListener

func NewListener(id radio.ListenerClientID, req *http.Request) radio.Listener

func ParseListClientsXML

func ParseListClientsXML(r io.Reader) ([]radio.Listener, error)

func RemoveIcecastClient

func RemoveIcecastClient(ctx context.Context, cfg config.Config, id radio.ListenerClientID) error

Types

type Icestats

type Icestats struct {
	XMLName xml.Name `xml:"icestats"`
	Text    string   `xml:",chardata"`
	Source  struct {
		Text      string `xml:",chardata"`
		Mount     string `xml:"mount,attr"`
		Listeners string `xml:"Listeners"`
		Listener  []struct {
			Text      string `xml:",chardata"`
			IP        string `xml:"IP"`
			UserAgent string `xml:"UserAgent"`
			Connected string `xml:"Connected"`
			ID        string `xml:"ID"`
		} `xml:"listener"`
	} `xml:"source"`
}

type Listener

type Listener struct {
	radio.Listener
	Removed     bool
	RemovedTime time.Time
}

type Recorder

type Recorder struct {
	// contains filtered or unexported fields
}

func NewRecorder

func NewRecorder(ctx context.Context, cfg config.Config) *Recorder

func (*Recorder) ListClients

func (r *Recorder) ListClients(ctx context.Context) ([]radio.Listener, error)

func (*Recorder) ListenerAdd

func (r *Recorder) ListenerAdd(ctx context.Context, listener radio.Listener)

func (*Recorder) ListenerAmount

func (r *Recorder) ListenerAmount() int64

func (*Recorder) ListenerRemove

func (r *Recorder) ListenerRemove(ctx context.Context, id radio.ListenerClientID)

func (*Recorder) MarshalJSON

func (r *Recorder) MarshalJSON() ([]byte, error)

func (*Recorder) PeriodicallyRemoveStale

func (r *Recorder) PeriodicallyRemoveStale(ctx context.Context, tickrate time.Duration)

func (*Recorder) RemoveClient

func (r *Recorder) RemoveClient(ctx context.Context, id radio.ListenerClientID) error

func (*Recorder) Sync

func (r *Recorder) Sync(ctx context.Context, other []radio.Listener)

func (*Recorder) UnmarshalJSON

func (r *Recorder) UnmarshalJSON(p []byte) error

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(ctx context.Context, cfg config.Config) *Server

func (*Server) Close

func (s *Server) Close() error

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

func (*Server) Start

func (s *Server) Start(ctx context.Context, fds *fdstore.Store) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL