add tls config option
This commit is contained in:
@ -1,11 +1,8 @@
|
||||
package quic
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"net"
|
||||
"time"
|
||||
|
||||
tls_util "github.com/go-gost/gost/pkg/common/util/tls"
|
||||
mdata "github.com/go-gost/gost/pkg/metadata"
|
||||
)
|
||||
|
||||
@ -15,7 +12,6 @@ type metadata struct {
|
||||
handshakeTimeout time.Duration
|
||||
|
||||
cipherKey []byte
|
||||
tlsConfig *tls.Config
|
||||
}
|
||||
|
||||
func (d *quicDialer) parseMetadata(md mdata.Metadata) (err error) {
|
||||
@ -24,12 +20,6 @@ func (d *quicDialer) parseMetadata(md mdata.Metadata) (err error) {
|
||||
handshakeTimeout = "handshakeTimeout"
|
||||
maxIdleTimeout = "maxIdleTimeout"
|
||||
|
||||
certFile = "certFile"
|
||||
keyFile = "keyFile"
|
||||
caFile = "caFile"
|
||||
secure = "secure"
|
||||
serverName = "serverName"
|
||||
|
||||
cipherKey = "cipherKey"
|
||||
)
|
||||
|
||||
@ -39,18 +29,6 @@ func (d *quicDialer) parseMetadata(md mdata.Metadata) (err error) {
|
||||
d.md.cipherKey = []byte(key)
|
||||
}
|
||||
|
||||
sn, _, _ := net.SplitHostPort(mdata.GetString(md, serverName))
|
||||
if sn == "" {
|
||||
sn = "localhost"
|
||||
}
|
||||
d.md.tlsConfig, err = tls_util.LoadClientConfig(
|
||||
mdata.GetString(md, certFile),
|
||||
mdata.GetString(md, keyFile),
|
||||
mdata.GetString(md, caFile),
|
||||
mdata.GetBool(md, secure),
|
||||
sn,
|
||||
)
|
||||
|
||||
d.md.keepAlive = mdata.GetBool(md, keepAlive)
|
||||
d.md.handshakeTimeout = mdata.GetDuration(md, handshakeTimeout)
|
||||
d.md.maxIdleTimeout = mdata.GetDuration(md, maxIdleTimeout)
|
||||
|
Reference in New Issue
Block a user