mirror of
https://github.com/smallnest/rpcx.git
synced 2025-09-27 04:26:26 +08:00
28 lines
488 B
Go
28 lines
488 B
Go
//go:build quic
|
|
// +build quic
|
|
|
|
package client
|
|
|
|
import (
|
|
"crypto/tls"
|
|
"net"
|
|
|
|
"github.com/quic-go/quic-go"
|
|
"github.com/smallnest/quick"
|
|
)
|
|
|
|
func newDirectQuicConn(c *Client, network, address string) (net.Conn, error) {
|
|
tlsConf := c.option.TLSConfig
|
|
if tlsConf == nil {
|
|
tlsConf = &tls.Config{InsecureSkipVerify: true}
|
|
}
|
|
|
|
if len(tlsConf.NextProtos) == 0 {
|
|
tlsConf.NextProtos = []string{"rpcx"}
|
|
}
|
|
|
|
quicConfig := &quic.Config{}
|
|
|
|
return quick.Dial(address, tlsConf, quicConfig)
|
|
}
|