Skip to content

Commit 2687e16

Browse files
committed
fix: package ident
Change-Id: I944469daa9fd259b64112eaf669a8a382c0051cf
1 parent 37335f7 commit 2687e16

File tree

19 files changed

+104
-104
lines changed

19 files changed

+104
-104
lines changed

examples/bench/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func main() {
2828
erpc.SetGopool(1024*1024*100, time.Minute*10)
2929

3030
go func() {
31-
log.Println(hterpc.ListenAndServe(*debugAddr, nil))
31+
log.Println(http.ListenAndServe(*debugAddr, nil))
3232
}()
3333

3434
conc, tn, err := msg.CheckArgs(*concurrency, *total)

examples/bench/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func main() {
4444
erpc.SetGopool(1024*1024*100, time.Minute*10)
4545

4646
go func() {
47-
log.Println(hterpc.ListenAndServe(*debugAddr, nil))
47+
log.Println(http.ListenAndServe(*debugAddr, nil))
4848
}()
4949

5050
erpc.SetServiceMethodMapper(erpc.RPCServiceMethodMapper)

mixer/evio/bench/tp_client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func main() {
2828
erpc.SetGopool(1024*1024*100, time.Minute*10)
2929

3030
go func() {
31-
log.Println(hterpc.ListenAndServe(*debugAddr, nil))
31+
log.Println(http.ListenAndServe(*debugAddr, nil))
3232
}()
3333

3434
conc, tn, err := msg.CheckArgs(*concurrency, *total)

mixer/evio/bench/tp_evio_server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func main() {
4545
erpc.SetGopool(1024*1024*100, time.Minute*10)
4646

4747
go func() {
48-
log.Println(hterpc.ListenAndServe(*debugAddr, nil))
48+
log.Println(http.ListenAndServe(*debugAddr, nil))
4949
}()
5050

5151
erpc.SetServiceMethodMapper(erpc.RPCServiceMethodMapper)

mixer/evio/evio/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ $ go run examples/echo-server/main.go
155155
These benchmarks were run on an ec2 c4.xlarge instance in single-threaded mode (GOMAXPROC=1) over Ipv4 localhost.
156156
Check out [benchmarks](benchmarks) for more info.
157157

158-
<img src="benchmarks/out/echo.png" width="336" height="144" border="0" alt="echo benchmark"><img src="benchmarks/out/hterpc.png" width="336" height="144" border="0" alt="http benchmark"><img src="benchmarks/out/redis_pipeline_1.png" width="336" height="144" border="0" alt="redis 1 benchmark"><img src="benchmarks/out/redis_pipeline_8.png" width="336" height="144" border="0" alt="redis 8 benchmark">
158+
<img src="benchmarks/out/echo.png" width="336" height="144" border="0" alt="echo benchmark"><img src="benchmarks/out/http.png" width="336" height="144" border="0" alt="http benchmark"><img src="benchmarks/out/redis_pipeline_1.png" width="336" height="144" border="0" alt="redis 1 benchmark"><img src="benchmarks/out/redis_pipeline_8.png" width="336" height="144" border="0" alt="redis 8 benchmark">
159159

160160

161161
## Contact

mixer/evio/evio/vendor/github.com/kavu/go_reuseport/README.md

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mixer/evio/evio/vendor/github.com/kavu/go_reuseport/tcp_test.go

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mixer/websocket/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ func TestPbWebsocketTLS(t *testing.T) {
8686

8787
func TestCustomizedWebsocket(t *testing.T) {
8888
srv := erpc.NewPeer(erpc.PeerConfig{})
89-
hterpc.Handle("/ws", ws.NewJSONServeHandler(srv, nil))
90-
go hterpc.ListenAndServe(":9092", nil)
89+
http.Handle("/ws", ws.NewJSONServeHandler(srv, nil))
90+
go http.ListenAndServe(":9092", nil)
9191
srv.RouteCall(new(P))
9292
time.Sleep(time.Second * 1)
9393

mixer/websocket/server.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,18 @@ import (
3131
type Server struct {
3232
erpc.Peer
3333
cfg erpc.PeerConfig
34-
serveMux *hterpc.ServeMux
35-
server *hterpc.Server
34+
serveMux *http.ServeMux
35+
server *http.Server
3636
rootPath string
3737
lis net.Listener
3838
lisAddr net.Addr
39-
handshake func(*ws.Config, *hterpc.Request) error
39+
handshake func(*ws.Config, *http.Request) error
4040
}
4141

4242
// NewServer creates a websocket server.
4343
func NewServer(rootPath string, cfg erpc.PeerConfig, globalLeftPlugin ...erpc.Plugin) *Server {
4444
p := erpc.NewPeer(cfg, globalLeftPlugin...)
45-
serveMux := hterpc.NewServeMux()
45+
serveMux := http.NewServeMux()
4646
lisAddr := cfg.ListenAddr()
4747
host, port, _ := net.SplitHostPort(lisAddr.String())
4848
if port == "0" {
@@ -59,7 +59,7 @@ func NewServer(rootPath string, cfg erpc.PeerConfig, globalLeftPlugin ...erpc.Pl
5959
serveMux: serveMux,
6060
rootPath: fixRootPath(rootPath),
6161
lisAddr: lisAddr,
62-
server: &hterpc.Server{Addr: lisAddr.String(), Handler: serveMux},
62+
server: &http.Server{Addr: lisAddr.String(), Handler: serveMux},
6363
}
6464
}
6565

@@ -115,33 +115,33 @@ func (srv *Server) Close() error {
115115
}
116116

117117
// SetHandshake sets customized handshake function.
118-
func (srv *Server) SetHandshake(handshake func(*ws.Config, *hterpc.Request) error) {
118+
func (srv *Server) SetHandshake(handshake func(*ws.Config, *http.Request) error) {
119119
srv.handshake = handshake
120120
}
121121

122122
// Handle registers the handler for the given rootPath.
123123
// If a handler already exists for rootPath, Handle panics.
124-
func (srv *Server) Handle(rootPath string, handler hterpc.Handler) {
124+
func (srv *Server) Handle(rootPath string, handler http.Handler) {
125125
srv.serveMux.Handle(rootPath, handler)
126126
}
127127

128128
// HandleFunc registers the handler function for the given rootPath.
129-
func (srv *Server) HandleFunc(rootPath string, handler func(hterpc.ResponseWriter, *hterpc.Request)) {
129+
func (srv *Server) HandleFunc(rootPath string, handler func(http.ResponseWriter, *http.Request)) {
130130
srv.serveMux.HandleFunc(rootPath, handler)
131131
}
132132

133133
// NewJSONServeHandler creates a websocket json handler.
134-
func NewJSONServeHandler(peer erpc.Peer, handshake func(*ws.Config, *hterpc.Request) error) hterpc.Handler {
134+
func NewJSONServeHandler(peer erpc.Peer, handshake func(*ws.Config, *http.Request) error) http.Handler {
135135
return NewServeHandler(peer, handshake, jsonSubProto.NewJSONSubProtoFunc())
136136
}
137137

138138
// NewPbServeHandler creates a websocket protobuf handler.
139-
func NewPbServeHandler(peer erpc.Peer, handshake func(*ws.Config, *hterpc.Request) error) hterpc.Handler {
139+
func NewPbServeHandler(peer erpc.Peer, handshake func(*ws.Config, *http.Request) error) http.Handler {
140140
return NewServeHandler(peer, handshake, pbSubProto.NewPbSubProtoFunc())
141141
}
142142

143143
// NewServeHandler creates a websocket handler.
144-
func NewServeHandler(peer erpc.Peer, handshake func(*ws.Config, *hterpc.Request) error, protoFunc ...erpc.ProtoFunc) hterpc.Handler {
144+
func NewServeHandler(peer erpc.Peer, handshake func(*ws.Config, *http.Request) error, protoFunc ...erpc.ProtoFunc) http.Handler {
145145
w := &serverHandler{
146146
peer: peer,
147147
Server: new(ws.Server),
@@ -154,15 +154,15 @@ func NewServeHandler(peer erpc.Peer, handshake func(*ws.Config, *hterpc.Request)
154154
scheme = "wss"
155155
}
156156
if handshake != nil {
157-
w.Server.Handshake = func(cfg *ws.Config, r *hterpc.Request) error {
157+
w.Server.Handshake = func(cfg *ws.Config, r *http.Request) error {
158158
cfg.Origin = &url.URL{
159159
Host: r.RemoteAddr,
160160
Scheme: scheme,
161161
}
162162
return handshake(cfg, r)
163163
}
164164
} else {
165-
w.Server.Handshake = func(cfg *ws.Config, r *hterpc.Request) error {
165+
w.Server.Handshake = func(cfg *ws.Config, r *http.Request) error {
166166
cfg.Origin = &url.URL{
167167
Host: r.RemoteAddr,
168168
Scheme: scheme,

mixer/websocket/websocket/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func NewConfig(server, origin string) (config *Config, err error) {
3434
if err != nil {
3535
return
3636
}
37-
config.Header = hterpc.Header(make(map[string][]string))
37+
config.Header = http.Header(make(map[string][]string))
3838
return
3939
}
4040

mixer/websocket/websocket/hybi.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ func (handler *hybiFrameHandler) WritePong(msg []byte) (n int, err error) {
332332
}
333333

334334
// newHybiConn creates a new WebSocket connection speaking hybi draft protocol.
335-
func newHybiConn(config *Config, buf *bufio.ReadWriter, rwc io.ReadWriteCloser, request *hterpc.Request) *Conn {
335+
func newHybiConn(config *Config, buf *bufio.ReadWriter, rwc io.ReadWriteCloser, request *http.Request) *Conn {
336336
if buf == nil {
337337
br := bufio.NewReader(rwc)
338338
bw := bufio.NewWriter(rwc)
@@ -437,7 +437,7 @@ func hybiClientHandshake(config *Config, br *bufio.Reader, bw *bufio.Writer) (er
437437
return err
438438
}
439439

440-
resp, err := hterpc.ReadResponse(br, &hterpc.Request{Method: "GET"})
440+
resp, err := http.ReadResponse(br, &http.Request{Method: "GET"})
441441
if err != nil {
442442
return err
443443
}
@@ -487,28 +487,28 @@ type hybiServerHandshaker struct {
487487
accept []byte
488488
}
489489

490-
func (c *hybiServerHandshaker) ReadHandshake(buf *bufio.Reader, req *hterpc.Request) (code int, err error) {
490+
func (c *hybiServerHandshaker) ReadHandshake(buf *bufio.Reader, req *http.Request) (code int, err error) {
491491
c.Version = ProtocolVersionHybi13
492492
if req.Method != "GET" {
493-
return hterpc.StatusMethodNotAllowed, ErrBadRequestMethod
493+
return http.StatusMethodNotAllowed, ErrBadRequestMethod
494494
}
495495
// HTTP version can be safely ignored.
496496

497497
if strings.ToLower(req.Header.Get("Upgrade")) != "websocket" ||
498498
!strings.Contains(strings.ToLower(req.Header.Get("Connection")), "upgrade") {
499-
return hterpc.StatusBadRequest, ErrNotWebSocket
499+
return http.StatusBadRequest, ErrNotWebSocket
500500
}
501501

502502
key := req.Header.Get("Sec-Websocket-Key")
503503
if key == "" {
504-
return hterpc.StatusBadRequest, ErrChallengeResponse
504+
return http.StatusBadRequest, ErrChallengeResponse
505505
}
506506
version := req.Header.Get("Sec-Websocket-Version")
507507
switch version {
508508
case "13":
509509
c.Version = ProtocolVersionHybi13
510510
default:
511-
return hterpc.StatusBadRequest, ErrBadWebSocketVersion
511+
return http.StatusBadRequest, ErrBadWebSocketVersion
512512
}
513513
var scheme string
514514
if req.TLS != nil {
@@ -518,7 +518,7 @@ func (c *hybiServerHandshaker) ReadHandshake(buf *bufio.Reader, req *hterpc.Requ
518518
}
519519
c.Location, err = url.ParseRequestURI(scheme + "://" + req.Host + req.URL.RequestURI())
520520
if err != nil {
521-
return hterpc.StatusBadRequest, err
521+
return http.StatusBadRequest, err
522522
}
523523
protocol := strings.TrimSpace(req.Header.Get("Sec-Websocket-Protocol"))
524524
if protocol != "" {
@@ -529,14 +529,14 @@ func (c *hybiServerHandshaker) ReadHandshake(buf *bufio.Reader, req *hterpc.Requ
529529
}
530530
c.accept, err = getNonceAccept([]byte(key))
531531
if err != nil {
532-
return hterpc.StatusInternalServerError, err
532+
return http.StatusInternalServerError, err
533533
}
534-
return hterpc.StatusSwitchingProtocols, nil
534+
return http.StatusSwitchingProtocols, nil
535535
}
536536

537537
// Origin parses the Origin header in req.
538538
// If the Origin header is not set, it returns nil and nil.
539-
func Origin(config *Config, req *hterpc.Request) (*url.URL, error) {
539+
func Origin(config *Config, req *http.Request) (*url.URL, error) {
540540
var origin string
541541
switch config.Version {
542542
case ProtocolVersionHybi13:
@@ -573,11 +573,11 @@ func (c *hybiServerHandshaker) AcceptHandshake(buf *bufio.Writer) (err error) {
573573
return buf.Flush()
574574
}
575575

576-
func (c *hybiServerHandshaker) NewServerConn(buf *bufio.ReadWriter, rwc io.ReadWriteCloser, request *hterpc.Request) *Conn {
576+
func (c *hybiServerHandshaker) NewServerConn(buf *bufio.ReadWriter, rwc io.ReadWriteCloser, request *http.Request) *Conn {
577577
return newHybiServerConn(c.Config, buf, rwc, request)
578578
}
579579

580580
// newHybiServerConn returns a new WebSocket connection speaking hybi draft protocol.
581-
func newHybiServerConn(config *Config, buf *bufio.ReadWriter, rwc io.ReadWriteCloser, request *hterpc.Request) *Conn {
581+
func newHybiServerConn(config *Config, buf *bufio.ReadWriter, rwc io.ReadWriteCloser, request *http.Request) *Conn {
582582
return newHybiConn(config, buf, rwc, request)
583583
}

0 commit comments

Comments
 (0)