fix: 内置 dartssh2 2.11.0 补丁版(third_party 本地依赖),修复新版 Dart SDK 下 sftp_client 编译错误

This commit is contained in:
ZV Team committed 2026-10-25 09:51:08 +08:00
1 parent 6daa9dd361
commit 0a33fabec2
139 files changed
+16497 -1

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
import 'dart:io';
import 'package:dartssh2/dartssh2.dart';
void main(List<String> args) async {
final socket = await SSHSocket.connect('localhost', 22);
final client = SSHClient(
socket,
username: 'root',
onPasswordRequest: () {
stdout.write('Password: ');
stdin.echoMode = false;
return stdin.readLineSync() ?? exit(1);
},
);
await client.authenticated;
final serverSocket = await ServerSocket.bind('localhost', 8080);
print('Listening on ${serverSocket.address.address}:${serverSocket.port}');
await for (final socket in serverSocket) {
final forward = await client.forwardLocal('httpbin.org', 80);
forward.stream.cast<List<int>>().pipe(socket);
socket.cast<List<int>>().pipe(forward.sink);
}
client.close();
await client.done;
}