add tls config option

This commit is contained in:
ginuerzh
2022-01-05 00:02:55 +08:00
parent c428b37a36
commit 3b48c4acfb
43 changed files with 395 additions and 496 deletions

View File

@ -1,15 +1,17 @@
package listener
import (
"crypto/tls"
"net/url"
"github.com/go-gost/gost/pkg/logger"
)
type Options struct {
Addr string
Auths []*url.Userinfo
Logger logger.Logger
Addr string
Auths []*url.Userinfo
TLSConfig *tls.Config
Logger logger.Logger
}
type Option func(opts *Options)
@ -26,6 +28,12 @@ func AuthsOption(auths ...*url.Userinfo) Option {
}
}
func TLSConfigOption(tlsConfig *tls.Config) Option {
return func(opts *Options) {
opts.TLSConfig = tlsConfig
}
}
func LoggerOption(logger logger.Logger) Option {
return func(opts *Options) {
opts.Logger = logger