amule-ec-client 0.6.1 → 0.7.0
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-DEKGy-R2.js} +2 -3
- package/dist/{ClientQueueRequest-DFfCiNcz.js → ClientQueueRequest-DrLXSxtp.js} +2 -3
- package/dist/{ClientQueueResponse-JTrBqrr1.js → ClientQueueResponse-CXxY_9wU.js} +6 -4
- package/dist/{CreateCategoryRequest-CRUMcPo5.js → CreateCategoryRequest-COulF12x.js} +2 -3
- package/dist/{DeleteCategoryRequest-C8v9oGZ-.js → DeleteCategoryRequest-D-mljaNV.js} +2 -3
- package/dist/{DownloadCommandRequest-B3KV_bvm.js → DownloadCommandRequest-Bf1Ez8Da.js} +2 -3
- package/dist/{DownloadFileRequest-BjrroO3h.js → DownloadFileRequest-WfOIV07R.js} +2 -3
- package/dist/{DownloadQueueRequest-Dil5hl3D.js → DownloadQueueRequest-Br-pgrRt.js} +2 -3
- package/dist/DownloadQueueResponse-C-5d4teB.js +241 -0
- package/dist/{GetPreferencesRequest-DsxlghqT.js → GetPreferencesRequest-BE3RbRRn.js} +2 -3
- package/dist/{PreferencesDetailsResponse-DapscVQi.js → PreferencesDetailsResponse-D8lBd8Ot.js} +1 -2
- package/dist/{PreferencesResponse-8n1STWUZ.js → PreferencesResponse-BmGTQM30.js} +1 -2
- package/dist/{ReloadSharedFilesRequest-kt0Pxs8A.js → ReloadSharedFilesRequest-BbDUeGcq.js} +2 -2
- package/dist/{Request-C0UUuQIX.js → Request-BvScDpeu.js} +3 -9
- package/dist/{SearchProgressResponse-C1CdzKnz.js → SearchProgressResponse-BQPliUup.js} +1 -2
- package/dist/{SearchRequest-DQnKfA5Z.js → SearchRequest-DOakj8fA.js} +2 -3
- package/dist/{SearchResultsRequest-2ejFGQmQ.js → SearchResultsRequest-oZBs5KKm.js} +2 -2
- package/dist/{SearchResultsResponse-DwmvbQop.js → SearchResultsResponse-C9I9x035.js} +1 -2
- package/dist/{SearchStatusRequest-B_xr4-72.js → SearchStatusRequest-B1ZzSQlE.js} +2 -2
- package/dist/{SearchStopRequest-8hwXobty.js → SearchStopRequest-FfXf_DCn.js} +2 -2
- package/dist/{ServerConnectRequest-BhNpGiEJ.js → ServerConnectRequest-Cdiw-KWu.js} +2 -3
- package/dist/{ServerDisconnectRequest-BjCitLtU.js → ServerDisconnectRequest-BVXSumxX.js} +2 -2
- package/dist/{ServerListRequest-BWXLGJib.js → ServerListRequest-3yMrgZID.js} +2 -2
- package/dist/{ServerListResponse-BUJ7sz5p.js → ServerListResponse-Do3iRai0.js} +5 -4
- package/dist/{ServerUpdateFromUrlRequest-K8C_d0UQ.js → ServerUpdateFromUrlRequest-DpxBII5W.js} +2 -3
- package/dist/{SetFileCategoryRequest-VwroLBTV.js → SetFileCategoryRequest-CFgkJB-H.js} +2 -3
- package/dist/{SetPreferencesRequest-KZ23VaBY.js → SetPreferencesRequest-BdZ40Ao_.js} +2 -3
- package/dist/{SharedFilePriorityRequest-7BriqAcr.js → SharedFilePriorityRequest-BMNmaL06.js} +2 -3
- package/dist/{SharedFilesRequest-B72XyRcA.js → SharedFilesRequest-BZKz0oyn.js} +2 -3
- package/dist/SharedFilesResponse-DE0cd1DT.js +45 -0
- package/dist/{StatsRequest-CGGumOOx.js → StatsRequest-DVwx5wk1.js} +2 -3
- package/dist/{StatsResponse-DxQk686g.js → StatsResponse-CP2F2zt0.js} +25 -2
- package/dist/{Codes-CjiW7Pdl.js → Tag-B5gWV2XF.js} +268 -1
- package/dist/{UpdateCategoryRequest-CzKJa_rC.js → UpdateCategoryRequest-Bu22YjOm.js} +2 -3
- package/dist/{UpdateRequest-g2ReOQ5m.js → UpdateRequest-CaQ867p8.js} +2 -3
- package/dist/UpdateState-Dn-SuAsj.js +173 -0
- package/dist/index.d.ts +358 -336
- package/dist/index.js +93 -51
- 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;
|
|
@@ -189,93 +193,6 @@ declare enum SearchType {
|
|
|
189
193
|
WEB = 3
|
|
190
194
|
}
|
|
191
195
|
//#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
196
|
//#region src/ec/Codes.d.ts
|
|
280
197
|
declare enum ProtocolVersion {
|
|
281
198
|
EC_CURRENT_PROTOCOL_VERSION = 516
|
|
@@ -662,6 +579,13 @@ declare enum ECSearchType {
|
|
|
662
579
|
EC_SEARCH_KAD = 2,
|
|
663
580
|
EC_SEARCH_WEB = 3
|
|
664
581
|
}
|
|
582
|
+
declare enum ECSearchFileDownloadStatus {
|
|
583
|
+
NEW = 0,
|
|
584
|
+
DOWNLOADED = 1,
|
|
585
|
+
QUEUED = 2,
|
|
586
|
+
CANCELED = 3,
|
|
587
|
+
QUEUEDCANCELED = 4
|
|
588
|
+
}
|
|
665
589
|
declare enum EcPrefs {
|
|
666
590
|
EC_PREFS_CATEGORIES = 1,
|
|
667
591
|
EC_PREFS_GENERAL = 2,
|
|
@@ -691,235 +615,107 @@ declare enum ECTagType {
|
|
|
691
615
|
EC_TAGTYPE_UINT128 = 10
|
|
692
616
|
}
|
|
693
617
|
//#endregion
|
|
694
|
-
//#region src/
|
|
695
|
-
interface
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
password: string;
|
|
699
|
-
timeout?: number;
|
|
700
|
-
requestTimeout?: number;
|
|
618
|
+
//#region src/types/preferences.d.ts
|
|
619
|
+
interface AmulePrefsGeneral {
|
|
620
|
+
userNick: string;
|
|
621
|
+
checkNewVersion: boolean;
|
|
701
622
|
}
|
|
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;
|
|
623
|
+
interface AmulePrefsConnection {
|
|
624
|
+
uploadCapacity: number;
|
|
625
|
+
downloadCapacity: number;
|
|
626
|
+
maxUploadSpeed: number;
|
|
627
|
+
maxDownloadSpeed: number;
|
|
628
|
+
slotAllocation: number;
|
|
629
|
+
tcpPort: number;
|
|
630
|
+
udpPort: number;
|
|
631
|
+
maxFileSources: number;
|
|
632
|
+
maxConnections: number;
|
|
633
|
+
autoconnect: boolean;
|
|
634
|
+
reconnect: boolean;
|
|
635
|
+
networkED2K: boolean;
|
|
636
|
+
networkKademlia: boolean;
|
|
731
637
|
}
|
|
732
|
-
interface
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
completeSourceCount: number;
|
|
739
|
-
sourceCount: number;
|
|
740
|
-
}[];
|
|
638
|
+
interface AmulePrefsServers {
|
|
639
|
+
removeDead: boolean;
|
|
640
|
+
deadRetries: number;
|
|
641
|
+
useScoreSystem: boolean;
|
|
642
|
+
smartIdCheck: boolean;
|
|
643
|
+
updateUrl: string;
|
|
741
644
|
}
|
|
742
|
-
interface
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
645
|
+
interface AmulePrefsSecurity {
|
|
646
|
+
canSeeShares: number;
|
|
647
|
+
ipFilterClients: boolean;
|
|
648
|
+
ipFilterServers: boolean;
|
|
649
|
+
ipFilterAutoUpdate: boolean;
|
|
650
|
+
ipFilterUpdateUrl: string;
|
|
651
|
+
ipFilterLevel: number;
|
|
652
|
+
filterLan: boolean;
|
|
653
|
+
useSecIdent: boolean;
|
|
654
|
+
obfuscationSupported: boolean;
|
|
655
|
+
obfuscationRequested: boolean;
|
|
656
|
+
obfuscationRequired: boolean;
|
|
748
657
|
}
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
658
|
+
interface AmulePreferences {
|
|
659
|
+
general: AmulePrefsGeneral;
|
|
660
|
+
connection: AmulePrefsConnection;
|
|
661
|
+
servers: AmulePrefsServers;
|
|
662
|
+
security: AmulePrefsSecurity;
|
|
663
|
+
}
|
|
664
|
+
//#endregion
|
|
665
|
+
//#region src/types/index.d.ts
|
|
666
|
+
interface SearchFilters {
|
|
667
|
+
minSize?: number;
|
|
668
|
+
maxSize?: number;
|
|
669
|
+
fileType?: string;
|
|
670
|
+
extension?: string;
|
|
671
|
+
availability?: number;
|
|
672
|
+
}
|
|
673
|
+
interface ConnectionState {
|
|
674
|
+
ed2kConnected: boolean;
|
|
675
|
+
ed2kConnecting: boolean;
|
|
676
|
+
kadConnected: boolean;
|
|
677
|
+
kadFirewalled: boolean;
|
|
678
|
+
kadRunning: boolean;
|
|
679
|
+
serverIpv4?: {
|
|
680
|
+
address: string;
|
|
681
|
+
port: number;
|
|
682
|
+
};
|
|
683
|
+
serverPing?: number;
|
|
684
|
+
serverPrio?: number;
|
|
685
|
+
serverFailed?: number;
|
|
686
|
+
serverStatic?: boolean;
|
|
687
|
+
serverVersion?: string;
|
|
688
|
+
serverName?: string;
|
|
689
|
+
serverDescription?: string;
|
|
690
|
+
serverUsers?: number;
|
|
691
|
+
serverUsersMax?: number;
|
|
692
|
+
serverFiles?: number;
|
|
693
|
+
ed2kId?: number;
|
|
694
|
+
kadId?: number;
|
|
695
|
+
clientId?: number;
|
|
696
|
+
}
|
|
697
|
+
//#endregion
|
|
698
|
+
//#region src/ec/packet/Flags.d.ts
|
|
699
|
+
/**
|
|
700
|
+
* Packet flags for EC protocol
|
|
701
|
+
*/
|
|
702
|
+
declare class Flags {
|
|
703
|
+
private static readonly FLAG_ACCEPTS;
|
|
704
|
+
private static readonly FLAG_ZLIB;
|
|
705
|
+
private static readonly FLAG_UTF8_NUMBERS;
|
|
706
|
+
private static readonly FLAG_ALWAYS_SET;
|
|
707
|
+
private readonly flags;
|
|
708
|
+
constructor(flags?: number);
|
|
752
709
|
/**
|
|
753
|
-
*
|
|
754
|
-
* Use 0 to disable request timeout.
|
|
710
|
+
* Create flags from buffer
|
|
755
711
|
*/
|
|
756
|
-
|
|
712
|
+
static fromBuffer(buffer: Buffer, offset?: number): Flags;
|
|
757
713
|
/**
|
|
758
|
-
*
|
|
714
|
+
* Write flags to buffer
|
|
759
715
|
*/
|
|
760
|
-
|
|
716
|
+
writeToBuffer(buffer: Buffer, offset?: number): void;
|
|
761
717
|
/**
|
|
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
|
|
718
|
+
* Check if UTF-8 number encoding is supported/accepted
|
|
923
719
|
*/
|
|
924
720
|
isUtf8NumbersAccepted(): boolean;
|
|
925
721
|
/**
|
|
@@ -1056,7 +852,6 @@ declare class Packet {
|
|
|
1056
852
|
readonly opCode: ECOpCode;
|
|
1057
853
|
readonly flags: Flags;
|
|
1058
854
|
readonly tags: Tag<any>[];
|
|
1059
|
-
private static readonly EC_CURRENT_PROTOCOL_VERSION;
|
|
1060
855
|
constructor(opCode: ECOpCode, flags?: Flags, tags?: Tag<any>[]);
|
|
1061
856
|
/**
|
|
1062
857
|
* Add a tag to the packet
|
|
@@ -1066,14 +861,10 @@ declare class Packet {
|
|
|
1066
861
|
* Add multiple tags to the packet
|
|
1067
862
|
*/
|
|
1068
863
|
addTags(tags: Tag<any>[]): this;
|
|
1069
|
-
/**
|
|
1070
|
-
* Get protocol version
|
|
1071
|
-
*/
|
|
1072
|
-
static getProtocolVersion(): number;
|
|
1073
864
|
/**
|
|
1074
865
|
* Find a tag by name
|
|
1075
866
|
*/
|
|
1076
|
-
findTag(tagName:
|
|
867
|
+
findTag(tagName: ECTagName): Tag<any> | undefined;
|
|
1077
868
|
/**
|
|
1078
869
|
* Get all tags with a specific name
|
|
1079
870
|
*/
|
|
@@ -1084,6 +875,237 @@ declare class Packet {
|
|
|
1084
875
|
hasTag(tagName: number): boolean;
|
|
1085
876
|
}
|
|
1086
877
|
//#endregion
|
|
878
|
+
//#region src/response/StatsResponse.d.ts
|
|
879
|
+
interface StatsResponse {
|
|
880
|
+
id: number;
|
|
881
|
+
ed2kId: number;
|
|
882
|
+
kadId?: string;
|
|
883
|
+
connectedServer?: {
|
|
884
|
+
name?: string;
|
|
885
|
+
description?: string;
|
|
886
|
+
ip: string;
|
|
887
|
+
port: number;
|
|
888
|
+
};
|
|
889
|
+
connectionState?: ConnectionState;
|
|
890
|
+
uploadOverhead: number;
|
|
891
|
+
downloadOverhead: number;
|
|
892
|
+
bannedCount: number;
|
|
893
|
+
loggerMessage: string[];
|
|
894
|
+
totalSentBytes: number;
|
|
895
|
+
totalReceivedBytes: number;
|
|
896
|
+
sharedFileCount: number;
|
|
897
|
+
uploadSpeed: number;
|
|
898
|
+
downloadSpeed: number;
|
|
899
|
+
uploadSpeedLimit: number;
|
|
900
|
+
downloadSpeedLimit: number;
|
|
901
|
+
uploadQueueLength: number;
|
|
902
|
+
totalSourceCount: number;
|
|
903
|
+
ed2kUsers: number;
|
|
904
|
+
kadUsers: number;
|
|
905
|
+
ed2kFiles: number;
|
|
906
|
+
kadFiles: number;
|
|
907
|
+
kadNodes: number;
|
|
908
|
+
}
|
|
909
|
+
//#endregion
|
|
910
|
+
//#region src/response/SearchResultsResponse.d.ts
|
|
911
|
+
interface SearchResultsResponse {
|
|
912
|
+
files: {
|
|
913
|
+
fileName: string;
|
|
914
|
+
hash: Buffer;
|
|
915
|
+
sizeFull: number;
|
|
916
|
+
downloadStatus: ECSearchFileDownloadStatus;
|
|
917
|
+
completeSourceCount: number;
|
|
918
|
+
sourceCount: number;
|
|
919
|
+
}[];
|
|
920
|
+
}
|
|
921
|
+
//#endregion
|
|
922
|
+
//#region src/response/UpdateResponse.d.ts
|
|
923
|
+
interface UpdateResponse {
|
|
924
|
+
sharedFiles: AmuleFile[];
|
|
925
|
+
downloadQueue: AmuleTransferringFile[];
|
|
926
|
+
clients: AmuleUpDownClient[];
|
|
927
|
+
servers: AmuleServer[];
|
|
928
|
+
friends: AmuleFriend[];
|
|
929
|
+
}
|
|
930
|
+
//#endregion
|
|
931
|
+
//#region src/client/AmuleClient.d.ts
|
|
932
|
+
interface AmuleClientOptions {
|
|
933
|
+
host: string;
|
|
934
|
+
port: number;
|
|
935
|
+
password: string;
|
|
936
|
+
timeout?: number;
|
|
937
|
+
requestTimeout?: number;
|
|
938
|
+
}
|
|
939
|
+
declare class AmuleClient {
|
|
940
|
+
private connection;
|
|
941
|
+
private updateState?;
|
|
942
|
+
constructor(options: AmuleClientOptions);
|
|
943
|
+
/**
|
|
944
|
+
* Set default timeout for individual request/response cycles.
|
|
945
|
+
* Use 0 to disable request timeout.
|
|
946
|
+
*/
|
|
947
|
+
setRequestTimeout(timeoutMs: number): void;
|
|
948
|
+
/**
|
|
949
|
+
* Get current default timeout for requests.
|
|
950
|
+
*/
|
|
951
|
+
getRequestTimeout(): number;
|
|
952
|
+
/**
|
|
953
|
+
* Reconnect to the server
|
|
954
|
+
*/
|
|
955
|
+
reconnect(): Promise<void>;
|
|
956
|
+
/**
|
|
957
|
+
* Get server statistics
|
|
958
|
+
*/
|
|
959
|
+
getStats(): Promise<StatsResponse>;
|
|
960
|
+
/**
|
|
961
|
+
* Get updates for files, clients, servers, and friends.
|
|
962
|
+
*
|
|
963
|
+
* The underlying EC_OP_GET_UPDATE request is incremental per connection: the daemon
|
|
964
|
+
* only sends the fields that changed since the previous call. This method keeps a
|
|
965
|
+
* client-side cache and merges those diffs, so it always returns full snapshots.
|
|
966
|
+
* Downloads carry their connected peers in `sources` (linked via client requestFileId
|
|
967
|
+
* and file ecid). The cache is reset whenever the connection is re-established.
|
|
968
|
+
*/
|
|
969
|
+
getUpdate(detailLevel?: ECDetailLevel): Promise<UpdateResponse>;
|
|
970
|
+
/**
|
|
971
|
+
* Get the download queue including per-peer source details.
|
|
972
|
+
*
|
|
973
|
+
* Unlike getDownloadQueue() (EC_OP_GET_DLOAD_QUEUE, which never includes peers),
|
|
974
|
+
* this uses the incremental update mechanism (see getUpdate), the only way the
|
|
975
|
+
* daemon exposes the clients each download is fed from. Each returned file has
|
|
976
|
+
* `sources` filled with the currently connected peers for that download.
|
|
977
|
+
*/
|
|
978
|
+
getDownloadQueueWithSources(): Promise<AmuleTransferringFile[]>;
|
|
979
|
+
/**
|
|
980
|
+
* Start an asynchronous search
|
|
981
|
+
*/
|
|
982
|
+
searchAsync(query: string, searchType?: SearchType, filters?: SearchFilters): Promise<string>;
|
|
983
|
+
/**
|
|
984
|
+
* Get search status (0-1)
|
|
985
|
+
*/
|
|
986
|
+
searchStatus(): Promise<number>;
|
|
987
|
+
/**
|
|
988
|
+
* Get search results
|
|
989
|
+
*/
|
|
990
|
+
searchResults(): Promise<SearchResultsResponse>;
|
|
991
|
+
/**
|
|
992
|
+
* Perform a synchronous search (waits for results)
|
|
993
|
+
*/
|
|
994
|
+
searchSync(query: string, searchType?: SearchType, filters?: SearchFilters, timeout?: number): Promise<SearchResultsResponse>;
|
|
995
|
+
/**
|
|
996
|
+
* Stop current search
|
|
997
|
+
*/
|
|
998
|
+
searchStop(): Promise<void>;
|
|
999
|
+
/**
|
|
1000
|
+
* Download a file from search results
|
|
1001
|
+
*/
|
|
1002
|
+
downloadSearchResult(hash: Buffer): Promise<void>;
|
|
1003
|
+
/**
|
|
1004
|
+
* Download from an ed2k link
|
|
1005
|
+
*/
|
|
1006
|
+
downloadEd2kLink(link: string): Promise<void>;
|
|
1007
|
+
/**
|
|
1008
|
+
* Get download queue
|
|
1009
|
+
*/
|
|
1010
|
+
getDownloadQueue(): Promise<AmuleTransferringFile[]>;
|
|
1011
|
+
/**
|
|
1012
|
+
* Get shared files
|
|
1013
|
+
*/
|
|
1014
|
+
getSharedFiles(): Promise<AmuleFile[]>;
|
|
1015
|
+
/**
|
|
1016
|
+
* Reload shared files list
|
|
1017
|
+
*/
|
|
1018
|
+
reloadSharedFiles(): Promise<void>;
|
|
1019
|
+
/**
|
|
1020
|
+
* Get the upload queue: clients we are uploading to or that wait in our queue
|
|
1021
|
+
* (EC_OP_GET_ULOAD_QUEUE). For download sources use getDownloadQueueWithSources().
|
|
1022
|
+
*/
|
|
1023
|
+
getClientQueue(): Promise<AmuleUpDownClient[]>;
|
|
1024
|
+
/**
|
|
1025
|
+
* Get the list of servers
|
|
1026
|
+
*/
|
|
1027
|
+
getServerList(): Promise<AmuleServer[]>;
|
|
1028
|
+
/**
|
|
1029
|
+
* Connect to a specific server
|
|
1030
|
+
*/
|
|
1031
|
+
connectToServer(ip?: string, port?: number): Promise<void>;
|
|
1032
|
+
/**
|
|
1033
|
+
* Disconnect from the current server
|
|
1034
|
+
*/
|
|
1035
|
+
disconnectFromServer(): Promise<void>;
|
|
1036
|
+
/**
|
|
1037
|
+
* Create a category
|
|
1038
|
+
*/
|
|
1039
|
+
createCategory(category: AmuleCategory): Promise<void>;
|
|
1040
|
+
/**
|
|
1041
|
+
* Update a category
|
|
1042
|
+
*/
|
|
1043
|
+
updateCategory(id: number, category: AmuleCategory): Promise<void>;
|
|
1044
|
+
/**
|
|
1045
|
+
* Delete a category
|
|
1046
|
+
*/
|
|
1047
|
+
deleteCategory(id: number): Promise<void>;
|
|
1048
|
+
/**
|
|
1049
|
+
* Get all categories
|
|
1050
|
+
*/
|
|
1051
|
+
getCategories(): Promise<AmuleCategory[]>;
|
|
1052
|
+
/**
|
|
1053
|
+
* Set file category
|
|
1054
|
+
*/
|
|
1055
|
+
setFileCategory(hash: Buffer, categoryId: number): Promise<void>;
|
|
1056
|
+
/**
|
|
1057
|
+
* Send a download command (PAUSE, RESUME, STOP, DELETE, etc.)
|
|
1058
|
+
*/
|
|
1059
|
+
sendDownloadCommand(hash: Buffer, command: DownloadCommand): Promise<void>;
|
|
1060
|
+
/**
|
|
1061
|
+
* Pause a download
|
|
1062
|
+
*/
|
|
1063
|
+
pauseDownload(hash: Buffer): Promise<void>;
|
|
1064
|
+
/**
|
|
1065
|
+
* Resume a download
|
|
1066
|
+
*/
|
|
1067
|
+
resumeDownload(hash: Buffer): Promise<void>;
|
|
1068
|
+
/**
|
|
1069
|
+
* Stop a download
|
|
1070
|
+
*/
|
|
1071
|
+
stopDownload(hash: Buffer): Promise<void>;
|
|
1072
|
+
/**
|
|
1073
|
+
* Delete a download
|
|
1074
|
+
*/
|
|
1075
|
+
deleteDownload(hash: Buffer): Promise<void>;
|
|
1076
|
+
/**
|
|
1077
|
+
* Trigger a server list update from an URL.
|
|
1078
|
+
*/
|
|
1079
|
+
updateServerListFromUrl(url: string): Promise<void>;
|
|
1080
|
+
/**
|
|
1081
|
+
* Set upload priority for a shared file.
|
|
1082
|
+
*/
|
|
1083
|
+
setSharedFilePriority(hash: Buffer, priority: number): Promise<void>;
|
|
1084
|
+
/**
|
|
1085
|
+
* Get daemon preferences for general/connection/servers/security sections.
|
|
1086
|
+
*/
|
|
1087
|
+
getPreferences(): Promise<AmulePreferences>;
|
|
1088
|
+
/**
|
|
1089
|
+
* Set daemon preferences. Only sections present in the input object are sent.
|
|
1090
|
+
*/
|
|
1091
|
+
setPreferences(preferences: Partial<AmulePreferences>): Promise<void>;
|
|
1092
|
+
}
|
|
1093
|
+
//#endregion
|
|
1094
|
+
//#region src/exceptions/index.d.ts
|
|
1095
|
+
declare class AmuleException extends Error {
|
|
1096
|
+
cause?: Error | undefined;
|
|
1097
|
+
constructor(message: string, cause?: Error | undefined);
|
|
1098
|
+
}
|
|
1099
|
+
declare class InvalidECException extends AmuleException {
|
|
1100
|
+
constructor(message: string, cause?: Error);
|
|
1101
|
+
}
|
|
1102
|
+
declare class CommunicationException extends AmuleException {
|
|
1103
|
+
constructor(message: string, cause?: Error);
|
|
1104
|
+
}
|
|
1105
|
+
declare class ServerException extends AmuleException {
|
|
1106
|
+
constructor(message: string, cause?: Error);
|
|
1107
|
+
}
|
|
1108
|
+
//#endregion
|
|
1087
1109
|
//#region src/ec/packet/PacketWriter.d.ts
|
|
1088
1110
|
declare class PacketWriter {
|
|
1089
1111
|
private static readonly HEADER_SIZE;
|
|
@@ -1126,4 +1148,4 @@ declare class PacketParser {
|
|
|
1126
1148
|
static hasCompletePacket(buffer: Buffer): boolean;
|
|
1127
1149
|
}
|
|
1128
1150
|
//#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
|
|
1151
|
+
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 };
|