configuration.nix/hosts/rico2/services/frpc.nix

64 lines
1.3 KiB
Nix
Raw Normal View History

2023-07-01 17:45:08 +05:30
{
pkgs,
secrets,
...
}: let
2023-07-11 22:41:18 +05:30
inherit (secrets) frp_config;
2023-05-27 21:12:16 +05:30
in {
systemd.services.frpc = {
enable = true;
description = "FRP Client";
2023-05-29 23:20:18 +05:30
after = ["network.target"];
2023-05-27 21:12:16 +05:30
requires = ["network.target"];
2023-05-29 23:20:18 +05:30
wantedBy = ["multi-user.target"];
serviceConfig = {
2023-06-02 11:29:07 +05:30
Type = "simple";
ExecStart = "${pkgs.frp}/bin/frpc -c /etc/frp/frpc.ini";
Restart = "always";
RestartSec = "5s";
2023-05-29 23:20:18 +05:30
};
2023-05-27 21:12:16 +05:30
};
environment.etc."frp/frpc.ini".text = ''
[common]
server_addr = "${frp_config.ip}"
server_port = 7000
authentication_method = token
token = "${frp_config.token}"
[ssh.rico2]
type = tcp
local_port = 22
remote_port = 6002
2023-06-02 12:45:51 +05:30
[http.adtya.xyz]
type = http
custom_domains = adtya.xyz
local_port = 80
[https.adtya.xyz]
type = https
custom_domains = adtya.xyz
local_port = 443
[http.www.adtya.xyz]
type = http
custom_domains = www.adtya.xyz
local_port = 80
[https.www.adtya.xyz]
type = https
custom_domains = www.adtya.xyz
local_port = 443
2023-06-02 23:40:36 +05:30
[http.proofs.adtya.xyz]
type = http
custom_domains = proofs.adtya.xyz
local_port = 80
[https.proofs.adtya.xyz]
type = https
custom_domains = proofs.adtya.xyz
local_port = 443
2023-05-27 21:12:16 +05:30
'';
}