-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(clients): fix clients names (#6)
* fix(clients): fix clients and load test
- Loading branch information
Showing
9 changed files
with
115 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package dfx | ||
|
||
import ( | ||
"errors" | ||
"strings" | ||
|
||
"go.uber.org/fx" | ||
"go.uber.org/zap" | ||
|
||
"github.com/gstones/moke-kit/server/pkg/sfx" | ||
) | ||
|
||
// Author is a demo auth service | ||
type Author struct { | ||
} | ||
|
||
// Auth is a demo auth method | ||
func (d *Author) Auth(token string) (string, error) { | ||
if !strings.Contains(token, "test") { | ||
return "", errors.New("token error") | ||
} | ||
return token, nil | ||
} | ||
|
||
// AuthModule is a demo auth module | ||
// you can implement your own auth service or auth function | ||
// Auth will check every rpc/http request, | ||
// if you want to disable it for a service, add `utility.WithoutAuth` in struct of your service | ||
// | ||
// type service struct { | ||
// utility.WithoutAuth | ||
// } | ||
var AuthModule = fx.Provide( | ||
func( | ||
l *zap.Logger, | ||
) (out sfx.AuthServiceResult, err error) { | ||
out.AuthService = &Author{} | ||
return | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export const makeParams = (token) => { | ||
return { | ||
metadata: { | ||
'x-my-header': 'k6test', | ||
'x-my-header-bin': new Uint8Array([1, 2, 3]), | ||
'authorization': "bearer " + token, | ||
}, | ||
tags: {k6test: 'yes'}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
syntax = "proto3"; | ||
|
||
package demo.pb; | ||
option go_package = "demo/api;pb"; | ||
|
||
service DemoService { | ||
rpc Hi (HiRequest) returns (HiResponse) {}; | ||
rpc Watch(WatchRequest) returns (stream WatchResponse) {}; | ||
} | ||
|
||
message HiRequest { | ||
string uid = 1; | ||
string message = 2; | ||
} | ||
|
||
message HiResponse { | ||
string message = 1; | ||
} | ||
|
||
message WatchRequest { | ||
string uid = 1; | ||
string topic = 2; | ||
} | ||
|
||
message WatchResponse { | ||
string message = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters