Skip to content

Feat auth supported for clients#111

Open
gutan wants to merge 3 commits into
bilibili:masterfrom
gutan:feat_auth_supported_for_clients
Open

Feat auth supported for clients#111
gutan wants to merge 3 commits into
bilibili:masterfrom
gutan:feat_auth_supported_for_clients

Conversation

@gutan
Copy link
Copy Markdown
Contributor

@gutan gutan commented Oct 29, 2019

proxy supported AUTH cmd for clients

@codecov-io
Copy link
Copy Markdown

Codecov Report

Merging #111 into master will decrease coverage by 0.19%.
The diff coverage is 44.64%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #111     +/-   ##
=========================================
- Coverage   49.47%   49.27%   -0.2%     
=========================================
  Files          62       62             
  Lines        6280     6307     +27     
=========================================
+ Hits         3107     3108      +1     
- Misses       2826     2849     +23     
- Partials      347      350      +3
Impacted Files Coverage Δ
proxy/config.go 25% <ø> (ø) ⬆️
proxy/proxy.go 0% <0%> (ø) ⬆️
proxy/handler.go 0% <0%> (ø) ⬆️
proxy/proto/redis/request.go 47.05% <0%> (-2.33%) ⬇️
proxy/proto/redis/cluster/proxy_conn.go 60.6% <0%> (ø) ⬆️
proxy/proto/redis/proxy_conn.go 72.63% <54.34%> (-8.81%) ⬇️
proxy/proto/pipe.go 82.64% <0%> (-0.83%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update eb1e8a6...fe617d5. Read the comment docs.

}

func (r *Request) IsAuth() bool {
if r.IsCtl() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return r.IsCtrl() && bytes.Equal(r.resp.array[0].data, cmdAuthBytes)

} else if bytes.Equal(reqData, cmdQuitBytes) {
req.reply.respType = respString
// general supported cmd need authorized
if !pc.authorized && !req.IsAuth() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should not forward any command when pc.authorized is false. And so that authorized should be atomic flag or guard by mutex (be used by encoder/decoder together).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants