@@ -132,42 +132,17 @@ pub trait ResolvesServerCert: Debug + Send + Sync {
132
132
}
133
133
134
134
/// A struct representing the received Client Hello
135
+ #[ derive( Debug ) ]
135
136
pub struct ClientHello < ' a > {
136
- server_name : & ' a Option < DnsName < ' a > > ,
137
- signature_schemes : & ' a [ SignatureScheme ] ,
138
- alpn : Option < & ' a Vec < ProtocolName > > ,
139
- server_cert_types : Option < & ' a [ CertificateType ] > ,
140
- client_cert_types : Option < & ' a [ CertificateType ] > ,
141
- cipher_suites : & ' a [ CipherSuite ] ,
137
+ pub ( super ) server_name : & ' a Option < DnsName < ' a > > ,
138
+ pub ( super ) signature_schemes : & ' a [ SignatureScheme ] ,
139
+ pub ( super ) alpn : Option < & ' a Vec < ProtocolName > > ,
140
+ pub ( super ) server_cert_types : Option < & ' a [ CertificateType ] > ,
141
+ pub ( super ) client_cert_types : Option < & ' a [ CertificateType ] > ,
142
+ pub ( super ) cipher_suites : & ' a [ CipherSuite ] ,
142
143
}
143
144
144
145
impl < ' a > ClientHello < ' a > {
145
- /// Creates a new ClientHello
146
- pub ( super ) fn new (
147
- server_name : & ' a Option < DnsName < ' _ > > ,
148
- signature_schemes : & ' a [ SignatureScheme ] ,
149
- alpn : Option < & ' a Vec < ProtocolName > > ,
150
- server_cert_types : Option < & ' a [ CertificateType ] > ,
151
- client_cert_types : Option < & ' a [ CertificateType ] > ,
152
- cipher_suites : & ' a [ CipherSuite ] ,
153
- ) -> Self {
154
- trace ! ( "sni {:?}" , server_name) ;
155
- trace ! ( "sig schemes {:?}" , signature_schemes) ;
156
- trace ! ( "alpn protocols {:?}" , alpn) ;
157
- trace ! ( "server cert types {:?}" , server_cert_types) ;
158
- trace ! ( "client cert types {:?}" , client_cert_types) ;
159
- trace ! ( "cipher suites {:?}" , cipher_suites) ;
160
-
161
- ClientHello {
162
- server_name,
163
- signature_schemes,
164
- alpn,
165
- server_cert_types,
166
- client_cert_types,
167
- cipher_suites,
168
- }
169
- }
170
-
171
146
/// Get the server name indicator.
172
147
///
173
148
/// Returns `None` if the client did not supply a SNI.
@@ -938,14 +913,17 @@ impl Accepted {
938
913
/// Get the [`ClientHello`] for this connection.
939
914
pub fn client_hello ( & self ) -> ClientHello < ' _ > {
940
915
let payload = Self :: client_hello_payload ( & self . message ) ;
941
- ClientHello :: new (
942
- & self . connection . core . data . sni ,
943
- & self . sig_schemes ,
944
- payload. alpn_extension ( ) ,
945
- payload. server_certificate_extension ( ) ,
946
- payload. client_certificate_extension ( ) ,
947
- & payload. cipher_suites ,
948
- )
916
+ let ch = ClientHello {
917
+ server_name : & self . connection . core . data . sni ,
918
+ signature_schemes : & self . sig_schemes ,
919
+ alpn : payload. alpn_extension ( ) ,
920
+ server_cert_types : payload. server_certificate_extension ( ) ,
921
+ client_cert_types : payload. client_certificate_extension ( ) ,
922
+ cipher_suites : & payload. cipher_suites ,
923
+ } ;
924
+
925
+ trace ! ( "Accepted::client_hello(): {ch:#?}" ) ;
926
+ ch
949
927
}
950
928
951
929
/// Convert the [`Accepted`] into a [`ServerConnection`].
0 commit comments