@@ -266,6 +266,9 @@ impl<L: AttestationPlatform, R: AttestationPlatform> ProxyClient<L, R> {
266266 . await
267267 }
268268
269+ /// Create a new proxy with given TLS configuration
270+ ///
271+ /// This is private as it allows dangerous configuration but is used in tests
269272 async fn new_with_tls_config (
270273 client_config : Arc < ClientConfig > ,
271274 local : impl ToSocketAddrs ,
@@ -293,6 +296,7 @@ impl<L: AttestationPlatform, R: AttestationPlatform> ProxyClient<L, R> {
293296 } )
294297 }
295298
299+ /// Accept an incoming connection and handle it
296300 pub async fn accept ( & self ) -> io:: Result < ( ) > {
297301 let ( inbound, _client_addr) = self . inner . listener . accept ( ) . await ?;
298302
@@ -322,10 +326,12 @@ impl<L: AttestationPlatform, R: AttestationPlatform> ProxyClient<L, R> {
322326 Ok ( ( ) )
323327 }
324328
329+ /// Helper to return the local socket address from the underlying TCP listener
325330 pub fn local_addr ( & self ) -> std:: io:: Result < SocketAddr > {
326331 self . inner . listener . local_addr ( )
327332 }
328333
334+ /// Handle an incoming connection
329335 async fn handle_connection (
330336 inbound : TcpStream ,
331337 connector : TlsConnector ,
@@ -386,6 +392,7 @@ impl<L: AttestationPlatform, R: AttestationPlatform> ProxyClient<L, R> {
386392 }
387393}
388394
395+ /// An error when running a proxy client or server
389396#[ derive( Error , Debug ) ]
390397pub enum ProxyError {
391398 #[ error( "Client auth is required when the client is running in a CVM" ) ]
@@ -404,6 +411,7 @@ pub enum ProxyError {
404411 IntConversion ( #[ from] TryFromIntError ) ,
405412}
406413
414+ /// Given a byte array, encode its length as a 4 byte big endian u32
407415fn length_prefix ( input : & [ u8 ] ) -> [ u8 ; 4 ] {
408416 let len = input. len ( ) as u32 ;
409417 len. to_be_bytes ( )
0 commit comments