mirror of
https://github.com/CHN-beta/nixos.git
synced 2026-01-12 04:39:23 +08:00
modules.services.xmuvpn: remove
This commit is contained in:
@@ -64,14 +64,6 @@
|
||||
finalImageTag = "latest";
|
||||
};
|
||||
misskey = {};
|
||||
xmuvpn = pkgs.dockerTools.pullImage
|
||||
{
|
||||
imageName = "hagb/docker-easyconnect";
|
||||
imageDigest = "sha256:1c3a86e41c1d2425a4fd555d279deaec6ff1e3c2287853eb16d23c9cb6dc3409";
|
||||
sha256 = "1jpk2y46lnk0mi6ir7hdx0p6378p0v6qjbh6jm9a4cv5abw0mb2k";
|
||||
finalImageName = "hagb/docker-easyconnec";
|
||||
finalImageTag = "7.6.7";
|
||||
};
|
||||
vesta =
|
||||
{
|
||||
version = "3.90.5a";
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
inputs:
|
||||
{
|
||||
options.nixos.services.xmuvpn = let inherit (inputs.lib) mkOption types; in mkOption
|
||||
{ type = types.nullOr (types.submodule {}); default = null; };
|
||||
config = let inherit (inputs.config.nixos.services) xmuvpn; in inputs.lib.mkIf (xmuvpn != null)
|
||||
{
|
||||
assertions =
|
||||
[{
|
||||
assertion = inputs.config.nixos.services.xray.client.enable;
|
||||
message = "Xray should be enabled.";
|
||||
}];
|
||||
virtualisation.oci-containers.containers.xmuvpn =
|
||||
{
|
||||
image = "hagb/docker-easyconnect";
|
||||
imageFile = inputs.topInputs.self.src.xmuvpn;
|
||||
ports = [ "127.0.0.1:5901:5901/tcp" "127.0.0.1:10069:1080/tcp" ];
|
||||
extraOptions = [ "--dns=223.5.5.5" "--device=/dev/net/tun" "--cap-add=NET_ADMIN" ];
|
||||
volumes = [ "xmuvpn:/root" ];
|
||||
environment = { PASSWORD = "xxxx"; PING_ADDR = "office.chn.moe"; };
|
||||
};
|
||||
nixos.services.docker = {};
|
||||
systemd.services.xmuvpn-forwarder =
|
||||
{
|
||||
description = "xmuvpn forwarder daemon";
|
||||
after = [ "network.target" "v2ray-forwarder.service" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig =
|
||||
let ipset = "${inputs.pkgs.ipset}/bin/ipset";
|
||||
in
|
||||
{
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
ExecStart = inputs.pkgs.writeShellScript "xmuvpn-forwarder.start"
|
||||
(builtins.concatStringsSep "\n" (builtins.map
|
||||
(host: "${ipset} add xmu_net ${host}")
|
||||
[
|
||||
# when add new ip, remember to also add it to router
|
||||
"218.193.58.125" "210.34.0.35" "121.192.191.10" "10.24.84.31" "59.77.0.143" "59.77.36.248"
|
||||
"172.27.124.24" "59.77.36.156" "59.77.36.223" "210.34.0.84" "218.193.50.157"
|
||||
"210.34.16.60" "10.26.14.70" "10.26.14.56" "210.34.16.20" "59.77.36.250"
|
||||
]));
|
||||
ExecStop = inputs.pkgs.writeShellScript "xmuvpn-forwarder.stop" "${ipset} flush xmu_net";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2010 Jo-Philipp Wich
|
||||
|
||||
START=99
|
||||
STOP=01
|
||||
|
||||
start() {
|
||||
ipset create xmunet hash:net
|
||||
ipset add xmunet 218.193.58.125
|
||||
ipset add xmunet 210.34.0.35
|
||||
ipset add xmunet 121.192.191.10
|
||||
ipset add xmunet 10.24.84.31
|
||||
ipset add xmunet 59.77.0.143
|
||||
ipset add xmunet 59.77.36.248
|
||||
ipset add xmunet 172.27.124.24
|
||||
ipset add xmunet 59.77.36.156
|
||||
ipset add xmunet 59.77.36.223
|
||||
ipset add xmunet 210.34.0.84
|
||||
ipset add xmunet 218.193.50.157
|
||||
ipset add xmunet 210.34.16.60
|
||||
ipset add xmunet 10.26.14.70
|
||||
ipset add xmunet 10.26.14.56
|
||||
ipset add xmunet 210.34.16.20
|
||||
ipset add xmunet 59.77.36.250
|
||||
iptables -t mangle -A PREROUTING ! -s 192.168.1.2 -m set --match-set xmunet dst -j MARK --set-mark 1/1
|
||||
ip route add unicast 0.0.0.0/0 via 192.168.1.2 dev br-lan table 100
|
||||
ip rule add fwmark 1/1 table 100
|
||||
}
|
||||
|
||||
stop() {
|
||||
iptables -t mangle -D PREROUTING ! -s 192.168.1.2 -m set --match-set xmunet dst -j MARK --set-mark 1/1 -w
|
||||
# somehow -w does not work
|
||||
sleep 1
|
||||
ip rule del fwmark 1/1 table 100
|
||||
ip route del table 100
|
||||
ipset flush xmunet
|
||||
ipset destroy xmunet
|
||||
}
|
||||
Reference in New Issue
Block a user