File: option.go

package info (click to toggle)
golang-github-pion-interceptor 0.1.12-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bookworm-backports, forky, sid, trixie
  • size: 764 kB
  • sloc: makefile: 8
file content (30 lines) | stat: -rw-r--r-- 712 bytes parent folder | download
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
package rfc8888

import "time"

// An Option is a function that can be used to configure a SenderInterceptor
type Option func(*SenderInterceptor) error

// SenderTicker sets an alternative for time.Ticker.
func SenderTicker(f TickerFactory) Option {
	return func(i *SenderInterceptor) error {
		i.newTicker = f
		return nil
	}
}

// SenderNow sets an alternative for the time.Now function.
func SenderNow(f func() time.Time) Option {
	return func(i *SenderInterceptor) error {
		i.now = f
		return nil
	}
}

// SendInterval sets the feedback send interval for the interceptor
func SendInterval(interval time.Duration) Option {
	return func(s *SenderInterceptor) error {
		s.interval = interval
		return nil
	}
}