(ctx context.Context, req *http.Request, username, network, address string)
| 83 | } |
| 84 | |
| 85 | func (j *JSFilter) Access(ctx context.Context, req *http.Request, username, network, address string) error { |
| 86 | ri := jsext.JSRequestInfoFromRequest(req) |
| 87 | di, err := jsext.JSDstInfoFromContext(ctx, network, address) |
| 88 | if err != nil { |
| 89 | return fmt.Errorf("unable to construct dst info: %w", err) |
| 90 | } |
| 91 | var res bool |
| 92 | func() { |
| 93 | f := <-j.funcPool |
| 94 | defer func(pool chan JSFilterFunc, f JSFilterFunc) { |
| 95 | pool <- f |
| 96 | }(j.funcPool, f) |
| 97 | res, err = f(ri, di, username) |
| 98 | }() |
| 99 | if err != nil { |
| 100 | return fmt.Errorf("JS access script exception: %w", err) |
| 101 | } |
| 102 | if !res { |
| 103 | return ErrJSDenied |
| 104 | } |
| 105 | return j.next.Access(ctx, req, username, network, address) |
| 106 | } |
nothing calls this directly
no test coverage detected