update to xray-core 1.8.0, remove xtls support

This commit is contained in:
yuzuki999
2023-03-23 09:08:01 +08:00
parent 5a95dac587
commit afbf67d5b4
8 changed files with 165 additions and 154 deletions

View File

@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.1
// protoc v3.21.5
// protoc v3.21.12
// source: config.proto
package dispatcher

View File

@@ -5,6 +5,11 @@ package dispatcher
import (
"context"
"fmt"
routingSession "github.com/xtls/xray-core/features/routing/session"
"strings"
"sync"
"time"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/common/log"
@@ -16,13 +21,9 @@ import (
"github.com/xtls/xray-core/features/outbound"
"github.com/xtls/xray-core/features/policy"
"github.com/xtls/xray-core/features/routing"
routingSession "github.com/xtls/xray-core/features/routing/session"
"github.com/xtls/xray-core/features/stats"
"github.com/xtls/xray-core/transport"
"github.com/xtls/xray-core/transport/pipe"
"strings"
"sync"
"time"
)
var errSniffingTimeout = newError("timeout on sniffing")
@@ -138,7 +139,7 @@ func (*DefaultDispatcher) Start() error {
// Close implements common.Closable.
func (*DefaultDispatcher) Close() error { return nil }
func (d *DefaultDispatcher) getLink(ctx context.Context, network net.Network, sniffing session.SniffingRequest) (*transport.Link, *transport.Link, error) {
func (d *DefaultDispatcher) getLink(ctx context.Context, network net.Network, sniffing session.SniffingRequest) (*transport.Link, *transport.Link) {
downOpt := pipe.OptionsFromContext(ctx)
upOpt := downOpt
@@ -169,7 +170,7 @@ func (d *DefaultDispatcher) getLink(ctx context.Context, network net.Network, sn
newError("[fakedns client] create a new map").WriteToLog(session.ExportIDToError(ctx))
}
domain := addr.Domain()
ips, err := d.dns.LookupIP(domain, dns.IPOption{IPv4Enable: true, IPv6Enable: true})
ips, err := d.dns.LookupIP(domain, dns.IPOption{true, true, false})
if err == nil {
for _, ip := range ips {
ip2domain.Store(ip.String(), domain)
@@ -235,7 +236,7 @@ func (d *DefaultDispatcher) getLink(ctx context.Context, network net.Network, sn
common.Close(inboundLink.Writer)
common.Interrupt(outboundLink.Reader)
common.Interrupt(inboundLink.Reader)
return nil, nil, newError("Devices reach the limit: ", user.Email)
return nil, nil
}
if ok {
inboundLink.Writer = d.Limiter.RateWriter(inboundLink.Writer, bucket)
@@ -261,7 +262,8 @@ func (d *DefaultDispatcher) getLink(ctx context.Context, network net.Network, sn
}
}
}
return inboundLink, outboundLink, nil
return inboundLink, outboundLink
}
func (d *DefaultDispatcher) shouldOverride(ctx context.Context, result SniffResult, request session.SniffingRequest, destination net.Destination) bool {
@@ -313,10 +315,7 @@ func (d *DefaultDispatcher) Dispatch(ctx context.Context, destination net.Destin
}
sniffingRequest := content.SniffingRequest
inbound, outbound, err := d.getLink(ctx, destination.Network, sniffingRequest)
if err != nil {
return nil, err
}
inbound, outbound := d.getLink(ctx, destination.Network, sniffingRequest)
if !sniffingRequest.Enabled {
go d.routedDispatch(ctx, outbound, destination, "")
} else {
@@ -385,6 +384,7 @@ func (d *DefaultDispatcher) DispatchLink(ctx context.Context, destination net.De
d.routedDispatch(ctx, outbound, destination, content.Protocol)
}()
}
return nil
}