refactor: remove redundant dump calls from Firewall setup and adjust logging level in ProxyHalf

This commit is contained in:
SunBK201 2025-11-12 19:51:41 +08:00
parent 186a88a654
commit 1c10f373b2
4 changed files with 4 additions and 5 deletions

View File

@ -118,8 +118,6 @@ func (f *Firewall) Setup(cfg *config.Config) (err error) {
if err != nil { if err != nil {
f.Cleanup() f.Cleanup()
} }
f.DumpNFTables()
f.DumpIPTables()
return err return err
} }

View File

@ -45,6 +45,8 @@ func (s *Server) Setup() (err error) {
logrus.Errorf("s.Firewall.Setup: %v", err) logrus.Errorf("s.Firewall.Setup: %v", err)
return err return err
} }
s.Firewall.DumpNFTables()
s.Firewall.DumpIPTables()
return nil return nil
} }

View File

@ -71,8 +71,8 @@ func ProxyHalf(dst, src net.Conn, rw *rewrite.Rewriter, destAddr string) {
}) })
if rw.Cache.Contains(destAddr) { if rw.Cache.Contains(destAddr) {
// Fast path: known pass-through // Fast path
log.LogInfoWithAddr(srcAddr, destAddr, fmt.Sprintf("destination (%s) in cache, passing through", destAddr)) log.LogDebugWithAddr(srcAddr, destAddr, fmt.Sprintf("destination (%s) in cache, direct forward", destAddr))
io.CopyBuffer(dst, src, one) io.CopyBuffer(dst, src, one)
return return
} }

View File

@ -64,7 +64,6 @@ func main() {
} }
logrus.Info("UA3F exited gracefully") logrus.Info("UA3F exited gracefully")
os.Exit(0) os.Exit(0)
}() }()
if err := srv.Start(); err != nil { if err := srv.Start(); err != nil {