File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 1
1
use async_std:: io:: { self , BufRead , Read } ;
2
2
use async_std:: sync;
3
3
4
+ use std:: net:: SocketAddr ;
4
5
use std:: convert:: TryInto ;
5
6
use std:: mem;
6
7
use std:: pin:: Pin ;
@@ -36,6 +37,8 @@ pin_project_lite::pin_project! {
36
37
#[ pin]
37
38
body: Body ,
38
39
local: TypeMap ,
40
+ local_addr: Option <SocketAddr >,
41
+ peer_addr: Option <SocketAddr >,
39
42
}
40
43
}
41
44
@@ -52,9 +55,22 @@ impl Request {
52
55
sender : Some ( sender) ,
53
56
receiver : Some ( receiver) ,
54
57
local : TypeMap :: new ( ) ,
58
+ peer_addr : None ,
59
+ local_addr : None ,
55
60
}
56
61
}
57
62
63
+ /// get the peer socket address for the underlying transport, if appropriate
64
+ pub fn peer_addr ( & self ) -> Option < SocketAddr > {
65
+ self . peer_addr
66
+ }
67
+
68
+ /// get the local socket address for the underlying transport, if appropriate
69
+ pub fn local_addr ( & self ) -> Option < SocketAddr > {
70
+ self . local_addr
71
+ }
72
+
73
+
58
74
/// Get the HTTP method
59
75
pub fn method ( & self ) -> Method {
60
76
self . method
You can’t perform that action at this time.
0 commit comments