Add h2Alpn option for TLS ClientHello
This commit is contained in:
16
client.go
16
client.go
@ -85,6 +85,7 @@ type DialOptions struct {
|
||||
Chain *Chain
|
||||
Host string
|
||||
HeaderConfig map[string]string
|
||||
H2Alpn bool
|
||||
}
|
||||
|
||||
// DialOption allows a common way to set DialOptions.
|
||||
@ -118,6 +119,13 @@ func HeaderConfigDialOption(HeaderConfig map[string]string) DialOption {
|
||||
}
|
||||
}
|
||||
|
||||
// H2AlpnDialOption specifies is use HTTP2 in ALPN for TLS ClientHello
|
||||
func H2AlpnDialOption(useH2Alpn bool) DialOption {
|
||||
return func(opts *DialOptions) {
|
||||
opts.H2Alpn = useH2Alpn
|
||||
}
|
||||
}
|
||||
|
||||
// HandshakeOptions describes the options for handshake.
|
||||
type HandshakeOptions struct {
|
||||
Addr string
|
||||
@ -131,6 +139,7 @@ type HandshakeOptions struct {
|
||||
KCPConfig *KCPConfig
|
||||
QUICConfig *QUICConfig
|
||||
SSHConfig *SSHConfig
|
||||
H2Alpn bool
|
||||
}
|
||||
|
||||
// HandshakeOption allows a common way to set HandshakeOptions.
|
||||
@ -213,6 +222,13 @@ func SSHConfigHandshakeOption(config *SSHConfig) HandshakeOption {
|
||||
}
|
||||
}
|
||||
|
||||
// H2AlpnHandshakeOption specifies is use HTTP2 in ALPN for TLS ClientHello.
|
||||
func H2AlpnHandshakeOption(useH2Alpn bool) HandshakeOption {
|
||||
return func(opts *HandshakeOptions) {
|
||||
opts.H2Alpn = useH2Alpn
|
||||
}
|
||||
}
|
||||
|
||||
// ConnectOptions describes the options for Connector.Connect.
|
||||
type ConnectOptions struct {
|
||||
Addr string
|
||||
|
Reference in New Issue
Block a user