amule-ec-client 0.6.1 → 0.7.1
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.
- package/README.md +10 -2
- package/dist/{AddLinkRequest-D2IME4eb.js → AddLinkRequest-CGv1H3PC.js} +2 -3
- package/dist/{ClientQueueRequest-DFfCiNcz.js → ClientQueueRequest-mklt-KLi.js} +2 -3
- package/dist/{ClientQueueResponse-JTrBqrr1.js → ClientQueueResponse-RfXh2JGa.js} +8 -5
- package/dist/{CreateCategoryRequest-CRUMcPo5.js → CreateCategoryRequest-Cyp9G7jU.js} +2 -3
- package/dist/{DeleteCategoryRequest-C8v9oGZ-.js → DeleteCategoryRequest-DbLJ4mvi.js} +2 -3
- package/dist/{DownloadCommandRequest-B3KV_bvm.js → DownloadCommandRequest-DLU7RtYs.js} +2 -3
- package/dist/{DownloadFileRequest-BjrroO3h.js → DownloadFileRequest-Db7oijyu.js} +2 -3
- package/dist/{DownloadQueueRequest-Dil5hl3D.js → DownloadQueueRequest-DdHRjl4L.js} +2 -3
- package/dist/{GetPreferencesRequest-DsxlghqT.js → GetPreferencesRequest-BlWGYNCP.js} +2 -3
- package/dist/{PreferencesDetailsResponse-DapscVQi.js → PreferencesDetailsResponse-BX6qUoga.js} +1 -2
- package/dist/{PreferencesResponse-8n1STWUZ.js → PreferencesResponse-migFtIG7.js} +1 -2
- package/dist/{ReloadSharedFilesRequest-kt0Pxs8A.js → ReloadSharedFilesRequest-WD9iYLje.js} +2 -2
- package/dist/{Request-C0UUuQIX.js → Request-YQ0nIM6b.js} +3 -9
- package/dist/{SearchProgressResponse-C1CdzKnz.js → SearchProgressResponse-CkEgZGFE.js} +1 -2
- package/dist/{SearchRequest-DQnKfA5Z.js → SearchRequest-DaAKS4IO.js} +2 -3
- package/dist/{SearchResultsRequest-2ejFGQmQ.js → SearchResultsRequest-B53jwjRH.js} +2 -2
- package/dist/{SearchResultsResponse-DwmvbQop.js → SearchResultsResponse-C1l-bBja.js} +1 -2
- package/dist/{SearchStatusRequest-B_xr4-72.js → SearchStatusRequest-DuEa5ZYu.js} +2 -2
- package/dist/{SearchStopRequest-8hwXobty.js → SearchStopRequest-B5TZdMiB.js} +2 -2
- package/dist/{ServerConnectRequest-BhNpGiEJ.js → ServerConnectRequest-BeB8RSBN.js} +2 -3
- package/dist/{ServerDisconnectRequest-BjCitLtU.js → ServerDisconnectRequest-CSkUHETP.js} +2 -2
- package/dist/{ServerListRequest-BWXLGJib.js → ServerListRequest-B82686jD.js} +2 -2
- package/dist/{ServerListResponse-BUJ7sz5p.js → ServerListResponse-M3C2OcfZ.js} +5 -4
- package/dist/{ServerUpdateFromUrlRequest-K8C_d0UQ.js → ServerUpdateFromUrlRequest-BcvhRKgH.js} +2 -3
- package/dist/{SetFileCategoryRequest-VwroLBTV.js → SetFileCategoryRequest-C1jWsYO5.js} +2 -3
- package/dist/{SetPreferencesRequest-KZ23VaBY.js → SetPreferencesRequest-CNJVmeQl.js} +2 -3
- package/dist/{SharedFilePriorityRequest-7BriqAcr.js → SharedFilePriorityRequest-CBqkaXaK.js} +2 -3
- package/dist/{SharedFilesRequest-B72XyRcA.js → SharedFilesRequest-5mKKjzgt.js} +2 -3
- package/dist/SharedFilesResponse-CFl0NuO-.js +45 -0
- package/dist/{StatsRequest-CGGumOOx.js → StatsRequest-C9gBUvSq.js} +2 -3
- package/dist/{StatsResponse-DxQk686g.js → StatsResponse-KOk-xT6_.js} +25 -2
- package/dist/{Codes-CjiW7Pdl.js → Tag-D_Ybe5RQ.js} +280 -1
- package/dist/{UpdateCategoryRequest-CzKJa_rC.js → UpdateCategoryRequest-BOYfb6Vn.js} +2 -3
- package/dist/{UpdateRequest-g2ReOQ5m.js → UpdateRequest-csLQz7JO.js} +2 -3
- package/dist/UpdateState-LhdtiATk.js +443 -0
- package/dist/index.d.ts +381 -337
- package/dist/index.js +116 -55
- package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/{utils-DBnUQnZ-.js → utils-CNoUroOI.js} +11 -1
- package/package.json +1 -1
- package/dist/DownloadQueueResponse-DUam_zNf.js +0 -259
- package/dist/SharedFilesResponse-CkqvYd3N.js +0 -39
- package/dist/Tag-CZF6BRMY.js +0 -260
- package/dist/UpdateResponse-CGwVjn0Y.js +0 -45
package/dist/index.d.ts
CHANGED
|
@@ -12,33 +12,33 @@ interface ChunkInfo {
|
|
|
12
12
|
partCount: number;
|
|
13
13
|
sizeFull: number;
|
|
14
14
|
}
|
|
15
|
-
interface ParsedSource {
|
|
16
|
-
clientName: string;
|
|
17
|
-
userHash: string;
|
|
18
|
-
software: string;
|
|
19
|
-
softwareVersion: string;
|
|
20
|
-
score: number;
|
|
21
|
-
uploadSpeed: number;
|
|
22
|
-
downloadSpeed: number;
|
|
23
|
-
uploadState: number;
|
|
24
|
-
downloadState: number;
|
|
25
|
-
ip: string;
|
|
26
|
-
port: number;
|
|
27
|
-
remoteQueueRank: number;
|
|
28
|
-
waitingPosition: number;
|
|
29
|
-
identState: number;
|
|
30
|
-
obfuscationStatus: number;
|
|
31
|
-
remoteFilename: string;
|
|
32
|
-
availableParts: number;
|
|
33
|
-
sourceFrom: number;
|
|
34
|
-
}
|
|
35
15
|
interface SourceNameCount {
|
|
36
16
|
name: string;
|
|
37
17
|
count: number;
|
|
38
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Raw diff entry of a partfile's source-names map, as sent by the daemon.
|
|
21
|
+
* `name` is only present when the entry is new for this connection; count 0 removes the entry.
|
|
22
|
+
*/
|
|
23
|
+
interface SourceNameEntry {
|
|
24
|
+
id: number;
|
|
25
|
+
name?: string;
|
|
26
|
+
count: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Raw part/gap/req status buffers of a partfile.
|
|
30
|
+
* Depending on the context they hold RLE-encoded wire data or RLE-decoded state.
|
|
31
|
+
*/
|
|
32
|
+
interface PartFileStatusBuffers {
|
|
33
|
+
partStatus?: Buffer;
|
|
34
|
+
gapStatus?: Buffer;
|
|
35
|
+
reqStatus?: Buffer;
|
|
36
|
+
}
|
|
39
37
|
//#endregion
|
|
40
38
|
//#region src/model/index.d.ts
|
|
41
39
|
interface AmuleFile {
|
|
40
|
+
/** ECID assigned by the daemon (EC protocol >= 0x0204). Stable while the daemon runs, used to link clients to files. */
|
|
41
|
+
ecid?: number;
|
|
42
42
|
fileHashHexString?: string;
|
|
43
43
|
fileName?: string;
|
|
44
44
|
filePath?: string;
|
|
@@ -76,13 +76,15 @@ interface AmuleTransferringFile extends AmuleFile {
|
|
|
76
76
|
downloadActiveTime?: number;
|
|
77
77
|
availablePartCount?: number;
|
|
78
78
|
a4AFAuto?: boolean;
|
|
79
|
-
|
|
79
|
+
/** Number of already-hashed parts while the file is being (re)hashed */
|
|
80
|
+
hashedPartCount?: number;
|
|
80
81
|
getLostDueToCorruption?: number;
|
|
81
82
|
getGainDueToCompression?: number;
|
|
82
83
|
totalPacketsSavedDueToICH?: number;
|
|
83
84
|
a4afSources?: number[];
|
|
84
85
|
chunkInfo?: ChunkInfo;
|
|
85
|
-
sources
|
|
86
|
+
/** Per-peer info of the sources of this download. Only filled by update-based methods (see AmuleClient.getDownloadQueueWithSources). */
|
|
87
|
+
sources?: AmuleUpDownClient[];
|
|
86
88
|
sourceNames?: SourceNameCount[];
|
|
87
89
|
}
|
|
88
90
|
interface AmuleCategory {
|
|
@@ -109,6 +111,8 @@ interface AmuleServer {
|
|
|
109
111
|
failedCount?: number;
|
|
110
112
|
}
|
|
111
113
|
interface AmuleUpDownClient {
|
|
114
|
+
/** ECID assigned by the daemon. Used to link this client to files via requestFileId/uploadFileId. */
|
|
115
|
+
ecid?: number;
|
|
112
116
|
clientName?: string;
|
|
113
117
|
userHashHexString?: string;
|
|
114
118
|
userID?: number;
|
|
@@ -121,7 +125,9 @@ interface AmuleUpDownClient {
|
|
|
121
125
|
serverIP?: string;
|
|
122
126
|
serverPort?: number;
|
|
123
127
|
serverName?: string;
|
|
128
|
+
/** Upload speed towards this client, in bytes/s */
|
|
124
129
|
upSpeed?: number;
|
|
130
|
+
/** Download speed from this client, in bytes/s (the daemon sends kB/s; normalized on parse) */
|
|
125
131
|
downSpeed?: number;
|
|
126
132
|
uploadSession?: number;
|
|
127
133
|
transferredDown?: number;
|
|
@@ -189,93 +195,6 @@ declare enum SearchType {
|
|
|
189
195
|
WEB = 3
|
|
190
196
|
}
|
|
191
197
|
//#endregion
|
|
192
|
-
//#region src/types/preferences.d.ts
|
|
193
|
-
interface AmulePrefsGeneral {
|
|
194
|
-
userNick: string;
|
|
195
|
-
checkNewVersion: boolean;
|
|
196
|
-
}
|
|
197
|
-
interface AmulePrefsConnection {
|
|
198
|
-
uploadCapacity: number;
|
|
199
|
-
downloadCapacity: number;
|
|
200
|
-
maxUploadSpeed: number;
|
|
201
|
-
maxDownloadSpeed: number;
|
|
202
|
-
slotAllocation: number;
|
|
203
|
-
tcpPort: number;
|
|
204
|
-
udpPort: number;
|
|
205
|
-
maxFileSources: number;
|
|
206
|
-
maxConnections: number;
|
|
207
|
-
autoconnect: boolean;
|
|
208
|
-
reconnect: boolean;
|
|
209
|
-
networkED2K: boolean;
|
|
210
|
-
networkKademlia: boolean;
|
|
211
|
-
}
|
|
212
|
-
interface AmulePrefsServers {
|
|
213
|
-
removeDead: boolean;
|
|
214
|
-
deadRetries: number;
|
|
215
|
-
useScoreSystem: boolean;
|
|
216
|
-
smartIdCheck: boolean;
|
|
217
|
-
updateUrl: string;
|
|
218
|
-
}
|
|
219
|
-
interface AmulePrefsSecurity {
|
|
220
|
-
canSeeShares: number;
|
|
221
|
-
ipFilterClients: boolean;
|
|
222
|
-
ipFilterServers: boolean;
|
|
223
|
-
ipFilterAutoUpdate: boolean;
|
|
224
|
-
ipFilterUpdateUrl: string;
|
|
225
|
-
ipFilterLevel: number;
|
|
226
|
-
filterLan: boolean;
|
|
227
|
-
useSecIdent: boolean;
|
|
228
|
-
obfuscationSupported: boolean;
|
|
229
|
-
obfuscationRequested: boolean;
|
|
230
|
-
obfuscationRequired: boolean;
|
|
231
|
-
}
|
|
232
|
-
interface AmulePreferences {
|
|
233
|
-
general: AmulePrefsGeneral;
|
|
234
|
-
connection: AmulePrefsConnection;
|
|
235
|
-
servers: AmulePrefsServers;
|
|
236
|
-
security: AmulePrefsSecurity;
|
|
237
|
-
}
|
|
238
|
-
//#endregion
|
|
239
|
-
//#region src/types/index.d.ts
|
|
240
|
-
interface SearchFilters {
|
|
241
|
-
minSize?: number;
|
|
242
|
-
maxSize?: number;
|
|
243
|
-
fileType?: string;
|
|
244
|
-
extension?: string;
|
|
245
|
-
availability?: number;
|
|
246
|
-
}
|
|
247
|
-
interface ConnectionState {
|
|
248
|
-
ed2kConnected: boolean;
|
|
249
|
-
ed2kConnecting: boolean;
|
|
250
|
-
kadConnected: boolean;
|
|
251
|
-
kadFirewalled: boolean;
|
|
252
|
-
kadRunning: boolean;
|
|
253
|
-
serverIpv4?: {
|
|
254
|
-
address: string;
|
|
255
|
-
port: number;
|
|
256
|
-
};
|
|
257
|
-
serverPing?: number;
|
|
258
|
-
serverPrio?: number;
|
|
259
|
-
serverFailed?: number;
|
|
260
|
-
serverStatic?: boolean;
|
|
261
|
-
serverVersion?: string;
|
|
262
|
-
serverName?: string;
|
|
263
|
-
serverDescription?: string;
|
|
264
|
-
serverUsers?: number;
|
|
265
|
-
serverUsersMax?: number;
|
|
266
|
-
serverFiles?: number;
|
|
267
|
-
ed2kId?: number;
|
|
268
|
-
kadId?: number;
|
|
269
|
-
clientId?: number;
|
|
270
|
-
}
|
|
271
|
-
declare enum SearchFileDownloadStatus {
|
|
272
|
-
NEW = 0,
|
|
273
|
-
DOWNLOADED = 1,
|
|
274
|
-
QUEUED = 2,
|
|
275
|
-
CANCELED = 3,
|
|
276
|
-
QUEUEDCANCELED = 4
|
|
277
|
-
}
|
|
278
|
-
//#endregion
|
|
279
198
|
//#region src/ec/Codes.d.ts
|
|
280
199
|
declare enum ProtocolVersion {
|
|
281
200
|
EC_CURRENT_PROTOCOL_VERSION = 516
|
|
@@ -662,6 +581,13 @@ declare enum ECSearchType {
|
|
|
662
581
|
EC_SEARCH_KAD = 2,
|
|
663
582
|
EC_SEARCH_WEB = 3
|
|
664
583
|
}
|
|
584
|
+
declare enum ECSearchFileDownloadStatus {
|
|
585
|
+
NEW = 0,
|
|
586
|
+
DOWNLOADED = 1,
|
|
587
|
+
QUEUED = 2,
|
|
588
|
+
CANCELED = 3,
|
|
589
|
+
QUEUEDCANCELED = 4
|
|
590
|
+
}
|
|
665
591
|
declare enum EcPrefs {
|
|
666
592
|
EC_PREFS_CATEGORIES = 1,
|
|
667
593
|
EC_PREFS_GENERAL = 2,
|
|
@@ -691,235 +617,107 @@ declare enum ECTagType {
|
|
|
691
617
|
EC_TAGTYPE_UINT128 = 10
|
|
692
618
|
}
|
|
693
619
|
//#endregion
|
|
694
|
-
//#region src/
|
|
695
|
-
interface
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
password: string;
|
|
699
|
-
timeout?: number;
|
|
700
|
-
requestTimeout?: number;
|
|
620
|
+
//#region src/types/preferences.d.ts
|
|
621
|
+
interface AmulePrefsGeneral {
|
|
622
|
+
userNick: string;
|
|
623
|
+
checkNewVersion: boolean;
|
|
701
624
|
}
|
|
702
|
-
interface
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
loggerMessage: string[];
|
|
717
|
-
totalSentBytes: number;
|
|
718
|
-
totalReceivedBytes: number;
|
|
719
|
-
sharedFileCount: number;
|
|
720
|
-
uploadSpeed: number;
|
|
721
|
-
downloadSpeed: number;
|
|
722
|
-
uploadSpeedLimit: number;
|
|
723
|
-
downloadSpeedLimit: number;
|
|
724
|
-
uploadQueueLength: number;
|
|
725
|
-
totalSourceCount: number;
|
|
726
|
-
ed2kUsers: number;
|
|
727
|
-
kadUsers: number;
|
|
728
|
-
ed2kFiles: number;
|
|
729
|
-
kadFiles: number;
|
|
730
|
-
kadNodes: number;
|
|
625
|
+
interface AmulePrefsConnection {
|
|
626
|
+
uploadCapacity: number;
|
|
627
|
+
downloadCapacity: number;
|
|
628
|
+
maxUploadSpeed: number;
|
|
629
|
+
maxDownloadSpeed: number;
|
|
630
|
+
slotAllocation: number;
|
|
631
|
+
tcpPort: number;
|
|
632
|
+
udpPort: number;
|
|
633
|
+
maxFileSources: number;
|
|
634
|
+
maxConnections: number;
|
|
635
|
+
autoconnect: boolean;
|
|
636
|
+
reconnect: boolean;
|
|
637
|
+
networkED2K: boolean;
|
|
638
|
+
networkKademlia: boolean;
|
|
731
639
|
}
|
|
732
|
-
interface
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
completeSourceCount: number;
|
|
739
|
-
sourceCount: number;
|
|
740
|
-
}[];
|
|
640
|
+
interface AmulePrefsServers {
|
|
641
|
+
removeDead: boolean;
|
|
642
|
+
deadRetries: number;
|
|
643
|
+
useScoreSystem: boolean;
|
|
644
|
+
smartIdCheck: boolean;
|
|
645
|
+
updateUrl: string;
|
|
741
646
|
}
|
|
742
|
-
interface
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
647
|
+
interface AmulePrefsSecurity {
|
|
648
|
+
canSeeShares: number;
|
|
649
|
+
ipFilterClients: boolean;
|
|
650
|
+
ipFilterServers: boolean;
|
|
651
|
+
ipFilterAutoUpdate: boolean;
|
|
652
|
+
ipFilterUpdateUrl: string;
|
|
653
|
+
ipFilterLevel: number;
|
|
654
|
+
filterLan: boolean;
|
|
655
|
+
useSecIdent: boolean;
|
|
656
|
+
obfuscationSupported: boolean;
|
|
657
|
+
obfuscationRequested: boolean;
|
|
658
|
+
obfuscationRequired: boolean;
|
|
748
659
|
}
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
660
|
+
interface AmulePreferences {
|
|
661
|
+
general: AmulePrefsGeneral;
|
|
662
|
+
connection: AmulePrefsConnection;
|
|
663
|
+
servers: AmulePrefsServers;
|
|
664
|
+
security: AmulePrefsSecurity;
|
|
665
|
+
}
|
|
666
|
+
//#endregion
|
|
667
|
+
//#region src/types/index.d.ts
|
|
668
|
+
interface SearchFilters {
|
|
669
|
+
minSize?: number;
|
|
670
|
+
maxSize?: number;
|
|
671
|
+
fileType?: string;
|
|
672
|
+
extension?: string;
|
|
673
|
+
availability?: number;
|
|
674
|
+
}
|
|
675
|
+
interface ConnectionState {
|
|
676
|
+
ed2kConnected: boolean;
|
|
677
|
+
ed2kConnecting: boolean;
|
|
678
|
+
kadConnected: boolean;
|
|
679
|
+
kadFirewalled: boolean;
|
|
680
|
+
kadRunning: boolean;
|
|
681
|
+
serverIpv4?: {
|
|
682
|
+
address: string;
|
|
683
|
+
port: number;
|
|
684
|
+
};
|
|
685
|
+
serverPing?: number;
|
|
686
|
+
serverPrio?: number;
|
|
687
|
+
serverFailed?: number;
|
|
688
|
+
serverStatic?: boolean;
|
|
689
|
+
serverVersion?: string;
|
|
690
|
+
serverName?: string;
|
|
691
|
+
serverDescription?: string;
|
|
692
|
+
serverUsers?: number;
|
|
693
|
+
serverUsersMax?: number;
|
|
694
|
+
serverFiles?: number;
|
|
695
|
+
ed2kId?: number;
|
|
696
|
+
kadId?: number;
|
|
697
|
+
clientId?: number;
|
|
698
|
+
}
|
|
699
|
+
//#endregion
|
|
700
|
+
//#region src/ec/packet/Flags.d.ts
|
|
701
|
+
/**
|
|
702
|
+
* Packet flags for EC protocol
|
|
703
|
+
*/
|
|
704
|
+
declare class Flags {
|
|
705
|
+
private static readonly FLAG_ACCEPTS;
|
|
706
|
+
private static readonly FLAG_ZLIB;
|
|
707
|
+
private static readonly FLAG_UTF8_NUMBERS;
|
|
708
|
+
private static readonly FLAG_ALWAYS_SET;
|
|
709
|
+
private readonly flags;
|
|
710
|
+
constructor(flags?: number);
|
|
752
711
|
/**
|
|
753
|
-
*
|
|
754
|
-
* Use 0 to disable request timeout.
|
|
712
|
+
* Create flags from buffer
|
|
755
713
|
*/
|
|
756
|
-
|
|
714
|
+
static fromBuffer(buffer: Buffer, offset?: number): Flags;
|
|
757
715
|
/**
|
|
758
|
-
*
|
|
716
|
+
* Write flags to buffer
|
|
759
717
|
*/
|
|
760
|
-
|
|
718
|
+
writeToBuffer(buffer: Buffer, offset?: number): void;
|
|
761
719
|
/**
|
|
762
|
-
*
|
|
763
|
-
*/
|
|
764
|
-
reconnect(): Promise<void>;
|
|
765
|
-
/**
|
|
766
|
-
* Get server statistics
|
|
767
|
-
*/
|
|
768
|
-
getStats(): Promise<StatsResponse>;
|
|
769
|
-
/**
|
|
770
|
-
* Get incremental updates for files, clients, servers, and friends
|
|
771
|
-
*/
|
|
772
|
-
getUpdate(detailLevel?: ECDetailLevel): Promise<UpdateResponse>;
|
|
773
|
-
/**
|
|
774
|
-
* Start an asynchronous search
|
|
775
|
-
*/
|
|
776
|
-
searchAsync(query: string, searchType?: SearchType, filters?: SearchFilters): Promise<string>;
|
|
777
|
-
/**
|
|
778
|
-
* Get search status (0-1)
|
|
779
|
-
*/
|
|
780
|
-
searchStatus(): Promise<number>;
|
|
781
|
-
/**
|
|
782
|
-
* Get search results
|
|
783
|
-
*/
|
|
784
|
-
searchResults(): Promise<SearchResultsResponse>;
|
|
785
|
-
/**
|
|
786
|
-
* Perform a synchronous search (waits for results)
|
|
787
|
-
*/
|
|
788
|
-
searchSync(query: string, searchType?: SearchType, filters?: SearchFilters, timeout?: number): Promise<SearchResultsResponse>;
|
|
789
|
-
/**
|
|
790
|
-
* Stop current search
|
|
791
|
-
*/
|
|
792
|
-
searchStop(): Promise<void>;
|
|
793
|
-
/**
|
|
794
|
-
* Download a file from search results
|
|
795
|
-
*/
|
|
796
|
-
downloadSearchResult(hash: Buffer): Promise<void>;
|
|
797
|
-
/**
|
|
798
|
-
* Download from an ed2k link
|
|
799
|
-
*/
|
|
800
|
-
downloadEd2kLink(link: string): Promise<void>;
|
|
801
|
-
/**
|
|
802
|
-
* Get download queue
|
|
803
|
-
*/
|
|
804
|
-
getDownloadQueue(): Promise<AmuleTransferringFile[]>;
|
|
805
|
-
/**
|
|
806
|
-
* Get shared files
|
|
807
|
-
*/
|
|
808
|
-
getSharedFiles(): Promise<AmuleFile[]>;
|
|
809
|
-
/**
|
|
810
|
-
* Reload shared files list
|
|
811
|
-
*/
|
|
812
|
-
reloadSharedFiles(): Promise<void>;
|
|
813
|
-
/**
|
|
814
|
-
* Get client upload/download queue (clients we are uploading to/downloading from)
|
|
815
|
-
*/
|
|
816
|
-
getClientQueue(): Promise<AmuleUpDownClient[]>;
|
|
817
|
-
/**
|
|
818
|
-
* Get the list of servers
|
|
819
|
-
*/
|
|
820
|
-
getServerList(): Promise<AmuleServer[]>;
|
|
821
|
-
/**
|
|
822
|
-
* Connect to a specific server
|
|
823
|
-
*/
|
|
824
|
-
connectToServer(ip?: string, port?: number): Promise<void>;
|
|
825
|
-
/**
|
|
826
|
-
* Disconnect from the current server
|
|
827
|
-
*/
|
|
828
|
-
disconnectFromServer(): Promise<void>;
|
|
829
|
-
/**
|
|
830
|
-
* Create a category
|
|
831
|
-
*/
|
|
832
|
-
createCategory(category: AmuleCategory): Promise<void>;
|
|
833
|
-
/**
|
|
834
|
-
* Update a category
|
|
835
|
-
*/
|
|
836
|
-
updateCategory(id: number, category: AmuleCategory): Promise<void>;
|
|
837
|
-
/**
|
|
838
|
-
* Delete a category
|
|
839
|
-
*/
|
|
840
|
-
deleteCategory(id: number): Promise<void>;
|
|
841
|
-
/**
|
|
842
|
-
* Get all categories
|
|
843
|
-
*/
|
|
844
|
-
getCategories(): Promise<AmuleCategory[]>;
|
|
845
|
-
/**
|
|
846
|
-
* Set file category
|
|
847
|
-
*/
|
|
848
|
-
setFileCategory(hash: Buffer, categoryId: number): Promise<void>;
|
|
849
|
-
/**
|
|
850
|
-
* Send a download command (PAUSE, RESUME, STOP, DELETE, etc.)
|
|
851
|
-
*/
|
|
852
|
-
sendDownloadCommand(hash: Buffer, command: DownloadCommand): Promise<void>;
|
|
853
|
-
/**
|
|
854
|
-
* Pause a download
|
|
855
|
-
*/
|
|
856
|
-
pauseDownload(hash: Buffer): Promise<void>;
|
|
857
|
-
/**
|
|
858
|
-
* Resume a download
|
|
859
|
-
*/
|
|
860
|
-
resumeDownload(hash: Buffer): Promise<void>;
|
|
861
|
-
/**
|
|
862
|
-
* Stop a download
|
|
863
|
-
*/
|
|
864
|
-
stopDownload(hash: Buffer): Promise<void>;
|
|
865
|
-
/**
|
|
866
|
-
* Delete a download
|
|
867
|
-
*/
|
|
868
|
-
deleteDownload(hash: Buffer): Promise<void>;
|
|
869
|
-
/**
|
|
870
|
-
* Trigger a server list update from an URL.
|
|
871
|
-
*/
|
|
872
|
-
updateServerListFromUrl(url: string): Promise<void>;
|
|
873
|
-
/**
|
|
874
|
-
* Set upload priority for a shared file.
|
|
875
|
-
*/
|
|
876
|
-
setSharedFilePriority(hash: Buffer, priority: number): Promise<void>;
|
|
877
|
-
/**
|
|
878
|
-
* Get daemon preferences for general/connection/servers/security sections.
|
|
879
|
-
*/
|
|
880
|
-
getPreferences(): Promise<AmulePreferences>;
|
|
881
|
-
/**
|
|
882
|
-
* Set daemon preferences. Only sections present in the input object are sent.
|
|
883
|
-
*/
|
|
884
|
-
setPreferences(preferences: Partial<AmulePreferences>): Promise<void>;
|
|
885
|
-
}
|
|
886
|
-
//#endregion
|
|
887
|
-
//#region src/exceptions/index.d.ts
|
|
888
|
-
declare class AmuleException extends Error {
|
|
889
|
-
cause?: Error | undefined;
|
|
890
|
-
constructor(message: string, cause?: Error | undefined);
|
|
891
|
-
}
|
|
892
|
-
declare class InvalidECException extends AmuleException {
|
|
893
|
-
constructor(message: string, cause?: Error);
|
|
894
|
-
}
|
|
895
|
-
declare class CommunicationException extends AmuleException {
|
|
896
|
-
constructor(message: string, cause?: Error);
|
|
897
|
-
}
|
|
898
|
-
declare class ServerException extends AmuleException {
|
|
899
|
-
constructor(message: string, cause?: Error);
|
|
900
|
-
}
|
|
901
|
-
//#endregion
|
|
902
|
-
//#region src/ec/packet/Flags.d.ts
|
|
903
|
-
/**
|
|
904
|
-
* Packet flags for EC protocol
|
|
905
|
-
*/
|
|
906
|
-
declare class Flags {
|
|
907
|
-
private static readonly FLAG_ACCEPTS;
|
|
908
|
-
private static readonly FLAG_ZLIB;
|
|
909
|
-
private static readonly FLAG_UTF8_NUMBERS;
|
|
910
|
-
private static readonly FLAG_ALWAYS_SET;
|
|
911
|
-
private readonly flags;
|
|
912
|
-
constructor(flags?: number);
|
|
913
|
-
/**
|
|
914
|
-
* Create flags from buffer
|
|
915
|
-
*/
|
|
916
|
-
static fromBuffer(buffer: Buffer, offset?: number): Flags;
|
|
917
|
-
/**
|
|
918
|
-
* Write flags to buffer
|
|
919
|
-
*/
|
|
920
|
-
writeToBuffer(buffer: Buffer, offset?: number): void;
|
|
921
|
-
/**
|
|
922
|
-
* Check if UTF-8 number encoding is supported/accepted
|
|
720
|
+
* Check if UTF-8 number encoding is supported/accepted
|
|
923
721
|
*/
|
|
924
722
|
isUtf8NumbersAccepted(): boolean;
|
|
925
723
|
/**
|
|
@@ -1028,11 +826,18 @@ declare class StringTag extends Tag<string> {
|
|
|
1028
826
|
parseValue(value: Buffer): void;
|
|
1029
827
|
encodeValue(): Buffer;
|
|
1030
828
|
}
|
|
1031
|
-
|
|
829
|
+
/**
|
|
830
|
+
* EC_TAGTYPE_DOUBLE tags are transmitted as a null-terminated ASCII decimal string,
|
|
831
|
+
* not as a binary double (see CECTag(ec_tagname_t, double) in aMule's ECTag.cpp).
|
|
832
|
+
*/
|
|
833
|
+
declare class DoubleTag extends Tag<number> implements NumericTag {
|
|
1032
834
|
constructor(name: ECTagName, value?: number, subtags?: Tag<any>[], nameValue?: number);
|
|
1033
835
|
static withValue(name: ECTagName, value: number, subtags?: Tag<any>[]): DoubleTag;
|
|
1034
836
|
parseValue(value: Buffer): void;
|
|
1035
837
|
encodeValue(): Buffer;
|
|
838
|
+
getShort(): number;
|
|
839
|
+
getInt(): number;
|
|
840
|
+
getLong(): bigint;
|
|
1036
841
|
}
|
|
1037
842
|
interface Ipv4Value {
|
|
1038
843
|
address: string;
|
|
@@ -1056,7 +861,6 @@ declare class Packet {
|
|
|
1056
861
|
readonly opCode: ECOpCode;
|
|
1057
862
|
readonly flags: Flags;
|
|
1058
863
|
readonly tags: Tag<any>[];
|
|
1059
|
-
private static readonly EC_CURRENT_PROTOCOL_VERSION;
|
|
1060
864
|
constructor(opCode: ECOpCode, flags?: Flags, tags?: Tag<any>[]);
|
|
1061
865
|
/**
|
|
1062
866
|
* Add a tag to the packet
|
|
@@ -1066,14 +870,10 @@ declare class Packet {
|
|
|
1066
870
|
* Add multiple tags to the packet
|
|
1067
871
|
*/
|
|
1068
872
|
addTags(tags: Tag<any>[]): this;
|
|
1069
|
-
/**
|
|
1070
|
-
* Get protocol version
|
|
1071
|
-
*/
|
|
1072
|
-
static getProtocolVersion(): number;
|
|
1073
873
|
/**
|
|
1074
874
|
* Find a tag by name
|
|
1075
875
|
*/
|
|
1076
|
-
findTag(tagName:
|
|
876
|
+
findTag(tagName: ECTagName): Tag<any> | undefined;
|
|
1077
877
|
/**
|
|
1078
878
|
* Get all tags with a specific name
|
|
1079
879
|
*/
|
|
@@ -1084,6 +884,250 @@ declare class Packet {
|
|
|
1084
884
|
hasTag(tagName: number): boolean;
|
|
1085
885
|
}
|
|
1086
886
|
//#endregion
|
|
887
|
+
//#region src/response/StatsResponse.d.ts
|
|
888
|
+
interface StatsResponse {
|
|
889
|
+
id: number;
|
|
890
|
+
ed2kId: number;
|
|
891
|
+
kadId?: string;
|
|
892
|
+
connectedServer?: {
|
|
893
|
+
name?: string;
|
|
894
|
+
description?: string;
|
|
895
|
+
ip: string;
|
|
896
|
+
port: number;
|
|
897
|
+
};
|
|
898
|
+
connectionState?: ConnectionState;
|
|
899
|
+
uploadOverhead: number;
|
|
900
|
+
downloadOverhead: number;
|
|
901
|
+
bannedCount: number;
|
|
902
|
+
loggerMessage: string[];
|
|
903
|
+
totalSentBytes: number;
|
|
904
|
+
totalReceivedBytes: number;
|
|
905
|
+
sharedFileCount: number;
|
|
906
|
+
uploadSpeed: number;
|
|
907
|
+
downloadSpeed: number;
|
|
908
|
+
uploadSpeedLimit: number;
|
|
909
|
+
downloadSpeedLimit: number;
|
|
910
|
+
uploadQueueLength: number;
|
|
911
|
+
totalSourceCount: number;
|
|
912
|
+
ed2kUsers: number;
|
|
913
|
+
kadUsers: number;
|
|
914
|
+
ed2kFiles: number;
|
|
915
|
+
kadFiles: number;
|
|
916
|
+
kadNodes: number;
|
|
917
|
+
}
|
|
918
|
+
//#endregion
|
|
919
|
+
//#region src/response/SearchResultsResponse.d.ts
|
|
920
|
+
interface SearchResultsResponse {
|
|
921
|
+
files: {
|
|
922
|
+
fileName: string;
|
|
923
|
+
hash: Buffer;
|
|
924
|
+
sizeFull: number;
|
|
925
|
+
downloadStatus: ECSearchFileDownloadStatus;
|
|
926
|
+
completeSourceCount: number;
|
|
927
|
+
sourceCount: number;
|
|
928
|
+
}[];
|
|
929
|
+
}
|
|
930
|
+
//#endregion
|
|
931
|
+
//#region src/response/UpdateResponse.d.ts
|
|
932
|
+
interface UpdateResponse {
|
|
933
|
+
sharedFiles: AmuleFile[];
|
|
934
|
+
downloadQueue: AmuleTransferringFile[];
|
|
935
|
+
clients: AmuleUpDownClient[];
|
|
936
|
+
servers: AmuleServer[];
|
|
937
|
+
friends: AmuleFriend[];
|
|
938
|
+
}
|
|
939
|
+
//#endregion
|
|
940
|
+
//#region src/client/AmuleClient.d.ts
|
|
941
|
+
interface AmuleClientOptions {
|
|
942
|
+
host: string;
|
|
943
|
+
port: number;
|
|
944
|
+
password: string;
|
|
945
|
+
timeout?: number;
|
|
946
|
+
requestTimeout?: number;
|
|
947
|
+
}
|
|
948
|
+
declare class AmuleClient {
|
|
949
|
+
private connection;
|
|
950
|
+
private updateState?;
|
|
951
|
+
constructor(options: AmuleClientOptions);
|
|
952
|
+
/**
|
|
953
|
+
* Set default timeout for individual request/response cycles.
|
|
954
|
+
* Use 0 to disable request timeout.
|
|
955
|
+
*/
|
|
956
|
+
setRequestTimeout(timeoutMs: number): void;
|
|
957
|
+
/**
|
|
958
|
+
* Get current default timeout for requests.
|
|
959
|
+
*/
|
|
960
|
+
getRequestTimeout(): number;
|
|
961
|
+
/**
|
|
962
|
+
* Reconnect to the server
|
|
963
|
+
*/
|
|
964
|
+
reconnect(): Promise<void>;
|
|
965
|
+
/**
|
|
966
|
+
* Get server statistics
|
|
967
|
+
*/
|
|
968
|
+
getStats(): Promise<StatsResponse>;
|
|
969
|
+
/**
|
|
970
|
+
* Per-connection file-detail state (diff baselines, source names, merged snapshots).
|
|
971
|
+
* The daemon diffs per connection and shares the diff state between the update,
|
|
972
|
+
* download-queue and shared-files requests, so this state must be fed by all of
|
|
973
|
+
* them (see UpdateState). Call only after sendRequest: connecting may have started
|
|
974
|
+
* a new session, which invalidates the previous state.
|
|
975
|
+
*/
|
|
976
|
+
private getFileState;
|
|
977
|
+
/**
|
|
978
|
+
* Get updates for files, clients, servers, and friends.
|
|
979
|
+
*
|
|
980
|
+
* The underlying EC_OP_GET_UPDATE request is incremental per connection: the daemon
|
|
981
|
+
* only sends the fields that changed since the previous call. This method keeps a
|
|
982
|
+
* client-side cache and merges those diffs, so it always returns full snapshots.
|
|
983
|
+
* Downloads carry their connected peers in `sources` (linked via client requestFileId
|
|
984
|
+
* and file ecid). The cache is reset whenever the connection is re-established.
|
|
985
|
+
*/
|
|
986
|
+
getUpdate(detailLevel?: ECDetailLevel): Promise<UpdateResponse>;
|
|
987
|
+
/**
|
|
988
|
+
* Get the download queue including per-peer source details.
|
|
989
|
+
*
|
|
990
|
+
* Unlike getDownloadQueue() (EC_OP_GET_DLOAD_QUEUE, which never includes peers),
|
|
991
|
+
* this uses the incremental update mechanism (see getUpdate), the only way the
|
|
992
|
+
* daemon exposes the clients each download is fed from. Each returned file has
|
|
993
|
+
* `sources` filled with the currently connected peers for that download.
|
|
994
|
+
*/
|
|
995
|
+
getDownloadQueueWithSources(): Promise<AmuleTransferringFile[]>;
|
|
996
|
+
/**
|
|
997
|
+
* Start an asynchronous search
|
|
998
|
+
*/
|
|
999
|
+
searchAsync(query: string, searchType?: SearchType, filters?: SearchFilters): Promise<string>;
|
|
1000
|
+
/**
|
|
1001
|
+
* Get search status (0-1)
|
|
1002
|
+
*/
|
|
1003
|
+
searchStatus(): Promise<number>;
|
|
1004
|
+
/**
|
|
1005
|
+
* Get search results
|
|
1006
|
+
*/
|
|
1007
|
+
searchResults(): Promise<SearchResultsResponse>;
|
|
1008
|
+
/**
|
|
1009
|
+
* Perform a synchronous search (waits for results)
|
|
1010
|
+
*/
|
|
1011
|
+
searchSync(query: string, searchType?: SearchType, filters?: SearchFilters, timeout?: number): Promise<SearchResultsResponse>;
|
|
1012
|
+
/**
|
|
1013
|
+
* Stop current search
|
|
1014
|
+
*/
|
|
1015
|
+
searchStop(): Promise<void>;
|
|
1016
|
+
/**
|
|
1017
|
+
* Download a file from search results
|
|
1018
|
+
*/
|
|
1019
|
+
downloadSearchResult(hash: Buffer): Promise<void>;
|
|
1020
|
+
/**
|
|
1021
|
+
* Download from an ed2k link
|
|
1022
|
+
*/
|
|
1023
|
+
downloadEd2kLink(link: string): Promise<void>;
|
|
1024
|
+
/**
|
|
1025
|
+
* Get download queue (EC_OP_GET_DLOAD_QUEUE, full detail).
|
|
1026
|
+
*
|
|
1027
|
+
* The response rebases the per-connection diff state the daemon shares with
|
|
1028
|
+
* getUpdate()/getDownloadQueueWithSources(), so it is fed into the same
|
|
1029
|
+
* client-side state: both methods stay consistent however they are interleaved,
|
|
1030
|
+
* and chunkInfo/sourceNames are correct across repeated calls.
|
|
1031
|
+
*/
|
|
1032
|
+
getDownloadQueue(): Promise<AmuleTransferringFile[]>;
|
|
1033
|
+
/**
|
|
1034
|
+
* Get shared files
|
|
1035
|
+
*/
|
|
1036
|
+
getSharedFiles(): Promise<AmuleFile[]>;
|
|
1037
|
+
/**
|
|
1038
|
+
* Reload shared files list
|
|
1039
|
+
*/
|
|
1040
|
+
reloadSharedFiles(): Promise<void>;
|
|
1041
|
+
/**
|
|
1042
|
+
* Get the upload queue: clients we are uploading to or that wait in our queue
|
|
1043
|
+
* (EC_OP_GET_ULOAD_QUEUE). For download sources use getDownloadQueueWithSources().
|
|
1044
|
+
*/
|
|
1045
|
+
getClientQueue(): Promise<AmuleUpDownClient[]>;
|
|
1046
|
+
/**
|
|
1047
|
+
* Get the list of servers
|
|
1048
|
+
*/
|
|
1049
|
+
getServerList(): Promise<AmuleServer[]>;
|
|
1050
|
+
/**
|
|
1051
|
+
* Connect to a specific server
|
|
1052
|
+
*/
|
|
1053
|
+
connectToServer(ip?: string, port?: number): Promise<void>;
|
|
1054
|
+
/**
|
|
1055
|
+
* Disconnect from the current server
|
|
1056
|
+
*/
|
|
1057
|
+
disconnectFromServer(): Promise<void>;
|
|
1058
|
+
/**
|
|
1059
|
+
* Create a category
|
|
1060
|
+
*/
|
|
1061
|
+
createCategory(category: AmuleCategory): Promise<void>;
|
|
1062
|
+
/**
|
|
1063
|
+
* Update a category
|
|
1064
|
+
*/
|
|
1065
|
+
updateCategory(id: number, category: AmuleCategory): Promise<void>;
|
|
1066
|
+
/**
|
|
1067
|
+
* Delete a category
|
|
1068
|
+
*/
|
|
1069
|
+
deleteCategory(id: number): Promise<void>;
|
|
1070
|
+
/**
|
|
1071
|
+
* Get all categories
|
|
1072
|
+
*/
|
|
1073
|
+
getCategories(): Promise<AmuleCategory[]>;
|
|
1074
|
+
/**
|
|
1075
|
+
* Set file category
|
|
1076
|
+
*/
|
|
1077
|
+
setFileCategory(hash: Buffer, categoryId: number): Promise<void>;
|
|
1078
|
+
/**
|
|
1079
|
+
* Send a download command (PAUSE, RESUME, STOP, DELETE, etc.)
|
|
1080
|
+
*/
|
|
1081
|
+
sendDownloadCommand(hash: Buffer, command: DownloadCommand): Promise<void>;
|
|
1082
|
+
/**
|
|
1083
|
+
* Pause a download
|
|
1084
|
+
*/
|
|
1085
|
+
pauseDownload(hash: Buffer): Promise<void>;
|
|
1086
|
+
/**
|
|
1087
|
+
* Resume a download
|
|
1088
|
+
*/
|
|
1089
|
+
resumeDownload(hash: Buffer): Promise<void>;
|
|
1090
|
+
/**
|
|
1091
|
+
* Stop a download
|
|
1092
|
+
*/
|
|
1093
|
+
stopDownload(hash: Buffer): Promise<void>;
|
|
1094
|
+
/**
|
|
1095
|
+
* Delete a download
|
|
1096
|
+
*/
|
|
1097
|
+
deleteDownload(hash: Buffer): Promise<void>;
|
|
1098
|
+
/**
|
|
1099
|
+
* Trigger a server list update from an URL.
|
|
1100
|
+
*/
|
|
1101
|
+
updateServerListFromUrl(url: string): Promise<void>;
|
|
1102
|
+
/**
|
|
1103
|
+
* Set upload priority for a shared file.
|
|
1104
|
+
*/
|
|
1105
|
+
setSharedFilePriority(hash: Buffer, priority: number): Promise<void>;
|
|
1106
|
+
/**
|
|
1107
|
+
* Get daemon preferences for general/connection/servers/security sections.
|
|
1108
|
+
*/
|
|
1109
|
+
getPreferences(): Promise<AmulePreferences>;
|
|
1110
|
+
/**
|
|
1111
|
+
* Set daemon preferences. Only sections present in the input object are sent.
|
|
1112
|
+
*/
|
|
1113
|
+
setPreferences(preferences: Partial<AmulePreferences>): Promise<void>;
|
|
1114
|
+
}
|
|
1115
|
+
//#endregion
|
|
1116
|
+
//#region src/exceptions/index.d.ts
|
|
1117
|
+
declare class AmuleException extends Error {
|
|
1118
|
+
cause?: Error | undefined;
|
|
1119
|
+
constructor(message: string, cause?: Error | undefined);
|
|
1120
|
+
}
|
|
1121
|
+
declare class InvalidECException extends AmuleException {
|
|
1122
|
+
constructor(message: string, cause?: Error);
|
|
1123
|
+
}
|
|
1124
|
+
declare class CommunicationException extends AmuleException {
|
|
1125
|
+
constructor(message: string, cause?: Error);
|
|
1126
|
+
}
|
|
1127
|
+
declare class ServerException extends AmuleException {
|
|
1128
|
+
constructor(message: string, cause?: Error);
|
|
1129
|
+
}
|
|
1130
|
+
//#endregion
|
|
1087
1131
|
//#region src/ec/packet/PacketWriter.d.ts
|
|
1088
1132
|
declare class PacketWriter {
|
|
1089
1133
|
private static readonly HEADER_SIZE;
|
|
@@ -1126,4 +1170,4 @@ declare class PacketParser {
|
|
|
1126
1170
|
static hasCompletePacket(buffer: Buffer): boolean;
|
|
1127
1171
|
}
|
|
1128
1172
|
//#endregion
|
|
1129
|
-
export { AmuleCategory, AmuleClient, type AmuleClientOptions, AmuleException, AmuleFile, AmuleFriend, type AmulePreferences, type AmulePrefsConnection, type AmulePrefsGeneral, type AmulePrefsSecurity, type AmulePrefsServers, AmuleServer, AmuleTransferringFile, AmuleUpDownClient, type ChunkInfo, ChunkStatus, CommunicationException, type ConnectionState, CustomTag, DoubleTag, DownloadCommand, ECDetailLevel, ECOpCode, ECSearchType, ECTagName, EcPrefs, FileStatus, Flags, Hash16Tag, InvalidECException, Ipv4Tag, PARTSIZE, Packet, PacketParser, PacketWriter, type
|
|
1173
|
+
export { AmuleCategory, AmuleClient, type AmuleClientOptions, AmuleException, AmuleFile, AmuleFriend, type AmulePreferences, type AmulePrefsConnection, type AmulePrefsGeneral, type AmulePrefsSecurity, type AmulePrefsServers, AmuleServer, AmuleTransferringFile, AmuleUpDownClient, type ChunkInfo, ChunkStatus, CommunicationException, type ConnectionState, CustomTag, DoubleTag, DownloadCommand, ECDetailLevel, ECOpCode, ECSearchFileDownloadStatus, type ECSearchFileDownloadStatus as SearchFileDownloadStatus, ECSearchType, ECTagName, EcPrefs, FileStatus, Flags, Hash16Tag, InvalidECException, Ipv4Tag, PARTSIZE, Packet, PacketParser, PacketWriter, type PartFileStatusBuffers, ProtocolVersion, type SearchFilters, type SearchResultsResponse, SearchType, ServerException, type SourceNameCount, type SourceNameEntry, type StatsResponse, StringTag, Tag, UByteTag, UInt128Tag, UIntTag, ULongTag, UShortTag, type UpdateResponse };
|