|
1 | 1 | use std::net::IpAddr; |
2 | 2 | use std::path::PathBuf; |
3 | 3 |
|
| 4 | +use super::SshConnection; |
| 5 | + |
4 | 6 | /// SSH credentials for remote instance authentication. |
5 | 7 | /// |
6 | 8 | /// Contains the static SSH authentication information that is known |
@@ -33,7 +35,7 @@ impl SshCredentials { |
33 | 35 | /// |
34 | 36 | /// ```rust |
35 | 37 | /// # use std::path::PathBuf; |
36 | | - /// # use torrust_tracker_deploy::config::ssh::SshCredentials; |
| 38 | + /// # use torrust_tracker_deploy::command_wrappers::ssh::SshCredentials; |
37 | 39 | /// let credentials = SshCredentials::new( |
38 | 40 | /// PathBuf::from("/home/user/.ssh/deploy_key"), |
39 | 41 | /// PathBuf::from("/home/user/.ssh/deploy_key.pub"), |
@@ -65,63 +67,3 @@ impl SshCredentials { |
65 | 67 | } |
66 | 68 | } |
67 | 69 | } |
68 | | - |
69 | | -/// SSH connection configuration for a specific remote instance. |
70 | | -/// |
71 | | -/// Contains both the SSH credentials and the target host IP address, |
72 | | -/// representing everything needed to establish an SSH connection. |
73 | | -#[derive(Clone)] |
74 | | -pub struct SshConnection { |
75 | | - /// SSH authentication credentials. |
76 | | - pub credentials: SshCredentials, |
77 | | - |
78 | | - /// IP address of the target host for SSH connections. |
79 | | - /// |
80 | | - /// This is the IP address of the remote instance that the SSH client |
81 | | - /// will connect to. |
82 | | - pub host_ip: IpAddr, |
83 | | -} |
84 | | - |
85 | | -impl SshConnection { |
86 | | - /// Creates a new SSH connection configuration with the provided parameters. |
87 | | - /// |
88 | | - /// ```rust |
89 | | - /// # use std::net::{IpAddr, Ipv4Addr}; |
90 | | - /// # use std::path::PathBuf; |
91 | | - /// # use torrust_tracker_deploy::config::ssh::{SshCredentials, SshConnection}; |
92 | | - /// let credentials = SshCredentials::new( |
93 | | - /// PathBuf::from("/home/user/.ssh/deploy_key"), |
94 | | - /// PathBuf::from("/home/user/.ssh/deploy_key.pub"), |
95 | | - /// "ubuntu".to_string(), |
96 | | - /// ); |
97 | | - /// let connection = SshConnection::new( |
98 | | - /// credentials, |
99 | | - /// IpAddr::V4(Ipv4Addr::new(192, 168, 1, 100)), |
100 | | - /// ); |
101 | | - /// ``` |
102 | | - #[must_use] |
103 | | - pub fn new(credentials: SshCredentials, host_ip: IpAddr) -> Self { |
104 | | - Self { |
105 | | - credentials, |
106 | | - host_ip, |
107 | | - } |
108 | | - } |
109 | | - |
110 | | - /// Access the SSH private key path. |
111 | | - #[must_use] |
112 | | - pub fn ssh_priv_key_path(&self) -> &PathBuf { |
113 | | - &self.credentials.ssh_priv_key_path |
114 | | - } |
115 | | - |
116 | | - /// Access the SSH public key path. |
117 | | - #[must_use] |
118 | | - pub fn ssh_pub_key_path(&self) -> &PathBuf { |
119 | | - &self.credentials.ssh_pub_key_path |
120 | | - } |
121 | | - |
122 | | - /// Access the SSH username. |
123 | | - #[must_use] |
124 | | - pub fn ssh_username(&self) -> &str { |
125 | | - &self.credentials.ssh_username |
126 | | - } |
127 | | -} |
0 commit comments