cpolar-connect 0.1.0.dev0__tar.gz → 0.1.0.dev1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cpolar_connect-0.1.0.dev0 → cpolar_connect-0.1.0.dev1}/PKG-INFO +2 -5
- {cpolar_connect-0.1.0.dev0 → cpolar_connect-0.1.0.dev1}/README.md +1 -4
- {cpolar_connect-0.1.0.dev0 → cpolar_connect-0.1.0.dev1}/pyproject.toml +1 -1
- {cpolar_connect-0.1.0.dev0 → cpolar_connect-0.1.0.dev1}/src/cpolar_connect/cli.py +1 -1
- {cpolar_connect-0.1.0.dev0 → cpolar_connect-0.1.0.dev1}/src/cpolar_connect/i18n.py +10 -0
- {cpolar_connect-0.1.0.dev0 → cpolar_connect-0.1.0.dev1}/src/cpolar_connect/ssh.py +12 -1
- {cpolar_connect-0.1.0.dev0 → cpolar_connect-0.1.0.dev1}/.gitignore +0 -0
- {cpolar_connect-0.1.0.dev0 → cpolar_connect-0.1.0.dev1}/LICENSE +0 -0
- {cpolar_connect-0.1.0.dev0 → cpolar_connect-0.1.0.dev1}/src/cpolar_connect/__init__.py +0 -0
- {cpolar_connect-0.1.0.dev0 → cpolar_connect-0.1.0.dev1}/src/cpolar_connect/auth.py +0 -0
- {cpolar_connect-0.1.0.dev0 → cpolar_connect-0.1.0.dev1}/src/cpolar_connect/config.py +0 -0
- {cpolar_connect-0.1.0.dev0 → cpolar_connect-0.1.0.dev1}/src/cpolar_connect/doctor.py +0 -0
- {cpolar_connect-0.1.0.dev0 → cpolar_connect-0.1.0.dev1}/src/cpolar_connect/exceptions.py +0 -0
- {cpolar_connect-0.1.0.dev0 → cpolar_connect-0.1.0.dev1}/src/cpolar_connect/tunnel.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cpolar-connect
|
|
3
|
-
Version: 0.1.0.
|
|
3
|
+
Version: 0.1.0.dev1
|
|
4
4
|
Summary: Easy-to-use CLI tool for cpolar tunnel management and SSH connections
|
|
5
5
|
Project-URL: Homepage, https://github.com/Hoper-J/cpolar-connect
|
|
6
6
|
Project-URL: Repository, https://github.com/Hoper-J/cpolar-connect.git
|
|
@@ -317,9 +317,6 @@ MIT License - 详见 [LICENSE](LICENSE)
|
|
|
317
317
|
---
|
|
318
318
|
|
|
319
319
|
<div align="center">
|
|
320
|
-
|
|
321
|
-
**如果觉得有用,请给个 ⭐ Star!**
|
|
322
|
-
|
|
323
|
-
Made with ❤️ for developers
|
|
320
|
+
**感谢你的STAR🌟,希望这一切对你有所帮助。**
|
|
324
321
|
|
|
325
322
|
</div>
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "cpolar-connect"
|
|
7
|
-
version = "0.1.0.
|
|
7
|
+
version = "0.1.0.dev1"
|
|
8
8
|
description = "Easy-to-use CLI tool for cpolar tunnel management and SSH connections"
|
|
9
9
|
authors = [
|
|
10
10
|
{name = "Hoper_J", email = "hoper.hw@gmail.com"},
|
|
@@ -21,7 +21,7 @@ from .i18n import _, get_i18n, Language
|
|
|
21
21
|
console = Console()
|
|
22
22
|
|
|
23
23
|
@click.group(invoke_without_command=True)
|
|
24
|
-
@click.version_option(version="0.0.
|
|
24
|
+
@click.version_option(version="0.1.0.dev1")
|
|
25
25
|
@click.pass_context
|
|
26
26
|
def cli(ctx):
|
|
27
27
|
"""🚀 Cpolar Connect - Easy cpolar tunnel management and SSH connections"""
|
|
@@ -43,6 +43,8 @@ class Messages:
|
|
|
43
43
|
"ssh.generating_key": "Generating SSH key pair...",
|
|
44
44
|
"ssh.key_exists": "SSH key already exists: {path}",
|
|
45
45
|
"ssh.uploading_key": "Uploading public key to server...",
|
|
46
|
+
"ssh.need_password_for_key_upload": "Need password to upload SSH key to server",
|
|
47
|
+
"ssh.trying_connect": "Attempting SSH connection as {username}@{hostname}...",
|
|
46
48
|
"ssh.key_uploaded": "✅ Public key uploaded successfully",
|
|
47
49
|
"ssh.updating_config": "Updating SSH config...",
|
|
48
50
|
"ssh.config_updated": "✅ SSH config updated",
|
|
@@ -101,6 +103,9 @@ class Messages:
|
|
|
101
103
|
"error.ssh_upload_failed": "Failed to upload public key: {error}",
|
|
102
104
|
"error.ssh_connect_failed": "Failed to connect: {error}",
|
|
103
105
|
"error.ssh_auth_failed": "Failed to establish SSH key authentication",
|
|
106
|
+
"error.ssh_auth_failed_detail": "SSH authentication failed for user '{username}' on {hostname}",
|
|
107
|
+
"hint.check_username_password": "Please verify: 1) Server username is correct (run 'whoami' on server), 2) Password is correct",
|
|
108
|
+
"hint.run_doctor": "Run 'cpolar-connect doctor' for diagnostics or 'cpolar-connect config set server.user USERNAME' to fix",
|
|
104
109
|
"error.tunnel_url_invalid": "Invalid tunnel URL format: {url}",
|
|
105
110
|
"error.password_clear_failed": "Failed to clear password: {error}",
|
|
106
111
|
"error.keyring_access_failed": "Failed to access keyring: {error}",
|
|
@@ -227,6 +232,8 @@ class Messages:
|
|
|
227
232
|
"ssh.generating_key": "正在生成 SSH 密钥对...",
|
|
228
233
|
"ssh.key_exists": "SSH 密钥已存在:{path}",
|
|
229
234
|
"ssh.uploading_key": "正在上传公钥到服务器...",
|
|
235
|
+
"ssh.need_password_for_key_upload": "需要密码来上传 SSH 密钥到服务器",
|
|
236
|
+
"ssh.trying_connect": "正在尝试以 {username}@{hostname} 进行 SSH 连接...",
|
|
230
237
|
"ssh.key_uploaded": "✅ 公钥上传成功",
|
|
231
238
|
"ssh.updating_config": "正在更新 SSH 配置...",
|
|
232
239
|
"ssh.config_updated": "✅ SSH 配置已更新",
|
|
@@ -285,6 +292,9 @@ class Messages:
|
|
|
285
292
|
"error.ssh_upload_failed": "上传公钥失败:{error}",
|
|
286
293
|
"error.ssh_connect_failed": "连接失败:{error}",
|
|
287
294
|
"error.ssh_auth_failed": "建立 SSH 密钥认证失败",
|
|
295
|
+
"error.ssh_auth_failed_detail": "SSH 认证失败:用户 '{username}' 在主机 {hostname} 上认证失败",
|
|
296
|
+
"hint.check_username_password": "请检查:1) 服务器用户名是否正确(在服务器运行 'whoami' 查看),2) 密码是否正确",
|
|
297
|
+
"hint.run_doctor": "运行 'cpolar-connect doctor' 进行诊断,或使用 'cpolar-connect config set server.user 用户名' 修正",
|
|
288
298
|
"error.tunnel_url_invalid": "无效的隧道 URL 格式:{url}",
|
|
289
299
|
"error.password_clear_failed": "清除密码失败:{error}",
|
|
290
300
|
"error.keyring_access_failed": "访问密钥环失败:{error}",
|
|
@@ -172,6 +172,7 @@ class SSHManager:
|
|
|
172
172
|
|
|
173
173
|
# Get password if not provided
|
|
174
174
|
if not password:
|
|
175
|
+
console.print(f"[yellow]🔑 {_('ssh.need_password_for_key_upload')}[/yellow]")
|
|
175
176
|
password = getpass(f"Enter password for {self.server_user}@{hostname}: ")
|
|
176
177
|
|
|
177
178
|
ssh = paramiko.SSHClient()
|
|
@@ -181,12 +182,15 @@ class SSHManager:
|
|
|
181
182
|
|
|
182
183
|
try:
|
|
183
184
|
# Connect with password
|
|
185
|
+
console.print(f"[dim]{_('ssh.trying_connect', username=self.server_user, hostname=hostname)}[/dim]")
|
|
184
186
|
ssh.connect(
|
|
185
187
|
hostname=hostname,
|
|
186
188
|
port=port,
|
|
187
189
|
username=self.server_user,
|
|
188
190
|
password=password,
|
|
189
|
-
timeout=
|
|
191
|
+
timeout=30, # Increase timeout for slow connections
|
|
192
|
+
allow_agent=False,
|
|
193
|
+
look_for_keys=False
|
|
190
194
|
)
|
|
191
195
|
|
|
192
196
|
# Ensure .ssh directory exists
|
|
@@ -213,6 +217,13 @@ class SSHManager:
|
|
|
213
217
|
|
|
214
218
|
ssh.close()
|
|
215
219
|
|
|
220
|
+
except paramiko.AuthenticationException as e:
|
|
221
|
+
logger.error(f"SSH authentication failed: {e}")
|
|
222
|
+
error_msg = _('error.ssh_auth_failed_detail', username=self.server_user, hostname=hostname)
|
|
223
|
+
console.print(f"[red]❌ {error_msg}[/red]")
|
|
224
|
+
console.print(f"[yellow]💡 {_('hint.check_username_password')}[/yellow]")
|
|
225
|
+
console.print(f"[yellow]💡 {_('hint.run_doctor')}[/yellow]")
|
|
226
|
+
raise SSHError(error_msg)
|
|
216
227
|
except Exception as e:
|
|
217
228
|
logger.error(f"Failed to upload public key: {e}")
|
|
218
229
|
raise SSHError(_('error.ssh_upload_failed', error=e))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|