add observer
This commit is contained in:
1 parent
6b5c04b5e4
commit
5a427b4eaf
3 files changed
+38
No files matched your search
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/go-gost/core/limiter/traffic"
|
||||
"github.com/go-gost/core/logger"
|
||||
"github.com/go-gost/core/metadata"
|
||||
"github.com/go-gost/core/observer"
|
||||
)
|
||||
|
||||
type Options struct {
|
||||
@@ -22,6 +23,7 @@ type Options struct {
|
||||
Limiter traffic.TrafficLimiter
|
||||
TLSConfig *tls.Config
|
||||
Logger logger.Logger
|
||||
Observer observer.Observer
|
||||
Service string
|
||||
}
|
||||
|
||||
@@ -75,6 +77,12 @@ func LoggerOption(logger logger.Logger) Option {
|
||||
}
|
||||
}
|
||||
|
||||
func ObserverOption(observer observer.Observer) Option {
|
||||
return func(opts *Options) {
|
||||
opts.Observer = observer
|
||||
}
|
||||
}
|
||||
|
||||
func ServiceOption(service string) Option {
|
||||
return func(opts *Options) {
|
||||
opts.Service = service
|
||||
|
||||
Reference in new issue
Block a user