1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-09-28 14:56:33 -04:00

relocated browser forwarder interface

This commit is contained in:
Shelikhoo 2021-05-01 00:06:10 +01:00
parent ffc8887d79
commit 7a6f887fe3
No known key found for this signature in database
GPG Key ID: C4D5E79D22B25316
3 changed files with 8 additions and 9 deletions

View File

@ -5,6 +5,7 @@ package browserforwarder
import ( import (
"bytes" "bytes"
"context" "context"
"github.com/v2fly/v2ray-core/v4/features/extension"
"io" "io"
"net/http" "net/http"
"time" "time"
@ -14,7 +15,6 @@ import (
"github.com/v2fly/v2ray-core/v4/common" "github.com/v2fly/v2ray-core/v4/common"
"github.com/v2fly/v2ray-core/v4/common/net" "github.com/v2fly/v2ray-core/v4/common/net"
"github.com/v2fly/v2ray-core/v4/common/platform/securedload" "github.com/v2fly/v2ray-core/v4/common/platform/securedload"
"github.com/v2fly/v2ray-core/v4/features/ext"
"github.com/v2fly/v2ray-core/v4/transport/internet" "github.com/v2fly/v2ray-core/v4/transport/internet"
) )
@ -47,7 +47,7 @@ func (f *Forwarder) DialWebsocket(url string, header http.Header) (io.ReadWriteC
} }
func (f *Forwarder) Type() interface{} { func (f *Forwarder) Type() interface{} {
return ext.BrowserForwarderType() return extension.BrowserForwarderType()
} }
func (f *Forwarder) Start() error { func (f *Forwarder) Start() error {

View File

@ -1,4 +1,4 @@
package ext package extension
import ( import (
"io" "io"

View File

@ -6,13 +6,12 @@ import (
"bytes" "bytes"
"context" "context"
"encoding/base64" "encoding/base64"
"github.com/v2fly/v2ray-core/v4/features/extension"
"io" "io"
"time" "time"
core "github.com/v2fly/v2ray-core/v4"
"github.com/v2fly/v2ray-core/v4/features/ext"
"github.com/gorilla/websocket" "github.com/gorilla/websocket"
core "github.com/v2fly/v2ray-core/v4"
"github.com/v2fly/v2ray-core/v4/common" "github.com/v2fly/v2ray-core/v4/common"
"github.com/v2fly/v2ray-core/v4/common/net" "github.com/v2fly/v2ray-core/v4/common/net"
@ -62,8 +61,8 @@ func dialWebsocket(ctx context.Context, dest net.Destination, streamSettings *in
uri := protocol + "://" + host + wsSettings.GetNormalizedPath() uri := protocol + "://" + host + wsSettings.GetNormalizedPath()
if wsSettings.UseBrowserForwarding { if wsSettings.UseBrowserForwarding {
var forwarder ext.BrowserForwarder var forwarder extension.BrowserForwarder
err := core.RequireFeatures(ctx, func(Forwarder ext.BrowserForwarder) { err := core.RequireFeatures(ctx, func(Forwarder extension.BrowserForwarder) {
forwarder = Forwarder forwarder = Forwarder
}) })
if err != nil { if err != nil {
@ -141,7 +140,7 @@ func (d dialerWithEarlyData) Dial(earlyData []byte) (*websocket.Conn, error) {
} }
type dialerWithEarlyDataRelayed struct { type dialerWithEarlyDataRelayed struct {
forwarder ext.BrowserForwarder forwarder extension.BrowserForwarder
uriBase string uriBase string
config *Config config *Config
} }