yuhan6665 2024-12-10 20:07:52 -05:00 committed by GitHub
parent a2b773135a
commit 0e2304c403
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 98 additions and 59 deletions

View file

@ -4,8 +4,9 @@ import (
"context"
"github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/features/routing"
)
type DialFunc func(ctx context.Context, dest net.Destination, tag string) (net.Conn, error)
type DialFunc func(ctx context.Context, dispatcher routing.Dispatcher, dest net.Destination, tag string) (net.Conn, error)
var Dialer DialFunc

View file

@ -12,17 +12,10 @@ import (
"github.com/xtls/xray-core/transport/internet/tagged"
)
func DialTaggedOutbound(ctx context.Context, dest net.Destination, tag string) (net.Conn, error) {
var dispatcher routing.Dispatcher
func DialTaggedOutbound(ctx context.Context, dispatcher routing.Dispatcher, dest net.Destination, tag string) (net.Conn, error) {
if core.FromContext(ctx) == nil {
return nil, errors.New("Instance context variable is not in context, dial denied. ")
}
if err := core.RequireFeatures(ctx, func(dispatcherInstance routing.Dispatcher) {
dispatcher = dispatcherInstance
}); err != nil {
return nil, errors.New("Required Feature dispatcher not resolved").Base(err)
}
content := new(session.Content)
content.SkipDNSResolve = true