mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-07-24 16:23:30 +03:00
Fix read deadline implementation
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/sagernet/sing-box/common/tls"
|
||||
"github.com/sagernet/sing-box/option"
|
||||
"github.com/sagernet/sing/common"
|
||||
"github.com/sagernet/sing/common/bufio/deadline"
|
||||
M "github.com/sagernet/sing/common/metadata"
|
||||
N "github.com/sagernet/sing/common/network"
|
||||
|
||||
@@ -107,5 +108,5 @@ func (c *Client) DialContext(ctx context.Context) (net.Conn, error) {
|
||||
cancel(err)
|
||||
return nil, err
|
||||
}
|
||||
return NewGRPCConn(stream, cancel), nil
|
||||
return deadline.NewConn(NewGRPCConn(stream, cancel)), nil
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/sagernet/sing-box/common/tls"
|
||||
"github.com/sagernet/sing-box/option"
|
||||
"github.com/sagernet/sing/common"
|
||||
"github.com/sagernet/sing/common/bufio/deadline"
|
||||
M "github.com/sagernet/sing/common/metadata"
|
||||
N "github.com/sagernet/sing/common/network"
|
||||
|
||||
@@ -66,7 +67,7 @@ func (s *Server) Tun(server GunService_TunServer) error {
|
||||
}
|
||||
}
|
||||
}
|
||||
go s.handler.NewConnection(ctx, conn, metadata)
|
||||
go s.handler.NewConnection(ctx, deadline.NewConn(conn), metadata)
|
||||
<-ctx.Done()
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user