fix: 内置 dartssh2 2.11.0 补丁版(third_party 本地依赖),修复新版 Dart SDK 下 sftp_client 编译错误
This commit is contained in:
1 parent
6daa9dd361
commit
0a33fabec2
139 files changed
+16497
-1
No files matched your search
+41
@@ -0,0 +1,41 @@
|
||||
import 'dart:async';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:dartssh2/src/socket/ssh_socket.dart';
|
||||
import 'package:dartssh2/src/ssh_channel.dart';
|
||||
|
||||
class SSHForwardChannel implements SSHSocket {
|
||||
final SSHChannel _channel;
|
||||
|
||||
SSHForwardChannel(this._channel) {
|
||||
_sinkController.stream
|
||||
.map((data) => data is Uint8List ? data : Uint8List.fromList(data))
|
||||
.map((data) => SSHChannelData(data))
|
||||
.pipe(_channel.sink);
|
||||
}
|
||||
|
||||
final _sinkController = StreamController<List<int>>();
|
||||
|
||||
/// Data received from the remote host.
|
||||
@override
|
||||
Stream<Uint8List> get stream => _channel.stream.map((data) => data.bytes);
|
||||
|
||||
/// Write to this sink to send data to the remote host.
|
||||
@override
|
||||
StreamSink<List<int>> get sink => _sinkController.sink;
|
||||
|
||||
/// Close our end of the channel. Returns a future that waits for the
|
||||
/// other side to close.
|
||||
@override
|
||||
Future<void> close() => _channel.close();
|
||||
|
||||
/// A future that completes when both ends of the channel are closed.
|
||||
@override
|
||||
Future<void> get done => _channel.done;
|
||||
|
||||
/// Destroys the socket in both directions.
|
||||
@override
|
||||
void destroy() {
|
||||
_channel.destroy();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user