Cloudflare DNS-over-HTTPS (DoH)
https://cloudflare-dns.com/dns-query
References
https://dnsprivacy.org/public_resolvers/
https://cloudflare-dns.com/dns-query
References
https://dnsprivacy.org/public_resolvers/
Download and install the cloudflared daemon
Or Download and install cloudflared via the Cloudflare Package Repository.
Ubuntu 20.04 LTS (Focal Fossa)
# Add cloudflare gpg key sudo mkdir -p --mode=0755 /usr/share/keyrings curl -fsSL https://pkg.cloudflare.com/cloudflare-main.gpg | sudo tee /usr/share/keyrings/cloudflare-main.gpg >/dev/null # Add this repo to your apt repositories echo 'deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg] https://pkg.cloudflare.com/cloudflared focal main' | sudo tee /etc/apt/sources.list.d/cloudflared.list # install cloudflared sudo apt-get update && sudo apt-get install cloudflared
cloudflared --version
Run without systemd
cloudflared proxy-dns #cloudflared proxy-dns --port 5553
Run with systemd
sudo tee /etc/systemd/system/cloudflared-proxy-dns.service >/dev/null <<EOF [Unit] Description=DNS over HTTPS (DoH) proxy client Wants=network-online.target nss-lookup.target Before=nss-lookup.target [Service] AmbientCapabilities=CAP_NET_BIND_SERVICE CapabilityBoundingSet=CAP_NET_BIND_SERVICE DynamicUser=yes ExecStart=/usr/local/bin/cloudflared proxy-dns [Install] WantedBy=multi-user.target EOF
sudo systemctl enable --now cloudflared-proxy-dns
sudo rm -f /etc/resolv.conf
echo nameserver 127.0.0.1 | sudo tee /etc/resolv.conf >/dev/null
Finally, verify it locally with:
dig +short @127.0.0.1 cloudflare.com AAAA
Update cloudflared
cloudflared update
References
https://developers.cloudflare.com/1.1.1.1/encryption/dns-over-https/dns-over-https-client/
https://pkg.cloudflare.com/index.html
The correct configuration for an executable that does not fork is to use Type=simple.
[Unit] Description=djalbat.com [Service] Type=simple WorkingDirectory=/var/www/djalbat.com/ ExecStart=/usr/bin/node ./bin/main.js start 2>&1 >> /var/log/djalbat.com.log [Install] WantedBy=multi-user.target
References
https://askubuntu.com/questions/1004853/systemd-is-hanging-when-i-start-or-restart-a-service
[Index(nameof(Url))]
public class Blog
{
public int BlogId { get; set; }
public string Url { get; set; }
}
Composite index
[Index(nameof(FirstName), nameof(LastName))]
public class Person
{
public int PersonId { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}
Index uniqueness
[Index(nameof(Url), IsUnique = true)]
public class Blog
{
public int BlogId { get; set; }
public string Url { get; set; }
}
Index sort order
[Index(nameof(Url), nameof(Rating), AllDescending = true)]
public class Blog
{
public int BlogId { get; set; }
public string Url { get; set; }
public int Rating { get; set; }
}
[Index(nameof(Url), nameof(Rating), IsDescending = new[] { false, true })]
public class Blog
{
public int BlogId { get; set; }
public string Url { get; set; }
public int Rating { get; set; }
}
Index name
[Index(nameof(Url), Name = "Index_Url")]
public class Blog
{
public int BlogId { get; set; }
public string Url { get; set; }
}
References
https://learn.microsoft.com/en-us/ef/core/modeling/indexes?tabs=data-annotations
# generated by dependadotnet
# https://github.com/dotnet/core/tree/main/samples/dependadotnet
version: 2
updates:
- package-ecosystem: "nuget"
directory: "/azure/sdk-identity-resources-storage" #AzureIdentityStorageExample.csproj
schedule:
interval: "weekly"
day: "wednesday"
open-pull-requests-limit: 5
- package-ecosystem: "nuget"
directory: "/csharp/expression-trees" #expression-trees.csproj
schedule:
interval: "weekly"
day: "wednesday"
open-pull-requests-limit: 5
- package-ecosystem: "nuget"
directory: "/core/assembly/MetadataLoadContext" #MetadataLoadContextSample.csproj
schedule:
interval: "weekly"
day: "wednesday"
open-pull-requests-limit: 5
References
https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
https://github.com/dotnet/samples/blob/main/.github/dependabot.yml
var dateNow = DateOnly.FromDateTime(DateTime.Now);
var timeNow = TimeOnly.FromDateTime(DateTime.Now);
References
https://stackoverflow.com/questions/69798302/datetime-now-equivalent-for-timeonly-and-dateonly
Open Programs and Features in Control Panel and Install Hyper V and Windows Subsystem for Linux

Download latest WSL from here and install
Now you can install Ubuntu from Microsoft Store
References
https://aka.ms/wsl2kernel
Check Your PowerShell Version
Download latest version from here and install
References
https://petri.com/how-to-check-your-powershell-version/
https://aka.ms/PSWindows
Install required Ubuntu packages
apt install -y chrony timedatectl set-ntp true systemctl enable chrony && systemctl restart chrony timedatectl set-timezone Asia/Tehran chronyc sourcestats -v chronyc tracking -v date
Install Certbot
sudo snap install core; sudo snap refresh core sudo snap install --classic certbot sudo ln -s /snap/bin/certbot /usr/bin/certbot sudo certbot certonly --standalone
result
# Certificate is saved at: /etc/letsencrypt/live/example.com/fullchain.pem # Key is saved at: /etc/letsencrypt/live/example.com/privkey.pem
Xray
bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install -u root
# xray remove # bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ remove --purge
# /etc/systemd/system/xray.service # /usr/local/bin/xray run -config /usr/local/etc/xray/config.json
nano /usr/local/etc/xray/config.json
{
"log": {
"loglevel": "warning"
},
"inbounds": [
{
"port": 10002,
"listen": "127.0.0.1",
"protocol": "vless",
"settings": {
"clients": [
{
"id": "559f6df4-0a3c-4f5f-bb95-d17888b16361",
"level": 0,
"email": "love@example.com"
}
],
"decryption": "none"
},
"streamSettings": {
"network": "ws",
"security": "none",
"wsSettings": {
"path": "/xray"
}
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": { },
"tag": "direct"
},
{
"protocol": "blackhole",
"settings": { },
"tag": "blocked"
}
],
"dns": {
"servers": [
"https+local://1.1.1.1/dns-query",
"1.1.1.1",
"1.0.0.1",
"8.8.8.8",
"8.8.4.4",
"localhost"
]
}
}
Xray Dat Path
/usr/local/share/xray
Apache
nano /etc/apache2/apache2.conf
<VirtualHost *:80>
Servername example.com
RewriteEngine on
RewriteCond %{SERVER_NAME} =example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URL} [END,NE,R=permanent]
</VirtualHost>
<VirtualHost *:443>
# change your domain
ServerName example.com
# you may have a different root
DocumentRoot /var/www/
# the SSL configuration enable https for your site and it’s also required by shadowsocks + v2ray
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/example.com/privkey.pem
SSLProtocol All -SSLv2 -SSLv3 -TLSv1 -TLSv1.1 +TLSv1.2 +TLSv1.3
SSLCipherSuite HIGH:!aNULL
<Location "/xray">
ProxyPass ws://127.0.0.1:10002/xray
ProxyAddHeaders Off
ProxyPreserveHost On
RequestHeader append X-Forwarded-For %{REMOTE_ADDR}s
</Location>
</VirtualHost>
References
https://github.com/XTLS/Xray-core
https://github.com/XTLS/Xray-examples
https://github.com/v2fly/v2ray-examples
https://github.com/XTLS/Xray-install
Assuming that project file location is src/MyProject/MyProject.csproj, then Install dependencies step should be:
- name: Install dependencies run: dotnet restore working-directory: src/MyProject
References
https://stackoverflow.com/questions/61188284/github-action-dotnetcore-sln-and-project-in-same-folder