update handler options

This commit is contained in:
ginuerzh
2022-01-04 21:56:58 +08:00
parent 566e930010
commit c428b37a36
36 changed files with 468 additions and 524 deletions

View File

@ -1,14 +1,15 @@
package listener
import (
"github.com/go-gost/gost/pkg/auth"
"net/url"
"github.com/go-gost/gost/pkg/logger"
)
type Options struct {
Addr string
Authenticator auth.Authenticator
Logger logger.Logger
Addr string
Auths []*url.Userinfo
Logger logger.Logger
}
type Option func(opts *Options)
@ -19,9 +20,9 @@ func AddrOption(addr string) Option {
}
}
func AuthenticatorOption(auth auth.Authenticator) Option {
func AuthsOption(auths ...*url.Userinfo) Option {
return func(opts *Options) {
opts.Authenticator = auth
opts.Auths = auths
}
}