11 cfg = config.services.miredo;
12 pidFile = "/run/miredo.pid";
13 miredoConf = pkgs.writeText "miredo.conf" ''
14 InterfaceName ${cfg.interfaceName}
15 ServerAddress ${cfg.serverAddress}
16 ${optionalString (cfg.bindAddress != null) "BindAddress ${cfg.bindAddress}"}
17 ${optionalString (cfg.bindPort != null) "BindPort ${cfg.bindPort}"}
28 enable = mkEnableOption "the Miredo IPv6 tunneling service";
30 package = mkPackageOption pkgs "miredo" { };
32 serverAddress = mkOption {
33 default = "teredo.remlab.net";
36 The hostname or primary IPv4 address of the Teredo server.
37 This setting is required if Miredo runs as a Teredo client.
38 "teredo.remlab.net" is an experimental service for testing only.
39 Please use another server for production and/or large scale deployments.
43 interfaceName = mkOption {
47 Name of the network tunneling interface.
51 bindAddress = mkOption {
53 type = types.nullOr types.str;
55 Depending on the local firewall/NAT rules, you might need to force
56 Miredo to use a fixed UDP port and or IPv4 address.
62 type = types.nullOr types.str;
64 Depending on the local firewall/NAT rules, you might need to force
65 Miredo to use a fixed UDP port and or IPv4 address.
73 config = mkIf cfg.enable {
75 systemd.services.miredo = {
76 wantedBy = [ "multi-user.target" ];
77 after = [ "network.target" ];
78 description = "Teredo IPv6 Tunneling Daemon";
82 ExecStart = "${cfg.package}/bin/miredo -c ${miredoConf} -p ${pidFile} -f";
83 ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";