2018-06-10 14:50:03 +00:00
|
|
|
package tunnel
|
|
|
|
|
|
|
|
import (
|
2019-02-02 12:47:38 +00:00
|
|
|
"fmt"
|
2018-12-05 13:13:29 +00:00
|
|
|
"net"
|
2019-12-28 10:44:01 +00:00
|
|
|
"runtime"
|
2018-06-10 14:50:03 +00:00
|
|
|
"sync"
|
2018-06-16 13:34:13 +00:00
|
|
|
"time"
|
2018-06-10 14:50:03 +00:00
|
|
|
|
2019-12-08 04:17:24 +00:00
|
|
|
"github.com/Dreamacro/clash/adapters/inbound"
|
|
|
|
"github.com/Dreamacro/clash/adapters/provider"
|
2019-10-11 12:11:18 +00:00
|
|
|
"github.com/Dreamacro/clash/component/nat"
|
2020-02-15 13:42:46 +00:00
|
|
|
"github.com/Dreamacro/clash/component/resolver"
|
2018-06-10 14:50:03 +00:00
|
|
|
C "github.com/Dreamacro/clash/constant"
|
2018-12-05 13:13:29 +00:00
|
|
|
"github.com/Dreamacro/clash/dns"
|
2018-11-21 05:47:46 +00:00
|
|
|
"github.com/Dreamacro/clash/log"
|
2018-06-10 14:50:03 +00:00
|
|
|
|
2019-02-02 12:47:38 +00:00
|
|
|
channels "gopkg.in/eapache/channels.v1"
|
2018-06-10 14:50:03 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2020-02-15 13:42:46 +00:00
|
|
|
tcpQueue = channels.NewInfiniteChannel()
|
|
|
|
udpQueue = channels.NewInfiniteChannel()
|
|
|
|
natTable = nat.New()
|
|
|
|
rules []C.Rule
|
|
|
|
proxies = make(map[string]C.Proxy)
|
|
|
|
providers map[string]provider.ProxyProvider
|
|
|
|
configMux sync.RWMutex
|
|
|
|
enhancedMode *dns.Resolver
|
2019-04-24 04:02:52 +00:00
|
|
|
|
|
|
|
// experimental features
|
|
|
|
ignoreResolveFail bool
|
2018-07-25 16:04:59 +00:00
|
|
|
|
|
|
|
// Outbound Rule
|
2020-02-15 13:42:46 +00:00
|
|
|
mode = Rule
|
|
|
|
|
|
|
|
// default timeout for UDP session
|
|
|
|
udpTimeout = 60 * time.Second
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
go process()
|
2018-06-10 14:50:03 +00:00
|
|
|
}
|
|
|
|
|
2018-07-25 16:04:59 +00:00
|
|
|
// Add request to queue
|
2020-02-15 13:42:46 +00:00
|
|
|
func Add(req C.ServerAdapter) {
|
|
|
|
tcpQueue.In() <- req
|
2019-12-28 10:44:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// AddPacket add udp Packet to queue
|
2020-02-15 13:42:46 +00:00
|
|
|
func AddPacket(packet *inbound.PacketAdapter) {
|
|
|
|
udpQueue.In() <- packet
|
2018-06-10 14:50:03 +00:00
|
|
|
}
|
|
|
|
|
2018-11-21 05:47:46 +00:00
|
|
|
// Rules return all rules
|
2020-02-15 13:42:46 +00:00
|
|
|
func Rules() []C.Rule {
|
|
|
|
return rules
|
2018-06-18 03:31:49 +00:00
|
|
|
}
|
|
|
|
|
2018-11-21 05:47:46 +00:00
|
|
|
// UpdateRules handle update rules
|
2020-02-15 13:42:46 +00:00
|
|
|
func UpdateRules(newRules []C.Rule) {
|
|
|
|
configMux.Lock()
|
|
|
|
rules = newRules
|
|
|
|
configMux.Unlock()
|
2018-11-21 05:47:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Proxies return all proxies
|
2020-02-15 13:42:46 +00:00
|
|
|
func Proxies() map[string]C.Proxy {
|
|
|
|
return proxies
|
2018-11-21 05:47:46 +00:00
|
|
|
}
|
|
|
|
|
2019-12-08 04:17:24 +00:00
|
|
|
// Providers return all compatible providers
|
2020-02-15 13:42:46 +00:00
|
|
|
func Providers() map[string]provider.ProxyProvider {
|
|
|
|
return providers
|
2019-12-08 04:17:24 +00:00
|
|
|
}
|
|
|
|
|
2018-11-21 05:47:46 +00:00
|
|
|
// UpdateProxies handle update proxies
|
2020-02-15 13:42:46 +00:00
|
|
|
func UpdateProxies(newProxies map[string]C.Proxy, newProviders map[string]provider.ProxyProvider) {
|
|
|
|
configMux.Lock()
|
|
|
|
proxies = newProxies
|
|
|
|
providers = newProviders
|
|
|
|
configMux.Unlock()
|
2019-04-24 04:02:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// UpdateExperimental handle update experimental config
|
2020-02-15 13:42:46 +00:00
|
|
|
func UpdateExperimental(value bool) {
|
|
|
|
configMux.Lock()
|
|
|
|
ignoreResolveFail = value
|
|
|
|
configMux.Unlock()
|
2018-11-21 05:47:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Mode return current mode
|
2020-02-15 13:42:46 +00:00
|
|
|
func Mode() TunnelMode {
|
|
|
|
return mode
|
2018-11-21 05:47:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// SetMode change the mode of tunnel
|
2020-02-15 13:42:46 +00:00
|
|
|
func SetMode(m TunnelMode) {
|
|
|
|
mode = m
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetResolver set custom dns resolver for enhanced mode
|
|
|
|
func SetResolver(r *dns.Resolver) {
|
|
|
|
enhancedMode = r
|
2018-06-10 14:50:03 +00:00
|
|
|
}
|
|
|
|
|
2019-12-28 10:44:01 +00:00
|
|
|
// processUDP starts a loop to handle udp packet
|
2020-02-15 13:42:46 +00:00
|
|
|
func processUDP() {
|
|
|
|
queue := udpQueue.Out()
|
2019-12-28 10:44:01 +00:00
|
|
|
for elm := range queue {
|
|
|
|
conn := elm.(*inbound.PacketAdapter)
|
2020-02-15 13:42:46 +00:00
|
|
|
handleUDPConn(conn)
|
2019-12-28 10:44:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-15 13:42:46 +00:00
|
|
|
func process() {
|
2019-12-28 10:44:01 +00:00
|
|
|
numUDPWorkers := 4
|
|
|
|
if runtime.NumCPU() > numUDPWorkers {
|
|
|
|
numUDPWorkers = runtime.NumCPU()
|
|
|
|
}
|
|
|
|
for i := 0; i < numUDPWorkers; i++ {
|
2020-02-15 13:42:46 +00:00
|
|
|
go processUDP()
|
2019-12-28 10:44:01 +00:00
|
|
|
}
|
2019-10-11 12:11:18 +00:00
|
|
|
|
2020-02-15 13:42:46 +00:00
|
|
|
queue := tcpQueue.Out()
|
2019-10-11 12:11:18 +00:00
|
|
|
for elm := range queue {
|
2018-06-10 14:50:03 +00:00
|
|
|
conn := elm.(C.ServerAdapter)
|
2020-02-15 13:42:46 +00:00
|
|
|
go handleTCPConn(conn)
|
2018-06-10 14:50:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-15 13:42:46 +00:00
|
|
|
func needLookupIP(metadata *C.Metadata) bool {
|
|
|
|
return enhancedMode != nil && (enhancedMode.IsMapping() || enhancedMode.FakeIPEnabled()) && metadata.Host == "" && metadata.DstIP != nil
|
2019-02-11 07:44:42 +00:00
|
|
|
}
|
|
|
|
|
2020-02-15 13:42:46 +00:00
|
|
|
func preHandleMetadata(metadata *C.Metadata) error {
|
2020-02-07 12:53:43 +00:00
|
|
|
// handle IP string on host
|
2019-10-27 16:02:23 +00:00
|
|
|
if ip := net.ParseIP(metadata.Host); ip != nil {
|
|
|
|
metadata.DstIP = ip
|
|
|
|
}
|
|
|
|
|
2019-05-02 16:05:14 +00:00
|
|
|
// preprocess enhanced-mode metadata
|
2020-02-15 13:42:46 +00:00
|
|
|
if needLookupIP(metadata) {
|
|
|
|
host, exist := enhancedMode.IPToHost(metadata.DstIP)
|
2018-12-05 13:13:29 +00:00
|
|
|
if exist {
|
|
|
|
metadata.Host = host
|
|
|
|
metadata.AddrType = C.AtypDomainName
|
2020-02-15 13:42:46 +00:00
|
|
|
if enhancedMode.FakeIPEnabled() {
|
2019-05-09 13:00:29 +00:00
|
|
|
metadata.DstIP = nil
|
2019-05-02 16:05:14 +00:00
|
|
|
}
|
2020-02-15 13:42:46 +00:00
|
|
|
} else if enhancedMode.IsFakeIP(metadata.DstIP) {
|
2020-02-07 12:53:43 +00:00
|
|
|
return fmt.Errorf("fake DNS record %s missing", metadata.DstIP)
|
2018-12-05 13:13:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-07 12:53:43 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-02-15 13:42:46 +00:00
|
|
|
func resolveMetadata(metadata *C.Metadata) (C.Proxy, C.Rule, error) {
|
2018-07-12 15:28:38 +00:00
|
|
|
var proxy C.Proxy
|
2019-08-08 17:28:37 +00:00
|
|
|
var rule C.Rule
|
2020-02-15 13:42:46 +00:00
|
|
|
switch mode {
|
2018-11-21 05:47:46 +00:00
|
|
|
case Direct:
|
2020-02-15 13:42:46 +00:00
|
|
|
proxy = proxies["DIRECT"]
|
2018-11-21 05:47:46 +00:00
|
|
|
case Global:
|
2020-02-15 13:42:46 +00:00
|
|
|
proxy = proxies["GLOBAL"]
|
2018-07-12 15:28:38 +00:00
|
|
|
// Rule
|
|
|
|
default:
|
2019-02-02 12:47:38 +00:00
|
|
|
var err error
|
2020-02-15 13:42:46 +00:00
|
|
|
proxy, rule, err = match(metadata)
|
2019-02-02 12:47:38 +00:00
|
|
|
if err != nil {
|
2019-10-11 12:11:18 +00:00
|
|
|
return nil, nil, err
|
2019-02-02 12:47:38 +00:00
|
|
|
}
|
2018-07-12 15:28:38 +00:00
|
|
|
}
|
2019-10-11 12:11:18 +00:00
|
|
|
return proxy, rule, nil
|
|
|
|
}
|
2019-02-02 12:47:38 +00:00
|
|
|
|
2020-02-15 13:42:46 +00:00
|
|
|
func handleUDPConn(packet *inbound.PacketAdapter) {
|
2019-12-28 10:44:01 +00:00
|
|
|
metadata := packet.Metadata()
|
2019-10-11 12:11:18 +00:00
|
|
|
if !metadata.Valid() {
|
|
|
|
log.Warnln("[Metadata] not valid: %#v", metadata)
|
|
|
|
return
|
2019-07-25 09:47:39 +00:00
|
|
|
}
|
|
|
|
|
2020-02-15 13:42:46 +00:00
|
|
|
if err := preHandleMetadata(metadata); err != nil {
|
2020-02-07 12:53:43 +00:00
|
|
|
log.Debugln("[Metadata PreHandle] error: %s", err)
|
|
|
|
return
|
2020-01-31 11:26:33 +00:00
|
|
|
}
|
|
|
|
|
2020-01-31 06:43:54 +00:00
|
|
|
key := packet.LocalAddr().String()
|
2020-02-15 13:42:46 +00:00
|
|
|
pc := natTable.Get(key)
|
2019-10-11 12:11:18 +00:00
|
|
|
if pc != nil {
|
2020-02-07 12:53:43 +00:00
|
|
|
if !metadata.Resolved() {
|
2020-02-15 13:42:46 +00:00
|
|
|
ip, err := resolver.ResolveIP(metadata.Host)
|
2020-02-07 12:53:43 +00:00
|
|
|
if err != nil {
|
|
|
|
log.Warnln("[UDP] Resolve %s failed: %s, %#v", metadata.Host, err.Error(), metadata)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
metadata.DstIP = ip
|
|
|
|
}
|
|
|
|
|
2020-02-15 13:42:46 +00:00
|
|
|
handleUDPToRemote(packet, pc, metadata.UDPAddr())
|
2019-10-11 12:11:18 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
lockKey := key + "-lock"
|
2020-02-15 13:42:46 +00:00
|
|
|
wg, loaded := natTable.GetOrCreateLock(lockKey)
|
2019-12-28 10:44:01 +00:00
|
|
|
|
2019-10-11 12:11:18 +00:00
|
|
|
go func() {
|
|
|
|
if !loaded {
|
|
|
|
wg.Add(1)
|
2020-02-15 13:42:46 +00:00
|
|
|
proxy, rule, err := resolveMetadata(metadata)
|
2019-10-11 12:11:18 +00:00
|
|
|
if err != nil {
|
2019-12-25 04:01:48 +00:00
|
|
|
log.Warnln("[UDP] Parse metadata failed: %s", err.Error())
|
2020-02-15 13:42:46 +00:00
|
|
|
natTable.Delete(lockKey)
|
2019-10-11 12:11:18 +00:00
|
|
|
wg.Done()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2020-01-31 06:43:54 +00:00
|
|
|
rawPc, err := proxy.DialUDP(metadata)
|
2019-10-11 12:11:18 +00:00
|
|
|
if err != nil {
|
2019-12-25 04:01:48 +00:00
|
|
|
log.Warnln("[UDP] dial %s error: %s", proxy.Name(), err.Error())
|
2020-02-15 13:42:46 +00:00
|
|
|
natTable.Delete(lockKey)
|
2019-10-11 12:11:18 +00:00
|
|
|
wg.Done()
|
|
|
|
return
|
|
|
|
}
|
2019-10-27 13:44:07 +00:00
|
|
|
pc = newUDPTracker(rawPc, DefaultManager, metadata, rule)
|
2019-10-11 12:11:18 +00:00
|
|
|
|
2020-01-31 06:58:54 +00:00
|
|
|
switch true {
|
|
|
|
case rule != nil:
|
|
|
|
log.Infoln("[UDP] %s --> %v match %s using %s", metadata.SourceAddress(), metadata.String(), rule.RuleType().String(), rawPc.Chains().String())
|
2020-02-15 13:42:46 +00:00
|
|
|
case mode == Global:
|
2020-01-31 06:58:54 +00:00
|
|
|
log.Infoln("[UDP] %s --> %v using GLOBAL", metadata.SourceAddress(), metadata.String())
|
2020-02-15 13:42:46 +00:00
|
|
|
case mode == Direct:
|
2020-01-31 06:58:54 +00:00
|
|
|
log.Infoln("[UDP] %s --> %v using DIRECT", metadata.SourceAddress(), metadata.String())
|
|
|
|
default:
|
|
|
|
log.Infoln("[UDP] %s --> %v doesn't match any rule using DIRECT", metadata.SourceAddress(), metadata.String())
|
2019-10-11 12:11:18 +00:00
|
|
|
}
|
|
|
|
|
2020-02-15 13:42:46 +00:00
|
|
|
natTable.Set(key, pc)
|
|
|
|
natTable.Delete(lockKey)
|
2019-10-11 12:11:18 +00:00
|
|
|
wg.Done()
|
2020-02-15 13:42:46 +00:00
|
|
|
go handleUDPToLocal(packet.UDPPacket, pc, key)
|
2019-04-24 02:29:29 +00:00
|
|
|
}
|
|
|
|
|
2019-10-11 12:11:18 +00:00
|
|
|
wg.Wait()
|
2020-02-15 13:42:46 +00:00
|
|
|
pc := natTable.Get(key)
|
2019-10-11 12:11:18 +00:00
|
|
|
if pc != nil {
|
2020-02-07 12:53:43 +00:00
|
|
|
if !metadata.Resolved() {
|
2020-02-15 13:42:46 +00:00
|
|
|
ip, err := resolver.ResolveIP(metadata.Host)
|
2020-02-07 12:53:43 +00:00
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
metadata.DstIP = ip
|
|
|
|
}
|
2020-02-15 13:42:46 +00:00
|
|
|
handleUDPToRemote(packet, pc, metadata.UDPAddr())
|
2019-08-08 17:28:37 +00:00
|
|
|
}
|
2019-10-11 12:11:18 +00:00
|
|
|
}()
|
|
|
|
}
|
2019-08-08 17:28:37 +00:00
|
|
|
|
2020-02-15 13:42:46 +00:00
|
|
|
func handleTCPConn(localConn C.ServerAdapter) {
|
2019-10-11 12:11:18 +00:00
|
|
|
defer localConn.Close()
|
|
|
|
|
|
|
|
metadata := localConn.Metadata()
|
|
|
|
if !metadata.Valid() {
|
|
|
|
log.Warnln("[Metadata] not valid: %#v", metadata)
|
|
|
|
return
|
2019-04-23 15:29:36 +00:00
|
|
|
}
|
|
|
|
|
2020-02-15 13:42:46 +00:00
|
|
|
if err := preHandleMetadata(metadata); err != nil {
|
2020-02-07 12:53:43 +00:00
|
|
|
log.Debugln("[Metadata PreHandle] error: %s", err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2020-02-15 13:42:46 +00:00
|
|
|
proxy, rule, err := resolveMetadata(metadata)
|
2019-10-11 12:11:18 +00:00
|
|
|
if err != nil {
|
|
|
|
log.Warnln("Parse metadata failed: %v", err)
|
|
|
|
return
|
|
|
|
}
|
2019-07-25 09:47:39 +00:00
|
|
|
|
2019-08-12 06:01:32 +00:00
|
|
|
remoteConn, err := proxy.Dial(metadata)
|
2018-06-10 14:50:03 +00:00
|
|
|
if err != nil {
|
2019-08-10 12:14:24 +00:00
|
|
|
log.Warnln("dial %s error: %s", proxy.Name(), err.Error())
|
2018-06-10 14:50:03 +00:00
|
|
|
return
|
|
|
|
}
|
2019-10-27 13:44:07 +00:00
|
|
|
remoteConn = newTCPTracker(remoteConn, DefaultManager, metadata, rule)
|
2019-08-12 06:01:32 +00:00
|
|
|
defer remoteConn.Close()
|
2018-06-10 14:50:03 +00:00
|
|
|
|
2020-01-31 06:58:54 +00:00
|
|
|
switch true {
|
|
|
|
case rule != nil:
|
|
|
|
log.Infoln("[TCP] %s --> %v match %s using %s", metadata.SourceAddress(), metadata.String(), rule.RuleType().String(), remoteConn.Chains().String())
|
2020-02-15 13:42:46 +00:00
|
|
|
case mode == Global:
|
2020-01-31 06:58:54 +00:00
|
|
|
log.Infoln("[TCP] %s --> %v using GLOBAL", metadata.SourceAddress(), metadata.String())
|
2020-02-15 13:42:46 +00:00
|
|
|
case mode == Direct:
|
2020-01-31 06:58:54 +00:00
|
|
|
log.Infoln("[TCP] %s --> %v using DIRECT", metadata.SourceAddress(), metadata.String())
|
|
|
|
default:
|
|
|
|
log.Infoln("[TCP] %s --> %v doesn't match any rule using DIRECT", metadata.SourceAddress(), metadata.String())
|
2019-08-08 17:28:37 +00:00
|
|
|
}
|
|
|
|
|
2018-07-25 16:04:59 +00:00
|
|
|
switch adapter := localConn.(type) {
|
2019-12-08 04:17:24 +00:00
|
|
|
case *inbound.HTTPAdapter:
|
2020-02-15 13:42:46 +00:00
|
|
|
handleHTTP(adapter, remoteConn)
|
2019-12-08 04:17:24 +00:00
|
|
|
case *inbound.SocketAdapter:
|
2020-02-15 13:42:46 +00:00
|
|
|
handleSocket(adapter, remoteConn)
|
2018-07-25 16:04:59 +00:00
|
|
|
}
|
2018-06-10 14:50:03 +00:00
|
|
|
}
|
|
|
|
|
2020-02-15 13:42:46 +00:00
|
|
|
func shouldResolveIP(rule C.Rule, metadata *C.Metadata) bool {
|
2019-10-27 16:02:23 +00:00
|
|
|
return !rule.NoResolveIP() && metadata.Host != "" && metadata.DstIP == nil
|
2019-02-02 12:47:38 +00:00
|
|
|
}
|
|
|
|
|
2020-02-15 13:42:46 +00:00
|
|
|
func match(metadata *C.Metadata) (C.Proxy, C.Rule, error) {
|
|
|
|
configMux.RLock()
|
|
|
|
defer configMux.RUnlock()
|
2018-06-14 16:49:52 +00:00
|
|
|
|
2019-04-24 04:02:52 +00:00
|
|
|
var resolved bool
|
2019-09-11 09:00:55 +00:00
|
|
|
|
2020-02-15 13:42:46 +00:00
|
|
|
if node := resolver.DefaultHosts.Search(metadata.Host); node != nil {
|
2019-09-11 09:00:55 +00:00
|
|
|
ip := node.Data.(net.IP)
|
2019-10-27 13:44:07 +00:00
|
|
|
metadata.DstIP = ip
|
2019-09-11 09:00:55 +00:00
|
|
|
resolved = true
|
|
|
|
}
|
|
|
|
|
2020-02-15 13:42:46 +00:00
|
|
|
for _, rule := range rules {
|
|
|
|
if !resolved && shouldResolveIP(rule, metadata) {
|
|
|
|
ip, err := resolver.ResolveIP(metadata.Host)
|
2019-02-02 12:47:38 +00:00
|
|
|
if err != nil {
|
2020-02-15 13:42:46 +00:00
|
|
|
if !ignoreResolveFail {
|
2019-08-08 17:28:37 +00:00
|
|
|
return nil, nil, fmt.Errorf("[DNS] resolve %s error: %s", metadata.Host, err.Error())
|
2019-04-24 04:02:52 +00:00
|
|
|
}
|
|
|
|
log.Debugln("[DNS] resolve %s error: %s", metadata.Host, err.Error())
|
|
|
|
} else {
|
|
|
|
log.Debugln("[DNS] %s --> %s", metadata.Host, ip.String())
|
2019-10-27 13:44:07 +00:00
|
|
|
metadata.DstIP = ip
|
2019-02-02 12:47:38 +00:00
|
|
|
}
|
2019-04-24 04:02:52 +00:00
|
|
|
resolved = true
|
2019-02-02 12:47:38 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 16:02:23 +00:00
|
|
|
if rule.Match(metadata) {
|
2020-02-15 13:42:46 +00:00
|
|
|
adapter, ok := proxies[rule.Adapter()]
|
2019-04-23 15:29:36 +00:00
|
|
|
if !ok {
|
|
|
|
continue
|
2018-06-10 14:50:03 +00:00
|
|
|
}
|
2019-04-23 15:29:36 +00:00
|
|
|
|
|
|
|
if metadata.NetWork == C.UDP && !adapter.SupportUDP() {
|
2019-07-25 09:47:39 +00:00
|
|
|
log.Debugln("%v UDP is not supported", adapter.Name())
|
2019-04-23 15:29:36 +00:00
|
|
|
continue
|
|
|
|
}
|
2019-08-08 17:28:37 +00:00
|
|
|
return adapter, rule, nil
|
2018-06-10 14:50:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-15 13:42:46 +00:00
|
|
|
return proxies["DIRECT"], nil, nil
|
2018-06-10 14:50:03 +00:00
|
|
|
}
|