diff --git a/addon/addon.go b/addon/addon.go index 5b12c85..3d5114d 100644 --- a/addon/addon.go +++ b/addon/addon.go @@ -63,11 +63,11 @@ func (addon *Log) ClientDisconnected(client *connection.Client) { } func (addon *Log) ServerConnected(connCtx *flow.ConnContext) { - log.Infof("%v server connect %v\n", connCtx.Client.Conn.RemoteAddr(), connCtx.Server.Conn.RemoteAddr()) + log.Infof("%v server connect %v (%v)\n", connCtx.Client.Conn.RemoteAddr(), connCtx.Server.Address, connCtx.Server.Conn.RemoteAddr()) } func (addon *Log) ServerDisconnected(connCtx *flow.ConnContext) { - log.Infof("%v server disconnect %v\n", connCtx.Client.Conn.RemoteAddr(), connCtx.Server.Conn.RemoteAddr()) + log.Infof("%v server disconnect %v (%v)\n", connCtx.Client.Conn.RemoteAddr(), connCtx.Server.Address, connCtx.Server.Conn.RemoteAddr()) } func (addon *Log) Requestheaders(f *flow.Flow) { diff --git a/connection/connection.go b/connection/connection.go index b50449a..aec42f1 100644 --- a/connection/connection.go +++ b/connection/connection.go @@ -22,9 +22,10 @@ func NewClient(c net.Conn) *Client { } type Server struct { - Id uuid.UUID - Conn net.Conn - Client *http.Client + Id uuid.UUID + Conn net.Conn + Client *http.Client + Address string } func NewServer() *Server { diff --git a/flow/conncontext.go b/flow/conncontext.go index 0165d01..7d7565d 100644 --- a/flow/conncontext.go +++ b/flow/conncontext.go @@ -48,6 +48,7 @@ func (connCtx *ConnContext) InitHttpServer(sslInsecure bool, connWrap func(net.C cw := connWrap(c) server.Conn = cw + server.Address = addr defer whenConnected() return cw, nil }, @@ -90,6 +91,7 @@ func (connCtx *ConnContext) InitHttpsServer(sslInsecure bool, connWrap func(net. cw := connWrap(plainConn) server.Conn = cw + server.Address = addr whenConnected() firstTLSHost, _, err := net.SplitHostPort(addr)