2
0
mirror of https://github.com/soheilhy/cmux.git synced 2024-11-14 11:31:28 +08:00

support proxy protocol

This commit is contained in:
munding 2023-02-18 11:00:40 +08:00
parent 7303c90c48
commit 225edbee33

View File

@ -187,6 +187,10 @@ func (m *cMux) serve(c net.Conn, donec <-chan struct{}, wg *sync.WaitGroup) {
if m.readTimeout > noTimeout { if m.readTimeout > noTimeout {
_ = c.SetReadDeadline(time.Now().Add(m.readTimeout)) _ = c.SetReadDeadline(time.Now().Add(m.readTimeout))
} }
if err := muc.checkPrefix(); err != nil {
_ = c.Close()
return
}
for _, sl := range m.sls { for _, sl := range m.sls {
for _, s := range sl.ss { for _, s := range sl.ss {
matched := s(muc.Conn, muc.startSniffing()) matched := s(muc.Conn, muc.startSniffing())