mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-08 01:20:27 +00:00
feat(protocol): add FTP, FTPS and FTPES downloads (#1569)
This commit is contained in:
1 parent
e0951de270
commit
c0b70d319d
54 files changed
+3850
-38
No files matched your search
@@ -67,6 +67,25 @@ void main() {
|
||||
expect(decoded.disablePex, isTrue);
|
||||
});
|
||||
|
||||
test('FTP settings round-trip with the Go json keys', () {
|
||||
final config = DownloaderConfig();
|
||||
config.protocolConfig.ftp.connections = 6;
|
||||
|
||||
final json = config.toJson();
|
||||
final ftp = (json['protocolConfig'] as Map<String, dynamic>)['ftp'] as Map<String, dynamic>;
|
||||
expect(ftp, {'connections': 6});
|
||||
expect(DownloaderConfig.fromJson(json).protocolConfig.ftp.connections, 6);
|
||||
});
|
||||
|
||||
test('a stored config without FTP settings still parses', () {
|
||||
final json = DownloaderConfig().toJson();
|
||||
(json['protocolConfig'] as Map<String, dynamic>).remove('ftp');
|
||||
|
||||
final decoded = DownloaderConfig.fromJson(json);
|
||||
expect(decoded.protocolConfig.ftp.connections, 0);
|
||||
expect(decoded.protocolConfig.http.connections, DownloaderConfig().protocolConfig.http.connections);
|
||||
});
|
||||
|
||||
test('BitTorrent peer discovery stays on when a stored config lacks the keys', () {
|
||||
final bt = BtConfig.fromJson({'listenPort': 6881, 'seedRatio': 1.0});
|
||||
expect(bt.disableDht, isFalse);
|
||||
|
||||
@@ -23,6 +23,22 @@ void main() {
|
||||
expect(stats.connections.last.completed, isTrue);
|
||||
});
|
||||
|
||||
test('FTP stats use the HTTP connection layout', () {
|
||||
final stats =
|
||||
TaskStats.fromJson(Protocol.ftp, {
|
||||
'snapshot': {
|
||||
'connections': [
|
||||
{'downloaded': 512, 'total': 1024, 'completed': false, 'failed': false, 'retryTimes': 1},
|
||||
],
|
||||
},
|
||||
'runtime': null,
|
||||
})
|
||||
as HttpTaskStats;
|
||||
|
||||
expect(stats.connections.single.downloaded, 512);
|
||||
expect(stats.connections.single.retryTimes, 1);
|
||||
});
|
||||
|
||||
test('BT stats decode the ordered completion bitset and peer transport', () {
|
||||
final stats =
|
||||
TaskStats.fromJson(Protocol.bt, {
|
||||
|
||||
Reference in new issue
Block a user