mirror of
https://github.com/ehang-io/nps.git
synced 2025-07-03 13:10:42 +00:00
Compress crypt bug
This commit is contained in:
parent
ad22ada1f1
commit
0d257a95dd
@ -9,6 +9,7 @@ import (
|
|||||||
"github.com/cnlh/nps/lib/file"
|
"github.com/cnlh/nps/lib/file"
|
||||||
"github.com/cnlh/nps/vender/github.com/astaxie/beego"
|
"github.com/cnlh/nps/vender/github.com/astaxie/beego"
|
||||||
"github.com/cnlh/nps/vender/github.com/astaxie/beego/logs"
|
"github.com/cnlh/nps/vender/github.com/astaxie/beego/logs"
|
||||||
|
"io"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httputil"
|
"net/http/httputil"
|
||||||
@ -121,6 +122,7 @@ func (s *httpServer) process(c *conn.Conn, r *http.Request) {
|
|||||||
target net.Conn
|
target net.Conn
|
||||||
lastHost *file.Host
|
lastHost *file.Host
|
||||||
err error
|
err error
|
||||||
|
connClient io.ReadWriteCloser
|
||||||
)
|
)
|
||||||
if host, err = file.GetCsvDb().GetInfoByHost(r.Host, r); err != nil {
|
if host, err = file.GetCsvDb().GetInfoByHost(r.Host, r); err != nil {
|
||||||
logs.Notice("the url %s %s can't be parsed!", r.Host, r.RequestURI)
|
logs.Notice("the url %s %s can't be parsed!", r.Host, r.RequestURI)
|
||||||
@ -151,9 +153,10 @@ func (s *httpServer) process(c *conn.Conn, r *http.Request) {
|
|||||||
logs.Notice("connect to target %s error %s", lk.Host, err)
|
logs.Notice("connect to target %s error %s", lk.Host, err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
connClient = conn.GetConn(target, lk.Crypt, lk.Compress, host.Client.Rate)
|
||||||
isConn = false
|
isConn = false
|
||||||
go func() {
|
go func() {
|
||||||
w, _ := common.CopyBuffer(c, conn.GetConn(target, lk.Crypt, lk.Compress, host.Client.Rate))
|
w, _ := common.CopyBuffer(c, connClient)
|
||||||
host.Flow.Add(0, w)
|
host.Flow.Add(0, w)
|
||||||
c.Close()
|
c.Close()
|
||||||
target.Close()
|
target.Close()
|
||||||
@ -182,7 +185,7 @@ func (s *httpServer) process(c *conn.Conn, r *http.Request) {
|
|||||||
}
|
}
|
||||||
host.Flow.Add(int64(len(b)), 0)
|
host.Flow.Add(int64(len(b)), 0)
|
||||||
//write
|
//write
|
||||||
target.Write(b)
|
connClient.Write(b)
|
||||||
}
|
}
|
||||||
end:
|
end:
|
||||||
if isConn {
|
if isConn {
|
||||||
|
@ -70,8 +70,8 @@
|
|||||||
<label class="control-label col-sm-2">crypt</label>
|
<label class="control-label col-sm-2">crypt</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<select class="form-control" name="crypt">
|
<select class="form-control" name="crypt">
|
||||||
<option {{if eq false .c.Cnf.Compress}}selected{{end}} value="0">no</option>
|
<option {{if eq false .c.Cnf.Crypt}}selected{{end}} value="0">no</option>
|
||||||
<option {{if eq true .c.Cnf.Compress}}selected{{end}} value="1">yes</option>
|
<option {{if eq true .c.Cnf.Crypt}}selected{{end}} value="1">yes</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user