Skip to content

Commit

Permalink
format代码
Browse files Browse the repository at this point in the history
  • Loading branch information
Hurricanezwf committed Feb 5, 2016
1 parent 04c26d1 commit 60c9804
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 18 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ bin/

# Cache
*.swp
*.swo
2 changes: 1 addition & 1 deletion cmd/frpc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"os"
"sync"

"frp/pkg/utils/log"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/frps/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package main
import (
"os"

"frp/pkg/utils/log"
"frp/pkg/utils/conn"
"frp/pkg/utils/log"
)

func main() {
Expand Down
16 changes: 8 additions & 8 deletions pkg/models/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
)

type ProxyClient struct {
Name string
Passwd string
LocalPort int64
Name string
Passwd string
LocalPort int64
}

func (p *ProxyClient) GetLocalConn() (c *conn.Conn, err error) {
Expand All @@ -24,7 +24,7 @@ func (p *ProxyClient) GetLocalConn() (c *conn.Conn, err error) {

func (p *ProxyClient) GetRemoteConn(addr string, port int64) (c *conn.Conn, err error) {
c = &conn.Conn{}
defer func(){
defer func() {
if err != nil {
c.Close()
}
Expand All @@ -37,9 +37,9 @@ func (p *ProxyClient) GetRemoteConn(addr string, port int64) (c *conn.Conn, err
}

req := &ClientCtlReq{
Type: WorkConn,
ProxyName: p.Name,
Passwd: p.Passwd,
Type: WorkConn,
ProxyName: p.Name,
Passwd: p.Passwd,
}

buf, _ := json.Marshal(req)
Expand All @@ -64,7 +64,7 @@ func (p *ProxyClient) StartTunnel(serverAddr string, serverPort int64) (err erro
}

log.Debug("Join two conns, (l[%s] r[%s]) (l[%s] r[%s])", localConn.GetLocalAddr(), localConn.GetRemoteAddr(),
remoteConn.GetLocalAddr(), remoteConn.GetRemoteAddr())
remoteConn.GetLocalAddr(), remoteConn.GetRemoteAddr())
go conn.Join(localConn, remoteConn)
return nil
}
13 changes: 6 additions & 7 deletions pkg/models/msg.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package models

type GeneralRes struct {
Code int64 `json:"code"`
Msg string `json:"msg"`
Code int64 `json:"code"`
Msg string `json:"msg"`
}

// type
Expand All @@ -12,16 +12,15 @@ const (
)

type ClientCtlReq struct {
Type int64 `json:"type"`
ProxyName string `json:"proxy_name"`
Passwd string `json:"passwd"`
Type int64 `json:"type"`
ProxyName string `json:"proxy_name"`
Passwd string `json:"passwd"`
}

type ClientCtlRes struct {
GeneralRes
}


type ServerCtlReq struct {
Type int64 `json:"type"`
Type int64 `json:"type"`
}
1 change: 1 addition & 0 deletions pkg/models/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func (p *ProxyServer) Start() (err error) {
p.UserConnList.Remove(element)
} else {
cliConn.Close()
p.Unlock()
continue
}
p.Unlock()
Expand Down
2 changes: 1 addition & 1 deletion pkg/utils/log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func SetLogFile(logWay string, logFile string) {
if logWay == "console" {
Log.SetLogger("console", "")
} else {
Log.SetLogger("file", `{"filename": "` + logFile + `"}`)
Log.SetLogger("file", `{"filename": "`+logFile+`"}`)
}
}

Expand Down

0 comments on commit 60c9804

Please sign in to comment.