diff --git a/proxy/addon.go b/proxy/addon.go index 7ed029d..84232a6 100644 --- a/proxy/addon.go +++ b/proxy/addon.go @@ -77,11 +77,11 @@ func (addon *LogAddon) ClientDisconnected(client *ClientConn) { } func (addon *LogAddon) ServerConnected(connCtx *ConnContext) { - log.Infof("%v server connect %v (%v)\n", connCtx.ClientConn.Conn.RemoteAddr(), connCtx.ServerConn.Address, connCtx.ServerConn.Conn.RemoteAddr()) + log.Infof("%v server connect %v (%v->%v)\n", connCtx.ClientConn.Conn.RemoteAddr(), connCtx.ServerConn.Address, connCtx.ServerConn.Conn.LocalAddr(), connCtx.ServerConn.Conn.RemoteAddr()) } func (addon *LogAddon) ServerDisconnected(connCtx *ConnContext) { - log.Infof("%v server disconnect %v (%v)\n", connCtx.ClientConn.Conn.RemoteAddr(), connCtx.ServerConn.Address, connCtx.ServerConn.Conn.RemoteAddr()) + log.Infof("%v server disconnect %v (%v->%v)\n", connCtx.ClientConn.Conn.RemoteAddr(), connCtx.ServerConn.Address, connCtx.ServerConn.Conn.LocalAddr(), connCtx.ServerConn.Conn.RemoteAddr()) } func (addon *LogAddon) Requestheaders(f *Flow) { diff --git a/proxy/connection.go b/proxy/connection.go index b433b8f..e808f75 100644 --- a/proxy/connection.go +++ b/proxy/connection.go @@ -235,7 +235,7 @@ func (c *wrapClientConn) Close() error { if c.closed { return c.closeErr } - log.Debugln("in wrapClientConn close") + log.Debugln("in wrapClientConn close", c.connCtx.ClientConn.Conn.RemoteAddr()) c.closed = true c.closeErr = c.Conn.Close() @@ -245,7 +245,7 @@ func (c *wrapClientConn) Close() error { } if c.connCtx.ServerConn != nil && c.connCtx.ServerConn.Conn != nil { - c.connCtx.ServerConn.Conn.(*wrapServerConn).Conn.(*net.TCPConn).CloseRead() + c.connCtx.ServerConn.Conn.Close() } return c.closeErr @@ -282,7 +282,7 @@ func (c *wrapServerConn) Close() error { if c.closed { return c.closeErr } - log.Debugln("in wrapServerConn close") + log.Debugln("in wrapServerConn close", c.connCtx.ClientConn.Conn.RemoteAddr()) c.closed = true c.closeErr = c.Conn.Close()