-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathinterceptor_option.go
More file actions
78 lines (65 loc) · 2.38 KB
/
interceptor_option.go
File metadata and controls
78 lines (65 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// SPDX-FileCopyrightText: 2026 The Pion community <https://pion.ly>
// SPDX-License-Identifier: MIT
//go:build !js
package webrtc
import (
"github.com/pion/interceptor/pkg/nack"
"github.com/pion/interceptor/pkg/report"
"github.com/pion/interceptor/pkg/stats"
"github.com/pion/interceptor/pkg/twcc"
"github.com/pion/logging"
)
// interceptorOptions contains options for configuring interceptors.
type interceptorOptions struct {
loggerFactory logging.LoggerFactory
nackGeneratorOptions []nack.GeneratorOption
nackResponderOptions []nack.ResponderOption
reportReceiverOptions []report.ReceiverOption
reportSenderOptions []report.SenderOption
statsOptions []stats.Option
twccOptions []twcc.Option
}
// InterceptorOption is a function that configures InterceptorOptions.
type InterceptorOption func(*interceptorOptions)
// WithInterceptorLoggerFactory sets the logger factory for interceptors.
func WithInterceptorLoggerFactory(loggerFactory logging.LoggerFactory) InterceptorOption {
return func(o *interceptorOptions) {
o.loggerFactory = loggerFactory
}
}
// WithNackGeneratorOptions sets options for the NACK generator interceptor.
func WithNackGeneratorOptions(opts ...nack.GeneratorOption) InterceptorOption {
return func(o *interceptorOptions) {
o.nackGeneratorOptions = opts
}
}
// WithNackResponderOptions sets options for the NACK responder interceptor.
func WithNackResponderOptions(opts ...nack.ResponderOption) InterceptorOption {
return func(o *interceptorOptions) {
o.nackResponderOptions = opts
}
}
// WithReportReceiverOptions sets options for the report receiver interceptor.
func WithReportReceiverOptions(opts ...report.ReceiverOption) InterceptorOption {
return func(o *interceptorOptions) {
o.reportReceiverOptions = opts
}
}
// WithReportSenderOptions sets options for the report sender interceptor.
func WithReportSenderOptions(opts ...report.SenderOption) InterceptorOption {
return func(o *interceptorOptions) {
o.reportSenderOptions = opts
}
}
// WithStatsInterceptorOptions sets options for the stats interceptor.
func WithStatsInterceptorOptions(opts ...stats.Option) InterceptorOption {
return func(o *interceptorOptions) {
o.statsOptions = opts
}
}
// WithTWCCOptions sets options for the TWCC interceptor.
func WithTWCCOptions(opts ...twcc.Option) InterceptorOption {
return func(o *interceptorOptions) {
o.twccOptions = opts
}
}