MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / RPopAuth

Method RPopAuth

internal/home/client.go:808–834  ·  view source on GitHub ↗
(ctx context.Context, requestedModel string, sessionID string, headers http.Header, count int)

Source from the content-addressed store, hash-verified

806}
807
808func (c *Client) RPopAuth(ctx context.Context, requestedModel string, sessionID string, headers http.Header, count int) ([]byte, error) {
809 cmd, errClient := c.commandClient()
810 if errClient != nil {
811 return nil, errClient
812 }
813 requestedModel = strings.TrimSpace(requestedModel)
814 if requestedModel == "" {
815 return nil, fmt.Errorf("home: requested model is empty")
816 }
817 req := newAuthDispatchRequest(requestedModel, sessionID, headers, count)
818 keyBytes, err := json.Marshal(&req)
819 if err != nil {
820 return nil, err
821 }
822
823 raw, err := cmd.RPop(ctx, string(keyBytes)).Bytes()
824 if errors.Is(err, redis.Nil) {
825 return nil, ErrAuthNotFound
826 }
827 if err != nil {
828 return nil, err
829 }
830 if len(raw) == 0 {
831 return nil, ErrEmptyResponse
832 }
833 return raw, nil
834}
835
836func (c *Client) GetRefreshAuth(ctx context.Context, authIndex string) ([]byte, error) {
837 cmd, errClient := c.commandClient()

Callers

nothing calls this directly

Calls 3

commandClientMethod · 0.95
newAuthDispatchRequestFunction · 0.85
BytesMethod · 0.80

Tested by

no test coverage detected