From c161d5e6bee42473c75d929f94a64ee47fc57452 Mon Sep 17 00:00:00 2001 From: Skyxim Date: Thu, 28 Apr 2022 09:24:40 +0800 Subject: [PATCH] fix: inner request error --- adapter/inbound/socket.go | 9 ++------- adapter/provider/vehicle.go | 5 ----- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/adapter/inbound/socket.go b/adapter/inbound/socket.go index dea100e1..5aa90034 100644 --- a/adapter/inbound/socket.go +++ b/adapter/inbound/socket.go @@ -33,15 +33,10 @@ func NewInner(conn net.Conn, dst string, host string) *context.ConnContext { metadata.Host = host metadata.AddrType = C.AtypDomainName metadata.Process = C.ClashName - if ip, port, err := parseAddr(dst); err == nil { + if h, port, err := net.SplitHostPort(dst); err == nil { metadata.DstPort = port if host == "" { - metadata.DstIP = ip - if ip.Is4() { - metadata.AddrType = C.AtypIPv6 - } else { - metadata.AddrType = C.AtypIPv4 - } + metadata.Host = h } } diff --git a/adapter/provider/vehicle.go b/adapter/provider/vehicle.go index eba8423c..30282d82 100644 --- a/adapter/provider/vehicle.go +++ b/adapter/provider/vehicle.go @@ -2,7 +2,6 @@ package provider import ( "context" - "github.com/Dreamacro/clash/component/dialer" "github.com/Dreamacro/clash/listener/inner" "io" "net" @@ -86,10 +85,6 @@ func (h *HTTPVehicle) Read() ([]byte, error) { client := http.Client{Transport: transport} resp, err := client.Do(req) if err != nil { - transport.DialContext = func(ctx context.Context, network, address string) (net.Conn, error) { - return dialer.DialContext(ctx, network, address) - } - resp, err = client.Do(req) if err != nil { return nil, err }