MCPcopy Create free account
hub / github.com/SenseUnit/dumbproxy / Parameters

Method Parameters

forward/jslimit.go:81–107  ·  view source on GitHub ↗
(ctx context.Context, username, network, address string)

Source from the content-addressed store, hash-verified

79}
80
81func (j *JSLimitProvider) Parameters(ctx context.Context, username, network, address string) (res *LimitParameters, err error) {
82 defer func() {
83 if err != nil {
84 j.logger.Error("%v", err)
85 }
86 }()
87 req, _ := dto.FilterParamsFromContext(ctx)
88 ri := jsext.JSRequestInfoFromRequest(req)
89 di, err := jsext.JSDstInfoFromContext(ctx, network, address)
90 if err != nil {
91 return nil, fmt.Errorf("unable to construct dst info: %w", err)
92 }
93 func() {
94 f := <-j.funcPool
95 defer func(pool chan JSLimitFunc, f JSLimitFunc) {
96 pool <- f
97 }(j.funcPool, f)
98 res, err = f(ri, di, username)
99 }()
100 if err != nil {
101 return nil, fmt.Errorf("JS limit script exception: %w", err)
102 }
103 if res == nil {
104 return nil, fmt.Errorf("JS limit script returned null object")
105 }
106 return res, nil
107}

Callers

nothing calls this directly

Calls 5

FilterParamsFromContextFunction · 0.92
JSRequestInfoFromRequestFunction · 0.92
JSDstInfoFromContextFunction · 0.92
ErrorfMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected