forked from quic-go/quic-go
use Config.TLSConfig.ServerName as client hostname if provided
Currently quic client always parse `hostname` from the addr. It prevent us to specific a different `hostname` to the client. This PR is to enable this by the `TLSConfig.ServerName` field. Thanks. Signed-off-by: Phus Lu <phuslu@hotmail.com>
This commit is contained in:
13
client.go
13
client.go
@@ -73,9 +73,16 @@ func DialNonFWSecure(pconn net.PacketConn, remoteAddr net.Addr, host string, con
|
||||
return nil, err
|
||||
}
|
||||
|
||||
hostname, _, err := net.SplitHostPort(host)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
var hostname string
|
||||
if config.TLSConfig != nil {
|
||||
hostname = config.TLSConfig.ServerName
|
||||
}
|
||||
|
||||
if hostname == "" {
|
||||
hostname, _, err = net.SplitHostPort(host)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
clientConfig := populateClientConfig(config)
|
||||
|
||||
Reference in New Issue
Block a user