Skip to content

Commit

Permalink
Signed-off-by: arraykeys@gmail.com <arraykeys@gmail.com>
Browse files Browse the repository at this point in the history
  • Loading branch information
snail007 committed Jun 29, 2018
1 parent a9f8acd commit 0932aec
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
5 changes: 2 additions & 3 deletions services/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@ func (s *HTTP) OutToTCP(useProxy bool, address string, inConn *net.Conn, req *ut
Password: *s.cfg.ParentKey,
})
}

outAddr := outConn.RemoteAddr().String()
//outLocalAddr := outConn.LocalAddr().String()
if req.IsHTTPS() && (!useProxy || *s.cfg.ParentType == "ssh") {
Expand All @@ -353,8 +352,8 @@ func (s *HTTP) OutToTCP(useProxy bool, address string, inConn *net.Conn, req *ut
} else {
//https或者http,上级是代理,proxy需要转发
outConn.SetDeadline(time.Now().Add(time.Millisecond * time.Duration(*s.cfg.Timeout)))
//直连目标或上级非代理,清理HTTP头部的代理头信息
if !useProxy || *s.cfg.ParentType == "ssh" {
//直连目标或上级非代理或非SNI,清理HTTP头部的代理头信息.
if (!useProxy || *s.cfg.ParentType == "ssh") && !req.IsSNI {
_, err = outConn.Write(utils.RemoveProxyHeaders(req.HeadBuf))
} else {
_, err = outConn.Write(req.HeadBuf)
Expand Down
4 changes: 2 additions & 2 deletions utils/conncrypt/conncrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
)

//Confg defaults
const DefaultIterations = 2048
const DefaultKeySize = 32 //256bits
const DefaultIterations = 1024
const DefaultKeySize = 24 //256bits
var DefaultHashFunc = sha256.New
var DefaultSalt = []byte(`
(;QUHj.BQ?RXzYSO]ifkXp/G!kFmWyXyEV6Nt!d|@bo+N$L9+<d$|g6e26T}
Expand Down
2 changes: 2 additions & 0 deletions utils/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ type HTTPRequest struct {
isBasicAuth bool
basicAuth *BasicAuth
log *logger.Logger
IsSNI bool
}

func NewHTTPRequest(inConn *net.Conn, bufSize int, isBasicAuth bool, basicAuth *BasicAuth, log *logger.Logger, header ...[]byte) (req HTTPRequest, err error) {
Expand Down Expand Up @@ -360,6 +361,7 @@ func NewHTTPRequest(inConn *net.Conn, bufSize int, isBasicAuth bool, basicAuth *
//sni success
req.Method = "SNI"
req.hostOrURL = "https://" + serverName + ":443"
req.IsSNI = true
} else {
//sni fail , try http
index := bytes.IndexByte(req.HeadBuf, '\n')
Expand Down

0 comments on commit 0932aec

Please sign in to comment.