Feature: add default-nameserver and outbound interface
This commit is contained in:
@ -16,10 +16,6 @@ import (
|
||||
"github.com/Dreamacro/clash/tunnel"
|
||||
)
|
||||
|
||||
var (
|
||||
tun = tunnel.Instance()
|
||||
)
|
||||
|
||||
type HttpListener struct {
|
||||
net.Listener
|
||||
address string
|
||||
@ -100,9 +96,9 @@ func handleConn(conn net.Conn, cache *cache.Cache) {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
tun.Add(adapters.NewHTTPS(request, conn))
|
||||
tunnel.Add(adapters.NewHTTPS(request, conn))
|
||||
return
|
||||
}
|
||||
|
||||
tun.Add(adapters.NewHTTP(request, conn))
|
||||
tunnel.Add(adapters.NewHTTP(request, conn))
|
||||
}
|
||||
|
@ -9,10 +9,6 @@ import (
|
||||
"github.com/Dreamacro/clash/tunnel"
|
||||
)
|
||||
|
||||
var (
|
||||
tun = tunnel.Instance()
|
||||
)
|
||||
|
||||
type RedirListener struct {
|
||||
net.Listener
|
||||
address string
|
||||
@ -59,5 +55,5 @@ func handleRedir(conn net.Conn) {
|
||||
return
|
||||
}
|
||||
conn.(*net.TCPConn).SetKeepAlive(true)
|
||||
tun.Add(inbound.NewSocket(target, conn, C.REDIR, C.TCP))
|
||||
tunnel.Add(inbound.NewSocket(target, conn, C.REDIR, C.TCP))
|
||||
}
|
||||
|
@ -13,10 +13,6 @@ import (
|
||||
"github.com/Dreamacro/clash/tunnel"
|
||||
)
|
||||
|
||||
var (
|
||||
tun = tunnel.Instance()
|
||||
)
|
||||
|
||||
type SockListener struct {
|
||||
net.Listener
|
||||
address string
|
||||
@ -68,5 +64,5 @@ func handleSocks(conn net.Conn) {
|
||||
io.Copy(ioutil.Discard, conn)
|
||||
return
|
||||
}
|
||||
tun.Add(adapters.NewSocket(target, conn, C.SOCKS, C.TCP))
|
||||
tunnel.Add(adapters.NewSocket(target, conn, C.SOCKS, C.TCP))
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
"github.com/Dreamacro/clash/common/pool"
|
||||
"github.com/Dreamacro/clash/component/socks5"
|
||||
C "github.com/Dreamacro/clash/constant"
|
||||
"github.com/Dreamacro/clash/tunnel"
|
||||
)
|
||||
|
||||
type SockUDPListener struct {
|
||||
@ -62,5 +63,5 @@ func handleSocksUDP(pc net.PacketConn, buf []byte, addr net.Addr) {
|
||||
payload: payload,
|
||||
bufRef: buf,
|
||||
}
|
||||
tun.AddPacket(adapters.NewPacket(target, packet, C.SOCKS))
|
||||
tunnel.AddPacket(adapters.NewPacket(target, packet, C.SOCKS))
|
||||
}
|
||||
|
Reference in New Issue
Block a user