Skip to content

Commit 213a14c

Browse files
authored
Merge pull request #418 from bingoohuang/master
feat: Add LocalAddr to TraceInfo to capture local network address
2 parents 03fab1a + 80a65c4 commit 213a14c

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

request.go

+1
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ func (r *Request) TraceInfo() TraceInfo {
146146
// Capture remote address info when connection is non-nil
147147
if ct.gotConnInfo.Conn != nil {
148148
ti.RemoteAddr = ct.gotConnInfo.Conn.RemoteAddr()
149+
ti.LocalAddr = ct.gotConnInfo.Conn.LocalAddr()
149150
}
150151

151152
return ti

trace.go

+3
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ type TraceInfo struct {
102102

103103
// RemoteAddr returns the remote network address.
104104
RemoteAddr net.Addr
105+
106+
// LocalAddr returns the local network address.
107+
LocalAddr net.Addr
105108
}
106109

107110
type clientTrace struct {

0 commit comments

Comments
 (0)