Skip to content
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

feat: all frame transmit upon one quic stream #620

Merged
merged 8 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (c *Credential) Name() string {
// Authenticate finds an authentication way in `auths` and authenticates the Object.
//
// If `auths` is nil or empty, It returns true, It think that authentication is not required.
func Authenticate(auths map[string]Authentication, obj *frame.AuthenticationFrame) (metadata.M, bool) {
func Authenticate(auths map[string]Authentication, obj *frame.HandshakeFrame) (metadata.M, bool) {
if auths == nil || len(auths) <= 0 {
return metadata.M{}, true
}
Expand Down
10 changes: 5 additions & 5 deletions core/auth/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TestRegister(t *testing.T) {
func TestAuthenticate(t *testing.T) {
type args struct {
auths map[string]Authentication
obj *frame.AuthenticationFrame
obj *frame.HandshakeFrame
}
tests := []struct {
name string
Expand All @@ -42,7 +42,7 @@ func TestAuthenticate(t *testing.T) {
name: "auths is nil",
args: args{
auths: nil,
obj: &frame.AuthenticationFrame{AuthName: "mock", AuthPayload: "mock_payload"},
obj: &frame.HandshakeFrame{AuthName: "mock", AuthPayload: "mock_payload"},
},
want: true,
},
Expand All @@ -58,23 +58,23 @@ func TestAuthenticate(t *testing.T) {
name: "auth obj not found",
args: args{
auths: map[string]Authentication{"mock": mockAuth{authed: true}},
obj: &frame.AuthenticationFrame{AuthName: "mock_not_match", AuthPayload: "mock_payload"},
obj: &frame.HandshakeFrame{AuthName: "mock_not_match", AuthPayload: "mock_payload"},
},
want: false,
},
{
name: "auth success",
args: args{
auths: map[string]Authentication{"mock": mockAuth{authed: true}},
obj: &frame.AuthenticationFrame{AuthName: "mock", AuthPayload: "mock_payload"},
obj: &frame.HandshakeFrame{AuthName: "mock", AuthPayload: "mock_payload"},
},
want: true,
},
{
name: "auth failed",
args: args{
auths: map[string]Authentication{"mock": mockAuth{authed: false}},
obj: &frame.AuthenticationFrame{AuthName: "mock", AuthPayload: "mock_payload"},
obj: &frame.HandshakeFrame{AuthName: "mock", AuthPayload: "mock_payload"},
},
want: false,
},
Expand Down
Loading