-
Notifications
You must be signed in to change notification settings - Fork 450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support handshake data validator #69
Conversation
添加握手验证hook
processPacket ,添加校验握手数据
新增WithHandshakeValidator 方法
修正‘=’缺失
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please format your code.
cluster/handler.go
Outdated
@@ -252,6 +252,12 @@ func (h *LocalHandler) handle(conn net.Conn) { | |||
func (h *LocalHandler) processPacket(agent *agent, p *packet.Packet) error { | |||
switch p.Type { | |||
case packet.Handshake: | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the blank line.
internal/env/env.go
Outdated
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why add two blank lines.
internal/env/env.go
Outdated
@@ -38,6 +38,7 @@ var ( | |||
CheckOrigin func(*http.Request) bool // check origin when websocket enabled | |||
Debug bool // enable Debug | |||
WSPath string // WebSocket path(eg: ws://127.0.0.1/WSPath) | |||
HandshakeValidator func([]byte) error // When you need to verify the custom data of the handshake request |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Format code.
internal/env/env.go
Outdated
Serializer = protobuf.NewSerializer() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the blank line.
Format Code Success |
@NicholasChan1025 Thanks for your contribution. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What problem does this PR solve?
Fix: #68
解决issue68 自定义握手数据验证,验证失败则握手失败