File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,11 +22,24 @@ pub mod client;
2222#[ cfg( feature = "openapi" ) ]
2323pub mod openapi;
2424
25+ #[ derive( Debug , Clone , PartialEq , Eq ) ]
26+ pub struct UnixPeerCred {
27+ /// Peer process ID (platform-independent representation)
28+ pub pid : u64 ,
29+ /// Peer user ID
30+ pub uid : u64 ,
31+ /// Peer group ID
32+ pub gid : u64 ,
33+ }
34+
2535#[ derive( Debug , Clone , PartialEq , Eq ) ]
2636pub enum RemoteEndpoint {
2737 Tcp ( SocketAddr ) ,
2838 Quic ( SocketAddr ) ,
29- Unix ( PathBuf ) ,
39+ /// Unix domain socket endpoint.
40+ ///
41+ /// When available, `peer` can carry SO_PEERCRED (pid/uid/gid) of the caller.
42+ Unix { path : PathBuf , peer : Option < UnixPeerCred > } ,
3043 Vsock { cid : u32 , port : u32 } ,
3144 Other ( String ) ,
3245}
Original file line number Diff line number Diff line change 55use std:: convert:: Infallible ;
66
77#[ cfg( all( feature = "rocket" , feature = "openapi" ) ) ]
8- use crate :: openapi:: { OpenApiDoc , RenderedDoc } ;
8+ use crate :: openapi:: { OpenApiDoc , RenderedDoc } ;
99#[ cfg( all( feature = "rocket" , feature = "openapi" ) ) ]
1010use rocket:: response:: content:: { RawHtml , RawJson } ;
1111#[ cfg( all( feature = "rocket" , feature = "openapi" ) ) ]
@@ -265,7 +265,10 @@ impl From<Endpoint> for RemoteEndpoint {
265265 match endpoint {
266266 Endpoint :: Tcp ( addr) => RemoteEndpoint :: Tcp ( addr) ,
267267 Endpoint :: Quic ( addr) => RemoteEndpoint :: Quic ( addr) ,
268- Endpoint :: Unix ( path) => RemoteEndpoint :: Unix ( path) ,
268+ Endpoint :: Unix ( path) => RemoteEndpoint :: Unix {
269+ path,
270+ peer : None ,
271+ } ,
269272 _ => {
270273 let address = endpoint. to_string ( ) ;
271274 match address. parse :: < VsockEndpoint > ( ) {
You can’t perform that action at this time.
0 commit comments