---
layout: page
title: Small collection of commands to filter public Yggdrasil peers
permalink: /blog/yggdrasil-get-peers/
keywords: yggdrasil,yggdrasil network,public peers,grep,sed
description: Small collection of commands to filter public Yggdrasil peers.
lang: en
date: 2024-01-17 00:00:00 +0100
feed: true
---

In the [Yggdrasil Public Peers Repository](https://github.com/yggdrasil-network/public-peers/) you will find a public list of Yggdrasil peers sorted by region.

Some of these peers are specified using a domain name. However, it is possible that these domain names are incorrectly listed on DNS blocklists, which are intended to keep out advertising and trackers. This has [happened in the past](https://github.com/no-cmyk/Search-Engine-Spam-Blocklist/issues/7) with the aaoth.xyz peer, for example.
To check something like this, you need a command that extracts the domain names from the public peers repository.
Since I recently dealt with this topic again, I thought I would publish the commands:
```sh
grep --recursive --extended-regexp "  \* \`(tcp|tls|quic)://[a-z][a-z0-9\.]*:[0-9]{1,5}\`" public-peers/ | sed --regexp-extended 's/.*:\/\/([^:]+).*/\1/' | sort | uniq
```

However, you can also modify these commands slightly to extract other peers. For example, the following command extracts all peers (DNS, IPv4, IPv6):
```sh
grep --recursive --extended-regexp "  \* \`(tcp|tls|quic)://.+:[0-9]{1,5}\`" public-peers/ | sed --regexp-extended 's/.*`(.*)`.*/\1/' | sort
```

However, you can also restrict the search to a folder or a file. To extract all peers from Germany, for example, the following command can be used:
```sh
grep --recursive --extended-regexp "  \* \`(tcp|tls|quic)://.+:[0-9]{1,5}\`" public-peers/europe/germany.md | sed --regexp-extended 's/.*`(.*)`.*/\1/' | sort
```

This command counts all QUIC peers:
```sh
grep --recursive --extended-regexp "  \* \`(quic)://.+:[0-9]{1,5}\`" public-peers/ | sed --regexp-extended 's/.*`(.*)`.*/\1/' | wc -l
```
At the time of writing this blog entry, for example, there are 36.
