Documentation
¶
Index ¶
- Variables
- func ConfigurableDetection(ctx context.Context, streamURL string, config *Config) (common.StreamType, error)
- func DetectFromHeaders(ctx context.Context, client *http.Client, streamURL string) common.StreamType
- func DetectFromURL(streamURL string) common.StreamType
- func DetectType(ctx context.Context, client *http.Client, streamURL string) (common.StreamType, error)
- func DetectTypeWithConfig(ctx context.Context, streamURL string, config *Config) (common.StreamType, error)
- func IsValidICEcastContent(ctx context.Context, client *http.Client, streamURL string) bool
- func ParseICYTitle(icyTitle string) (artist, title string)
- func ProbeStream(ctx context.Context, client *http.Client, streamURL string) (*common.StreamMetadata, error)
- func ProbeStreamWithConfig(ctx context.Context, streamURL string, config *Config) (*common.StreamMetadata, error)
- type AudioConfig
- type AudioDownloader
- func (d *AudioDownloader) DownloadAudioSample(ctx context.Context, streamURL string, targetDuration time.Duration) (*common.AudioData, error)
- func (d *AudioDownloader) DownloadAudioSampleDirect(ctx context.Context, streamURL string, targetDuration time.Duration) (*common.AudioData, error)
- func (d *AudioDownloader) DownloadAudioSampleWithRetry(ctx context.Context, url string, targetDuration time.Duration, maxRetries int) (*common.AudioData, error)
- func (d *AudioDownloader) GetDownloadStats() *DownloadStats
- type AudioMetrics
- type Config
- type ConfigurableMetadataExtractor
- type CustomHeaderMapping
- type DetectionConfig
- type Detector
- type DownloadConfig
- type DownloadStats
- type HTTPConfig
- type Handler
- func (h *Handler) CanHandle(ctx context.Context, url string) bool
- func (h *Handler) Close() error
- func (h *Handler) Connect(ctx context.Context, url string) error
- func (h *Handler) GetAudioFormat() map[string]any
- func (h *Handler) GetBytesPerSecond() float64
- func (h *Handler) GetClient() *http.Client
- func (h *Handler) GetConfig() *Config
- func (h *Handler) GetConfiguredUserAgent() string
- func (h *Handler) GetConnectionTime() time.Duration
- func (h *Handler) GetCurrentICYTitle() string
- func (h *Handler) GetICYMetadataInterval() int
- func (h *Handler) GetMetadata() (*common.StreamMetadata, error)
- func (h *Handler) GetResponseHeaders() map[string]string
- func (h *Handler) GetStats() *common.StreamStats
- func (h *Handler) GetStreamInfo() map[string]any
- func (h *Handler) HasICYMetadata() bool
- func (h *Handler) IsConfigured() bool
- func (h *Handler) IsLive() bool
- func (h *Handler) ReadAudio(ctx context.Context) (*common.AudioData, error)
- func (h *Handler) ReadAudioWithDuration(ctx context.Context, duration time.Duration) (*common.AudioData, error)
- func (h *Handler) RefreshMetadata() error
- func (h *Handler) Type() common.StreamType
- func (h *Handler) UpdateConfig(config *Config)
- type HeaderMapping
- type MetadataExtractor
- func (me *MetadataExtractor) AddHeaderMapping(mapping HeaderMapping)
- func (me *MetadataExtractor) ExtractAudioInfo(metadata *common.StreamMetadata)
- func (me *MetadataExtractor) ExtractMetadata(headers http.Header, streamURL string) *common.StreamMetadata
- func (me *MetadataExtractor) GetHeaderMapping(headerKey string) (HeaderMapping, bool)
- func (me *MetadataExtractor) GetSupportedHeaders() []string
- func (me *MetadataExtractor) RemoveHeaderMapping(headerKey string) bool
- func (me *MetadataExtractor) UpdateWithICYMetadata(metadata *common.StreamMetadata, icyTitle string)
- func (me *MetadataExtractor) ValidateMetadata(metadata *common.StreamMetadata) []string
- type MetadataExtractorConfig
- type QueryParamRule
- type Validator
- func (v *Validator) GetConfig() *Config
- func (v *Validator) UpdateConfig(config *Config)
- func (v *Validator) ValidateAudio(data *common.AudioData) error
- func (v *Validator) ValidateConfiguration() error
- func (v *Validator) ValidateICEcastSpecific(ctx context.Context, streamURL string) error
- func (v *Validator) ValidateStream(ctx context.Context, handler common.StreamHandler) error
- func (v *Validator) ValidateURL(ctx context.Context, streamURL string) error
Constants ¶
This section is empty.
Variables ¶
var ( // Source stream URL - SkyView Networks MSNBC stream TestSRCStreamURL = "http://stream1.skyviewnetworks.com:8010/MSNBC" // CDN stream URL - TuneIn CDN stream TestCDNStreamURL = "https://tunein.cdnstream1.com/3511_96.mp3" // Additional test URLs for various scenarios // TODO: Replace with more real valid ICEcast URLs when available TestValidICEcastURLs = []string{ TestSRCStreamURL, TestCDNStreamURL, } // Invalid URLs for negative testing TestInvalidICEcastURLs = []string{ "not-a-url", "ftp://example.com/file.mp3", "https://example.com/file.m3u8", "https://example.com/video.mp4", "", "mailto:[email protected]", "file:///local/file.mp3", } // Sample HTTP headers for testing metadata extraction TestICEcastHeaders = map[string]string{ "icy-name": "Test Radio Station", "icy-genre": "Rock", "icy-description": "The best rock music 24/7", "icy-url": "https://testradio.example.com", "icy-br": "128", "icy-sr": "44100", "icy-channels": "2", "icy-metaint": "16000", "icy-pub": "1", "icy-notice1": "This stream requires a license", "icy-notice2": "SHOUTcast Distributed Network Audio Server", "icy-version": "2.4.4", "content-type": "audio/mpeg", "server": "Icecast 2.4.4", "connection": "close", "cache-control": "no-cache", "expires": "Mon, 26 Jul 1997 05:00:00 GMT", "pragma": "no-cache", } // Alternative MP3 headers for different test scenarios TestICEcastMP3Headers128 = map[string]string{ "icy-name": "MP3 Test Station 128k", "icy-genre": "Jazz", "icy-br": "128", "icy-sr": "44100", "icy-channels": "2", "content-type": "audio/mpeg", "server": "Icecast 2.4.4", } TestICEcastMP3Headers64 = map[string]string{ "icy-name": "MP3 Test Station 64k", "icy-genre": "Rock", "icy-br": "64", "icy-sr": "44100", "icy-channels": "2", "content-type": "audio/mp3", "server": "Icecast 2.4.4", } // Headers without ICY metadata TestBasicAudioHeaders = map[string]string{ "content-type": "audio/mpeg", "server": "Apache/2.4.41", "connection": "keep-alive", } // Sample ICY metadata strings for testing TestICYMetadataStrings = []string{ "StreamTitle='Artist - Song Title';", "StreamTitle='Madonna - Like a Prayer';StreamUrl='http://example.com';", "StreamTitle='The Beatles - Hey Jude';", "StreamTitle='';", "StreamTitle='Radio Station Jingle';StreamUrl='';", "StreamTitle='News Update - Breaking News';", "StreamTitle='Commercial Break';", "StreamTitle='Live DJ Set by DJ Name';", } // Sample raw MP3 audio data for testing (mock MP3 frame headers) TestMP3AudioData = []byte{ 0xFF, 0xFB, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, } // Another MP3 frame for testing TestMP3AudioData64k = []byte{ 0xFF, 0xFB, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, } // Mock PCM audio data (16-bit signed samples) TestPCMData = []float64{ 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.4, 0.3, 0.2, 0.1, 0.0, -0.1, -0.2, -0.3, -0.4, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 0.8, 0.6, 0.4, 0.2, 0.0, -0.2, -0.4, -0.6, -0.8, -1.0, -0.8, -0.6, -0.4, -0.2, } // Silent PCM data for testing silence detection TestSilentPCMData = []float64{ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, } // Sample content types for testing (MP3 only for now) TestValidContentTypes = []string{ "audio/mpeg", "audio/mp3", } // Invalid content types for testing TestInvalidContentTypes = []string{ "audio/aac", "audio/ogg", "application/ogg", "video/mp4", "text/html", "application/json", "image/jpeg", "text/plain", "application/xml", } // Sample server headers for ICEcast/SHOUTcast servers TestICEcastServerHeaders = []string{ "Icecast 2.4.4", "Icecast/2.4.4", "SHOUTcast Distributed Network Audio Server/v2.5.5", "SHOUTcast/v2.5.5", "Icecast 2.5.0", } )
Test URLs for ICEcast streams used across all test files
Functions ¶
func ConfigurableDetection ¶
func ConfigurableDetection(ctx context.Context, streamURL string, config *Config) (common.StreamType, error)
ConfigurableDetection provides a complete detection suite with configuration
func DetectFromHeaders ¶
func DetectFromHeaders(ctx context.Context, client *http.Client, streamURL string) common.StreamType
DetectFromHeaders matches the HTTP headers with common ICEcast patterns (backward compatibility)
func DetectFromURL ¶
func DetectFromURL(streamURL string) common.StreamType
DetectFromURL matches the URL with common ICEcast patterns (backward compatibility)
func DetectType ¶
func DetectType(ctx context.Context, client *http.Client, streamURL string) (common.StreamType, error)
DetectType determines if the stream is ICEcast using URL patterns and headers
func DetectTypeWithConfig ¶
func DetectTypeWithConfig(ctx context.Context, streamURL string, config *Config) (common.StreamType, error)
DetectTypeWithConfig determines if the stream is ICEcast using full configuration
func IsValidICEcastContent ¶
IsValidICEcastContent checks if the content appears to be valid ICEcast (backward compatibility)
func ParseICYTitle ¶
ParseICYTitle parses ICY stream title metadata (format: "Artist - Title")
func ProbeStream ¶
func ProbeStream(ctx context.Context, client *http.Client, streamURL string) (*common.StreamMetadata, error)
ProbeStream performs a lightweight probe to gather ICEcast stream metadata
func ProbeStreamWithConfig ¶
func ProbeStreamWithConfig(ctx context.Context, streamURL string, config *Config) (*common.StreamMetadata, error)
ProbeStreamWithConfig performs a probe with full configuration control ProbeStreamWithConfig probes an ICEcast stream to detect audio properties Priority order: FFprobe > HTTP headers > config defaults
Types ¶
type AudioConfig ¶
type AudioConfig struct {
BufferSize int `json:"buffer_size"`
SampleDuration time.Duration `json:"sample_duration"`
MaxReadAttempts int `json:"max_read_attempts"`
ReadTimeout time.Duration `json:"read_timeout"`
HandleICYMeta bool `json:"handle_icy_meta"`
MetadataInterval int `json:"metadata_interval"`
}
AudioConfig holds audio-specific configuration for ICEcast
type AudioDownloader ¶
type AudioDownloader struct {
// contains filtered or unexported fields
}
AudioDownloader handles continuous streaming download from ICEcast servers
func NewAudioDownloader ¶
func NewAudioDownloader(config *Config) *AudioDownloader
NewAudioDownloader creates a new ICEcast audio downloader optimized for live streaming
func (*AudioDownloader) DownloadAudioSample ¶
func (d *AudioDownloader) DownloadAudioSample(ctx context.Context, streamURL string, targetDuration time.Duration) (*common.AudioData, error)
DownloadAudioSample downloads a continuous stream of audio for the specified duration
func (*AudioDownloader) DownloadAudioSampleDirect ¶
func (d *AudioDownloader) DownloadAudioSampleDirect(ctx context.Context, streamURL string, targetDuration time.Duration) (*common.AudioData, error)
DownloadAudioSampleDirect downloads ICEcast audio using FFmpeg directly with reconnection This bypasses all the complex ICEcast parsing and uses FFmpeg's native streaming support
func (*AudioDownloader) DownloadAudioSampleWithRetry ¶
func (d *AudioDownloader) DownloadAudioSampleWithRetry(ctx context.Context, url string, targetDuration time.Duration, maxRetries int) (*common.AudioData, error)
DownloadAudioSampleWithRetry downloads audio with automatic retry logic (legacy method)
func (*AudioDownloader) GetDownloadStats ¶
func (d *AudioDownloader) GetDownloadStats() *DownloadStats
GetDownloadStats returns the current download statistics
type AudioMetrics ¶
type AudioMetrics struct {
SamplesDecoded int64 `json:"samples_decoded"`
DecodedDuration float64 `json:"decoded_duration_seconds"`
AverageAmplitude float64 `json:"average_amplitude"`
PeakAmplitude float64 `json:"peak_amplitude"`
SilenceRatio float64 `json:"silence_ratio"`
ClippingDetected bool `json:"clipping_detected"`
}
AudioMetrics contains audio processing statistics
type Config ¶
type Config struct {
MetadataExtractor *MetadataExtractorConfig `json:"metadata_extractor"`
Detection *DetectionConfig `json:"detection"`
HTTP *HTTPConfig `json:"http"`
Audio *AudioConfig `json:"audio"`
AudioDecoder common.AudioDecoder `json:"-"` // nonserializable
}
Config holds configuration for ICEcast processing
func ConfigFromAppConfig ¶
ConfigFromAppConfig creates an ICEcast config from application config This allows ICEcast library to remain a standalone library while integrating with the main app
func ConfigFromMap ¶
ConfigFromMap creates an ICEcast config from a map (useful for testing and flexibility)
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns the default ICEcast configuration
func (*Config) GetHTTPHeaders ¶
GetHTTPHeaders returns all HTTP headers that should be set for requests
type ConfigurableMetadataExtractor ¶
type ConfigurableMetadataExtractor struct {
*MetadataExtractor
// contains filtered or unexported fields
}
ConfigurableMetadataExtractor is a metadata extractor that can be configured
func NewConfigurableMetadataExtractor ¶
func NewConfigurableMetadataExtractor(config *MetadataExtractorConfig) *ConfigurableMetadataExtractor
NewConfigurableMetadataExtractor creates a configurable metadata extractor
func (*ConfigurableMetadataExtractor) ExtractMetadata ¶
func (cme *ConfigurableMetadataExtractor) ExtractMetadata(headers http.Header, streamURL string) *common.StreamMetadata
ExtractMetadata extracts metadata with configuration overrides
type CustomHeaderMapping ¶
type CustomHeaderMapping struct {
HeaderKey string `json:"header_key"`
MetadataKey string `json:"metadata_key"`
Transform string `json:"transform"`
Description string `json:"description"`
}
CustomHeaderMapping defines a custom header mapping for configuration
type DetectionConfig ¶
type DetectionConfig struct {
URLPatterns []string `json:"url_patterns"`
ContentTypes []string `json:"content_types"`
RequiredHeaders []string `json:"required_headers"`
TimeoutSeconds int `json:"timeout_seconds"`
CommonPorts []string `json:"common_ports"`
}
DetectionConfig holds configuration for stream detection
type Detector ¶
type Detector struct {
// contains filtered or unexported fields
}
Detector handles ICEcast stream detection with configurable options
func NewDetector ¶
func NewDetector() *Detector
NewDetector creates a new ICEcast detector with default configuration
func NewDetectorWithConfig ¶
func NewDetectorWithConfig(config *DetectionConfig) *Detector
NewDetectorWithConfig creates a new ICEcast detector with custom configuration
func (*Detector) DetectFromHeaders ¶
func (d *Detector) DetectFromHeaders(ctx context.Context, streamURL string, httpConfig *HTTPConfig) common.StreamType
DetectFromHeaders matches the HTTP headers with configured ICEcast patterns
func (*Detector) DetectFromURL ¶
func (d *Detector) DetectFromURL(streamURL string) common.StreamType
DetectFromURL matches the URL with configured ICEcast patterns
func (*Detector) IsValidICEcastContent ¶
func (d *Detector) IsValidICEcastContent(ctx context.Context, streamURL string, httpConfig *HTTPConfig) bool
IsValidICEcastContent checks if the content appears to be valid ICEcast audio stream
type DownloadConfig ¶
type DownloadConfig struct {
MaxSegments int `json:"max_segments"`
SegmentTimeout time.Duration `json:"segment_timeout"`
MaxRetries int `json:"max_retries"`
TargetDuration time.Duration `json:"target_duration"`
PreferredBitrate int `json:"preferred_bitrate"`
OutputSampleRate int `json:"output_sample_rate"`
OutputChannels int `json:"output_channels"`
NormalizePCM bool `json:"normalize_pcm"`
ResampleQuality string `json:"resample_quality"`
CleanupTempFiles bool `json:"cleanup_temp_files"`
// ICEcast specific settings
InitialTimeout time.Duration `json:"initial_timeout"` // Timeout for first byte
StreamReadTimeout time.Duration `json:"stream_read_timeout"` // Timeout for individual reads
ConnectionKeepAlive time.Duration `json:"connection_keep_alive"` // Keep connection alive
MaxReconnectAttempts int `json:"max_reconnect_attempts"` // Max reconnection attempts
ReconnectDelay time.Duration `json:"reconnect_delay"` // Delay between reconnects
// Query parameter configuration
QueryParamRules []QueryParamRule `json:"query_param_rules"` // Rules for adding query parameters
GlobalQueryParams map[string]string `json:"global_query_params"` // Query parameters to add to all requests
}
DownloadConfig contains configuration for audio downloading
func DefaultDownloadConfig ¶
func DefaultDownloadConfig() *DownloadConfig
DefaultDownloadConfig returns default download configuration optimized for ICEcast
func DefaultSoundstackConfig ¶
func DefaultSoundstackConfig() *DownloadConfig
DefaultSoundstackConfig returns a config with soundstack/adzwizz query parameters
type DownloadStats ¶
type DownloadStats struct {
SegmentsDownloaded int `json:"segments_downloaded"`
BytesDownloaded int64 `json:"bytes_downloaded"`
DownloadTime time.Duration `json:"download_time"`
DecodeTime time.Duration `json:"decode_time"`
ErrorCount int `json:"error_count"`
AverageBitrate float64 `json:"average_bitrate"`
AudioMetrics *AudioMetrics `json:"audio_metrics,omitempty"`
// ICEcast specific stats
ConnectionAttempts int `json:"connection_attempts"`
TimeToFirstByte time.Duration `json:"time_to_first_byte"`
Reconnections int `json:"reconnections"`
LiveStartTime *time.Time `json:"live_start_time,omitempty"`
}
DownloadStats tracks download performance
type HTTPConfig ¶
type HTTPConfig struct {
UserAgent string `json:"user_agent"`
AcceptHeader string `json:"accept_header"`
ConnectionTimeout time.Duration `json:"connection_timeout"`
ReadTimeout time.Duration `json:"read_timeout"`
MaxRedirects int `json:"max_redirects"`
CustomHeaders map[string]string `json:"custom_headers"`
RequestICYMeta bool `json:"request_icy_meta"`
}
HTTPConfig holds HTTP-related configuration for ICEcast
func (*HTTPConfig) GetHTTPHeaders ¶
func (httpConfig *HTTPConfig) GetHTTPHeaders() map[string]string
GetHTTPHeaders returns configured HTTP headers for ICEcast requests
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler implements StreamHandler for ICEcast streams with full configuration support
func NewHandler ¶
func NewHandler() *Handler
NewHandler creates a new ICEcast stream handler with default configuration
func NewHandlerWithConfig ¶
NewHandlerWithConfig creates a new ICEcast stream handler with custom configuration
func (*Handler) GetAudioFormat ¶
GetAudioFormat returns the detected audio format information
func (*Handler) GetBytesPerSecond ¶
GetBytesPerSecond returns the current bytes per second rate
func (*Handler) GetConfiguredUserAgent ¶
GetConfiguredUserAgent returns the configured user agent
func (*Handler) GetConnectionTime ¶
GetConnectionTime returns the time elapsed since connection
func (*Handler) GetCurrentICYTitle ¶
GetCurrentICYTitle returns the current ICY title from metadata
func (*Handler) GetICYMetadataInterval ¶
GetICYMetadataInterval returns the ICY metadata interval
func (*Handler) GetMetadata ¶
func (h *Handler) GetMetadata() (*common.StreamMetadata, error)
GetMetadata retrieves stream metadata
func (*Handler) GetResponseHeaders ¶
GetResponseHeaders returns the HTTP response headers from the stream connection
func (*Handler) GetStats ¶
func (h *Handler) GetStats() *common.StreamStats
GetStats returns current streaming statistics
func (*Handler) GetStreamInfo ¶
GetStreamInfo returns detailed information about the current stream
func (*Handler) HasICYMetadata ¶
HasICYMetadata returns true if the stream supports ICY metadata
func (*Handler) IsConfigured ¶
IsConfigured returns true if the handler has a non-default configuration
func (*Handler) IsLive ¶
IsLive returns whether this appears to be a live stream (always true for ICEcast)
func (*Handler) ReadAudioWithDuration ¶
func (*Handler) RefreshMetadata ¶
RefreshMetadata manually refreshes metadata from headers (useful for live streams)
func (*Handler) Type ¶
func (h *Handler) Type() common.StreamType
Type returns the stream type for this handler
func (*Handler) UpdateConfig ¶
UpdateConfig updates the handler configuration
type HeaderMapping ¶
type HeaderMapping struct {
HeaderKey string
MetadataKey string
Transformer func(value string) any
}
HeaderMapping defines how to extract metadata from HTTP headers
type MetadataExtractor ¶
type MetadataExtractor struct {
// contains filtered or unexported fields
}
MetadataExtractor handles extraction of metadata from ICEcast streams
func NewMetadataExtractor ¶
func NewMetadataExtractor() *MetadataExtractor
NewMetadataExtractor creates a new metadata extractor with default mappings
func (*MetadataExtractor) AddHeaderMapping ¶
func (me *MetadataExtractor) AddHeaderMapping(mapping HeaderMapping)
AddHeaderMapping adds a new header mapping for metadata extraction
func (*MetadataExtractor) ExtractAudioInfo ¶
func (me *MetadataExtractor) ExtractAudioInfo(metadata *common.StreamMetadata)
ExtractAudioInfo attempts to extract audio info from icy-audio-info header
func (*MetadataExtractor) ExtractMetadata ¶
func (me *MetadataExtractor) ExtractMetadata(headers http.Header, streamURL string) *common.StreamMetadata
ExtractMetadata extracts comprehensive metadata from ICEcast headers and URL
func (*MetadataExtractor) GetHeaderMapping ¶
func (me *MetadataExtractor) GetHeaderMapping(headerKey string) (HeaderMapping, bool)
GetHeaderMapping returns the mapping for a specific header key
func (*MetadataExtractor) GetSupportedHeaders ¶
func (me *MetadataExtractor) GetSupportedHeaders() []string
GetSupportedHeaders returns a list of all supported ICEcast headers
func (*MetadataExtractor) RemoveHeaderMapping ¶
func (me *MetadataExtractor) RemoveHeaderMapping(headerKey string) bool
RemoveHeaderMapping removes a header mapping by header key
func (*MetadataExtractor) UpdateWithICYMetadata ¶
func (me *MetadataExtractor) UpdateWithICYMetadata(metadata *common.StreamMetadata, icyTitle string)
UpdateWithICYMetadata updates metadata with ICY stream title information
func (*MetadataExtractor) ValidateMetadata ¶
func (me *MetadataExtractor) ValidateMetadata(metadata *common.StreamMetadata) []string
ValidateMetadata performs basic validation on extracted metadata
type MetadataExtractorConfig ¶
type MetadataExtractorConfig struct {
EnableHeaderMappings bool `json:"enable_header_mappings"`
EnableICYMetadata bool `json:"enable_icy_metadata"`
CustomHeaderMappings []CustomHeaderMapping `json:"custom_header_mappings"`
DefaultValues map[string]any `json:"default_values"`
ICYMetadataTimeout time.Duration `json:"icy_metadata_timeout"`
}
MetadataExtractorConfig holds configuration for metadata extraction
type QueryParamRule ¶
type QueryParamRule struct {
HostPatterns []string `json:"host_patterns"` // Host patterns to match (e.g., "cdnstream1.com", "soundstack", "adzwizz")
PathPatterns []string `json:"path_patterns"` // Path patterns to match (optional)
QueryParams map[string]string `json:"query_params"` // Query parameters to add
}
QueryParamRule defines when and what query parameters to add
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator implements StreamValidator interface for ICEcast streams
func NewValidator ¶
func NewValidator() *Validator
NewValidator creates a new ICEcast validator with default configuration
func NewValidatorWithConfig ¶
NewValidatorWithConfig creates a new ICEcast validator with custom configuration
func (*Validator) UpdateConfig ¶
UpdateConfig updates the validator's configuration
func (*Validator) ValidateAudio ¶
ValidateAudio validates audio data quality for ICEcast
func (*Validator) ValidateConfiguration ¶
ValidateConfiguration validates the validator's own configuration
func (*Validator) ValidateICEcastSpecific ¶
ValidateICEcastSpecific performs ICEcast-specific validation checks
func (*Validator) ValidateStream ¶
ValidateStream validates ICEcast stream content and format