summaryrefslogtreecommitdiff
path: root/modules/server/networking/tor.nix
blob: ab3dc9fff5a34f3d8ed4742e12c83e0f76185bfc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{ config, ... }:
{
  services = {
    caddy.virtualHosts."fuwnme4wbs5x36jjf2usedw2zscozwhazykhyfkjsmudtb7egs3mb7yd.onion".extraConfig = "reverse_proxy localhost:8084";

    tor = {
      enable = true;
      enableGeoIP = false;

      relay.onionServices = {
        "fuwn.me" = {
          version = 3;
          secretKey = config.sops.secrets."fuwnme_onion_secret_key".path;

          map = [
            {
              port = 80;

              target = {
                addr = "[::1]";
                port = 8084;
              };
            }
            {
              port = 80;

              target = {
                addr = "0.0.0.0";
                port = 8084;
              };
            }
          ];
        };
      };

      settings = {
        ClientUseIPv4 = true;
        ClientUseIPv6 = true;
        ClientPreferIPv6ORPort = true;
      };
    };
  };
}