fix: inner request error

This commit is contained in:
Skyxim 2022-04-28 09:24:40 +08:00
parent 573be855f7
commit c161d5e6be
2 changed files with 2 additions and 12 deletions

View File

@ -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
}
}

View File

@ -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
}