I want to restricts node selection by selecting specific country in source code

Hi everyone,

I’m working on a modification for the Tor project and need some help. I’m adding a new configuration option to the torrc file called selected-countries. This option should accept one or more country ISO codes, separated by commas in the source code of Tor.

The intended effect is that when Tor is run in client mode, it should only use Tor nodes (onion routers/relays) located in the specified countries. Any nodes outside these countries should be rejected.

Could anyone provide guidance or tips on how to implement this feature? Thanks in advance!