mirror of
https://github.com/SagerNet/sing-box.git
synced 2025-06-08 11:44:13 +08:00
proxyproto listener handle conn without header
This commit is contained in:
parent
3d511f003f
commit
c40cc02c33
@ -22,7 +22,7 @@ func (l *Listener) Accept() (net.Conn, error) {
|
|||||||
}
|
}
|
||||||
bufReader := std_bufio.NewReader(conn)
|
bufReader := std_bufio.NewReader(conn)
|
||||||
header, err := proxyproto.Read(bufReader)
|
header, err := proxyproto.Read(bufReader)
|
||||||
if err != nil {
|
if err != nil && err != proxyproto.ErrNoProxyProtocol {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if bufReader.Buffered() > 0 {
|
if bufReader.Buffered() > 0 {
|
||||||
@ -33,8 +33,11 @@ func (l *Listener) Accept() (net.Conn, error) {
|
|||||||
}
|
}
|
||||||
conn = bufio.NewCachedConn(conn, cache)
|
conn = bufio.NewCachedConn(conn, cache)
|
||||||
}
|
}
|
||||||
return &bufio.AddrConn{Conn: conn, Metadata: M.Metadata{
|
if header != nil {
|
||||||
Source: M.SocksaddrFromNet(header.SourceAddr),
|
return &bufio.AddrConn{Conn: conn, Metadata: M.Metadata{
|
||||||
Destination: M.SocksaddrFromNet(header.DestinationAddr),
|
Source: M.SocksaddrFromNet(header.SourceAddr),
|
||||||
}}, nil
|
Destination: M.SocksaddrFromNet(header.DestinationAddr),
|
||||||
|
}}, nil
|
||||||
|
}
|
||||||
|
return conn, nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user