Turnstile hidden challenge before Page View

Hello,

Probably somebody faced with such solution and can give me advice.

Thinking about to direct traffic from some ASNs to page with Turnstile script. If challenge will be passed, redirect user to its destination.

Part with Nginx is clear to me.
As I understand, I need to create CF Worker to validate challenge but little bit confusing how to do that.
Worker documentation, unfortunately, not clear for newbies. It looks like

If somebody do that, will be appreciated for solution.

Why Turnstile? Why not just use Cloudflare’s default support for interstitial challenges?

You can trigger them for ASNs with custom rules

Because I don’t want to proxy traffic through Cloudflare. I love CF WAF, but unfortunately, it is twice slower than my setup:
Screenshot 2024-04-07 145603