feat: tor keep awake
This commit is contained in:
5 files changed
+33
No files matched your search
@@ -359,6 +359,7 @@ services.proxy-suite = {
|
||||
clientOnly = true;
|
||||
enable = false;
|
||||
extraConfig = "";
|
||||
keepAwake = false;
|
||||
lyrebirdPackage = pkgs.lyrebird;
|
||||
onionService = {
|
||||
enable = false;
|
||||
|
||||
@@ -15,6 +15,7 @@ Part of the [proxy-suite options reference](./index.md).
|
||||
- [lines](#services-proxy-suite-tor-bridges-lines)
|
||||
- [clientOnly](#services-proxy-suite-tor-clientonly)
|
||||
- [extraConfig](#services-proxy-suite-tor-extraconfig)
|
||||
- [keepAwake](#services-proxy-suite-tor-keepawake)
|
||||
- [lyrebirdPackage](#services-proxy-suite-tor-lyrebirdpackage)
|
||||
- onionService
|
||||
- [enable](#services-proxy-suite-tor-onionservice-enable)
|
||||
@@ -101,6 +102,17 @@ Extra torrc lines\.
|
||||
''
|
||||
```
|
||||
|
||||
<a id="services-proxy-suite-tor-keepawake"></a>
|
||||
## services\.proxy-suite\.tor\.keepAwake
|
||||
|
||||
Never let Tor go dormant\. By default it does after a day without use, and from then on
|
||||
only rebuilds its circuits when the next connection comes: the first \.onion after a quiet
|
||||
spell may wait long enough to fail\. Turn on where clients expect \.onion at once, as on a
|
||||
server whose inbounds route it\. A dormant Tor also starts dormant again; this wakes it\.
|
||||
|
||||
**Type:** boolean\
|
||||
**Default:** `false`
|
||||
|
||||
<a id="services-proxy-suite-tor-lyrebirdpackage"></a>
|
||||
## services\.proxy-suite\.tor\.lyrebirdPackage
|
||||
|
||||
|
||||
@@ -56,6 +56,17 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
keepAwake = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Never let Tor go dormant. By default it does after a day without use, and from then on
|
||||
only rebuilds its circuits when the next connection comes: the first .onion after a quiet
|
||||
spell may wait long enough to fail. Turn on where clients expect .onion at once, as on a
|
||||
server whose inbounds route it. A dormant Tor also starts dormant again; this wakes it.
|
||||
'';
|
||||
};
|
||||
|
||||
upstream = mkOption {
|
||||
type = types.enum [
|
||||
"direct"
|
||||
|
||||
@@ -89,6 +89,10 @@ let
|
||||
"CookieAuthentication 0"
|
||||
]
|
||||
++ lib.optional t.clientOnly "ClientOnly 1"
|
||||
++ lib.optionals t.keepAwake [
|
||||
"DormantTimeoutEnabled 0"
|
||||
"DormantCanceledByStartup 1"
|
||||
]
|
||||
++ (if t.asOutbound then [ "SocksPort 127.0.0.1:${toString t.socksPort}" ] else [ "SocksPort 0" ])
|
||||
++ lib.optionals bridgesEnabled [
|
||||
"UseBridges 1"
|
||||
|
||||
@@ -88,6 +88,8 @@ let
|
||||
|
||||
relayTorStart = torStartOf (mkFixture "sing-box" { tor.clientOnly = false; });
|
||||
|
||||
awakeTorStart = torStartOf (mkFixture "sing-box" { tor.keepAwake = true; });
|
||||
|
||||
noOnion = mkFixture "sing-box" { tor.routeOnion = false; };
|
||||
noOnionTun = mkTunConfig noOnion;
|
||||
|
||||
@@ -469,6 +471,9 @@ in
|
||||
&& hasInfix "DNSPort 0" singBoxTorStart
|
||||
&& hasInfix "ClientOnly 1" singBoxTorStart
|
||||
&& !(hasInfix "ClientOnly" relayTorStart)
|
||||
&& !(hasInfix "Dormant" singBoxTorStart)
|
||||
&& hasInfix "DormantTimeoutEnabled 0" awakeTorStart
|
||||
&& hasInfix "DormantCanceledByStartup 1" awakeTorStart
|
||||
&& hasInfix "ControlSocket unix:$RUNTIME_DIRECTORY/control/socket" singBoxTorStart
|
||||
&& !(hasInfix "UseBridges" singBoxTorStart)
|
||||
&& !(hasInfix "Socks5Proxy" singBoxTorStart)
|
||||
|
||||
Reference in new issue
Block a user