I've a program that with an algorithm generate link in .onion. Some link runs, some no. For check if every link runs, I would ask this: Is it possible to ping a link .onion? If yes, how to Can I do it?
ping, assuming you're talking about the *nix command, is ICMP. Tor is exclusively TCP in the requests carried across the network. You cannot "ping" an onion.
If you want to know if an onion is online, you can try to connect to it. A more heuristic method might be to fetch the onion's
descriptor and see when it was published but that doesn't mean it's online, or ever was, just that it published a descriptor to the HSDir at some point during that hour.
As @canonizingironize said - there's no ICMP in Tor. Actually, there's nothing except TCP in Tor. But there's a way to "ping" an onion:
- Any service has a TTFB(Time To First Byte) timing, and when you're connecting to it - on your side time to first byte is TTFB++, i.e. "ping delay", roughly speaking
- So - assuming that server-side TTFB is semi-equal(actually it is - in case of a proper server, jitter is +/- 1-2 miliseconds), you can use it in math model to make a system of equations and you can estimate server-side TTFB
This method will give you a very rough "packet travel time" estimation rounded to tens of miliseconds, but if you need it anyway - it's better than nothing.