fix: inner request error
This commit is contained in:
parent
573be855f7
commit
c161d5e6be
2 changed files with 2 additions and 12 deletions
|
@ -33,15 +33,10 @@ func NewInner(conn net.Conn, dst string, host string) *context.ConnContext {
|
||||||
metadata.Host = host
|
metadata.Host = host
|
||||||
metadata.AddrType = C.AtypDomainName
|
metadata.AddrType = C.AtypDomainName
|
||||||
metadata.Process = C.ClashName
|
metadata.Process = C.ClashName
|
||||||
if ip, port, err := parseAddr(dst); err == nil {
|
if h, port, err := net.SplitHostPort(dst); err == nil {
|
||||||
metadata.DstPort = port
|
metadata.DstPort = port
|
||||||
if host == "" {
|
if host == "" {
|
||||||
metadata.DstIP = ip
|
metadata.Host = h
|
||||||
if ip.Is4() {
|
|
||||||
metadata.AddrType = C.AtypIPv6
|
|
||||||
} else {
|
|
||||||
metadata.AddrType = C.AtypIPv4
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package provider
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/Dreamacro/clash/component/dialer"
|
|
||||||
"github.com/Dreamacro/clash/listener/inner"
|
"github.com/Dreamacro/clash/listener/inner"
|
||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
|
@ -86,10 +85,6 @@ func (h *HTTPVehicle) Read() ([]byte, error) {
|
||||||
client := http.Client{Transport: transport}
|
client := http.Client{Transport: transport}
|
||||||
resp, err := client.Do(req)
|
resp, err := client.Do(req)
|
||||||
if err != nil {
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue