|
@@ -6,6 +6,7 @@ import (
|
|
|
"syscall"
|
|
"syscall"
|
|
|
|
|
|
|
|
"github.com/sagernet/quic-go"
|
|
"github.com/sagernet/quic-go"
|
|
|
|
|
+ "github.com/sagernet/sing-box/common/baderror"
|
|
|
"github.com/sagernet/sing/common"
|
|
"github.com/sagernet/sing/common"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
@@ -38,6 +39,16 @@ type StreamWrapper struct {
|
|
|
quic.Stream
|
|
quic.Stream
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+func (s *StreamWrapper) Read(p []byte) (n int, err error) {
|
|
|
|
|
+ n, err = s.Stream.Read(p)
|
|
|
|
|
+ return n, baderror.WrapQUIC(err)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func (s *StreamWrapper) Write(p []byte) (n int, err error) {
|
|
|
|
|
+ n, err = s.Stream.Write(p)
|
|
|
|
|
+ return n, baderror.WrapQUIC(err)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
func (s *StreamWrapper) LocalAddr() net.Addr {
|
|
func (s *StreamWrapper) LocalAddr() net.Addr {
|
|
|
return s.Conn.LocalAddr()
|
|
return s.Conn.LocalAddr()
|
|
|
}
|
|
}
|
|
@@ -50,10 +61,6 @@ func (s *StreamWrapper) Upstream() any {
|
|
|
return s.Stream
|
|
return s.Stream
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func (s *StreamWrapper) ReaderReplaceable() bool {
|
|
|
|
|
- return true
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
func (s *StreamWrapper) WriterReplaceable() bool {
|
|
func (s *StreamWrapper) WriterReplaceable() bool {
|
|
|
return true
|
|
return true
|
|
|
}
|
|
}
|