mirror of
https://github.com/CHN-beta/nixos.git
synced 2026-01-12 01:55:22 +08:00
modules.services.xray.client: use coredns instead of dnsmasq
This commit is contained in:
@@ -37,7 +37,7 @@ inputs:
|
|||||||
xray.client =
|
xray.client =
|
||||||
{
|
{
|
||||||
xray.serverName = "xserver2.vps9.chn.moe";
|
xray.serverName = "xserver2.vps9.chn.moe";
|
||||||
dnsmasq = { extraInterfaces = [ "enp3s0" ]; hosts."git.chn.moe" = "127.0.0.1"; };
|
coredns = { extraInterfaces = [ "enp3s0" ]; hosts."git.chn.moe" = "127.0.0.1"; };
|
||||||
};
|
};
|
||||||
beesd."/".hashTableSizeMB = 10 * 128;
|
beesd."/".hashTableSizeMB = 10 * 128;
|
||||||
postgresql.mountFrom = "ssd";
|
postgresql.mountFrom = "ssd";
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ inputs:
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
sshd = {};
|
sshd = {};
|
||||||
xray.client.dnsmasq =
|
xray.client.coredns =
|
||||||
{
|
{
|
||||||
hosts = builtins.listToAttrs
|
hosts = builtins.listToAttrs
|
||||||
(
|
(
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ inputs:
|
|||||||
(inputs.lib.removeSuffix ".chn.moe" submoduleInputs.config.xray.serverName);
|
(inputs.lib.removeSuffix ".chn.moe" submoduleInputs.config.xray.serverName);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
dnsmasq =
|
coredns =
|
||||||
{
|
{
|
||||||
extraInterfaces = mkOption { type = types.listOf types.nonEmptyStr; default = []; };
|
extraInterfaces = mkOption { type = types.listOf types.nonEmptyStr; default = []; };
|
||||||
hosts = mkOption { type = types.attrsOf types.nonEmptyStr; default = {}; };
|
hosts = mkOption { type = types.attrsOf types.nonEmptyStr; default = {}; };
|
||||||
@@ -27,20 +27,26 @@ inputs:
|
|||||||
{
|
{
|
||||||
services =
|
services =
|
||||||
{
|
{
|
||||||
dnsmasq =
|
coredns =
|
||||||
{
|
{
|
||||||
enable = true;
|
enable = true;
|
||||||
settings =
|
config =
|
||||||
{
|
let
|
||||||
no-poll = true;
|
hosts = inputs.pkgs.writeText "coredns.hosts" (builtins.concatStringsSep "\n"
|
||||||
log-queries = true;
|
(inputs.lib.mapAttrsToList (n: v: "${v} ${n}") client.coredns.hosts));
|
||||||
server = [ "127.0.0.1#10853" ];
|
in
|
||||||
interface = client.dnsmasq.extraInterfaces ++ [ "lo" ];
|
''
|
||||||
bind-dynamic = true;
|
. {
|
||||||
address = builtins.map (host: "/${host.name}/${host.value}")
|
log
|
||||||
(inputs.localLib.attrsToList client.dnsmasq.hosts);
|
errors
|
||||||
cname = [ "git.chn.moe,nas.ts.chn.moe" ];
|
bind lo ${builtins.concatStringsSep " " client.coredns.extraInterfaces}
|
||||||
};
|
hosts ${hosts} {
|
||||||
|
fallthrough
|
||||||
|
}
|
||||||
|
rewrite name exact git.chn.moe nas.ts.chn.moe
|
||||||
|
forward . 127.0.0.1:10853
|
||||||
|
}
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
resolved.enable = false;
|
resolved.enable = false;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user