Skip to content

Commit

Permalink
优化一些内容
Browse files Browse the repository at this point in the history
  • Loading branch information
侯锐 committed Jan 21, 2019
1 parent ce29b94 commit 6700a15
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
4 changes: 2 additions & 2 deletions core/mylog/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ func init() {
}

func InitLog(file string, level string) {
fmt.Printf("### Log file is %s, env is %s ###\n", file, env)

if env == "develop" {
logrus.SetFormatter(&logrus.TextFormatter{
ForceColors: false,
Expand Down Expand Up @@ -68,4 +66,6 @@ func InitLog(file string, level string) {
}
logrus.SetOutput(logFile)
}

fmt.Printf("### Log file is [%s], log level is [%s], env is [%s] ###\n", file, logrus.GetLevel().String(), env)
}
7 changes: 0 additions & 7 deletions core/network/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package network
import (
"encoding/binary"
"errors"
"fmt"
"github.com/sirupsen/logrus"
"net"
)
Expand Down Expand Up @@ -38,12 +37,6 @@ func (c Connection) Read(length uint32) ([]byte, error) {

var buf = make([]byte, length)
var bufSize, err = c.conn.Read(buf)
// 连接被远程主机主动关闭
if bufSize == 0 {
e := fmt.Sprintf("conn closed by remote, %s -> %s", c.LocalAddress(), c.RemoteAddress())
logrus.Debug(e)
return nil, errors.New(e)
}
if err != nil {
c.Close()
return nil, err
Expand Down
3 changes: 2 additions & 1 deletion local/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,12 @@ func handlerSocks5(conn network.Connection) {
logrus.Warn(err)
return
}
logrus.Debugf("Socks5 auth success: %s", conn.RemoteAddress())
remoteConn, err := socks.ConnectRemote(conn, remoteServer, password)
if err != nil {
logrus.Warn(err)
return
}

logrus.Debugf("Socks5 remote connect success: %s", conn.RemoteAddress())
socks.HandlerSocks5Data(conn, remoteConn)
}

0 comments on commit 6700a15

Please sign in to comment.