Commit af460703 authored by aliiohs's avatar aliiohs

add tls support

parent 94d35a38
...@@ -73,6 +73,20 @@ func WithWebsocketServerRootCert(cert string) ServerOption { ...@@ -73,6 +73,20 @@ func WithWebsocketServerRootCert(cert string) ServerOption {
} }
} }
// @WithSslEnabled enable use tls
func WithServerSslEnabled(sslEnabled bool) ServerOption {
return func(o *ServerOptions) {
o.sslEnabled = sslEnabled
}
}
// @WithSslConfig sslConfig is tls config
func WithServerSslConfig(sslConfig *tls.Config) ServerOption {
return func(o *ServerOptions) {
o.sslConfig = sslConfig
}
}
///////////////////////////////////////// /////////////////////////////////////////
// Client Options // Client Options
///////////////////////////////////////// /////////////////////////////////////////
...@@ -125,3 +139,17 @@ func WithRootCertificateFile(cert string) ClientOption { ...@@ -125,3 +139,17 @@ func WithRootCertificateFile(cert string) ClientOption {
o.cert = cert o.cert = cert
} }
} }
// @WithSslEnabled enable use tls
func WithClientSslEnabled(sslEnabled bool) ClientOption {
return func(o *ClientOptions) {
o.sslEnabled = sslEnabled
}
}
// @WithSslConfig sslConfig is tls config
func WithClientSslConfig(sslConfig *tls.Config) ClientOption {
return func(o *ClientOptions) {
o.sslConfig = sslConfig
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment