From 6306a282c1da57a32ef7d996a90147f825159de6 Mon Sep 17 00:00:00 2001 From: uoosef Date: Sun, 3 Sep 2023 22:00:30 +0330 Subject: [PATCH] improved logging for dns hijacking resisted doh --- server/server.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/server.go b/server/server.go index 1ef6d64..478e488 100644 --- a/server/server.go +++ b/server/server.go @@ -166,15 +166,19 @@ func (s *Server) Handle(ctx context.Context, w io.Writer, req *socks5.Request, n // if user has a faulty dns, and it returns dpi ip, // we resolve destination based on extracted tls sni or http hostname if hostname != nil && strings.Contains(IPPort, "10.10.3") { + logger.Infof("%s is dpi ip extracting destination host from packets...", IPPort) req.RawDestAddr.FQDN = string(hostname) IPPort, err = s.resolveDestination(ctx, req) if err != nil { // if destination resolved to dpi and we cant resolve to actual destination // it's pointless to connect to dpi + logger.Infof("system was unable to extract destination host from packets!") return err } } + logger.Infof("Dialing %s...", IPPort) + conn, err := s.Dialer.TCPDial("tcp", "", IPPort) if err != nil { return err @@ -231,7 +235,6 @@ func (s *Server) resolveDestination(ctx context.Context, req *socks5.Request) (s } addr := net.JoinHostPort(dest.IP.String(), strconv.Itoa(dest.Port)) - logger.Infof("dialing %s", addr) return addr, nil }