* fixes #512: geo download failed when startup - 启动阶段,executor还未初始化tunnel,tcpIn==nil导致geo下载失败,阻塞在 tcpIn <- context * chore: handled by the upper layer * chore: remove useless parameters --------- Co-authored-by: Skyxim <noreply@skyxim.dev>
This commit is contained in:
@ -1,9 +1,11 @@
|
||||
package inner
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net"
|
||||
|
||||
"github.com/Dreamacro/clash/adapter/inbound"
|
||||
C "github.com/Dreamacro/clash/constant"
|
||||
"net"
|
||||
)
|
||||
|
||||
var tcpIn chan<- C.ConnContext
|
||||
@ -12,9 +14,13 @@ func New(in chan<- C.ConnContext) {
|
||||
tcpIn = in
|
||||
}
|
||||
|
||||
func HandleTcp(dst string, host string) net.Conn {
|
||||
func HandleTcp(address string) (conn net.Conn, err error) {
|
||||
if tcpIn == nil {
|
||||
return nil, errors.New("tcp uninitialized")
|
||||
}
|
||||
// executor Parsed
|
||||
conn1, conn2 := net.Pipe()
|
||||
context := inbound.NewInner(conn2, dst, host)
|
||||
context := inbound.NewInner(conn2, address)
|
||||
tcpIn <- context
|
||||
return conn1
|
||||
return conn1, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user