parse real client IP
This commit is contained in:
@@ -8,8 +8,9 @@ import (
|
||||
)
|
||||
|
||||
type conn struct {
|
||||
session *wt.Session
|
||||
stream *wt.Stream
|
||||
session *wt.Session
|
||||
stream *wt.Stream
|
||||
clientAddr net.Addr
|
||||
}
|
||||
|
||||
func Conn(session *wt.Session, stream *wt.Stream) net.Conn {
|
||||
@@ -19,6 +20,14 @@ func Conn(session *wt.Session, stream *wt.Stream) net.Conn {
|
||||
}
|
||||
}
|
||||
|
||||
func ConnWithClientAddr(session *wt.Session, stream *wt.Stream, clientAddr net.Addr) net.Conn {
|
||||
return &conn{
|
||||
session: session,
|
||||
stream: stream,
|
||||
clientAddr: clientAddr,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *conn) Read(b []byte) (n int, err error) {
|
||||
return c.stream.Read(b)
|
||||
}
|
||||
@@ -39,6 +48,10 @@ func (c *conn) RemoteAddr() net.Addr {
|
||||
return c.session.RemoteAddr()
|
||||
}
|
||||
|
||||
func (c *conn) ClientAddr() net.Addr {
|
||||
return c.clientAddr
|
||||
}
|
||||
|
||||
func (c *conn) SetDeadline(t time.Time) error {
|
||||
return c.stream.SetDeadline(t)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user