1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-12-28 13:05:28 -05:00

remove use of context.WithValue in transport

This commit is contained in:
Darien Raymond
2018-11-21 14:54:40 +01:00
parent d2d0c69f17
commit 5279296f03
32 changed files with 212 additions and 297 deletions

View File

@@ -22,10 +22,10 @@ type Server struct {
}
func (server *Server) Start() (net.Destination, error) {
return server.StartContext(context.Background())
return server.StartContext(context.Background(), nil)
}
func (server *Server) StartContext(ctx context.Context) (net.Destination, error) {
func (server *Server) StartContext(ctx context.Context, sockopt *internet.SocketConfig) (net.Destination, error) {
listenerAddr := server.Listen
if listenerAddr == nil {
listenerAddr = net.LocalHostIP
@@ -33,7 +33,7 @@ func (server *Server) StartContext(ctx context.Context) (net.Destination, error)
listener, err := internet.ListenSystem(ctx, &net.TCPAddr{
IP: listenerAddr.IP(),
Port: int(server.Port),
})
}, sockopt)
if err != nil {
return net.Destination{}, err
}