mirror of
https://github.com/xjasonlyu/tun2socks.git
synced 2025-10-11 11:40:12 +08:00
cleanup fakedns package
This commit is contained in:
@@ -19,7 +19,7 @@ import (
|
||||
"github.com/xjasonlyu/tun2socks/proxy"
|
||||
"github.com/xjasonlyu/tun2socks/tun"
|
||||
|
||||
D "github.com/xjasonlyu/tun2socks/component/dns"
|
||||
D "github.com/xjasonlyu/tun2socks/component/fakedns"
|
||||
S "github.com/xjasonlyu/tun2socks/component/stats"
|
||||
)
|
||||
|
||||
|
@@ -5,7 +5,7 @@ package main
|
||||
import (
|
||||
"flag"
|
||||
|
||||
"github.com/xjasonlyu/tun2socks/component/dns/fakedns"
|
||||
"github.com/xjasonlyu/tun2socks/component/fakedns"
|
||||
"github.com/xjasonlyu/tun2socks/log"
|
||||
)
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
package dns
|
||||
package fakedns
|
||||
|
||||
import (
|
||||
"net"
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
type FakeDNS interface {
|
||||
Start() error
|
||||
Stop() error
|
||||
|
||||
// IPToHost returns the corresponding domain for the given IP.
|
||||
IPToHost(ip net.IP) (string, bool)
|
||||
}
|
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
"github.com/xjasonlyu/tun2socks/common/lsof"
|
||||
"github.com/xjasonlyu/tun2socks/common/pool"
|
||||
"github.com/xjasonlyu/tun2socks/component/dns"
|
||||
D "github.com/xjasonlyu/tun2socks/component/fakedns"
|
||||
"github.com/xjasonlyu/tun2socks/component/stats"
|
||||
C "github.com/xjasonlyu/tun2socks/constant"
|
||||
"github.com/xjasonlyu/tun2socks/core"
|
||||
@@ -20,11 +20,11 @@ type tcpHandler struct {
|
||||
proxyHost string
|
||||
proxyPort int
|
||||
|
||||
fakeDNS dns.FakeDNS
|
||||
fakeDNS D.FakeDNS
|
||||
sessionStater stats.SessionStater
|
||||
}
|
||||
|
||||
func NewTCPHandler(proxyHost string, proxyPort int, fakeDNS dns.FakeDNS, sessionStater stats.SessionStater) core.TCPConnHandler {
|
||||
func NewTCPHandler(proxyHost string, proxyPort int, fakeDNS D.FakeDNS, sessionStater stats.SessionStater) core.TCPConnHandler {
|
||||
return &tcpHandler{
|
||||
proxyHost: proxyHost,
|
||||
proxyPort: proxyPort,
|
||||
|
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
"github.com/xjasonlyu/tun2socks/common/lsof"
|
||||
"github.com/xjasonlyu/tun2socks/common/pool"
|
||||
"github.com/xjasonlyu/tun2socks/component/dns"
|
||||
D "github.com/xjasonlyu/tun2socks/component/fakedns"
|
||||
"github.com/xjasonlyu/tun2socks/component/stats"
|
||||
C "github.com/xjasonlyu/tun2socks/constant"
|
||||
"github.com/xjasonlyu/tun2socks/core"
|
||||
@@ -24,11 +24,11 @@ type udpHandler struct {
|
||||
remoteAddrMap sync.Map
|
||||
remoteConnMap sync.Map
|
||||
|
||||
fakeDNS dns.FakeDNS
|
||||
fakeDNS D.FakeDNS
|
||||
sessionStater stats.SessionStater
|
||||
}
|
||||
|
||||
func NewUDPHandler(proxyHost string, proxyPort int, timeout time.Duration, fakeDNS dns.FakeDNS, sessionStater stats.SessionStater) core.UDPConnHandler {
|
||||
func NewUDPHandler(proxyHost string, proxyPort int, timeout time.Duration, fakeDNS D.FakeDNS, sessionStater stats.SessionStater) core.UDPConnHandler {
|
||||
return &udpHandler{
|
||||
proxyHost: proxyHost,
|
||||
proxyPort: proxyPort,
|
||||
|
@@ -8,12 +8,12 @@ import (
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"github.com/xjasonlyu/tun2socks/component/dns"
|
||||
D "github.com/xjasonlyu/tun2socks/component/fakedns"
|
||||
"github.com/xjasonlyu/tun2socks/proxy/socks"
|
||||
)
|
||||
|
||||
// DNS lookup
|
||||
func lookupHost(fakeDNS dns.FakeDNS, target net.Addr) (targetHost string, err error) {
|
||||
func lookupHost(fakeDNS D.FakeDNS, target net.Addr) (targetHost string, err error) {
|
||||
var targetIP net.IP
|
||||
switch addr := target.(type) {
|
||||
case *net.TCPAddr:
|
||||
|
Reference in New Issue
Block a user