summaryrefslogtreecommitdiff
path: root/vendor/github.com/pion/interceptor/registry.go
blob: d3eed3bf2d39b51a75e7a548e368662d9017faf8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package interceptor

// Registry is a collector for interceptors.
type Registry struct {
	interceptors []Interceptor
}

// Add adds a new Interceptor to the registry.
func (i *Registry) Add(icpr Interceptor) {
	i.interceptors = append(i.interceptors, icpr)
}

// Build constructs a single Interceptor from a InterceptorRegistry
func (i *Registry) Build() Interceptor {
	if len(i.interceptors) == 0 {
		return &NoOp{}
	}

	return NewChain(i.interceptors)
}