Skip to content

Commit abfbeec

Browse files
committed
update
1 parent 0841236 commit abfbeec

File tree

6 files changed

+18
-24
lines changed

6 files changed

+18
-24
lines changed

README.md

+16-8
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,25 @@
1818
Web framework,this contains protobuf plugin to generate code from proto file
1919
## cgrpc
2020
grpc framework,this contains protobuf plugin to generate code from proto file
21-
## stream
22-
stream connection framework,use websocket's frame format,so this can support rawtcp and websocket at the same time on same port
2321
## crpc
2422
a new rpc framework(20-30% fast then grpc),this contains protobuf plugin to generate code from proto file
25-
## id
26-
snow flake
27-
## log
28-
log and trace log
29-
## pool
30-
sync.Pool for []byte and bufio.Reader and bufio.Writer
23+
## pbex
24+
protobuf extension for message validate,this is used in the web/crpc/cgrpc framework
25+
## stream
26+
stream connection framework,use websocket's frame format,so this can support rawtcp and websocket at the same time on same port
27+
## ws
28+
a simple ws handshake and message recv and send framework
3129
## container
3230
some useful struct
31+
## monitor
32+
Promethus support
33+
## mysql
34+
mysql driver wraper,add trace support and read write seprate
35+
## mongo
36+
mongodb driver wraper,add trace support
37+
## redis
38+
redis driver wraper,add trace support and some useful function(bloom filter,rate limiter,message queue,verify code check)
39+
## email
40+
simple email client used to send email
3341
## superd
3442
fork child process to exec some other program,like supervisor

id/id.go container/id/id.go

File renamed without changes.
File renamed without changes.

ws/const.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,8 @@ func (op OPCode) IsControl() bool {
3636
var ErrNotWS = errors.New("not a websocket connection")
3737
var ErrRequestLineFormat = errors.New("http request line format wrong")
3838
var ErrResponseLineFormat = errors.New("http response line format wrong")
39-
var ErrHttpVersion = errors.New("http version wrong")
40-
var ErrHttpMethod = errors.New("http method wrong")
4139
var ErrHeaderLineFormat = errors.New("http header line format wrong")
42-
var ErrSign = errors.New("sign error")
40+
var ErrAcceptSign = errors.New("accept sign wrong")
4341

4442
var ErrMsgLarge = errors.New("message too large")
4543
var ErrMsgFin = errors.New("message must be fin")

ws/cupgrader.go

+1-5
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,6 @@ func Cupgrade(reader *bufio.Reader, writer net.Conn, host, path string) (header
9999
e = ErrResponseLineFormat
100100
return
101101
}
102-
if !bytes.Equal(pieces[0], []byte{'H', 'T', 'T', 'P', '/', '1', '.', '1'}) {
103-
e = ErrHttpVersion
104-
return
105-
}
106102
if !bytes.Equal(pieces[1], []byte{'1', '0', '1'}) {
107103
e = ErrResponseLineFormat
108104
return
@@ -142,7 +138,7 @@ func Cupgrade(reader *bufio.Reader, writer net.Conn, host, path string) (header
142138
h.Write(nonce)
143139
h.Write([]byte{'2', '5', '8', 'E', 'A', 'F', 'A', '5', '-', 'E', '9', '1', '4', '-', '4', '7', 'D', 'A', '-', '9', '5', 'C', 'A', '-', 'C', '5', 'A', 'B', '0', 'D', 'C', '8', '5', 'B', '1', '1'})
144140
if base64.StdEncoding.EncodeToString(h.Sum(nil)) != common.BTS(pieces[1]) {
145-
e = ErrSign
141+
e = ErrAcceptSign
146142
return
147143
}
148144
case "sec-websocket-version":

ws/supgrader.go

-8
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,6 @@ func Supgrade(reader *bufio.Reader, writer net.Conn) (path string, header http.H
7676
e = ErrRequestLineFormat
7777
return
7878
}
79-
if !bytes.Equal(pieces[0], []byte{'G', 'E', 'T'}) {
80-
e = ErrHttpMethod
81-
return
82-
}
83-
if !bytes.Equal(pieces[2], []byte{'H', 'T', 'T', 'P', '/', '1', '.', '1'}) {
84-
e = ErrHttpVersion
85-
return
86-
}
8779
if len(pieces[1]) == 0 {
8880
path = "/"
8981
} else if pieces[1][0] != '/' {

0 commit comments

Comments
 (0)