From bfa28d89da537f56ee48527d44aad0e22ed26aca Mon Sep 17 00:00:00 2001 From: xSmurf Date: Mon, 25 Sep 2017 17:28:46 +0000 Subject: [PATCH] Fmt'ing some log outputs... --- sgfw/prompt.go | 8 ++++---- sgfw/socks_server_chain.go | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/sgfw/prompt.go b/sgfw/prompt.go index 4c03c6c..619daf2 100644 --- a/sgfw/prompt.go +++ b/sgfw/prompt.go @@ -45,7 +45,7 @@ func (p *prompter) prompt(policy *Policy) { return } p.policyMap[policy.sandbox+"|"+policy.path] = policy - fmt.Println("Saving policy key:" + policy.sandbox + "|" + policy.path) + log.Debugf("Saving policy key:" + policy.sandbox + "|" + policy.path) p.policyQueue = append(p.policyQueue, policy) p.cond.Signal() } @@ -99,7 +99,7 @@ func (p *prompter) processNextPacket() bool { } if pc.getPrompting() { - fmt.Println("Skipping over already prompted connection") + log.Debugf("Skipping over already prompted connection") promptLock.Unlock() continue } @@ -245,7 +245,7 @@ func (p *prompter) nextConnection() (pendingConnection, bool) { p.removePolicy(policy) } else { if pc == nil && !qempty { - fmt.Println("FIX ME: I NEED TO SLEEP ON A WAKEABLE CONDITION PROPERLY!!") + log.Errorf("FIX ME: I NEED TO SLEEP ON A WAKEABLE CONDITION PROPERLY!!") time.Sleep(time.Millisecond * 300) } return pc, qempty @@ -258,7 +258,7 @@ func (p *prompter) removePolicy(policy *Policy) { if DoMultiPrompt { if len(p.policyQueue) == 0 { - fmt.Println("Skipping over zero length policy queue") + log.Debugf("Skipping over zero length policy queue") newQueue = make([]*Policy, 0, 0) } } diff --git a/sgfw/socks_server_chain.go b/sgfw/socks_server_chain.go index 6836d58..c183953 100644 --- a/sgfw/socks_server_chain.go +++ b/sgfw/socks_server_chain.go @@ -141,7 +141,7 @@ func (s *socksChain) start() { var err error s.listener, err = net.Listen(s.cfg.ListenSocksNet, s.cfg.ListenSocksAddr) if err != nil { - log.Errorf("ERR/socks: Failed to listen on the socks address: %v", err) + log.Errorf("SOCKS: Failed to listen on the socks address: %v", err) os.Exit(1) } @@ -157,7 +157,7 @@ func (s *socksChain) socksAcceptLoop() error { conn, err := s.listener.Accept() if err != nil { if e, ok := err.(net.Error); ok && !e.Temporary() { - log.Infof("ERR/socks: Failed to Accept(): %v", err) + log.Errorf("SOCKS: Failed to Accept(): %v", err) return err } continue @@ -171,12 +171,12 @@ func (c *socksChainSession) sessionWorker() { defer c.clientConn.Close() clientAddr := c.clientConn.RemoteAddr() - log.Infof("INFO/socks: New connection from: %v", clientAddr) + log.Debugf("SOCKS: New connection from: %v", clientAddr) // Do the SOCKS handshake with the client, and read the command. var err error if c.req, err = Handshake(c.clientConn); err != nil { - log.Infof("ERR/socks: Failed SOCKS5 handshake: %v", err) + log.Errorf("SOCKS: Failed SOCKS5 handshake: %v", err) return } @@ -206,7 +206,7 @@ func (c *socksChainSession) sessionWorker() { c.handleConnect(tls) default: // Should *NEVER* happen, validated as part of handshake. - log.Infof("BUG/socks: Unsupported SOCKS command: 0x%02x", c.req.Cmd) + log.Warningf("SOCKS: Unsupported SOCKS command: 0x%02x", c.req.Cmd) c.req.Reply(ReplyCommandNotSupported) } } @@ -389,7 +389,7 @@ func (c *socksChainSession) handleConnect(tls bool) { if c.optData != nil { if _, err = c.upstreamConn.Write(c.optData); err != nil { - log.Infof("ERR/socks: Failed writing OptData: %v", err) + log.Errorf("SOCKS: Failed writing OptData: %v", err) return } c.optData = nil @@ -398,7 +398,7 @@ func (c *socksChainSession) handleConnect(tls bool) { // A upstream connection has been established, push data back and forth // till the session is done. c.forwardTraffic(tls) - log.Infof("INFO/socks: Closed SOCKS connection from: %v", c.clientConn.RemoteAddr()) + log.Debugf("SOCKS: Closed SOCKS connection from: %v", c.clientConn.RemoteAddr()) } func (c *socksChainSession) forwardTraffic(tls bool) {