diff --git a/README.md b/README.md index ae0e033..67e7c06 100644 --- a/README.md +++ b/README.md @@ -92,37 +92,36 @@ dosh-client Default UDP port: `50000`. This is intentionally inside the common forwarded range `50000-52000/udp`. -Put this repo on your Gitea server, then install on each Linux server you want to -attach to: +Install on each Linux server you want to attach to: ```bash -curl -fsSL https://gitea.example.com/you/dosh/raw/branch/main/install.sh \ - | DOSH_REPO=https://gitea.example.com/you/dosh.git DOSH_PORT=50000 sh -s -- server +curl -fsSL https://git.palav.dev/Palav/dosh/raw/branch/main/install.sh \ + | DOSH_REPO=https://git.palav.dev/Palav/dosh.git DOSH_PORT=50000 sh -s -- server ``` Install the client on macOS: ```bash -curl -fsSL https://gitea.example.com/you/dosh/raw/branch/main/install.sh \ - | DOSH_REPO=https://gitea.example.com/you/dosh.git DOSH_SERVER=user@host DOSH_PORT=50000 sh -s -- client +curl -fsSL https://git.palav.dev/Palav/dosh/raw/branch/main/install.sh \ + | DOSH_REPO=https://git.palav.dev/Palav/dosh.git DOSH_SERVER=palav DOSH_HOST=git.palav.dev DOSH_PORT=50000 sh -s -- client ``` Install the client on Windows PowerShell: ```powershell -$env:DOSH_REPO="https://gitea.example.com/you/dosh.git"; $env:DOSH_SERVER="user@host"; $env:DOSH_PORT="50000"; irm https://gitea.example.com/you/dosh/raw/branch/main/install.ps1 | iex +$env:DOSH_REPO="https://git.palav.dev/Palav/dosh.git"; $env:DOSH_SERVER="palav"; $env:DOSH_HOST="git.palav.dev"; $env:DOSH_PORT="50000"; irm https://git.palav.dev/Palav/dosh/raw/branch/main/install.ps1 | iex ``` Attach: ```bash -dosh-client user@host +dosh palav ``` Use named sessions: ```bash -dosh-client --session work user@host +dosh --session work palav ``` Press `Ctrl-]` to detach the current client while leaving the server session alive. diff --git a/SPEC.md b/SPEC.md index e9e3f03..c3a66a7 100644 --- a/SPEC.md +++ b/SPEC.md @@ -454,7 +454,7 @@ Client config: `~/.config/dosh/client.toml` ```toml server = "user@example.com" -ssh_port = 22 +# ssh_port = 22 dosh_port = 50000 default_session = "default" reconnect_timeout_secs = 5 diff --git a/install.ps1 b/install.ps1 index 78c202d..75db057 100644 --- a/install.ps1 +++ b/install.ps1 @@ -51,7 +51,7 @@ try { @" server = "$defaultServer" $doshHostLine -ssh_port = 22 +# ssh_port = 22 dosh_port = $Port default_session = "default" reconnect_timeout_secs = 5 diff --git a/install.sh b/install.sh index b2f854e..e96642e 100755 --- a/install.sh +++ b/install.sh @@ -183,7 +183,7 @@ if [ "$role" = "client" ] || [ "$role" = "both" ]; then cat >"$client_config" < Result<()> { "read-write" } .to_string(); - let ssh_port = args.ssh_port.unwrap_or(config.ssh_port); + let ssh_port = args.ssh_port.or(config.ssh_port); let dosh_port = args.dosh_port.unwrap_or(config.dosh_port); let cache_path = cache_path(&config.credential_cache, &server, &session, &mode); let (cols, rows) = size().unwrap_or((80, 24)); @@ -232,7 +232,7 @@ fn local_bootstrap( fn ssh_bootstrap( server: &str, - ssh_port: u16, + ssh_port: Option, ssh_auth_command: &str, ssh_key: Option<&std::path::Path>, ssh_known_hosts: Option<&std::path::Path>, @@ -246,7 +246,10 @@ fn ssh_bootstrap( let nonce_b64 = URL_SAFE_NO_PAD.encode(nonce); let size = format!("{cols}x{rows}"); let mut command = Command::new("ssh"); - command.arg("-p").arg(ssh_port.to_string()).arg("-T"); + if let Some(ssh_port) = ssh_port { + command.arg("-p").arg(ssh_port.to_string()); + } + command.arg("-T"); if let Some(key) = ssh_key { command.arg("-i").arg(key); } diff --git a/src/config.rs b/src/config.rs index 3f853d9..30aec34 100644 --- a/src/config.rs +++ b/src/config.rs @@ -46,7 +46,7 @@ impl Default for ServerConfig { pub struct ClientConfig { pub server: String, pub dosh_host: Option, - pub ssh_port: u16, + pub ssh_port: Option, pub dosh_port: u16, pub default_session: String, pub reconnect_timeout_secs: u64, @@ -60,7 +60,7 @@ impl Default for ClientConfig { Self { server: "user@example.com".to_string(), dosh_host: None, - ssh_port: 22, + ssh_port: None, dosh_port: 50000, default_session: "default".to_string(), reconnect_timeout_secs: 5,