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:
@@ -73,10 +73,17 @@ func DialNonFWSecure(pconn net.PacketConn, remoteAddr net.Addr, host string, con
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
hostname, _, err := net.SplitHostPort(host)
|
var hostname string
|
||||||
|
if config.TLSConfig != nil {
|
||||||
|
hostname = config.TLSConfig.ServerName
|
||||||
|
}
|
||||||
|
|
||||||
|
if hostname == "" {
|
||||||
|
hostname, _, err = net.SplitHostPort(host)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
clientConfig := populateClientConfig(config)
|
clientConfig := populateClientConfig(config)
|
||||||
c := &client{
|
c := &client{
|
||||||
|
|||||||
Reference in New Issue
Block a user