chore: more context passing in outbounds

This commit is contained in:
wwqgtxx
2023-05-18 13:15:08 +08:00
parent 6b1a4385b2
commit 033f902ace
16 changed files with 65 additions and 88 deletions

View File

@ -1,6 +1,7 @@
package obfs
import (
"context"
"crypto/tls"
"net"
"net/http"
@ -22,7 +23,7 @@ type Option struct {
}
// NewV2rayObfs return a HTTPObfs
func NewV2rayObfs(conn net.Conn, option *Option) (net.Conn, error) {
func NewV2rayObfs(ctx context.Context, conn net.Conn, option *Option) (net.Conn, error) {
header := http.Header{}
for k, v := range option.Headers {
header.Add(k, v)
@ -57,7 +58,7 @@ func NewV2rayObfs(conn net.Conn, option *Option) (net.Conn, error) {
}
var err error
conn, err = vmess.StreamWebsocketConn(conn, config)
conn, err = vmess.StreamWebsocketConn(ctx, conn, config)
if err != nil {
return nil, err
}