···
cfg = config.atelier.frpc;
frpc-tunnel = pkgs.writeShellScriptBin "frpc-tunnel" ''
+
${pkgs.gum}/bin/gum style --bold --foreground 212 "Creating FRP tunnel"
+
subdomain=$(${pkgs.gum}/bin/gum input --placeholder "myapp" --prompt "Subdomain: ")
if [ -z "$subdomain" ]; then
+
${pkgs.gum}/bin/gum style --foreground 196 "No subdomain provided"
if ! echo "$subdomain" | ${pkgs.gnugrep}/bin/grep -qE '^[a-z0-9-]+$'; then
+
${pkgs.gum}/bin/gum style --foreground 196 "Invalid subdomain (use only lowercase letters, numbers, and hyphens)"
···
+
port=$(${pkgs.gum}/bin/gum input --placeholder "8000" --prompt "Local port: ")
+
${pkgs.gum}/bin/gum style --foreground 196 "No port provided"
if ! echo "$port" | ${pkgs.gnugrep}/bin/grep -qE '^[0-9]+$'; then
+
${pkgs.gum}/bin/gum style --foreground 196 "Invalid port (must be a number)"
+
# Check if local port is accessible
+
if ! ${pkgs.netcat}/bin/nc -z 127.0.0.1 "$port" 2>/dev/null; then
+
${pkgs.gum}/bin/gum style --foreground 214 "! Warning: Nothing listening on localhost:$port"
config_file=$(${pkgs.coreutils}/bin/mktemp)
trap "${pkgs.coreutils}/bin/rm -f $config_file" EXIT
···
+
public_url="https://$subdomain.${cfg.domain}"
+
${pkgs.gum}/bin/gum style --foreground 35 "โ Tunnel configured"
+
${pkgs.gum}/bin/gum style --foreground 117 " Local: localhost:$port"
+
${pkgs.gum}/bin/gum style --foreground 117 " Public: $public_url"
+
${pkgs.gum}/bin/gum style --foreground 214 "Connecting to ${cfg.serverAddr}:${toString cfg.serverPort}..."
exec ${pkgs.frp}/bin/frpc -c $config_file
···
serverAddr = lib.mkOption {
+
default = "bore.dunkirk.sh";
description = "frp server address";
···
description = "frp server port";
+
domain = lib.mkOption {
+
default = "bore.dunkirk.sh";
+
description = "Domain for public tunnel URLs";
authTokenFile = lib.mkOption {