amule-ec-client 0.6.0 → 0.6.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.
Files changed (82) hide show
  1. package/dist/{AddLinkRequest-DwUbSMXD.mjs → AddLinkRequest-D2IME4eb.js} +3 -5
  2. package/dist/{ClientQueueRequest-D9FaX5K9.mjs → ClientQueueRequest-DFfCiNcz.js} +3 -5
  3. package/dist/{ClientQueueResponse-FVQBR_8b.mjs → ClientQueueResponse-JTrBqrr1.js} +3 -5
  4. package/dist/{Codes-CjiW7Pdl.mjs → Codes-CjiW7Pdl.js} +0 -2
  5. package/dist/{CreateCategoryRequest-Br6yfDhZ.mjs → CreateCategoryRequest-CRUMcPo5.js} +3 -5
  6. package/dist/{DeleteCategoryRequest-C2-p6sx0.mjs → DeleteCategoryRequest-C8v9oGZ-.js} +3 -5
  7. package/dist/{DownloadCommandRequest-CaULjfNi.mjs → DownloadCommandRequest-B3KV_bvm.js} +4 -6
  8. package/dist/{DownloadFileRequest-CcNqsBo7.mjs → DownloadFileRequest-BjrroO3h.js} +3 -5
  9. package/dist/{DownloadQueueRequest-bd7lFiMj.mjs → DownloadQueueRequest-Dil5hl3D.js} +3 -5
  10. package/dist/{DownloadQueueResponse-DyP1rLTV.mjs → DownloadQueueResponse-DUam_zNf.js} +4 -6
  11. package/dist/{GetPreferencesRequest-C94Su9IH.mjs → GetPreferencesRequest-DsxlghqT.js} +3 -5
  12. package/dist/{PreferencesDetailsResponse-BjMxbvVY.mjs → PreferencesDetailsResponse-DapscVQi.js} +2 -4
  13. package/dist/{PreferencesResponse-Dth-n2sA.mjs → PreferencesResponse-8n1STWUZ.js} +2 -4
  14. package/dist/{ReloadSharedFilesRequest-CPwAEJYG.mjs → ReloadSharedFilesRequest-kt0Pxs8A.js} +2 -4
  15. package/dist/{Request-C0UUuQIX.mjs → Request-C0UUuQIX.js} +0 -2
  16. package/dist/{SearchProgressResponse-Bputc9Ww.mjs → SearchProgressResponse-C1CdzKnz.js} +2 -4
  17. package/dist/{SearchRequest-CNqz-K1Z.mjs → SearchRequest-DQnKfA5Z.js} +4 -6
  18. package/dist/{SearchResultsRequest-DKG508KF.mjs → SearchResultsRequest-2ejFGQmQ.js} +2 -4
  19. package/dist/{SearchResultsResponse-ChNrKJ6_.mjs → SearchResultsResponse-DwmvbQop.js} +2 -4
  20. package/dist/{SearchStatusRequest-Bv6iaC9Y.mjs → SearchStatusRequest-B_xr4-72.js} +2 -4
  21. package/dist/{SearchStopRequest-rET-2Nsz.mjs → SearchStopRequest-8hwXobty.js} +2 -4
  22. package/dist/{ServerConnectRequest-CcO2-Eqd.mjs → ServerConnectRequest-BhNpGiEJ.js} +3 -5
  23. package/dist/{ServerDisconnectRequest-DEORM3SF.mjs → ServerDisconnectRequest-BjCitLtU.js} +2 -4
  24. package/dist/{ServerListRequest-FwFQBp12.mjs → ServerListRequest-BWXLGJib.js} +2 -4
  25. package/dist/{ServerListResponse-ZAKSSCPZ.mjs → ServerListResponse-BUJ7sz5p.js} +3 -5
  26. package/dist/{ServerUpdateFromUrlRequest-D4xBqJDJ.mjs → ServerUpdateFromUrlRequest-K8C_d0UQ.js} +3 -5
  27. package/dist/{SetFileCategoryRequest-BwEPJVeR.mjs → SetFileCategoryRequest-VwroLBTV.js} +3 -5
  28. package/dist/{SetPreferencesRequest-D2fVIH3P.mjs → SetPreferencesRequest-KZ23VaBY.js} +3 -5
  29. package/dist/{SharedFilePriorityRequest-j6ImgagV.mjs → SharedFilePriorityRequest-7BriqAcr.js} +3 -5
  30. package/dist/{SharedFilesRequest-D2M3K0eB.mjs → SharedFilesRequest-B72XyRcA.js} +3 -5
  31. package/dist/{SharedFilesResponse-BiXT_oCx.mjs → SharedFilesResponse-CkqvYd3N.js} +3 -5
  32. package/dist/{StatsRequest-B8v9LLHG.mjs → StatsRequest-CGGumOOx.js} +3 -5
  33. package/dist/{StatsResponse-BVUxNPbz.mjs → StatsResponse-DxQk686g.js} +2 -4
  34. package/dist/{Tag-CZF6BRMY.mjs → Tag-CZF6BRMY.js} +0 -2
  35. package/dist/{UpdateCategoryRequest-CgzH7SxP.mjs → UpdateCategoryRequest-CzKJa_rC.js} +3 -5
  36. package/dist/{UpdateRequest-Bunl73Ga.mjs → UpdateRequest-g2ReOQ5m.js} +3 -5
  37. package/dist/{UpdateResponse-1LhyH9Zf.mjs → UpdateResponse-CGwVjn0Y.js} +7 -9
  38. package/dist/{download-details-OM0FJUhZ.mjs → download-details-OM0FJUhZ.js} +0 -2
  39. package/dist/{index.d.mts → index.d.ts} +1 -2
  40. package/dist/{index.mjs → index.js} +39 -41
  41. package/dist/{utils-DBnUQnZ-.mjs → utils-DBnUQnZ-.js} +0 -2
  42. package/package.json +1 -1
  43. package/dist/AddLinkRequest-DwUbSMXD.mjs.map +0 -1
  44. package/dist/ClientQueueRequest-D9FaX5K9.mjs.map +0 -1
  45. package/dist/ClientQueueResponse-FVQBR_8b.mjs.map +0 -1
  46. package/dist/Codes-CjiW7Pdl.mjs.map +0 -1
  47. package/dist/CreateCategoryRequest-Br6yfDhZ.mjs.map +0 -1
  48. package/dist/DeleteCategoryRequest-C2-p6sx0.mjs.map +0 -1
  49. package/dist/DownloadCommandRequest-CaULjfNi.mjs.map +0 -1
  50. package/dist/DownloadFileRequest-CcNqsBo7.mjs.map +0 -1
  51. package/dist/DownloadQueueRequest-bd7lFiMj.mjs.map +0 -1
  52. package/dist/DownloadQueueResponse-DyP1rLTV.mjs.map +0 -1
  53. package/dist/GetPreferencesRequest-C94Su9IH.mjs.map +0 -1
  54. package/dist/PreferencesDetailsResponse-BjMxbvVY.mjs.map +0 -1
  55. package/dist/PreferencesResponse-Dth-n2sA.mjs.map +0 -1
  56. package/dist/ReloadSharedFilesRequest-CPwAEJYG.mjs.map +0 -1
  57. package/dist/Request-C0UUuQIX.mjs.map +0 -1
  58. package/dist/SearchProgressResponse-Bputc9Ww.mjs.map +0 -1
  59. package/dist/SearchRequest-CNqz-K1Z.mjs.map +0 -1
  60. package/dist/SearchResultsRequest-DKG508KF.mjs.map +0 -1
  61. package/dist/SearchResultsResponse-ChNrKJ6_.mjs.map +0 -1
  62. package/dist/SearchStatusRequest-Bv6iaC9Y.mjs.map +0 -1
  63. package/dist/SearchStopRequest-rET-2Nsz.mjs.map +0 -1
  64. package/dist/ServerConnectRequest-CcO2-Eqd.mjs.map +0 -1
  65. package/dist/ServerDisconnectRequest-DEORM3SF.mjs.map +0 -1
  66. package/dist/ServerListRequest-FwFQBp12.mjs.map +0 -1
  67. package/dist/ServerListResponse-ZAKSSCPZ.mjs.map +0 -1
  68. package/dist/ServerUpdateFromUrlRequest-D4xBqJDJ.mjs.map +0 -1
  69. package/dist/SetFileCategoryRequest-BwEPJVeR.mjs.map +0 -1
  70. package/dist/SetPreferencesRequest-D2fVIH3P.mjs.map +0 -1
  71. package/dist/SharedFilePriorityRequest-j6ImgagV.mjs.map +0 -1
  72. package/dist/SharedFilesRequest-D2M3K0eB.mjs.map +0 -1
  73. package/dist/SharedFilesResponse-BiXT_oCx.mjs.map +0 -1
  74. package/dist/StatsRequest-B8v9LLHG.mjs.map +0 -1
  75. package/dist/StatsResponse-BVUxNPbz.mjs.map +0 -1
  76. package/dist/Tag-CZF6BRMY.mjs.map +0 -1
  77. package/dist/UpdateCategoryRequest-CgzH7SxP.mjs.map +0 -1
  78. package/dist/UpdateRequest-Bunl73Ga.mjs.map +0 -1
  79. package/dist/UpdateResponse-1LhyH9Zf.mjs.map +0 -1
  80. package/dist/download-details-OM0FJUhZ.mjs.map +0 -1
  81. package/dist/index.mjs.map +0 -1
  82. package/dist/utils-DBnUQnZ-.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"SetPreferencesRequest-D2fVIH3P.mjs","names":[],"sources":["../src/request/SetPreferencesRequest.ts"],"sourcesContent":["import { ECOpCode, ECTagName } from '../ec/Codes';\nimport { StringTag, UByteTag, UShortTag, UIntTag, type Tag } from '../ec/tag/Tag';\nimport type { AmulePreferences } from '../types/preferences';\nimport { Request } from './Request';\n\nexport class SetPreferencesRequest extends Request {\n\tconstructor(prefs: Partial<AmulePreferences>) {\n\t\tsuper(ECOpCode.EC_OP_SET_PREFERENCES);\n\t\tthis.tags.push(...SetPreferencesRequest.buildTopLevelTags(prefs));\n\t}\n\n\tprivate static buildTopLevelTags(prefs: Partial<AmulePreferences>): Tag<any>[] {\n\t\tconst topTags: Tag<any>[] = [];\n\n\t\tif (prefs.general) {\n\t\t\tconst g = prefs.general;\n\t\t\ttopTags.push(\n\t\t\t\tnew UByteTag(ECTagName.EC_TAG_PREFS_GENERAL, 0, [\n\t\t\t\t\tnew StringTag(ECTagName.EC_TAG_USER_NICK, g.userNick),\n\t\t\t\t\tnew UByteTag(ECTagName.EC_TAG_GENERAL_CHECK_NEW_VERSION, g.checkNewVersion ? 1 : 0),\n\t\t\t\t])\n\t\t\t);\n\t\t}\n\n\t\tif (prefs.connection) {\n\t\t\tconst c = prefs.connection;\n\t\t\ttopTags.push(\n\t\t\t\tnew UByteTag(ECTagName.EC_TAG_PREFS_CONNECTIONS, 0, [\n\t\t\t\t\tnew UIntTag(ECTagName.EC_TAG_CONN_UL_CAP, c.uploadCapacity),\n\t\t\t\t\tnew UIntTag(ECTagName.EC_TAG_CONN_DL_CAP, c.downloadCapacity),\n\t\t\t\t\tnew UIntTag(ECTagName.EC_TAG_CONN_MAX_UL, c.maxUploadSpeed),\n\t\t\t\t\tnew UIntTag(ECTagName.EC_TAG_CONN_MAX_DL, c.maxDownloadSpeed),\n\t\t\t\t\tnew UIntTag(ECTagName.EC_TAG_CONN_SLOT_ALLOCATION, c.slotAllocation),\n\t\t\t\t\tnew UShortTag(ECTagName.EC_TAG_CONN_TCP_PORT, c.tcpPort),\n\t\t\t\t\tnew UShortTag(ECTagName.EC_TAG_CONN_UDP_PORT, c.udpPort),\n\t\t\t\t\tnew UIntTag(ECTagName.EC_TAG_CONN_MAX_FILE_SOURCES, c.maxFileSources),\n\t\t\t\t\tnew UIntTag(ECTagName.EC_TAG_CONN_MAX_CONN, c.maxConnections),\n\t\t\t\t\tnew UByteTag(ECTagName.EC_TAG_CONN_AUTOCONNECT, c.autoconnect ? 1 : 0),\n\t\t\t\t\tnew UByteTag(ECTagName.EC_TAG_CONN_RECONNECT, c.reconnect ? 1 : 0),\n\t\t\t\t\tnew UByteTag(ECTagName.EC_TAG_NETWORK_ED2K, c.networkED2K ? 1 : 0),\n\t\t\t\t\tnew UByteTag(ECTagName.EC_TAG_NETWORK_KADEMLIA, c.networkKademlia ? 1 : 0),\n\t\t\t\t])\n\t\t\t);\n\t\t}\n\n\t\tif (prefs.servers) {\n\t\t\tconst s = prefs.servers;\n\t\t\ttopTags.push(\n\t\t\t\tnew UByteTag(ECTagName.EC_TAG_PREFS_SERVERS, 0, [\n\t\t\t\t\tnew UByteTag(ECTagName.EC_TAG_SERVERS_REMOVE_DEAD, s.removeDead ? 1 : 0),\n\t\t\t\t\tnew UShortTag(ECTagName.EC_TAG_SERVERS_DEAD_SERVER_RETRIES, s.deadRetries),\n\t\t\t\t\tnew UByteTag(ECTagName.EC_TAG_SERVERS_USE_SCORE_SYSTEM, s.useScoreSystem ? 1 : 0),\n\t\t\t\t\tnew UByteTag(ECTagName.EC_TAG_SERVERS_SMART_ID_CHECK, s.smartIdCheck ? 1 : 0),\n\t\t\t\t\tnew StringTag(ECTagName.EC_TAG_SERVERS_UPDATE_URL, s.updateUrl),\n\t\t\t\t])\n\t\t\t);\n\t\t}\n\n\t\tif (prefs.security) {\n\t\t\tconst sec = prefs.security;\n\t\t\ttopTags.push(\n\t\t\t\tnew UByteTag(ECTagName.EC_TAG_PREFS_SECURITY, 0, [\n\t\t\t\t\tnew UByteTag(ECTagName.EC_TAG_SECURITY_CAN_SEE_SHARES, sec.canSeeShares),\n\t\t\t\t\tnew UByteTag(ECTagName.EC_TAG_IPFILTER_CLIENTS, sec.ipFilterClients ? 1 : 0),\n\t\t\t\t\tnew UByteTag(ECTagName.EC_TAG_IPFILTER_SERVERS, sec.ipFilterServers ? 1 : 0),\n\t\t\t\t\tnew UByteTag(ECTagName.EC_TAG_IPFILTER_AUTO_UPDATE, sec.ipFilterAutoUpdate ? 1 : 0),\n\t\t\t\t\tnew StringTag(ECTagName.EC_TAG_IPFILTER_UPDATE_URL, sec.ipFilterUpdateUrl),\n\t\t\t\t\tnew UByteTag(ECTagName.EC_TAG_IPFILTER_LEVEL, sec.ipFilterLevel),\n\t\t\t\t\tnew UByteTag(ECTagName.EC_TAG_IPFILTER_FILTER_LAN, sec.filterLan ? 1 : 0),\n\t\t\t\t\tnew UByteTag(ECTagName.EC_TAG_SECURITY_USE_SECIDENT, sec.useSecIdent ? 1 : 0),\n\t\t\t\t\tnew UByteTag(ECTagName.EC_TAG_SECURITY_OBFUSCATION_SUPPORTED, sec.obfuscationSupported ? 1 : 0),\n\t\t\t\t\tnew UByteTag(ECTagName.EC_TAG_SECURITY_OBFUSCATION_REQUESTED, sec.obfuscationRequested ? 1 : 0),\n\t\t\t\t\tnew UByteTag(ECTagName.EC_TAG_SECURITY_OBFUSCATION_REQUIRED, sec.obfuscationRequired ? 1 : 0),\n\t\t\t\t])\n\t\t\t);\n\t\t}\n\n\t\treturn topTags;\n\t}\n}\n"],"mappings":";;;;AAKA,IAAa,wBAAb,MAAa,8BAA8B,QAAQ;CAClD,YAAY,OAAkC;EAC7C,MAAA,EAAoC;EACpC,KAAK,KAAK,KAAK,GAAG,sBAAsB,kBAAkB,KAAK,CAAC;CACjE;CAEA,OAAe,kBAAkB,OAA8C;EAC9E,MAAM,UAAsB,CAAC;EAE7B,IAAI,MAAM,SAAS;GAClB,MAAM,IAAI,MAAM;GAChB,QAAQ,KACP,IAAI,SAAA,MAAyC,GAAG,CAC/C,IAAI,UAAA,MAAsC,EAAE,QAAQ,GACpD,IAAI,SAAA,MAAqD,EAAE,kBAAkB,IAAI,CAAC,CACnF,CAAC,CACF;EACD;EAEA,IAAI,MAAM,YAAY;GACrB,MAAM,IAAI,MAAM;GAChB,QAAQ,KACP,IA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UAAA,MAAgD,IAAI,iBAAiB;IACzE,IAAI,SAAA,MAA0C,IAAI,aAAa;IAC/D,IAAI,SAAA,MAA+C,IAAI,YAAY,IAAI,CAAC;IACxE,IAAI,SAAA,MAAiD,IAAI,cAAc,IAAI,CAAC;IAC5E,IAAI,SAAA,MAA0D,IAAI,uBAAuB,IAAI,CAAC;IAC9F,IAAI,SAAA,MAA0D,IAAI,uBAAuB,IAAI,CAAC;IAC9F,IAAI,SAAA,MAAyD,IAAI,sBAAsB,IAAI,CAAC;GAC7F,CAAC,CACF;EACD;EAEA,OAAO;CACR;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SharedFilePriorityRequest-j6ImgagV.mjs","names":[],"sources":["../src/request/SharedFilePriorityRequest.ts"],"sourcesContent":["import { ECOpCode, ECTagName } from '../ec/Codes';\nimport { Hash16Tag, UIntTag } from '../ec/tag/Tag';\nimport { Request } from './Request';\n\nexport class SharedFilePriorityRequest extends Request {\n\tconstructor(hash: Buffer, priority: number) {\n\t\tsuper(ECOpCode.EC_OP_SHARED_SET_PRIO);\n\t\tthis.addTag(new Hash16Tag(ECTagName.EC_TAG_PARTFILE_HASH, hash));\n\t\tthis.addTag(new UIntTag(ECTagName.EC_TAG_KNOWNFILE_PRIO, priority));\n\t}\n}\n"],"mappings":";;;;AAIA,IAAa,4BAAb,cAA+C,QAAQ;CACtD,YAAY,MAAc,UAAkB;EAC3C,MAAA,EAAoC;EACpC,KAAK,OAAO,IAAI,UAAA,KAA0C,IAAI,CAAC;EAC/D,KAAK,OAAO,IAAI,QAAA,MAAyC,QAAQ,CAAC;CACnE;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SharedFilesRequest-D2M3K0eB.mjs","names":[],"sources":["../src/request/SharedFilesRequest.ts"],"sourcesContent":["/**\n * Shared Files Request - Get shared files list\n */\n\nimport { Request } from './Request';\nimport { ECOpCode, ECTagName, ECDetailLevel } from '../ec/Codes';\nimport { UByteTag } from '../ec/tag/Tag';\n\nexport class SharedFilesRequest extends Request {\n\tconstructor(detailLevel: ECDetailLevel = ECDetailLevel.EC_DETAIL_FULL) {\n\t\tsuper(ECOpCode.EC_OP_GET_SHARED_FILES);\n\n\t\tthis.addTag(new UByteTag(ECTagName.EC_TAG_DETAIL_LEVEL, detailLevel));\n\t}\n}\n"],"mappings":";;;;;;;AAQA,IAAa,qBAAb,cAAwC,QAAQ;CAC/C,YAAY,cAAA,GAA2D;EACtE,MAAA,EAAqC;EAErC,KAAK,OAAO,IAAI,SAAA,GAAwC,WAAW,CAAC;CACrE;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SharedFilesResponse-BiXT_oCx.mjs","names":[],"sources":["../src/response/SharedFilesResponse.ts"],"sourcesContent":["/**\n * Shared Files Response - Parse shared files list\n */\n\nimport { Packet } from '../ec/packet/Packet';\nimport { ECTagName } from '../ec/Codes';\nimport { findNumericTag, findTag } from '../ec/tag/Tag';\nimport type { AmuleFile } from '../model';\nimport { toOptionalNumber } from './utils';\n\nexport interface SharedFilesResponse {\n\tfiles: AmuleFile[];\n}\n\nexport class SharedFilesResponseParser {\n\tstatic fromPacket(packet: Packet): SharedFilesResponse {\n\t\tconst files: AmuleFile[] = [];\n\n\t\t// Find all knownfile tags\n\t\tconst knownfileTags = packet.tags.filter((tag) => tag.name === ECTagName.EC_TAG_KNOWNFILE);\n\n\t\tfor (const fileTag of knownfileTags) {\n\t\t\tconst tags = fileTag.nestedTags || [];\n\n\t\t\tconst hashTag = findTag(tags, ECTagName.EC_TAG_PARTFILE_HASH);\n\t\t\tconst fileNameTag = findTag(tags, ECTagName.EC_TAG_PARTFILE_NAME);\n\n\t\t\tconst file: AmuleFile = {\n\t\t\t\tfileHashHexString: hashTag ? hashTag.getValue().toString('hex') : undefined,\n\t\t\t\tfileName: fileNameTag ? fileNameTag.getValue() : undefined,\n\t\t\t\tfilePath: findTag(tags, ECTagName.EC_TAG_KNOWNFILE_FILENAME)?.getValue(),\n\t\t\t\tsizeFull: toOptionalNumber(findNumericTag(tags, ECTagName.EC_TAG_PARTFILE_SIZE_FULL)?.getLong()),\n\t\t\t\tfileEd2kLink: findTag(tags, ECTagName.EC_TAG_PARTFILE_ED2K_LINK)?.getValue(),\n\n\t\t\t\tupPrio: findNumericTag(tags, ECTagName.EC_TAG_KNOWNFILE_PRIO)?.getInt(),\n\t\t\t\tgetRequests: findNumericTag(tags, ECTagName.EC_TAG_KNOWNFILE_REQ_COUNT)?.getShort(),\n\t\t\t\tgetAllRequests: findNumericTag(tags, ECTagName.EC_TAG_KNOWNFILE_REQ_COUNT_ALL)?.getInt(),\n\t\t\t\tgetAccepts: findNumericTag(tags, ECTagName.EC_TAG_KNOWNFILE_ACCEPT_COUNT)?.getShort(),\n\t\t\t\tgetAllAccepts: findNumericTag(tags, ECTagName.EC_TAG_KNOWNFILE_ACCEPT_COUNT_ALL)?.getInt(),\n\t\t\t\tgetXferred: toOptionalNumber(findNumericTag(tags, ECTagName.EC_TAG_KNOWNFILE_XFERRED)?.getLong()),\n\t\t\t\tgetAllXferred: toOptionalNumber(findNumericTag(tags, ECTagName.EC_TAG_KNOWNFILE_XFERRED_ALL)?.getLong()),\n\t\t\t\tgetCompleteSourcesLow: findNumericTag(tags, ECTagName.EC_TAG_KNOWNFILE_COMPLETE_SOURCES_LOW)?.getShort(),\n\t\t\t\tgetCompleteSourcesHigh: findNumericTag(tags, ECTagName.EC_TAG_KNOWNFILE_COMPLETE_SOURCES_HIGH)?.getShort(),\n\t\t\t\tgetCompleteSources: findNumericTag(tags, ECTagName.EC_TAG_KNOWNFILE_COMPLETE_SOURCES)?.getShort(),\n\t\t\t\tgetOnQueue: findNumericTag(tags, ECTagName.EC_TAG_KNOWNFILE_ON_QUEUE)?.getShort(),\n\t\t\t\tgetComment: findTag(tags, ECTagName.EC_TAG_KNOWNFILE_COMMENT)?.getValue(),\n\t\t\t\tgetRating: findNumericTag(tags, ECTagName.EC_TAG_KNOWNFILE_RATING)?.getInt(),\n\t\t\t};\n\n\t\t\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SAAS;IAChF,YAAY,QAAQ,MAAA,IAAwC,CAAC,EAAE,SAAS;IACxE,WAAW,eAAe,MAAA,IAAuC,CAAC,EAAE,OAAO;GAC5E;GAEA,MAAM,KAAK,IAAI;EAChB;EAEA,OAAO,EAAE,MAAM;CAChB;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"StatsRequest-B8v9LLHG.mjs","names":[],"sources":["../src/request/StatsRequest.ts"],"sourcesContent":["/**\n * Stats Request - Request server statistics\n */\n\nimport { Request } from './Request';\nimport { ECOpCode, ECTagName, ECDetailLevel } from '../ec/Codes';\nimport { UByteTag } from '../ec/tag/Tag';\n\nexport class StatsRequest extends Request {\n\tconstructor(detailLevel: ECDetailLevel = ECDetailLevel.EC_DETAIL_FULL) {\n\t\tsuper(ECOpCode.EC_OP_STAT_REQ);\n\n\t\tthis.addTag(new UByteTag(ECTagName.EC_TAG_DETAIL_LEVEL, detailLevel));\n\t}\n}\n"],"mappings":";;;;;;;AAQA,IAAa,eAAb,cAAkC,QAAQ;CACzC,YAAY,cAAA,GAA2D;EACtE,MAAA,EAA6B;EAE7B,KAAK,OAAO,IAAI,SAAA,GAAwC,WAAW,CAAC;CACrE;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"StatsResponse-BVUxNPbz.mjs","names":[],"sources":["../src/response/StatsResponse.ts"],"sourcesContent":["/**\n * Stats Response - Server statistics\n */\n\nimport { Packet } from '../ec/packet/Packet';\nimport { ECTagName } from '../ec/Codes';\nimport { findNumericTag, findTag } from '../ec/tag/Tag';\nimport type { StatsResponse } from '../client/AmuleClient';\n\nexport class StatsResponseParser {\n\tstatic fromPacket(packet: Packet): StatsResponse {\n\t\t// Extract common stats\n\t\tconst uploadOverhead = findNumericTag(packet.tags, ECTagName.EC_TAG_STATS_UP_OVERHEAD)?.getValue() || 0;\n\t\tconst downloadOverhead = findNumericTag(packet.tags, ECTagName.EC_TAG_STATS_DOWN_OVERHEAD)?.getValue() || 0;\n\t\tconst bannedCount = findNumericTag(packet.tags, ECTagName.EC_TAG_STATS_BANNED_COUNT)?.getValue() || 0;\n\n\t\tconst totalSentBytes = findNumericTag(packet.tags, ECTagName.EC_TAG_STATS_TOTAL_SENT_BYTES)?.getValue() || 0;\n\t\tconst totalReceivedBytes = findNumericTag(packet.tags, ECTagName.EC_TAG_STATS_TOTAL_RECEIVED_BYTES)?.getValue() || 0;\n\t\tconst sharedFileCount = findNumericTag(packet.tags, ECTagName.EC_TAG_STATS_SHARED_FILE_COUNT)?.getValue() || 0;\n\n\t\tconst uploadSpeed = findNumericTag(packet.tags, ECTagName.EC_TAG_STATS_UL_SPEED)?.getValue() || 0;\n\t\tconst downloadSpeed = findNumericTag(packet.tags, ECTagName.EC_TAG_STATS_DL_SPEED)?.getValue() || 0;\n\t\tconst uploadSpeedLimit = findNumericTag(packet.tags, ECTagName.EC_TAG_STATS_UL_SPEED_LIMIT)?.getValue() || 0;\n\t\tconst downloadSpeedLimit = findNumericTag(packet.tags, ECTagName.EC_TAG_STATS_DL_SPEED_LIMIT)?.getValue() || 0;\n\n\t\tconst uploadQueueLength = findNumericTag(packet.tags, ECTagName.EC_TAG_STATS_UL_QUEUE_LEN)?.getValue() || 0;\n\t\tconst totalSourceCount = findNumericTag(packet.tags, ECTagName.EC_TAG_STATS_TOTAL_SRC_COUNT)?.getValue() || 0;\n\t\tconst ed2kUsers = findNumericTag(packet.tags, ECTagName.EC_TAG_STATS_ED2K_USERS)?.getValue() || 0;\n\t\tconst kadUsers = findNumericTag(packet.tags, ECTagName.EC_TAG_STATS_KAD_USERS)?.getValue() || 0;\n\t\tconst ed2kFiles = findNumericTag(packet.tags, ECTagName.EC_TAG_STATS_ED2K_FILES)?.getValue() || 0;\n\t\tconst kadFiles = findNumericTag(packet.tags, ECTagName.EC_TAG_STATS_KAD_FILES)?.getValue() || 0;\n\n\t\tconst kadNodes = findNumericTag(packet.tags, ECTagName.EC_TAG_STATS_KAD_NODES)?.getValue() || 0;\n\n\t\t// Connection State & Server Info\n\t\tconst connStateTag = findTag(packet.tags, ECTagName.EC_TAG_CONNSTATE);\n\t\tlet ed2kId = 0;\n\t\tlet clientId = 0;\n\t\tlet kadId: string | undefined;\n\t\tlet connectedServer: StatsResponse['connectedServer'];\n\n\t\tif (connStateTag && connStateTag.nestedTags) {\n\t\t\ted2kId = Number(findNumericTag(connStateTag.nestedTags, ECTagName.EC_TAG_ED2K_ID)?.getValue() || 0);\n\t\t\tclientId = Number(findNumericTag(connStateTag.nestedTags, ECTagName.EC_TAG_CLIENT_ID)?.getValue() || 0);\n\n\t\t\tconst kadIdTag = findTag(connStateTag.nestedTags, ECTagName.EC_TAG_KAD_ID);\n\t\t\tif (kadIdTag && kadIdTag.getValue() !== undefined) {\n\t\t\t\tconst val = kadIdTag.getValue();\n\t\t\t\tif (typeof val === 'bigint') {\n\t\t\t\t\tkadId = val.toString(16).padStart(32, '0');\n\t\t\t\t} else if (val instanceof Buffer) {\n\t\t\t\t\tkadId = val.toString('hex');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst serverTag = findTag(connStateTag.nestedTags, ECTagName.EC_TAG_SERVER);\n\t\t\tif (serverTag) {\n\t\t\t\tconst serverVal = serverTag.getValue() as any;\n\t\t\t\tif (serverVal && typeof serverVal === 'object' && 'address' in serverVal) {\n\t\t\t\t\tconnectedServer = {\n\t\t\t\t\t\tip: serverVal.address,\n\t\t\t\t\t\tport: serverVal.port,\n\t\t\t\t\t\tname: findTag(serverTag.nestedTags || [], ECTagName.EC_TAG_SERVER_NAME)?.getValue(),\n\t\t\t\t\t\tdescription: findTag(serverTag.nestedTags || [], ECTagName.EC_TAG_SERVER_DESC)?.getValue(),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Fallback for ID if not in connState\n\t\tconst id = clientId || Number(findNumericTag(packet.tags, ECTagName.EC_TAG_CLIENT_ID)?.getValue() || 0);\n\n\t\t// Logger messages (if any)\n\t\tconst loggerMessage: string[] = [];\n\t\t// TODO: Parse logger messages from nested tags if present\n\n\t\treturn {\n\t\t\tid: Number(id),\n\t\t\ted2kId,\n\t\t\tkadId,\n\t\t\tconnectedServer,\n\t\t\tuploadOverhead: Number(uploadOverhead),\n\t\t\tdownloadOverhead: Number(downloadOverhead),\n\t\t\tbannedCount: Number(bannedCount),\n\t\t\tloggerMessage,\n\t\t\ttotalSentBytes: Number(totalSentBytes),\n\t\t\ttotalReceivedBytes: Number(totalReceivedBytes),\n\t\t\tsharedFileCount: Number(sharedFileCount),\n\t\t\tuploadSpeed: Number(uploadSpeed),\n\t\t\tdownloadSpeed: Number(downloadSpeed),\n\t\t\tuploadSpeedLimit: Number(uploadSpeedLimit),\n\t\t\tdownloadSpeedLimit: Number(downloadSpeedLimit),\n\t\t\tuploadQueueLength: Number(uploadQueueLength),\n\t\t\ttotalSourceCount: Number(totalSourceCount),\n\t\t\ted2kUsers: Number(ed2kUsers),\n\t\t\tkadUsers: Number(kadUsers),\n\t\t\ted2kFiles: Number(ed2kFiles),\n\t\t\tkadFiles: Number(kadFiles),\n\t\t\tkadNodes: Number(kadNodes),\n\t\t};\n\t}\n}\n"],"mappings":";;;AASA,IAAa,sBAAb,MAAiC;CAChC,OAAO,WAAW,QAA+B;EAEhD,MAAM,iBAAiB,eAAe,OAAO,MAAA,GAAwC,CAAC,EAAE,SAAS,KAAK;EACtG,MAAM,mBAAmB,eAAe,OAAO,MAAA,GAA0C,CAAC,EAAE,SAAS,KAAK;EAC1G,MAAM,cAAc,eAAe,OAAO,MAAA,GAAyC,CAAC,EAAE,SAAS,KAAK;EAEpG,MAAM,iBAAiB,eAAe,OAAO,MAAA,GAA6C,CAAC,EAAE,SAAS,KAAK;EAC3G,MAAM,qBAAqB,eAAe,OAAO,MAAA,GAAiD,CAAC,EAAE,SAAS,KAAK;EACnH,MAAM,kBAAkB,eAAe,OAAO,MAAA,GAA8C,CAAC,EAAE,SAAS,KAAK;EAE7G,MAAM,cAAc,eAAe,OAAO,MAAA,GAAqC,CAAC,EAA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Q,IAAI,SAAS,KAAK;GAE5B;GAEA,MAAM,YAAY,QAAQ,aAAa,YAAA,IAAmC;GAC1E,IAAI,WAAW;IACd,MAAM,YAAY,UAAU,SAAS;IACrC,IAAI,aAAa,OAAO,cAAc,YAAY,aAAa,WAC9D,kBAAkB;KACjB,IAAI,UAAU;KACd,MAAM,UAAU;KAChB,MAAM,QAAQ,UAAU,cAAc,CAAC,GAAA,IAA+B,CAAC,EAAE,SAAS;KAClF,aAAa,QAAQ,UAAU,cAAc,CAAC,GAAA,IAA+B,CAAC,EAAE,SAAS;IAC1F;GAEF;EACD;EAGA,MAAM,KAAK,YAAY,OAAO,eAAe,OAAO,MAAA,EAAgC,CAAC,EAAE,SAAS,KAAK,CAAC;EAMtG,OAAO;GACN,IAAI,OAAO,EAAE;GACb;GACA;GACA;GACA,gBAAgB,OAAO,cAAc;GACrC,kBAAkB,OAAO,gBAAgB;GACzC,aAAa,OAAO,WAAW;GAC/B,eAAA,CAAY;GACZ,gBAAgB,OAAO,cAAc;GACrC,oBAAoB,OAAO,kBAAkB;GAC7C,iBAAiB,OAAO,eAAe;GACvC,aAAa,OAAO,WAAW;GAC/B,eAAe,OAAO,aAAa;GACnC,kBAAkB,OAAO,gBAAgB;GACzC,oBAAoB,OAAO,kBAAkB;GAC7C,mBAAmB,OAAO,iBAAiB;GAC3C,kBAAkB,OAAO,gBAAgB;GACzC,WAAW,OAAO,SAAS;GAC3B,UAAU,OAAO,QAAQ;GACzB,WAAW,OAAO,SAAS;GAC3B,UAAU,OAAO,QAAQ;GACzB,UAAU,OAAO,QAAQ;EAC1B;CACD;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Tag-CZF6BRMY.mjs","names":[],"sources":["../src/ec/tag/Tag.ts"],"sourcesContent":["// Tag definitions for EC protocol\n\nimport { ECTagName, ECTagType } from '../Codes';\n\nexport interface NumericTag {\n\tgetShort(): number;\n\tgetInt(): number;\n\tgetLong(): bigint;\n\tgetValue(): number | bigint;\n}\n\nexport abstract class Tag<T> {\n\tprotected value!: T;\n\tpublic nestedTags?: Tag<any>[];\n\n\tconstructor(\n\t\tpublic readonly name: ECTagName,\n\t\tpublic readonly type: ECTagType,\n\t\tnestedTags: Tag<any>[] = [],\n\t\tpublic readonly nameValue: number = name\n\t) {\n\t\tif (nestedTags.length > 0) {\n\t\t\tthis.nestedTags = nestedTags;\n\t\t}\n\t}\n\n\tabstract parseValue(value: Buffer): void;\n\tabstract encodeValue(): Buffer;\n\n\tgetValue(): T {\n\t\treturn this.value;\n\t}\n\n\tprotected setValue(value: T): void {\n\t\tthis.value = value;\n\t}\n}\n\nexport class CustomTag extends Tag<Buffer> {\n\tconstructor(name: ECTagName, value?: Buffer, subtags: Tag<any>[] = [], nameValue: number = name) {\n\t\tsuper(name, ECTagType.EC_TAGTYPE_CUSTOM, subtags, nameValue);\n\t\tif (value !== undefined) {\n\t\t\tthis.setValue(value);\n\t\t}\n\t}\n\n\tparseValue(value: Buffer): void {\n\t\tthis.setValue(value);\n\t}\n\n\tencodeValue(): Buffer {\n\t\treturn this.getValue();\n\t}\n}\n\nexport class UByteTag extends Tag<number> implements NumericTag {\n\tconstructor(name: ECTagName, value?: number, subtags: Tag<any>[] = [], nameValue: number = name) {\n\t\tsuper(name, ECTagType.EC_TAGTYPE_UINT8, subtags, nameValue);\n\t\tif (value !== undefined) {\n\t\t\tthis.setValue(value);\n\t\t}\n\t}\n\n\tstatic withValue(name: ECTagName, value: number, subtags: Tag<any>[] = []): UByteTag {\n\t\treturn new UByteTag(name, value, subtags);\n\t}\n\n\tparseValue(value: Buffer): void {\n\t\tif (value.length === 0) {\n\t\t\tthis.setValue(0);\n\t\t} else if (value.length === 1) {\n\t\t\tthis.setValue(value[0]);\n\t\t} else {\n\t\t\tthrow new Error('UInt8Tag value must be 1 byte long');\n\t\t}\n\t}\n\n\tencodeValue(): Buffer {\n\t\tconst buf = Buffer.allocUnsafe(1);\n\t\tbuf.writeUInt8(this.getValue());\n\t\treturn buf;\n\t}\n\n\tgetShort(): number {\n\t\treturn this.getValue();\n\t}\n\n\tgetInt(): number {\n\t\treturn this.getValue();\n\t}\n\n\tgetLong(): bigint {\n\t\treturn BigInt(this.getValue());\n\t}\n}\n\nexport class UShortTag extends Tag<number> implements NumericTag {\n\tconstructor(name: ECTagName, value?: number, subtags: Tag<any>[] = [], nameValue: number = name) {\n\t\tsuper(name, ECTagType.EC_TAGTYPE_UINT16, subtags, nameValue);\n\t\tif (value !== undefined) {\n\t\t\tthis.setValue(value);\n\t\t}\n\t}\n\n\tstatic withValue(name: ECTagName, value: number, subtags: Tag<any>[] = []): UShortTag {\n\t\treturn new UShortTag(name, value, subtags);\n\t}\n\n\tparseValue(value: Buffer): void {\n\t\tif (value.length === 0) {\n\t\t\tthis.setValue(0);\n\t\t} else if (value.length === 2) {\n\t\t\tthis.setValue(value.readUInt16BE(0));\n\t\t} else {\n\t\t\tthrow new Error('UInt16Tag value must be 2 bytes long');\n\t\t}\n\t}\n\n\tencodeValue(): Buffer {\n\t\tconst buf = Buffer.allocUnsafe(2);\n\t\tbuf.writeUInt16BE(this.getValue());\n\t\treturn buf;\n\t}\n\n\tgetShort(): number {\n\t\treturn this.getValue();\n\t}\n\n\tgetInt(): number {\n\t\treturn this.getValue();\n\t}\n\n\tgetLong(): bigint {\n\t\treturn BigInt(this.getValue());\n\t}\n}\n\nexport class UIntTag extends Tag<number> implements NumericTag {\n\tconstructor(name: ECTagName, value?: number, subtags: Tag<any>[] = [], nameValue: number = name) {\n\t\tsuper(name, ECTagType.EC_TAGTYPE_UINT32, subtags, nameValue);\n\t\tif (value !== undefined) {\n\t\t\tthis.setValue(value);\n\t\t}\n\t}\n\n\tstatic withValue(name: ECTagName, value: number, subtags: Tag<any>[] = []): UIntTag {\n\t\treturn new UIntTag(name, value, subtags);\n\t}\n\n\tparseValue(value: Buffer): void {\n\t\tif (value.length === 0) {\n\t\t\tthis.setValue(0);\n\t\t} else if (value.length === 4) {\n\t\t\tthis.setValue(value.readUInt32BE(0));\n\t\t} else {\n\t\t\tthrow new Error('UInt32Tag value must be 4 bytes long');\n\t\t}\n\t}\n\n\tencodeValue(): Buffer {\n\t\tconst buf = Buffer.allocUnsafe(4);\n\t\tbuf.writeUInt32BE(this.getValue());\n\t\treturn buf;\n\t}\n\n\tgetShort(): number {\n\t\tthrow new Error('Unsigned Integer cannot be cast to short');\n\t}\n\n\tgetInt(): number {\n\t\treturn this.getValue();\n\t}\n\n\tgetLong(): bigint {\n\t\treturn BigInt(this.getValue());\n\t}\n}\n\nexport class ULongTag extends Tag<bigint> implements NumericTag {\n\tconstructor(name: ECTagName, value?: bigint, subtags: Tag<any>[] = [], nameValue: number = name) {\n\t\tsuper(name, ECTagType.EC_TAGTYPE_UINT64, subtags, nameValue);\n\t\tif (value !== undefined) {\n\t\t\tthis.setValue(value);\n\t\t}\n\t}\n\n\tstatic withValue(name: ECTagName, value: bigint, subtags: Tag<any>[] = []): ULongTag {\n\t\treturn new ULongTag(name, value, subtags);\n\t}\n\n\tparseValue(value: Buffer): void {\n\t\tif (value.length === 0) {\n\t\t\tthis.setValue(0n);\n\t\t} else if (value.length === 8) {\n\t\t\tthis.setValue(value.readBigUInt64BE(0));\n\t\t} else {\n\t\t\tthrow new Error('UInt64Tag value must be 8 bytes long');\n\t\t}\n\t}\n\n\tencodeValue(): Buffer {\n\t\tconst buf = Buffer.allocUnsafe(8);\n\t\tbuf.writeBigUInt64BE(this.getValue());\n\t\treturn buf;\n\t}\n\n\tgetShort(): number {\n\t\tthrow new Error('Unsigned Long cannot be cast to short');\n\t}\n\n\tgetInt(): number {\n\t\tthrow new Error('Unsigned Long cannot be cast to int');\n\t}\n\n\tgetLong(): bigint {\n\t\treturn this.getValue();\n\t}\n}\n\nexport class UInt128Tag extends Tag<bigint> {\n\tconstructor(name: ECTagName, value?: bigint, subtags: Tag<any>[] = [], nameValue: number = name) {\n\t\tsuper(name, ECTagType.EC_TAGTYPE_UINT128, subtags, nameValue);\n\t\tif (value !== undefined) {\n\t\t\tthis.setValue(value);\n\t\t}\n\t}\n\n\tstatic withValue(name: ECTagName, value: bigint, subtags: Tag<any>[] = []): UInt128Tag {\n\t\treturn new UInt128Tag(name, value, subtags);\n\t}\n\n\tparseValue(value: Buffer): void {\n\t\tif (value.length === 0) {\n\t\t\tthis.setValue(0n);\n\t\t} else {\n\t\t\t// Read as big-endian big integer\n\t\t\tlet result = 0n;\n\t\t\tfor (let i = 0; i < value.length; i++) {\n\t\t\t\tresult = (result << 8n) | BigInt(value[i]);\n\t\t\t}\n\t\t\tthis.setValue(result);\n\t\t}\n\t}\n\n\tencodeValue(): Buffer {\n\t\t// Encode as big-endian\n\t\tconst val = this.getValue();\n\t\tconst bytes: number[] = [];\n\t\tlet remaining = val;\n\n\t\twhile (remaining > 0n) {\n\t\t\tbytes.unshift(Number(remaining & 0xffn));\n\t\t\tremaining >>= 8n;\n\t\t}\n\n\t\t// Pad to 16 bytes\n\t\twhile (bytes.length < 16) {\n\t\t\tbytes.unshift(0);\n\t\t}\n\n\t\treturn Buffer.from(bytes);\n\t}\n}\n\nexport class StringTag extends Tag<string> {\n\tconstructor(name: ECTagName, value?: string, subtags: Tag<any>[] = [], nameValue: number = name) {\n\t\tsuper(name, ECTagType.EC_TAGTYPE_STRING, subtags, nameValue);\n\t\tif (value !== undefined) {\n\t\t\tthis.setValue(value);\n\t\t}\n\t}\n\n\tstatic withValue(name: ECTagName, value: string, subtags: Tag<any>[] = []): StringTag {\n\t\treturn new StringTag(name, value, subtags);\n\t}\n\n\tparseValue(value: Buffer): void {\n\t\tif (value[value.length - 1] !== 0x00) {\n\t\t\tthrow new Error('StringTag value must be null terminated');\n\t\t}\n\t\tthis.setValue(value.toString('utf8', 0, value.length - 1));\n\t}\n\n\tencodeValue(): Buffer {\n\t\treturn Buffer.concat([Buffer.from(this.getValue(), 'utf8'), Buffer.from([0x00])]);\n\t}\n}\n\nexport class DoubleTag extends Tag<number> {\n\tconstructor(name: ECTagName, value?: number, subtags: Tag<any>[] = [], nameValue: number = name) {\n\t\tsuper(name, ECTagType.EC_TAGTYPE_DOUBLE, subtags, nameValue);\n\t\tif (value !== undefined) {\n\t\t\tthis.setValue(value);\n\t\t}\n\t}\n\n\tstatic withValue(name: ECTagName, value: number, subtags: Tag<any>[] = []): DoubleTag {\n\t\treturn new DoubleTag(name, value, subtags);\n\t}\n\n\tparseValue(value: Buffer): void {\n\t\tconst numValue = value.length >= 8 ? value.readDoubleBE(0) : 0;\n\t\tthis.setValue(numValue);\n\t}\n\n\tencodeValue(): Buffer {\n\t\tconst buf = Buffer.allocUnsafe(8);\n\t\tbuf.writeDoubleBE(this.getValue());\n\t\treturn buf;\n\t}\n}\n\nexport interface Ipv4Value {\n\taddress: string;\n\tport: number;\n}\n\nexport class Ipv4Tag extends Tag<Ipv4Value> {\n\tconstructor(name: ECTagName, value?: Ipv4Value, subtags: Tag<any>[] = [], nameValue: number = name) {\n\t\tsuper(name, ECTagType.EC_TAGTYPE_IPV4, subtags, nameValue);\n\t\tif (value !== undefined) {\n\t\t\tthis.setValue(value);\n\t\t}\n\t}\n\n\tstatic withValue(name: ECTagName, value: Ipv4Value, subtags: Tag<any>[] = []): Ipv4Tag {\n\t\treturn new Ipv4Tag(name, value, subtags);\n\t}\n\n\tparseValue(value: Buffer): void {\n\t\tif (value.length !== 6) {\n\t\t\tthrow new Error('Ipv4Tag value must be 6 bytes long');\n\t\t}\n\t\tconst address = `${value[0]}.${value[1]}.${value[2]}.${value[3]}`;\n\t\tconst port = value.readUInt16BE(4);\n\t\tthis.setValue({ address, port });\n\t}\n\n\tencodeValue(): Buffer {\n\t\tconst val = this.getValue();\n\t\tconst parts = val.address.split('.').map(Number);\n\t\tconst buf = Buffer.allocUnsafe(6);\n\t\tbuf[0] = parts[0];\n\t\tbuf[1] = parts[1];\n\t\tbuf[2] = parts[2];\n\t\tbuf[3] = parts[3];\n\t\tbuf.writeUInt16BE(val.port, 4);\n\t\treturn buf;\n\t}\n}\n\nexport class Hash16Tag extends Tag<Buffer> {\n\tconstructor(name: ECTagName, value?: Buffer, subtags: Tag<any>[] = [], nameValue: number = name) {\n\t\tsuper(name, ECTagType.EC_TAGTYPE_HASH16, subtags, nameValue);\n\t\tif (value !== undefined) {\n\t\t\tthis.setValue(value);\n\t\t}\n\t}\n\n\tstatic withValue(name: ECTagName, value: Buffer, subtags: Tag<any>[] = []): Hash16Tag {\n\t\treturn new Hash16Tag(name, value, subtags);\n\t}\n\n\tparseValue(value: Buffer): void {\n\t\tif (value.length === 16) {\n\t\t\tthis.setValue(value);\n\t\t} else {\n\t\t\tthrow new Error('Hash16Tag value must be 16 bytes long');\n\t\t}\n\t}\n\n\tencodeValue(): Buffer {\n\t\treturn this.getValue();\n\t}\n}\n\n// Helper functions for tag extraction\nexport function findTag(tags: Tag<any>[], name: ECTagName): Tag<any> | undefined {\n\treturn tags.find((tag) => tag.name === name);\n}\n\nexport function findNumericTag(tags: Tag<any>[], name: ECTagName): NumericTag | undefined {\n\tconst tag = tags.find((tag) => tag.name === name);\n\tif (tag && 'getInt' in tag && 'getShort' in tag && 'getLong' in tag) {\n\t\treturn tag as NumericTag;\n\t}\n\treturn undefined;\n}\n"],"mappings":";AAWA,IAAsB,MAAtB,MAA6B;CAKX;CACA;CAEA;CAPjB;CACA;CAEA,YACC,MACA,MACA,aAAyB,CAAC,GAC1B,YAAoC,MACnC;EAJe,KAAA,OAAA;EACA,KAAA,OAAA;EAEA,KAAA,YAAA;EAEhB,IAAI,WAAW,SAAS,GACvB,KAAK,aAAa;CAEpB;CAKA,WAAc;EACb,OAAO,KAAK;CACb;CAEA,SAAmB,OAAgB;EAClC,KAAK,QAAQ;CACd;AACD;AAEA,IAAa,YAAb,cAA+B,IAAY;CAC1C,YAAY,MAAiB,OAAgB,UAAsB,CAAC,GAAG,YAAoB,MAAM;EAChG,MAAM,MAAA,GAAmC,SAAS,SAAS;EAC3D,IAAI,UAAU,KAAA,GACb,KAAK,SAAS,KAAK;CAErB;CAEA,WAAW,OAAqB;EAC/B,KAAK,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,IAAI,SAAS,IAAI;AAC5C;AAEA,SAAgB,eAAe,MAAkB,MAAyC;CACzF,MAAM,MAAM,KAAK,MAAM,QAAQ,IAAI,SAAS,IAAI;CAChD,IAAI,OAAO,YAAY,OAAO,cAAc,OAAO,aAAa,KAC/D,OAAO;AAGT"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"UpdateCategoryRequest-CgzH7SxP.mjs","names":[],"sources":["../src/request/UpdateCategoryRequest.ts"],"sourcesContent":["/**\n * Update Category Request - Update an existing category\n */\n\nimport { Request } from './Request';\nimport { ECOpCode, ECTagName } from '../ec/Codes';\nimport { StringTag, UByteTag, UIntTag } from '../ec/tag/Tag';\nimport type { AmuleCategory } from '../model';\n\nexport class UpdateCategoryRequest extends Request {\n\tconstructor(id: number, category: AmuleCategory) {\n\t\tsuper(ECOpCode.EC_OP_UPDATE_CATEGORY);\n\n\t\tconst subtags = [\n\t\t\tnew StringTag(ECTagName.EC_TAG_CATEGORY_TITLE, category.name),\n\t\t\tnew StringTag(ECTagName.EC_TAG_CATEGORY_PATH, category.path),\n\t\t\tnew StringTag(ECTagName.EC_TAG_CATEGORY_COMMENT, category.comment),\n\t\t\tnew UIntTag(ECTagName.EC_TAG_CATEGORY_COLOR, category.color),\n\t\t\tnew UByteTag(ECTagName.EC_TAG_CATEGORY_PRIO, category.priority),\n\t\t];\n\n\t\t// Category tag is a container for all category properties\n\t\tthis.addTag(new UIntTag(ECTagName.EC_TAG_CATEGORY, id, subtags));\n\t}\n}\n"],"mappings":";;;;;;;AASA,IAAa,wBAAb,cAA2C,QAAQ;CAClD,YAAY,IAAY,UAAyB;EAChD,MAAA,EAAoC;EAEpC,MAAM,UAAU;GACf,IAAI,UAAA,MAA2C,SAAS,IAAI;GAC5D,IAAI,UAAA,MAA0C,SAAS,IAAI;GAC3D,IAAI,UAAA,MAA6C,SAAS,OAAO;GACjE,IAAI,QAAA,MAAyC,SAAS,KAAK;GAC3D,IAAI,SAAA,MAAyC,SAAS,QAAQ;EAC/D;EAGA,KAAK,OAAO,IAAI,QAAA,MAAmC,IAAI,OAAO,CAAC;CAChE;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"UpdateRequest-Bunl73Ga.mjs","names":[],"sources":["../src/request/UpdateRequest.ts"],"sourcesContent":["/**\n * Update Request - Get incremental updates for files, clients, and servers\n */\n\nimport { Request } from './Request';\nimport { ECOpCode, ECTagName, ECDetailLevel } from '../ec/Codes';\nimport { UByteTag } from '../ec/tag/Tag';\n\nexport class UpdateRequest extends Request {\n\tconstructor(detailLevel: ECDetailLevel = ECDetailLevel.EC_DETAIL_INC_UPDATE) {\n\t\tsuper(ECOpCode.EC_OP_GET_UPDATE);\n\n\t\tthis.addTag(new UByteTag(ECTagName.EC_TAG_DETAIL_LEVEL, detailLevel));\n\t}\n}\n"],"mappings":";;;;;;;AAQA,IAAa,gBAAb,cAAmC,QAAQ;CAC1C,YAAY,cAAA,GAAiE;EAC5E,MAAA,EAA+B;EAE/B,KAAK,OAAO,IAAI,SAAA,GAAwC,WAAW,CAAC;CACrE;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"UpdateResponse-1LhyH9Zf.mjs","names":[],"sources":["../src/response/UpdateResponse.ts"],"sourcesContent":["/**\n * Update Response - Parse incremental updates\n */\n\nimport { Packet } from '../ec/packet/Packet';\nimport { ECTagName } from '../ec/Codes';\nimport { findTag, findNumericTag } from '../ec/tag/Tag';\nimport { toOptionalBool, toOptionalIp } from './utils';\nimport type { AmuleFile, AmuleTransferringFile, AmuleUpDownClient, AmuleServer, AmuleFriend } from '../model';\nimport { SharedFilesResponseParser } from './SharedFilesResponse';\nimport { DownloadQueueResponseParser } from './DownloadQueueResponse';\nimport { ClientQueueResponseParser } from './ClientQueueResponse';\nimport { ServerListResponseParser } from './ServerListResponse';\n\nexport interface UpdateResponse {\n\tsharedFiles: AmuleFile[];\n\tdownloadQueue: AmuleTransferringFile[];\n\tclients: AmuleUpDownClient[];\n\tservers: AmuleServer[];\n\tfriends: AmuleFriend[];\n}\n\nexport class UpdateResponseParser {\n\tstatic fromPacket(packet: Packet): UpdateResponse {\n\t\t// Files are at the root of the packet according to res.cpp\n\t\tconst sharedFiles = SharedFilesResponseParser.fromPacket(packet).files;\n\t\tconst downloadQueue = DownloadQueueResponseParser.fromPacket(packet).files;\n\n\t\t// Clients, Servers, and Friends are wrapped in containers with their respective tag names\n\t\tconst clientContainer = findTag(packet.tags, ECTagName.EC_TAG_CLIENT);\n\t\tconst clients = clientContainer && clientContainer.nestedTags ? ClientQueueResponseParser.fromTags(clientContainer.nestedTags).clients : [];\n\n\t\tconst serverContainer = findTag(packet.tags, ECTagName.EC_TAG_SERVER);\n\t\tconst servers = serverContainer && serverContainer.nestedTags ? ServerListResponseParser.fromTags(serverContainer.nestedTags).servers : [];\n\n\t\tconst friendContainer = findTag(packet.tags, ECTagName.EC_TAG_FRIEND);\n\t\tconst friends = friendContainer && friendContainer.nestedTags ? this.parseFriends(friendContainer.nestedTags) : [];\n\n\t\treturn {\n\t\t\tsharedFiles,\n\t\t\tdownloadQueue,\n\t\t\tclients,\n\t\t\tservers,\n\t\t\tfriends,\n\t\t};\n\t}\n\n\tprivate static parseFriends(tags: any[]): AmuleFriend[] {\n\t\tconst friends: AmuleFriend[] = [];\n\t\tconst friendTags = tags.filter((t) => t.name === ECTagName.EC_TAG_FRIEND);\n\n\t\tfor (const friendTag of friendTags) {\n\t\t\tconst nested = friendTag.nestedTags || [];\n\t\t\tfriends.push({\n\t\t\t\tname: findTag(nested, ECTagName.EC_TAG_FRIEND_NAME)?.getValue(),\n\t\t\t\tuserHashHexString: findTag(nested, ECTagName.EC_TAG_FRIEND_HASH)?.getValue()?.toString('hex'),\n\t\t\t\tip: toOptionalIp(findNumericTag(nested, ECTagName.EC_TAG_FRIEND_IP)?.getInt()),\n\t\t\t\tport: findNumericTag(nested, ECTagName.EC_TAG_FRIEND_PORT)?.getInt(),\n\t\t\t\tfriendSlot: toOptionalBool(findNumericTag(nested, ECTagName.EC_TAG_FRIEND_FRIENDSLOT)?.getInt()),\n\t\t\t\tshared: toOptionalBool(findNumericTag(nested, ECTagName.EC_TAG_FRIEND_SHARED)?.getInt()),\n\t\t\t\t// Friend client information might be nested as a client tag\n\t\t\t\tclient: ClientQueueResponseParser.fromTags(nested).clients[0],\n\t\t\t});\n\t\t}\n\t\treturn friends;\n\t}\n}\n"],"mappings":";;;;;;;;AAsBA,IAAa,uBAAb,MAAkC;CACjC,OAAO,WAAW,QAAgC;EAEjD,MAAM,cAAc,0BAA0B,WAAW,MAAM,CAAC,CAAC;EACjE,MAAM,gBAAgB,4BAA4B,WAAW,MAAM,CAAC,CAAC;EAGrE,MAAM,kBAAkB,QAAQ,OAAO,MAAA,IAA6B;EACpE,MAAM,UAAU,mBAAmB,gBAAgB,aAAa,0BAA0B,SAAS,gBAAgB,UAAU,CAAC,CAAC,UAAU,CAAC;EAE1I,MAAM,kBAAkB,QAAQ,OAAO,MAAA,IAA6B;EACpE,MAAM,UAAU,mBAAmB,gBAAgB,aAAa,yBAAyB,SAAS,gBAAgB,UAAU,CAAC,CAAC,UAAU,CAAC;EAEzI,MAAM,kBAAkB,QAAQ,OAAO,MAAA,IAA6B;EAGpE,OAAO;GACN;GACA;GACA;GACA;GACA,SAPe,mBAAmB,gBAAgB,aAAa,KAAK,aAAa,gBAAgB,UAAU,IAAI,CAAC;EAQjH;CACD;CAEA,OAAe,aAAa,MAA4B;EACvD,MAAM,UAAyB,CAAC;EAChC,MAAM,aAAa,KAAK,QAAQ,MAAM,EAAE,SAAA,IAAgC;EAExE,KAAK,MAAM,aAAa,YAAY;GACnC,MAAM,SAAS,UAAU,cAAc,CAAC;GACxC,QAAQ,KAAK;IACZ,MAAM,QAAQ,QAAA,IAAoC,CAAC,EAAE,SAAS;IAC9D,mBAAmB,QAAQ,QAAA,IAAoC,CAAC,EAAE,SAAS,CAAC,EAAE,SAAS,KAAK;IAC5F,IAAI,aAAa,eAAe,QAAA,IAAkC,CAAC,EAAE,OAAO,CAAC;IAC7E,MAAM,eAAe,QAAA,IAAoC,CAAC,EAAE,OAAO;IACnE,YAAY,eAAe,eAAe,QAAA,IAA0C,CAAC,EAAE,OAAO,CAAC;IAC/F,QAAQ,eAAe,eAAe,QAAA,IAAsC,CAAC,EAAE,OAAO,CAAC;IAEvF,QAAQ,0BAA0B,SAAS,MAAM,CAAC,CAAC,QAAQ;GAC5D,CAAC;EACF;EACA,OAAO;CACR;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"download-details-OM0FJUhZ.mjs","names":[],"sources":["../src/types/download-details.ts"],"sourcesContent":["export const PARTSIZE = 9728000;\n\nexport const ChunkStatus = {\n\tUNAVAILABLE: 0,\n\tAVAILABLE: 1,\n\tCOMPLETE: 2,\n\tDOWNLOADING: 3,\n} as const;\n\nexport interface ChunkInfo {\n\tchunks: number[];\n\tavailability: number[];\n\tpartCount: number;\n\tsizeFull: number;\n}\n\nexport interface ParsedSource {\n\tclientName: string;\n\tuserHash: string;\n\tsoftware: string;\n\tsoftwareVersion: string;\n\tscore: number;\n\tuploadSpeed: number;\n\tdownloadSpeed: number;\n\tuploadState: number;\n\tdownloadState: number;\n\tip: string;\n\tport: number;\n\tremoteQueueRank: number;\n\twaitingPosition: number;\n\tidentState: number;\n\tobfuscationStatus: number;\n\tremoteFilename: string;\n\tavailableParts: number;\n\tsourceFrom: number;\n}\n\nexport interface SourceNameCount {\n\tname: string;\n\tcount: number;\n}\n\nexport interface SourceInfo {\n\tsources: ParsedSource[];\n\tsourceNames: SourceNameCount[];\n}\n"],"mappings":";AAAA,MAAa,WAAW;AAExB,MAAa,cAAc;CAC1B,aAAa;CACb,WAAW;CACX,UAAU;CACV,aAAa;AACd"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/exceptions/index.ts","../src/ec/Encoding.ts","../src/ec/tag/TagParser.ts","../src/ec/packet/PacketParser.ts","../src/ec/tag/TagEncoder.ts","../src/ec/packet/PacketWriter.ts","../src/request/AuthRequest.ts","../src/response/AuthSaltResponse.ts","../src/auth/PasswordHasher.ts","../src/client/AmuleConnection.ts","../src/model/index.ts","../src/client/AmuleClient.ts"],"sourcesContent":["// Base exception classes\n\nexport class AmuleException extends Error {\n\tconstructor(\n\t\tmessage: string,\n\t\tpublic cause?: Error\n\t) {\n\t\tsuper(message);\n\t\tthis.name = 'AmuleException';\n\t}\n}\n\nexport class InvalidECException extends AmuleException {\n\tconstructor(message: string, cause?: Error) {\n\t\tsuper(message, cause);\n\t\tthis.name = 'InvalidECException';\n\t}\n}\n\nexport class CommunicationException extends AmuleException {\n\tconstructor(message: string, cause?: Error) {\n\t\tsuper(message, cause);\n\t\tthis.name = 'CommunicationException';\n\t}\n}\n\nexport class ServerException extends AmuleException {\n\tconstructor(message: string, cause?: Error) {\n\t\tsuper(message, cause);\n\t\tthis.name = 'ServerException';\n\t}\n}\n","// Utility functions for encoding/decoding numbers and buffers\n\n/**\n * Reads a UTF-8 encoded number from a buffer\n * Treats UTF-8 bytes as a Unicode code point and returns the numeric value\n */\nexport function readUtf8Number(buffer: Buffer, offset: number): { value: bigint; newOffset: number } {\n\t// Determine the length of the UTF-8 sequence from the first byte\n\tconst firstByte = buffer[offset];\n\tlet length: number;\n\n\tif ((firstByte & 0x80) === 0) {\n\t\t// 0xxxxxxx - 1 byte (ASCII)\n\t\tlength = 1;\n\t} else if ((firstByte & 0xe0) === 0xc0) {\n\t\t// 110xxxxx - 2 bytes\n\t\tlength = 2;\n\t} else if ((firstByte & 0xf0) === 0xe0) {\n\t\t// 1110xxxx - 3 bytes\n\t\tlength = 3;\n\t} else if ((firstByte & 0xf8) === 0xf0) {\n\t\t// 11110xxx - 4 bytes\n\t\tlength = 4;\n\t} else {\n\t\tthrow new Error(`Invalid UTF-8 first byte: 0x${firstByte.toString(16)}`);\n\t}\n\n\t// Extract the UTF-8 sequence and decode it\n\tconst utf8Bytes = buffer.subarray(offset, offset + length);\n\tconst str = utf8Bytes.toString('utf-8');\n\tconst codePoint = str.codePointAt(0);\n\n\tif (codePoint === undefined) {\n\t\tthrow new Error('Failed to decode UTF-8 number');\n\t}\n\n\treturn {\n\t\tvalue: BigInt(codePoint),\n\t\tnewOffset: offset + length,\n\t};\n}\n\n/**\n * Encodes a number as UTF-8 code point\n * Treats the number as a Unicode code point and encodes it as UTF-8\n */\nexport function encodeUtf8Number(value: number | bigint): Buffer {\n\tconst num = Number(value);\n\n\t// Encode the number as a UTF-8 code point\n\t// Create a string from the code point and encode as UTF-8\n\tconst str = String.fromCodePoint(num);\n\treturn Buffer.from(str, 'utf-8');\n}\n\n/**\n * Reads a 16-bit unsigned integer\n */\nexport function readUInt16(buffer: Buffer, offset: number, utf8: boolean): number {\n\tif (utf8) {\n\t\tconst result = readUtf8Number(buffer, offset);\n\t\treturn Number(result.value);\n\t}\n\treturn buffer.readUInt16BE(offset);\n}\n\n/**\n * Reads a 32-bit unsigned integer\n */\nexport function readUInt32(buffer: Buffer, offset: number, utf8: boolean): number {\n\tif (utf8) {\n\t\tconst result = readUtf8Number(buffer, offset);\n\t\treturn Number(result.value);\n\t}\n\treturn buffer.readUInt32BE(offset);\n}\n\n/**\n * Reads a 64-bit unsigned integer as bigint\n */\nexport function readUInt64(buffer: Buffer, offset: number): bigint {\n\treturn buffer.readBigUInt64BE(offset);\n}\n\n/**\n * Encodes a 16-bit unsigned integer\n */\nexport function encodeUInt16(value: number, utf8: boolean): Buffer {\n\tif (utf8) {\n\t\treturn encodeUtf8Number(value);\n\t}\n\tconst buf = Buffer.allocUnsafe(2);\n\tbuf.writeUInt16BE(value);\n\treturn buf;\n}\n\n/**\n * Encodes a 32-bit unsigned integer\n */\nexport function encodeUInt32(value: number, utf8: boolean): Buffer {\n\tif (utf8) {\n\t\treturn encodeUtf8Number(value);\n\t}\n\tconst buf = Buffer.allocUnsafe(4);\n\tbuf.writeUInt32BE(value);\n\treturn buf;\n}\n\n/**\n * Encodes a 64-bit unsigned integer\n */\nexport function encodeUInt64(value: bigint): Buffer {\n\tconst buf = Buffer.allocUnsafe(8);\n\tbuf.writeBigUInt64BE(value);\n\treturn buf;\n}\n\n/**\n * Gets the number of bytes needed to encode a value as UTF-8 code point\n */\nexport function numberLength(value: number | bigint): number {\n\tconst num = Number(value);\n\n\t// Determine UTF-8 length based on code point value\n\tif (num < 0x80) {\n\t\treturn 1; // ASCII range\n\t} else if (num < 0x800) {\n\t\treturn 2; // 2-byte UTF-8\n\t} else if (num < 0x10000) {\n\t\treturn 3; // 3-byte UTF-8\n\t} else if (num < 0x110000) {\n\t\treturn 4; // 4-byte UTF-8\n\t} else {\n\t\tthrow new Error(`Code point out of range: ${num}`);\n\t}\n}\n","/**\n * Tag Parser - Deserializes tags from binary data\n *\n * This implementation follows jamule's TagParser logic closely.\n * Key insight: tagLength is calculated using FIXED header sizes (not UTF-8 sizes),\n * even when the wire format uses UTF-8 encoding. So we must track \"theoreticalLength\"\n * using fixed sizes to correctly calculate the value size.\n */\n\nimport { ECTagType, ECTagName } from '../Codes';\nimport { Tag, CustomTag, UByteTag, UShortTag, UIntTag, ULongTag, UInt128Tag, StringTag, DoubleTag, Ipv4Tag, Hash16Tag } from './Tag';\nimport { readUtf8Number } from '../Encoding';\nimport { InvalidECException } from '../../exceptions';\n\n// Fixed header sizes (from jamule TypeSizes.kt)\nconst TAG_NAME_SIZE = 2; // UShort\nconst TAG_TYPE_SIZE = 1; // UByte\nconst TAG_LENGTH_SIZE = 4; // UInt\nconst SUBTAG_COUNT_SIZE = 2; // UShort\n\ninterface TagParseResult {\n\ttag: Tag<any>;\n\ttheoreticalLength: number;\n\tendIndex: number;\n}\n\nexport class TagParser {\n\tprivate buffer: Buffer;\n\tprivate offset: number;\n\tprivate readonly useUtf8Numbers: boolean;\n\n\tconstructor(buffer: Buffer, offset: number = 0, useUtf8Numbers: boolean = false) {\n\t\tthis.buffer = buffer;\n\t\tthis.offset = offset;\n\t\tthis.useUtf8Numbers = useUtf8Numbers;\n\t}\n\n\t/**\n\t * Parse a single tag from the current position\n\t */\n\tparseTag(): Tag<any> {\n\t\treturn this.parseTagWithMetadata().tag;\n\t}\n\n\t/**\n\t * Internal parse that returns metadata needed for nested tag calculation\n\t */\n\tprivate parseTagWithMetadata(): TagParseResult {\n\t\t// First part is the tag name and the flag indicating if it has subtags\n\t\tconst tagNameAndSubtags = this.readNumber(TAG_NAME_SIZE);\n\t\tconst tagNameRaw = (tagNameAndSubtags >> 1) & 0xffff;\n\t\tconst tagName = tagNameRaw as ECTagName;\n\t\tconst hasSubtags = (tagNameAndSubtags & 1) !== 0;\n\n\t\t// Then is the tag type\n\t\tconst tagType = this.buffer.readUInt8(this.offset) as ECTagType;\n\t\tthis.offset += TAG_TYPE_SIZE;\n\n\t\t// Then is the tag length, indicating the tag's own content length + length of children (with headers)\n\t\tconst tagLength = this.readNumber(TAG_LENGTH_SIZE);\n\n\t\t// The next byte is the first byte of the tag's value\n\t\t// This is mutable because it will be updated if the tag has subtags\n\t\tlet valueStartIndex = this.offset;\n\n\t\t// If the tag has subtags, we need to parse them\n\t\tconst subTags: Tag<any>[] = [];\n\n\t\t// Theoretical length is the length of the tag, including the length of the subtags (with headers)\n\t\t// All numbers are considered to be non-UTF-8 (fixed sizes)\n\t\tlet theoreticalLength = 0;\n\n\t\t// The last byte of the tag's value\n\t\tlet valueEndIndex: number;\n\n\t\tif (!hasSubtags) {\n\t\t\tvalueEndIndex = valueStartIndex + tagLength - 1;\n\t\t} else {\n\t\t\t// The first part to read is the subtags count\n\t\t\tconst subTagCount = this.readNumber(SUBTAG_COUNT_SIZE);\n\n\t\t\t// We reuse valueStartIndex to store the index after reading subtag count\n\t\t\tvalueStartIndex = this.offset;\n\n\t\t\tfor (let i = 0; i < subTagCount; i++) {\n\t\t\t\tconst result = this.parseTagWithMetadata();\n\t\t\t\tsubTags.push(result.tag);\n\t\t\t\ttheoreticalLength += result.theoreticalLength;\n\t\t\t}\n\n\t\t\tif (subTags.length > subTagCount) {\n\t\t\t\tthrow new InvalidECException(`Error parsing subtags list - Expected subtags ${subTagCount} found subtags ${subTags.length}`);\n\t\t\t}\n\n\t\t\t// Calculate value end using tagLength minus theoreticalLength (fixed sizes)\n\t\t\tvalueEndIndex = this.offset + (tagLength - theoreticalLength - 1);\n\t\t\ttheoreticalLength += SUBTAG_COUNT_SIZE;\n\t\t}\n\n\t\t// Read the tag value\n\t\tconst valueSize = valueEndIndex - this.offset + 1;\n\t\tconst tagValue = this.buffer.subarray(this.offset, this.offset + valueSize);\n\t\tthis.offset += valueSize;\n\n\t\t// Update theoretical length with the value and header sizes\n\t\ttheoreticalLength += tagValue.length;\n\t\ttheoreticalLength += TAG_NAME_SIZE;\n\t\ttheoreticalLength += TAG_TYPE_SIZE;\n\t\ttheoreticalLength += TAG_LENGTH_SIZE;\n\n\t\t// Create the tag\n\t\tconst tag = this.createTagFromValue(tagName, tagType, tagValue);\n\t\tif (subTags.length > 0) {\n\t\t\ttag.nestedTags = subTags;\n\t\t}\n\n\t\treturn {\n\t\t\ttag,\n\t\t\ttheoreticalLength,\n\t\t\tendIndex: this.offset - 1,\n\t\t};\n\t}\n\n\t/**\n\t * Parse multiple tags\n\t */\n\tparseTags(count: number): Tag<any>[] {\n\t\tconst tags: Tag<any>[] = [];\n\t\tfor (let i = 0; i < count; i++) {\n\t\t\ttags.push(this.parseTag());\n\t\t}\n\t\treturn tags;\n\t}\n\n\t/**\n\t * Read a number with the given fixed size.\n\t * In UTF-8 mode, reads as UTF-8 codepoint. Otherwise reads as big-endian integer.\n\t */\n\tprivate readNumber(fixedSize: number): number {\n\t\tif (this.useUtf8Numbers) {\n\t\t\tconst result = readUtf8Number(this.buffer, this.offset);\n\t\t\tthis.offset = result.newOffset;\n\t\t\treturn Number(result.value);\n\t\t} else {\n\t\t\tlet value: number;\n\t\t\tswitch (fixedSize) {\n\t\t\t\tcase 1:\n\t\t\t\t\tvalue = this.buffer.readUInt8(this.offset);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\tvalue = this.buffer.readUInt16BE(this.offset);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 4:\n\t\t\t\t\tvalue = this.buffer.readUInt32BE(this.offset);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new InvalidECException(`Unsupported number size: ${fixedSize}`);\n\t\t\t}\n\t\t\tthis.offset += fixedSize;\n\t\t\treturn value;\n\t\t}\n\t}\n\n\t/**\n\t * Create a tag instance based on type and raw value bytes\n\t */\n\tprivate createTagFromValue(name: ECTagName, type: ECTagType, value: Buffer): Tag<any> {\n\t\tswitch (type) {\n\t\t\tcase ECTagType.EC_TAGTYPE_CUSTOM:\n\t\t\t\treturn new CustomTag(name, value);\n\n\t\t\tcase ECTagType.EC_TAGTYPE_UINT8: {\n\t\t\t\tconst numValue = value.length > 0 ? value.readUInt8(0) : 0;\n\t\t\t\treturn new UByteTag(name, numValue);\n\t\t\t}\n\n\t\t\tcase ECTagType.EC_TAGTYPE_UINT16: {\n\t\t\t\tconst numValue = value.length >= 2 ? value.readUInt16BE(0) : 0;\n\t\t\t\treturn new UShortTag(name, numValue);\n\t\t\t}\n\n\t\t\tcase ECTagType.EC_TAGTYPE_UINT32: {\n\t\t\t\tconst numValue = value.length >= 4 ? value.readUInt32BE(0) : 0;\n\t\t\t\treturn new UIntTag(name, numValue);\n\t\t\t}\n\n\t\t\tcase ECTagType.EC_TAGTYPE_UINT64: {\n\t\t\t\tconst numValue = value.length >= 8 ? value.readBigUInt64BE(0) : 0n;\n\t\t\t\treturn new ULongTag(name, numValue);\n\t\t\t}\n\n\t\t\tcase ECTagType.EC_TAGTYPE_UINT128:\n\t\t\t\tconst numValue = value.length >= 16 ? this.parseUInt128(value) : 0n;\n\t\t\t\treturn new UInt128Tag(name, numValue);\n\n\t\t\tcase ECTagType.EC_TAGTYPE_STRING: {\n\t\t\t\t// Remove null terminator if present\n\t\t\t\tconst strValue = value[value.length - 1] === 0x00 ? value.toString('utf-8', 0, value.length - 1) : value.toString('utf-8');\n\t\t\t\treturn new StringTag(name, strValue);\n\t\t\t}\n\n\t\t\tcase ECTagType.EC_TAGTYPE_DOUBLE: {\n\t\t\t\tconst numValue = value.length >= 8 ? value.readDoubleBE(0) : 0;\n\t\t\t\treturn new DoubleTag(name, numValue);\n\t\t\t}\n\n\t\t\tcase ECTagType.EC_TAGTYPE_IPV4: {\n\t\t\t\t// Read 4 bytes for IP address, 2 bytes for port (BE)\n\t\t\t\tif (value.length !== 6) {\n\t\t\t\t\tthrow new InvalidECException(`Ipv4Tag value must be 6 bytes long, got ${value.length}`);\n\t\t\t\t}\n\t\t\t\tconst address = `${value[0]}.${value[1]}.${value[2]}.${value[3]}`;\n\t\t\t\tconst port = value.readUInt16BE(4);\n\t\t\t\tconst tag = new Ipv4Tag(name);\n\t\t\t\ttag['value'] = { address, port };\n\t\t\t\treturn tag;\n\t\t\t}\n\n\t\t\tcase ECTagType.EC_TAGTYPE_HASH16:\n\t\t\t\treturn new Hash16Tag(name, value);\n\n\t\t\tcase ECTagType.EC_TAGTYPE_UNKNOWN:\n\t\t\tdefault:\n\t\t\t\tthrow new InvalidECException(`Unknown tag type: ${type} for tag ${name}`);\n\t\t}\n\t}\n\n\tprivate parseUInt128(value: Buffer): bigint {\n\t\tif (value.length < 16) {\n\t\t\tthrow new InvalidECException(`UInt128 value must be at least 16 bytes long, got ${value.length}`);\n\t\t}\n\t\treturn (value.readBigUInt64BE(0) << 64n) | value.readBigUInt64BE(8);\n\t}\n\n\t/**\n\t * Get current offset\n\t */\n\tgetOffset(): number {\n\t\treturn this.offset;\n\t}\n}\n","/**\n * Packet Parser - Deserializes EC packets from binary data\n */\n\nimport * as zlib from 'zlib';\nimport { Packet } from './Packet';\nimport { Flags } from './Flags';\nimport { ECOpCode } from '../Codes';\nimport { TagParser } from '../tag/TagParser';\nimport { InvalidECException } from '../../exceptions';\n\nexport class PacketParser {\n\tprivate static readonly HEADER_SIZE = 8; // flags(4) + data_length(4)\n\n\t/**\n\t * Parse a packet from a buffer\n\t */\n\tstatic parse(buffer: Buffer): Packet {\n\t\tif (buffer.length < this.HEADER_SIZE) {\n\t\t\tthrow new InvalidECException(`Buffer too small: ${buffer.length} bytes`);\n\t\t}\n\n\t\t// Read flags\n\t\tconst flags = Flags.fromBuffer(buffer, 0);\n\n\t\t// Read data length\n\t\tconst dataLength = buffer.readUInt32BE(4);\n\n\t\tif (buffer.length < this.HEADER_SIZE + dataLength) {\n\t\t\tthrow new InvalidECException(`Incomplete packet: expected ${this.HEADER_SIZE + dataLength} bytes, got ${buffer.length}`);\n\t\t}\n\n\t\t// Extract data\n\t\tlet data = buffer.subarray(this.HEADER_SIZE, this.HEADER_SIZE + dataLength);\n\n\t\t// Decompress if needed\n\t\tif (flags.isZlib()) {\n\t\t\tdata = this.decompress(data);\n\t\t}\n\n\t\t// Parse packet data\n\t\treturn this.parsePacketData(data, flags);\n\t}\n\n\t/**\n\t * Parse packet data (after decompression)\n\t */\n\tprivate static parsePacketData(data: Buffer, flags: Flags): Packet {\n\t\tlet offset = 0;\n\n\t\t// Read opcode\n\t\tconst opCode = data.readUInt8(offset) as ECOpCode;\n\t\toffset += 1;\n\n\t\t// Read tag count\n\t\tconst useUtf8 = flags.isUtf8Numbers();\n\t\tlet tagCount: number;\n\n\t\tif (useUtf8) {\n\t\t\t// UTF-8 encoded number - not implemented in full yet, assume simple case\n\t\t\ttagCount = data.readUInt8(offset);\n\t\t\toffset += 1;\n\t\t} else {\n\t\t\ttagCount = data.readUInt16BE(offset);\n\t\t\toffset += 2;\n\t\t}\n\n\t\t// Parse tags\n\t\tconst tagParser = new TagParser(data, offset, useUtf8);\n\t\tconst tags = tagParser.parseTags(tagCount);\n\n\t\treturn new Packet(opCode, flags, tags);\n\t}\n\n\t/**\n\t * Decompress ZLIB data\n\t */\n\tprivate static decompress(data: Buffer): Buffer {\n\t\ttry {\n\t\t\treturn zlib.inflateSync(data);\n\t\t} catch (error) {\n\t\t\tthrow new InvalidECException(`Failed to decompress packet: ${error}`);\n\t\t}\n\t}\n\n\t/**\n\t * Calculate expected packet size from header\n\t */\n\tstatic getExpectedPacketSize(headerBuffer: Buffer): number {\n\t\tif (headerBuffer.length < this.HEADER_SIZE) {\n\t\t\tthrow new InvalidECException('Header buffer too small');\n\t\t}\n\n\t\tconst dataLength = headerBuffer.readUInt32BE(4);\n\t\treturn this.HEADER_SIZE + dataLength;\n\t}\n\n\t/**\n\t * Check if buffer contains a complete packet\n\t */\n\tstatic hasCompletePacket(buffer: Buffer): boolean {\n\t\tif (buffer.length < this.HEADER_SIZE) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst expectedSize = this.getExpectedPacketSize(buffer);\n\t\treturn buffer.length >= expectedSize;\n\t}\n}\n","/**\n * Tag Encoder - Serializes tags to binary data\n */\n\nimport { ECTagType } from '../Codes';\nimport type { Tag } from './Tag';\nimport { encodeUtf8Number, numberLength } from '../Encoding';\n\nexport class TagEncoder {\n\tprivate readonly useUtf8Numbers: boolean;\n\n\tconstructor(useUtf8Numbers: boolean = false) {\n\t\tthis.useUtf8Numbers = useUtf8Numbers;\n\t}\n\n\t/**\n\t * Calculate total size needed for a tag (Physical Buffer Size)\n\t */\n\tcalculateTagSize(tag: Tag<any>): number {\n\t\tlet size = 0;\n\n\t\t// Tag name (with subtags bit)\n\t\tif (this.useUtf8Numbers) {\n\t\t\tconst hasSubtags = (tag.nestedTags?.length ?? 0) > 0 ? 1 : 0;\n\t\t\tconst nameAndSubtags = ((tag.name & 0xffff) << 1) | hasSubtags;\n\t\t\tsize += numberLength(nameAndSubtags);\n\t\t} else {\n\t\t\tsize += 2; // name (uint16)\n\t\t}\n\n\t\t// Type is always a single byte\n\t\tsize += 1; // type (uint8)\n\n\t\t// Tag length (subtags + value)\n\t\t// CRITICAL: The length field itself reports \"Logical Length\" (using fixed header sizes),\n\t\t// NOT the physical byte length. This matches Jamule/aMule protocol expectation.\n\t\t// However, the SIZE of the length field depends on the encoded value of this logical length.\n\t\tconst reportedLength = this.calculateReportedLength(tag);\n\t\tif (this.useUtf8Numbers) {\n\t\t\tsize += numberLength(reportedLength);\n\t\t} else {\n\t\t\tsize += 4; // uint32\n\t\t}\n\n\t\t// Nested tags count (only if has subtags)\n\t\tconst hasSubtags = (tag.nestedTags?.length ?? 0) > 0;\n\t\tif (hasSubtags) {\n\t\t\tconst nestedCount = tag.nestedTags?.length ?? 0;\n\t\t\tif (this.useUtf8Numbers) {\n\t\t\t\tsize += numberLength(nestedCount);\n\t\t\t} else {\n\t\t\t\t// In non-UTF8 mode, nested count is UInt16 (not UInt32)\n\t\t\t\tsize += 2; // uint16\n\t\t\t}\n\t\t}\n\n\t\t// Nested tags\n\t\tif (tag.nestedTags) {\n\t\t\tfor (const nestedTag of tag.nestedTags) {\n\t\t\t\tsize += this.calculateTagSize(nestedTag);\n\t\t\t}\n\t\t}\n\n\t\t// Tag value size\n\t\tsize += this.calculateValueSize(tag);\n\n\t\treturn size;\n\t}\n\n\t/**\n\t * Calculate the \"Reported Length\" of the tag content.\n\t * This logic mimics Jamule's computeTagLength, which assumes FIXED header sizes\n\t * (2 bytes name, 1 byte type, 4 bytes length, 2 bytes subtag count)\n\t * even when UTF-8 encoding is used.\n\t */\n\tprivate calculateReportedLength(tag: Tag<any>): number {\n\t\tlet length = 0;\n\n\t\t// Subtags\n\t\tif (tag.nestedTags) {\n\t\t\tfor (const nestedTag of tag.nestedTags) {\n\t\t\t\t// Reported length of subtag content\n\t\t\t\tlength += this.calculateReportedLength(nestedTag);\n\n\t\t\t\t// Add Fixed Header Overhead\n\t\t\t\t// TAG_NAME_SIZE (2) + TAG_TYPE_SIZE (1) + TAG_LENGTH_SIZE (4)\n\t\t\t\tlength += 7;\n\n\t\t\t\tif ((nestedTag.nestedTags?.length ?? 0) > 0) {\n\t\t\t\t\t// SUBTAG_COUNT_SIZE (2)\n\t\t\t\t\tlength += 2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Value of this tag\n\t\tlength += this.calculateValueSize(tag);\n\n\t\treturn length;\n\t}\n\n\t/**\n\t * Calculate size of tag value\n\t */\n\tprivate calculateValueSize(tag: Tag<any>): number {\n\t\tconst encoded = tag.encodeValue();\n\n\t\tswitch (tag.type) {\n\t\t\tcase ECTagType.EC_TAGTYPE_CUSTOM:\n\t\t\t\t// Empty custom tags (capability flags) have no data\n\t\t\t\tif (encoded.length === 0) {\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\t// Custom tags with data have no length prefix\n\t\t\t\treturn encoded.length;\n\n\t\t\tcase ECTagType.EC_TAGTYPE_STRING:\n\t\t\t\t// String value is just the UTF-8 string + null terminator\n\t\t\t\t// No length prefix\n\t\t\t\treturn encoded.length;\n\n\t\t\tcase ECTagType.EC_TAGTYPE_UINT8:\n\t\t\t\treturn 1;\n\n\t\t\tcase ECTagType.EC_TAGTYPE_UINT16:\n\t\t\t\treturn 2;\n\n\t\t\tcase ECTagType.EC_TAGTYPE_UINT32:\n\t\t\t\treturn 4;\n\n\t\t\tcase ECTagType.EC_TAGTYPE_UINT64:\n\t\t\t\treturn 8;\n\n\t\t\tcase ECTagType.EC_TAGTYPE_UINT128:\n\t\t\t\treturn 16;\n\n\t\t\tcase ECTagType.EC_TAGTYPE_DOUBLE:\n\t\t\t\treturn 8;\n\n\t\t\tcase ECTagType.EC_TAGTYPE_IPV4:\n\t\t\t\treturn 6; // 4 bytes IP + 2 bytes port\n\n\t\t\tcase ECTagType.EC_TAGTYPE_HASH16:\n\t\t\t\treturn 16;\n\n\t\t\tdefault:\n\t\t\t\treturn 0;\n\t\t}\n\t}\n\n\t/**\n\t * Encode a tag to a buffer\n\t */\n\tencodeTag(tag: Tag<any>, buffer: Buffer, offset: number): number {\n\t\tlet currentOffset = offset;\n\n\t\t// Write tag name with subtags bit\n\t\tconst hasSubtags = (tag.nestedTags?.length ?? 0) > 0 ? 1 : 0;\n\t\tconst nameAndSubtags = ((tag.name & 0xffff) << 1) | hasSubtags;\n\n\t\tif (this.useUtf8Numbers) {\n\t\t\tconst encoded = encodeUtf8Number(nameAndSubtags);\n\t\t\tencoded.copy(buffer, currentOffset);\n\t\t\tcurrentOffset += encoded.length;\n\t\t} else {\n\t\t\t// In non-UTF8 mode, also encode name with subtags bit\n\t\t\tbuffer.writeUInt16BE(nameAndSubtags, currentOffset);\n\t\t\tcurrentOffset += 2;\n\t\t}\n\n\t\t// Write type (always a single byte)\n\t\tbuffer.writeUInt8(tag.type, currentOffset);\n\t\tcurrentOffset += 1;\n\n\t\t// Write tag length (subtags + value)\n\t\t// Use Reported Length (Logical) for the Value\n\t\tconst tagLength = this.calculateReportedLength(tag);\n\t\tif (this.useUtf8Numbers) {\n\t\t\tconst encoded = encodeUtf8Number(tagLength);\n\t\t\tencoded.copy(buffer, currentOffset);\n\t\t\tcurrentOffset += encoded.length;\n\t\t} else {\n\t\t\tbuffer.writeUInt32BE(tagLength, currentOffset);\n\t\t\tcurrentOffset += 4;\n\t\t}\n\n\t\t// Write nested tags count if has subtags\n\t\tconst nestedCount = tag.nestedTags?.length ?? 0;\n\t\tif (hasSubtags) {\n\t\t\tif (this.useUtf8Numbers) {\n\t\t\t\tconst encoded = encodeUtf8Number(nestedCount);\n\t\t\t\tencoded.copy(buffer, currentOffset);\n\t\t\t\tcurrentOffset += encoded.length;\n\t\t\t} else {\n\t\t\t\t// In non-UTF8 mode, nested count is UInt16 (not UInt32)\n\t\t\t\tbuffer.writeUInt16BE(nestedCount, currentOffset);\n\t\t\t\tcurrentOffset += 2;\n\t\t\t}\n\t\t}\n\n\t\t// Write nested tags\n\t\tif (tag.nestedTags) {\n\t\t\tfor (const nestedTag of tag.nestedTags) {\n\t\t\t\tcurrentOffset = this.encodeTag(nestedTag, buffer, currentOffset);\n\t\t\t}\n\t\t}\n\n\t\t// Write tag value (AFTER subtags)\n\t\tcurrentOffset = this.encodeValue(tag, buffer, currentOffset);\n\n\t\treturn currentOffset;\n\t}\n\n\t/**\n\t * Encode tag value to buffer\n\t */\n\tprivate encodeValue(tag: Tag<any>, buffer: Buffer, offset: number): number {\n\t\tconst encoded = tag.encodeValue();\n\n\t\tswitch (tag.type) {\n\t\t\tcase ECTagType.EC_TAGTYPE_CUSTOM:\n\t\t\t\t// For empty custom tags (like capability flags), don't write any data\n\t\t\t\tif (encoded.length > 0) {\n\t\t\t\t\t// Custom tags with data have no additional length prefix\n\t\t\t\t\t// The tagLength header already specifies the size\n\t\t\t\t\tencoded.copy(buffer, offset);\n\t\t\t\t\treturn offset + encoded.length;\n\t\t\t\t}\n\t\t\t\treturn offset; // Empty custom tag, no data to write\n\n\t\t\tcase ECTagType.EC_TAGTYPE_UINT8:\n\t\t\tcase ECTagType.EC_TAGTYPE_UINT16:\n\t\t\tcase ECTagType.EC_TAGTYPE_UINT32:\n\t\t\tcase ECTagType.EC_TAGTYPE_UINT64:\n\t\t\tcase ECTagType.EC_TAGTYPE_STRING:\n\t\t\tcase ECTagType.EC_TAGTYPE_DOUBLE:\n\t\t\tcase ECTagType.EC_TAGTYPE_IPV4:\n\t\t\tcase ECTagType.EC_TAGTYPE_HASH16:\n\t\t\tcase ECTagType.EC_TAGTYPE_UINT128:\n\t\t\t\tencoded.copy(buffer, offset);\n\t\t\t\treturn offset + encoded.length;\n\n\t\t\tdefault:\n\t\t\t\treturn offset;\n\t\t}\n\t}\n\n\t/**\n\t * Encode multiple tags\n\t */\n\tencodeTags(tags: Tag<any>[]): Buffer {\n\t\t// Calculate total size\n\t\tlet totalSize = 0;\n\t\tfor (const tag of tags) {\n\t\t\ttotalSize += this.calculateTagSize(tag);\n\t\t}\n\n\t\t// Allocate buffer and encode\n\t\tconst buffer = Buffer.allocUnsafe(totalSize);\n\t\tlet offset = 0;\n\t\tfor (const tag of tags) {\n\t\t\toffset = this.encodeTag(tag, buffer, offset);\n\t\t}\n\n\t\treturn buffer;\n\t}\n}\n","/**\n * Packet Writer - Serializes EC packets to binary data\n */\n\nimport * as zlib from 'zlib';\nimport { Packet } from './Packet';\nimport { Flags } from './Flags';\nimport { TagEncoder } from '../tag/TagEncoder';\nimport { encodeUtf8Number } from '../Encoding';\n\nexport class PacketWriter {\n\tprivate static readonly HEADER_SIZE = 8; // flags(4) + data_length(4)\n\n\t/**\n\t * Write a packet to a buffer\n\t */\n\tstatic write(packet: Packet): Buffer {\n\t\tconst useUtf8 = packet.flags.isUtf8Numbers();\n\t\tconst useZlib = packet.flags.isZlib();\n\n\t\t// Encode packet data\n\t\tlet data = this.encodePacketData(packet, useUtf8);\n\n\t\t// Compress if needed\n\t\tif (useZlib) {\n\t\t\tdata = this.compress(data);\n\t\t}\n\n\t\t// Create final buffer with header\n\t\tconst buffer = Buffer.allocUnsafe(this.HEADER_SIZE + data.length);\n\n\t\t// Write flags\n\t\tpacket.flags.writeToBuffer(buffer, 0);\n\n\t\t// Write data length\n\t\tbuffer.writeUInt32BE(data.length, 4);\n\n\t\t// Write data\n\t\tdata.copy(buffer, this.HEADER_SIZE);\n\n\t\treturn buffer;\n\t}\n\n\t/**\n\t * Encode packet data (before compression)\n\t */\n\tprivate static encodePacketData(packet: Packet, useUtf8: boolean): Buffer {\n\t\tconst encoder = new TagEncoder(useUtf8);\n\n\t\t// Calculate size\n\t\tlet size = 1; // opcode\n\n\t\tif (useUtf8) {\n\t\t\tconst countBuf = encodeUtf8Number(packet.tags.length);\n\t\t\tsize += countBuf.length;\n\t\t} else {\n\t\t\tsize += 2; // tag count (uint16)\n\t\t}\n\n\t\t// Calculate tags size\n\t\tfor (const tag of packet.tags) {\n\t\t\tsize += encoder.calculateTagSize(tag);\n\t\t}\n\n\t\t// Create buffer\n\t\tconst buffer = Buffer.allocUnsafe(size);\n\t\tlet offset = 0;\n\n\t\t// Write opcode\n\t\tbuffer.writeUInt8(packet.opCode, offset);\n\t\toffset += 1;\n\n\t\t// Write tag count\n\t\tif (useUtf8) {\n\t\t\tconst countBuf = encodeUtf8Number(packet.tags.length);\n\t\t\tcountBuf.copy(buffer, offset);\n\t\t\toffset += countBuf.length;\n\t\t} else {\n\t\t\tbuffer.writeUInt16BE(packet.tags.length, offset);\n\t\t\toffset += 2;\n\t\t}\n\n\t\t// Write tags\n\t\tfor (const tag of packet.tags) {\n\t\t\toffset = encoder.encodeTag(tag, buffer, offset);\n\t\t}\n\n\t\treturn buffer;\n\t}\n\n\t/**\n\t * Compress data with ZLIB\n\t */\n\tprivate static compress(data: Buffer): Buffer {\n\t\treturn zlib.deflateSync(data, {\n\t\t\tlevel: zlib.constants.Z_BEST_COMPRESSION,\n\t\t});\n\t}\n}\n","/**\n * Auth Request - Send client info to initiate authentication\n */\n\nimport { Request } from './Request';\nimport { ECOpCode, ECTagName } from '../ec/Codes';\nimport { Hash16Tag, UShortTag, StringTag, CustomTag } from '../ec/tag/Tag';\n\nexport class AuthClientInfoRequest extends Request {\n\tconstructor(clientName: string = 'amule-ts-client', clientVersion: string = '1.0.0') {\n\t\tsuper(ECOpCode.EC_OP_AUTH_REQ);\n\n\t\t// Add client info\n\t\tthis.addTag(new StringTag(ECTagName.EC_TAG_CLIENT_NAME, clientName));\n\t\tthis.addTag(new StringTag(ECTagName.EC_TAG_CLIENT_VERSION, clientVersion));\n\n\t\t// Add protocol version\n\t\tthis.addTag(new UShortTag(ECTagName.EC_TAG_PROTOCOL_VERSION, 0x0204));\n\n\t\t// Add capability flags as empty CustomTag (like jamule does)\n\t\tthis.addTag(new CustomTag(ECTagName.EC_TAG_CAN_ZLIB, Buffer.alloc(0)));\n\t\tthis.addTag(new CustomTag(ECTagName.EC_TAG_CAN_UTF8_NUMBERS, Buffer.alloc(0)));\n\t}\n}\n\n/**\n * Auth Password Request - Send hashed password after receiving salt\n */\nexport class AuthPasswordRequest extends Request {\n\tconstructor(hashedPassword: Buffer) {\n\t\tsuper(ECOpCode.EC_OP_AUTH_PASSWD);\n\n\t\t// Add password hash\n\t\tthis.addTag(new Hash16Tag(ECTagName.EC_TAG_PASSWD_HASH, hashedPassword));\n\t}\n}\n","/**\n * Auth Salt Response - Contains authentication salt\n */\n\nimport { Packet } from '../ec/packet/Packet';\nimport { ECTagName } from '../ec/Codes';\nimport { findNumericTag } from '../ec/tag/Tag';\nimport { InvalidECException } from '../exceptions';\n\nexport class AuthSaltResponse {\n\tconstructor(public readonly salt: bigint) {}\n\n\tstatic fromPacket(packet: Packet): AuthSaltResponse {\n\t\tconst saltTag = findNumericTag(packet.tags, ECTagName.EC_TAG_PASSWD_SALT);\n\t\tif (!saltTag) {\n\t\t\tthrow new InvalidECException('Missing salt tag in auth salt response');\n\t\t}\n\n\t\treturn new AuthSaltResponse(saltTag.getLong());\n\t}\n}\n","/**\n * Password Hasher for aMule EC authentication\n */\n\nimport * as crypto from 'crypto';\n\nexport class PasswordHasher {\n\t/**\n\t * Hash a password with salt using MD5\n\t *\n\t * This matches aMule's password hashing algorithm (from jamule):\n\t * 1. saltHash = MD5(salt.toHexString().uppercase())\n\t * 2. passwordHash = MD5(password)\n\t * 3. return MD5(passwordHash.toHex().lowercase() + saltHash.toHex().lowercase())\n\t *\n\t * @param password The password to hash\n\t * @param salt The salt received from the server\n\t * @returns The hashed password as a Buffer\n\t */\n\tstatic hash(password: string, salt: bigint): Buffer {\n\t\t// Step 1: Hash the salt (as uppercase hex string)\n\t\tconst saltHexUpper = salt.toString(16).toUpperCase().padStart(16, '0');\n\t\tconst saltHash = crypto.createHash('md5').update(saltHexUpper, 'utf-8').digest();\n\n\t\t// Step 2: Hash the password\n\t\tconst passwordHash = crypto.createHash('md5').update(password, 'utf-8').digest();\n\n\t\t// Step 3: Hash the concatenation of both hashes (as lowercase hex strings)\n\t\tconst passwordHashHex = passwordHash.toString('hex').toLowerCase();\n\t\tconst saltHashHex = saltHash.toString('hex').toLowerCase();\n\t\tconst finalHash = crypto\n\t\t\t.createHash('md5')\n\t\t\t.update(passwordHashHex + saltHashHex, 'utf-8')\n\t\t\t.digest();\n\n\t\treturn finalHash;\n\t}\n\n\t/**\n\t * Hash a password without salt (for testing)\n\t */\n\tstatic hashWithoutSalt(password: string): Buffer {\n\t\tconst lowerPassword = password.toLowerCase();\n\t\tconst md5Hash = crypto.createHash('md5');\n\t\tmd5Hash.update(lowerPassword, 'utf-8');\n\t\treturn md5Hash.digest();\n\t}\n}\n","/**\n * AmuleConnection - Manages the low-level connection to aMule EC\n */\n\nimport * as net from 'net';\nimport { CommunicationException, ServerException } from '../exceptions';\nimport { Packet } from '../ec/packet/Packet';\nimport { PacketParser } from '../ec/packet/PacketParser';\nimport { PacketWriter } from '../ec/packet/PacketWriter';\nimport { ECOpCode } from '../ec/Codes';\nimport { AuthClientInfoRequest, AuthPasswordRequest } from '../request/AuthRequest';\nimport type { Request } from '../request/Request';\nimport { AuthSaltResponse } from '../response/AuthSaltResponse';\nimport { PasswordHasher } from '../auth/PasswordHasher';\n\ninterface IPendingResponse {\n\tresolve: (packet: Packet) => void;\n\treject: (error: Error) => void;\n\ttimeoutHandle?: NodeJS.Timeout;\n}\n\nexport class AmuleConnection {\n\tprivate socket?: net.Socket;\n\tprivate connected = false;\n\tprivate buffer: Buffer = Buffer.allocUnsafe(0);\n\tprivate pendingResponses: IPendingResponse[] = [];\n\tprivate connectionPromise?: Promise<void>;\n\tprivate requestTimeout = 0;\n\n\t// Debug logging flag (disabled by default)\n\tprivate debug = false;\n\n\t/**\n\t * Enable or disable debug logging\n\t */\n\tpublic setDebug(enabled: boolean): void {\n\t\tthis.debug = !!enabled;\n\t}\n\n\t/**\n\t * Internal debug logger\n\t */\n\tprivate log(...args: any[]): void {\n\t\tif (!this.debug) {\n\t\t\treturn;\n\t\t}\n\t\tconsole.log('[DEBUG]', ...args);\n\t}\n\n\tconstructor(\n\t\tprivate host: string,\n\t\tprivate port: number,\n\t\tprivate password: string,\n\t\tprivate timeout: number,\n\t\trequestTimeout: number = 0\n\t) {\n\t\tthis.requestTimeout = Math.max(0, requestTimeout);\n\t}\n\n\t/**\n\t * Set default timeout for a single request/response cycle.\n\t * Use 0 to disable.\n\t */\n\tpublic setRequestTimeout(timeoutMs: number): void {\n\t\tthis.requestTimeout = Math.max(0, timeoutMs || 0);\n\t}\n\n\t/**\n\t * Get current default timeout for requests.\n\t */\n\tpublic getRequestTimeout(): number {\n\t\treturn this.requestTimeout;\n\t}\n\n\t/**\n\t * Reject and clear all pending responses.\n\t */\n\tprivate rejectAllPending(error: Error): void {\n\t\twhile (this.pendingResponses.length > 0) {\n\t\t\tconst pending = this.pendingResponses.shift();\n\t\t\tif (pending?.timeoutHandle) {\n\t\t\t\tclearTimeout(pending.timeoutHandle);\n\t\t\t}\n\t\t\tpending?.reject(error);\n\t\t}\n\t}\n\n\t/**\n\t * Reconnect to the server\n\t */\n\tasync reconnect(): Promise<void> {\n\t\tif (this.connectionPromise) {\n\t\t\treturn this.connectionPromise;\n\t\t}\n\n\t\tthis.connectionPromise = (async () => {\n\t\t\tthis.connected = false;\n\t\t\tif (this.socket) {\n\t\t\t\tthis.socket.destroy();\n\t\t\t}\n\n\t\t\t// Create new socket\n\t\t\tthis.socket = new net.Socket();\n\t\t\tif (this.timeout > 0) {\n\t\t\t\tthis.socket.setTimeout(this.timeout);\n\t\t\t}\n\n\t\t\t// Setup event handlers\n\t\t\tthis.socket.on('data', (data) => this.handleData(Buffer.isBuffer(data) ? data : Buffer.from(data)));\n\t\t\tthis.socket.on('error', (error) => this.handleError(error));\n\t\t\tthis.socket.on('timeout', () => this.handleTimeout());\n\t\t\tthis.socket.on('close', () => this.handleClose());\n\n\t\t\ttry {\n\t\t\t\t// Connect\n\t\t\t\tawait this.connectSocket();\n\n\t\t\t\t// Perform authentication\n\t\t\t\tawait this.authenticate();\n\n\t\t\t\tthis.connected = true;\n\t\t\t} finally {\n\t\t\t\tthis.connectionPromise = undefined;\n\t\t\t}\n\t\t})();\n\n\t\treturn this.connectionPromise;\n\t}\n\n\t/**\n\t * Connect socket to server\n\t */\n\tprivate connectSocket(): Promise<void> {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tif (!this.socket) {\n\t\t\t\treturn reject(new CommunicationException('Socket not initialized'));\n\t\t\t}\n\n\t\t\tthis.socket.connect(this.port, this.host, () => {\n\t\t\t\tresolve();\n\t\t\t});\n\n\t\t\tthis.socket.once('error', reject);\n\t\t});\n\t}\n\n\t/**\n\t * Perform authentication handshake\n\t */\n\tprivate async authenticate(): Promise<void> {\n\t\tthis.log('Starting authentication...');\n\t\t// Step 1: Send client info\n\t\tconst clientInfoRequest = new AuthClientInfoRequest();\n\t\tthis.log('Sending client info...');\n\t\tconst saltPacket = await this.sendRequestNoAuth(clientInfoRequest);\n\t\tthis.log('Received salt response');\n\n\t\tif (saltPacket.opCode === ECOpCode.EC_OP_AUTH_FAIL) {\n\t\t\tthrow new ServerException('Authentication failed: server rejected client');\n\t\t}\n\n\t\tif (saltPacket.opCode !== ECOpCode.EC_OP_AUTH_SALT) {\n\t\t\tthrow new ServerException(`Unexpected response to client info: ${saltPacket.opCode}`);\n\t\t}\n\n\t\tconst saltResponse = AuthSaltResponse.fromPacket(saltPacket);\n\t\tthis.log('Salt:', saltResponse.salt);\n\n\t\t// Step 2: Hash password with salt\n\t\tconst hashedPassword = PasswordHasher.hash(this.password, saltResponse.salt);\n\t\tthis.log('Hashed password:', hashedPassword.toString('hex'));\n\n\t\t// Step 3: Send hashed password\n\t\tconst authRequest = new AuthPasswordRequest(hashedPassword);\n\t\tthis.log('Sending hashed password...');\n\t\tconst authPacket = await this.sendRequestNoAuth(authRequest);\n\t\tthis.log('Received auth response');\n\n\t\tif (authPacket.opCode === ECOpCode.EC_OP_AUTH_FAIL) {\n\t\t\tthrow new ServerException('Authentication failed: invalid password');\n\t\t}\n\n\t\tif (authPacket.opCode !== ECOpCode.EC_OP_AUTH_OK) {\n\t\t\tthrow new ServerException(`Unexpected auth response: ${authPacket.opCode}`);\n\t\t}\n\t\tthis.log('Authentication successful!');\n\t}\n\n\t/**\n\t * Handle incoming data\n\t */\n\tprivate handleData(data: Buffer): void {\n\t\tthis.log('Received data:', data.length, 'bytes, hex:', data.toString('hex').substring(0, 100));\n\t\t// Append to buffer\n\t\tthis.buffer = Buffer.concat([this.buffer, data]);\n\n\t\t// Try to parse packets\n\t\twhile (PacketParser.hasCompletePacket(this.buffer)) {\n\t\t\ttry {\n\t\t\t\tconst packet = PacketParser.parse(this.buffer);\n\t\t\t\tthis.log('Parsed packet, opCode:', packet.opCode);\n\n\t\t\t\t// Calculate consumed bytes\n\t\t\t\tconst consumedBytes = PacketParser.getExpectedPacketSize(this.buffer);\n\t\t\t\tthis.buffer = this.buffer.subarray(consumedBytes);\n\n\t\t\t\t// Resolve pending response\n\t\t\t\tconst pending = this.pendingResponses.shift();\n\t\t\t\tif (pending) {\n\t\t\t\t\tpending.resolve(packet);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tthis.log('Parse error:', error);\n\t\t\t\tconst pending = this.pendingResponses.shift();\n\t\t\t\tif (pending) {\n\t\t\t\t\tpending.reject(error as Error);\n\t\t\t\t}\n\t\t\t\t// If we have a parse error, the buffer might be corrupted for further packets\n\t\t\t\tthis.buffer = Buffer.allocUnsafe(0);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Handle socket error\n\t */\n\tprivate handleError(error: Error): void {\n\t\tthis.connected = false;\n\t\tthis.rejectAllPending(new CommunicationException(`Socket error: ${error.message}`));\n\t}\n\n\t/**\n\t * Handle socket timeout\n\t */\n\tprivate handleTimeout(): void {\n\t\tthis.connected = false;\n\t\tthis.rejectAllPending(new CommunicationException('Socket timeout'));\n\t}\n\n\t/**\n\t * Handle socket close\n\t */\n\tprivate handleClose(): void {\n\t\tthis.log('Socket closed! connected:', this.connected, 'pendingResponses:', this.pendingResponses.length);\n\t\tthis.connected = false;\n\t\tthis.rejectAllPending(new CommunicationException('Socket closed'));\n\t}\n\n\t/**\n\t * Send a request and wait for response\n\t */\n\tasync sendRequest(request: Request, timeoutMs?: number): Promise<Packet> {\n\t\tif (!this.connected) {\n\t\t\tawait this.reconnect();\n\t\t}\n\n\t\ttry {\n\t\t\treturn await this.sendRequestNoAuth(request, timeoutMs);\n\t\t} catch (error) {\n\t\t\tthis.connected = false;\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * Send a request without checking authentication\n\t */\n\tprivate async sendRequestNoAuth(request: Request, timeoutMs?: number): Promise<Packet> {\n\t\tif (!this.socket) {\n\t\t\tthrow new CommunicationException('Socket not initialized');\n\t\t}\n\n\t\t// Build and write packet\n\t\tconst packet = request.buildPacket();\n\t\tconst buffer = PacketWriter.write(packet);\n\t\tthis.log('Sending request:', packet.opCode.toString(16), 'Size:', buffer.length);\n\n\t\t// Create promise for response\n\t\tconst responsePromise = new Promise<Packet>((resolve, reject) => {\n\t\t\tconst pending: IPendingResponse = {\n\t\t\t\tresolve: (packet: Packet) => {\n\t\t\t\t\tif (pending.timeoutHandle) {\n\t\t\t\t\t\tclearTimeout(pending.timeoutHandle);\n\t\t\t\t\t}\n\t\t\t\t\tresolve(packet);\n\t\t\t\t},\n\t\t\t\treject: (error: Error) => {\n\t\t\t\t\tif (pending.timeoutHandle) {\n\t\t\t\t\t\tclearTimeout(pending.timeoutHandle);\n\t\t\t\t\t}\n\t\t\t\t\treject(error);\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tconst effectiveTimeout = timeoutMs ?? this.requestTimeout;\n\t\t\tif (effectiveTimeout > 0) {\n\t\t\t\tpending.timeoutHandle = setTimeout(() => {\n\t\t\t\t\tif (!this.pendingResponses.includes(pending)) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tthis.connected = false;\n\t\t\t\t\tthis.rejectAllPending(new CommunicationException(`Request timeout after ${effectiveTimeout}ms`));\n\t\t\t\t\tif (this.socket && !this.socket.destroyed) {\n\t\t\t\t\t\tthis.socket.destroy();\n\t\t\t\t\t}\n\t\t\t\t}, effectiveTimeout);\n\t\t\t}\n\n\t\t\tthis.pendingResponses.push(pending);\n\t\t});\n\n\t\t// Send packet\n\t\tthis.socket.write(buffer);\n\n\t\treturn responsePromise;\n\t}\n}\n","// Model types and interfaces\n\nimport type { ChunkInfo, ParsedSource, SourceNameCount } from '../types/download-details';\n\nexport interface AmuleFile {\n\tfileHashHexString?: string;\n\tfileName?: string;\n\tfilePath?: string;\n\tsizeFull?: number;\n\tfileEd2kLink?: string;\n\tupPrio?: number;\n\tgetRequests?: number;\n\tgetAllRequests?: number;\n\tgetAccepts?: number;\n\tgetAllAccepts?: number;\n\tgetXferred?: number;\n\tgetAllXferred?: number;\n\tgetCompleteSourcesLow?: number;\n\tgetCompleteSourcesHigh?: number;\n\tgetCompleteSources?: number;\n\tgetOnQueue?: number;\n\tgetComment?: string;\n\tgetRating?: number;\n}\n\nexport interface AmuleTransferringFile extends AmuleFile {\n\tpartMetID?: number;\n\tsizeXfer?: number;\n\tsizeDone?: number;\n\tfileStatus?: FileStatus;\n\tstopped?: boolean;\n\tsourceCount?: number;\n\tsourceNotCurrCount?: number;\n\tsourceXferCount?: number;\n\tsourceCountA4AF?: number;\n\tspeed?: number;\n\tdownPrio?: number;\n\tfileCat?: number;\n\tlastSeenComplete?: number;\n\tlastDateChanged?: number;\n\tdownloadActiveTime?: number;\n\tavailablePartCount?: number;\n\ta4AFAuto?: boolean;\n\thashingProgress?: boolean;\n\tgetLostDueToCorruption?: number;\n\tgetGainDueToCompression?: number;\n\ttotalPacketsSavedDueToICH?: number;\n\ta4afSources?: number[];\n\tchunkInfo?: ChunkInfo;\n\tsources?: ParsedSource[];\n\tsourceNames?: SourceNameCount[];\n}\n\nexport interface AmuleCategory {\n\tid?: number;\n\tname?: string;\n\tpath?: string;\n\tcomment?: string;\n\tcolor?: number;\n\tpriority?: number;\n}\n\nexport interface AmuleServer {\n\tname?: string;\n\tdescription?: string;\n\taddress?: string; // String representation usually\n\tip?: string;\n\tport?: number;\n\tping?: number;\n\tusers?: number;\n\tmaxUsers?: number;\n\tfiles?: number;\n\tpriority?: number;\n\tversion?: string;\n\tisStatic?: boolean;\n\tfailedCount?: number;\n}\n\nexport interface AmuleUpDownClient {\n\tclientName?: string;\n\tuserHashHexString?: string;\n\tuserID?: number;\n\tscore?: number;\n\tsoftware?: string;\n\tsoftVerStr?: string;\n\tuserIP?: string;\n\tuserPort?: number;\n\tsourceFrom?: number;\n\tserverIP?: string;\n\tserverPort?: number;\n\tserverName?: string;\n\n\tupSpeed?: number;\n\tdownSpeed?: number;\n\tuploadSession?: number;\n\ttransferredDown?: number;\n\tuploadedTotal?: number;\n\tdownloadedTotal?: number;\n\n\tuploadState?: number;\n\tdownloadState?: number;\n\tidentState?: number;\n\textProtocol?: number;\n\twaitingPosition?: number;\n\tremoteQueueRank?: number;\n\toldRemoteQueueRank?: number;\n\tobfuscationStatus?: number;\n\tkadPort?: number;\n\tfriendSlot?: number;\n\tuploadFileId?: bigint | number;\n\tuploadFilename?: string;\n\trequestFileId?: bigint | number;\n\tremoteFilename?: string;\n\tdisableViewShared?: boolean;\n\tversion?: number;\n\tmodVersion?: string;\n\tosInfo?: string;\n\tavailableParts?: number;\n\tpartStatus?: string;\n\tnextRequestedPart?: number;\n\tlastDownloadingPart?: number;\n\tuploadPartStatus?: string;\n}\n\nexport interface AmuleFriend {\n\tname?: string;\n\tuserHashHexString?: string;\n\tip?: string;\n\tport?: number;\n\tfriendSlot?: boolean;\n\tshared?: boolean;\n\tclient?: AmuleUpDownClient;\n}\n\nexport enum FileStatus {\n\tREADY = 0,\n\tEMPTY = 1,\n\tWAITINGFORHASH = 2,\n\tHASHING = 3,\n\tERROR = 4,\n\tINSUFFICIENT = 5,\n\tUNKNOWN = 6,\n\tPAUSED = 7,\n\tCOMPLETING = 8,\n\tCOMPLETE = 9,\n\tALLOCATING = 10,\n}\n\nexport enum DownloadCommand {\n\tSWAP_A4AF_THIS = 0x16,\n\tSWAP_A4AF_THIS_AUTO = 0x17,\n\tSWAP_A4AF_OTHERS = 0x18,\n\tPAUSE = 0x19,\n\tRESUME = 0x1a,\n\tSTOP = 0x1b,\n\tDELETE = 0x1d,\n}\n\nexport enum SearchType {\n\tGLOBAL = 1,\n\tKAD = 2,\n\tLOCAL = 0,\n\tWEB = 3,\n}\n","/**\n * Main aMule EC Client\n */\n\nimport { AmuleConnection } from './AmuleConnection';\nimport type { AmuleFile, AmuleTransferringFile, AmuleCategory, AmuleServer, SearchType, AmuleUpDownClient, AmuleFriend } from '../model';\nimport { DownloadCommand } from '../model';\nimport type { SearchFilters } from '../types';\nimport { EcPrefs, ECDetailLevel } from '../ec/Codes';\nimport type { AmulePreferences } from '../types/preferences';\n\nexport interface AmuleClientOptions {\n\thost: string;\n\tport: number;\n\tpassword: string;\n\ttimeout?: number;\n\trequestTimeout?: number;\n}\n\nexport interface StatsResponse {\n\tid: number;\n\ted2kId: number;\n\tkadId?: string;\n\tconnectedServer?: {\n\t\tname?: string;\n\t\tdescription?: string;\n\t\tip: string;\n\t\tport: number;\n\t};\n\tconnectionState?: any; // Will be properly typed later\n\tuploadOverhead: number;\n\tdownloadOverhead: number;\n\tbannedCount: number;\n\tloggerMessage: string[];\n\ttotalSentBytes: number;\n\ttotalReceivedBytes: number;\n\tsharedFileCount: number;\n\tuploadSpeed: number;\n\tdownloadSpeed: number;\n\tuploadSpeedLimit: number;\n\tdownloadSpeedLimit: number;\n\tuploadQueueLength: number;\n\ttotalSourceCount: number;\n\ted2kUsers: number;\n\tkadUsers: number;\n\ted2kFiles: number;\n\tkadFiles: number;\n\tkadNodes: number;\n}\n\nexport interface SearchResultsResponse {\n\tfiles: {\n\t\tfileName: string;\n\t\thash: Buffer;\n\t\tsizeFull: number;\n\t\tdownloadStatus: number;\n\t\tcompleteSourceCount: number;\n\t\tsourceCount: number;\n\t}[];\n}\n\nexport interface UpdateResponse {\n\tsharedFiles: AmuleFile[];\n\tdownloadQueue: AmuleTransferringFile[];\n\tclients: AmuleUpDownClient[];\n\tservers: AmuleServer[];\n\tfriends: AmuleFriend[];\n}\n\nexport class AmuleClient {\n\tprivate connection: AmuleConnection;\n\n\tconstructor(options: AmuleClientOptions) {\n\t\tthis.connection = new AmuleConnection(options.host, options.port, options.password, options.timeout || 0, options.requestTimeout || 0);\n\t}\n\n\t/**\n\t * Set default timeout for individual request/response cycles.\n\t * Use 0 to disable request timeout.\n\t */\n\tsetRequestTimeout(timeoutMs: number): void {\n\t\tthis.connection.setRequestTimeout(timeoutMs);\n\t}\n\n\t/**\n\t * Get current default timeout for requests.\n\t */\n\tgetRequestTimeout(): number {\n\t\treturn this.connection.getRequestTimeout();\n\t}\n\n\t/**\n\t * Reconnect to the server\n\t */\n\tasync reconnect(): Promise<void> {\n\t\tawait this.connection.reconnect();\n\t}\n\n\t/**\n\t * Get server statistics\n\t */\n\tasync getStats(): Promise<StatsResponse> {\n\t\tconst { StatsRequest } = await import('../request/StatsRequest');\n\t\tconst { StatsResponseParser } = await import('../response/StatsResponse');\n\n\t\tconst request = new StatsRequest();\n\t\tconst packet = await this.connection.sendRequest(request);\n\n\t\treturn StatsResponseParser.fromPacket(packet);\n\t}\n\n\t/**\n\t * Get incremental updates for files, clients, servers, and friends\n\t */\n\tasync getUpdate(detailLevel: ECDetailLevel = ECDetailLevel.EC_DETAIL_INC_UPDATE): Promise<UpdateResponse> {\n\t\tconst { UpdateRequest } = await import('../request/UpdateRequest');\n\t\tconst { UpdateResponseParser } = await import('../response/UpdateResponse');\n\n\t\tconst request = new UpdateRequest(detailLevel);\n\t\tconst packet = await this.connection.sendRequest(request);\n\n\t\treturn UpdateResponseParser.fromPacket(packet);\n\t}\n\n\t/**\n\t * Start an asynchronous search\n\t */\n\tasync searchAsync(query: string, searchType?: SearchType, filters?: SearchFilters): Promise<string> {\n\t\tconst { SearchRequest } = await import('../request/SearchRequest');\n\n\t\tconst request = new SearchRequest(query, searchType, filters);\n\t\tawait this.connection.sendRequest(request);\n\n\t\treturn query;\n\t}\n\n\t/**\n\t * Get search status (0-1)\n\t */\n\tasync searchStatus(): Promise<number> {\n\t\tconst { SearchStatusRequest } = await import('../request/SearchStatusRequest');\n\t\tconst { SearchProgressResponse } = await import('../response/SearchProgressResponse');\n\n\t\tconst request = new SearchStatusRequest();\n\t\tconst packet = await this.connection.sendRequest(request);\n\n\t\tconst response = SearchProgressResponse.fromPacket(packet);\n\t\treturn response.progress;\n\t}\n\n\t/**\n\t * Get search results\n\t */\n\tasync searchResults(): Promise<SearchResultsResponse> {\n\t\tconst { SearchResultsRequest } = await import('../request/SearchResultsRequest');\n\t\tconst { SearchResultsResponseParser } = await import('../response/SearchResultsResponse');\n\n\t\tconst request = new SearchResultsRequest();\n\t\tconst packet = await this.connection.sendRequest(request);\n\n\t\treturn SearchResultsResponseParser.fromPacket(packet);\n\t}\n\n\t/**\n\t * Perform a synchronous search (waits for results)\n\t */\n\tasync searchSync(query: string, searchType?: SearchType, filters?: SearchFilters, timeout: number = 30000): Promise<SearchResultsResponse> {\n\t\t// Start search\n\t\tawait this.searchAsync(query, searchType, filters);\n\n\t\t// Wait for completion\n\t\tconst startTime = Date.now();\n\t\twhile (Date.now() - startTime < timeout) {\n\t\t\tconst progress = await this.searchStatus();\n\n\t\t\tif (progress >= 1.0) {\n\t\t\t\treturn await this.searchResults();\n\t\t\t}\n\n\t\t\t// Wait a bit before checking again\n\t\t\tawait new Promise((resolve) => setTimeout(resolve, 500));\n\t\t}\n\n\t\tthrow new Error('Search timeout');\n\t}\n\n\t/**\n\t * Stop current search\n\t */\n\tasync searchStop(): Promise<void> {\n\t\tconst { SearchStopRequest } = await import('../request/SearchStopRequest');\n\n\t\tconst request = new SearchStopRequest();\n\t\tawait this.connection.sendRequest(request);\n\t}\n\n\t/**\n\t * Download a file from search results\n\t */\n\tasync downloadSearchResult(hash: Buffer): Promise<void> {\n\t\tconst { DownloadFileRequest } = await import('../request/DownloadFileRequest');\n\n\t\tconst request = new DownloadFileRequest(hash);\n\t\tawait this.connection.sendRequest(request);\n\t}\n\n\t/**\n\t * Download from an ed2k link\n\t */\n\tasync downloadEd2kLink(link: string): Promise<void> {\n\t\tconst { AddLinkRequest } = await import('../request/AddLinkRequest');\n\n\t\tconst request = new AddLinkRequest(link);\n\t\tawait this.connection.sendRequest(request);\n\t}\n\n\t/**\n\t * Get download queue\n\t */\n\tasync getDownloadQueue(): Promise<AmuleTransferringFile[]> {\n\t\tconst { DownloadQueueRequest } = await import('../request/DownloadQueueRequest');\n\t\tconst { DownloadQueueResponseParser } = await import('../response/DownloadQueueResponse');\n\n\t\tconst request = new DownloadQueueRequest();\n\t\tconst packet = await this.connection.sendRequest(request);\n\n\t\treturn DownloadQueueResponseParser.fromPacket(packet).files;\n\t}\n\n\t/**\n\t * Get shared files\n\t */\n\tasync getSharedFiles(): Promise<AmuleFile[]> {\n\t\tconst { SharedFilesRequest } = await import('../request/SharedFilesRequest');\n\t\tconst { SharedFilesResponseParser } = await import('../response/SharedFilesResponse');\n\n\t\tconst request = new SharedFilesRequest();\n\t\tconst packet = await this.connection.sendRequest(request);\n\n\t\treturn SharedFilesResponseParser.fromPacket(packet).files;\n\t}\n\n\t/**\n\t * Reload shared files list\n\t */\n\tasync reloadSharedFiles(): Promise<void> {\n\t\tconst { ReloadSharedFilesRequest } = await import('../request/ReloadSharedFilesRequest');\n\n\t\tconst request = new ReloadSharedFilesRequest();\n\t\tawait this.connection.sendRequest(request);\n\t}\n\n\t/**\n\t * Get client upload/download queue (clients we are uploading to/downloading from)\n\t */\n\tasync getClientQueue(): Promise<AmuleUpDownClient[]> {\n\t\tconst { ClientQueueRequest } = await import('../request/ClientQueueRequest');\n\t\tconst { ClientQueueResponseParser } = await import('../response/ClientQueueResponse');\n\n\t\tconst request = new ClientQueueRequest();\n\t\tconst packet = await this.connection.sendRequest(request);\n\n\t\treturn ClientQueueResponseParser.fromPacket(packet).clients;\n\t}\n\n\t/**\n\t * Get the list of servers\n\t */\n\tasync getServerList(): Promise<AmuleServer[]> {\n\t\tconst { ServerListRequest } = await import('../request/ServerListRequest');\n\t\tconst { ServerListResponseParser } = await import('../response/ServerListResponse');\n\n\t\tconst request = new ServerListRequest();\n\t\tconst packet = await this.connection.sendRequest(request);\n\n\t\treturn ServerListResponseParser.fromPacket(packet).servers;\n\t}\n\n\t/**\n\t * Connect to a specific server\n\t */\n\tasync connectToServer(ip?: string, port?: number): Promise<void> {\n\t\tconst { ServerConnectRequest } = await import('../request/ServerConnectRequest');\n\n\t\tconst request = new ServerConnectRequest(ip, port);\n\t\tawait this.connection.sendRequest(request);\n\t}\n\n\t/**\n\t * Disconnect from the current server\n\t */\n\tasync disconnectFromServer(): Promise<void> {\n\t\tconst { ServerDisconnectRequest } = await import('../request/ServerDisconnectRequest');\n\n\t\tconst request = new ServerDisconnectRequest();\n\t\tawait this.connection.sendRequest(request);\n\t}\n\n\t/**\n\t * Create a category\n\t */\n\tasync createCategory(category: AmuleCategory): Promise<void> {\n\t\tconst { CreateCategoryRequest } = await import('../request/CreateCategoryRequest');\n\n\t\tconst request = new CreateCategoryRequest(category);\n\t\tawait this.connection.sendRequest(request);\n\t}\n\n\t/**\n\t * Update a category\n\t */\n\tasync updateCategory(id: number, category: AmuleCategory): Promise<void> {\n\t\tconst { UpdateCategoryRequest } = await import('../request/UpdateCategoryRequest');\n\n\t\tconst request = new UpdateCategoryRequest(id, category);\n\t\tawait this.connection.sendRequest(request);\n\t}\n\n\t/**\n\t * Delete a category\n\t */\n\tasync deleteCategory(id: number): Promise<void> {\n\t\tconst { DeleteCategoryRequest } = await import('../request/DeleteCategoryRequest');\n\n\t\tconst request = new DeleteCategoryRequest(id);\n\t\tawait this.connection.sendRequest(request);\n\t}\n\n\t/**\n\t * Get all categories\n\t */\n\tasync getCategories(): Promise<AmuleCategory[]> {\n\t\tconst { GetPreferencesRequest } = await import('../request/GetPreferencesRequest');\n\t\tconst { PreferencesResponseParser } = await import('../response/PreferencesResponse');\n\n\t\tconst request = new GetPreferencesRequest(EcPrefs.EC_PREFS_CATEGORIES);\n\t\tconst packet = await this.connection.sendRequest(request);\n\t\treturn PreferencesResponseParser.fromPacket(packet).categories;\n\t}\n\n\t/**\n\t * Set file category\n\t */\n\tasync setFileCategory(hash: Buffer, categoryId: number): Promise<void> {\n\t\tconst { SetFileCategoryRequest } = await import('../request/SetFileCategoryRequest');\n\n\t\tconst request = new SetFileCategoryRequest(hash, categoryId);\n\t\tawait this.connection.sendRequest(request);\n\t}\n\n\t/**\n\t * Send a download command (PAUSE, RESUME, STOP, DELETE, etc.)\n\t */\n\tasync sendDownloadCommand(hash: Buffer, command: DownloadCommand): Promise<void> {\n\t\tconst { DownloadCommandRequest } = await import('../request/DownloadCommandRequest');\n\n\t\tconst request = new DownloadCommandRequest(hash, command);\n\t\tawait this.connection.sendRequest(request);\n\t}\n\n\t/**\n\t * Pause a download\n\t */\n\tasync pauseDownload(hash: Buffer): Promise<void> {\n\t\tawait this.sendDownloadCommand(hash, DownloadCommand.PAUSE);\n\t}\n\n\t/**\n\t * Resume a download\n\t */\n\tasync resumeDownload(hash: Buffer): Promise<void> {\n\t\tawait this.sendDownloadCommand(hash, DownloadCommand.RESUME);\n\t}\n\n\t/**\n\t * Stop a download\n\t */\n\tasync stopDownload(hash: Buffer): Promise<void> {\n\t\tawait this.sendDownloadCommand(hash, DownloadCommand.STOP);\n\t}\n\n\t/**\n\t * Delete a download\n\t */\n\tasync deleteDownload(hash: Buffer): Promise<void> {\n\t\tawait this.sendDownloadCommand(hash, DownloadCommand.DELETE);\n\t}\n\n\t/**\n\t * Trigger a server list update from an URL.\n\t */\n\tasync updateServerListFromUrl(url: string): Promise<void> {\n\t\tconst { ServerUpdateFromUrlRequest } = await import('../request/ServerUpdateFromUrlRequest');\n\n\t\tconst request = new ServerUpdateFromUrlRequest(url);\n\t\tawait this.connection.sendRequest(request);\n\t}\n\n\t/**\n\t * Set upload priority for a shared file.\n\t */\n\tasync setSharedFilePriority(hash: Buffer, priority: number): Promise<void> {\n\t\tconst { SharedFilePriorityRequest } = await import('../request/SharedFilePriorityRequest');\n\n\t\tconst request = new SharedFilePriorityRequest(hash, priority);\n\t\tawait this.connection.sendRequest(request);\n\t}\n\n\t/**\n\t * Get daemon preferences for general/connection/servers/security sections.\n\t */\n\tasync getPreferences(): Promise<AmulePreferences> {\n\t\tconst { GetPreferencesRequest } = await import('../request/GetPreferencesRequest');\n\t\tconst { PreferencesDetailsResponseParser } = await import('../response/PreferencesDetailsResponse');\n\n\t\tconst prefMask = EcPrefs.EC_PREFS_GENERAL | EcPrefs.EC_PREFS_CONNECTIONS | EcPrefs.EC_PREFS_SERVERS | EcPrefs.EC_PREFS_SECURITY;\n\n\t\tconst request = new GetPreferencesRequest(prefMask);\n\t\tconst packet = await this.connection.sendRequest(request);\n\t\treturn PreferencesDetailsResponseParser.fromPacket(packet).preferences;\n\t}\n\n\t/**\n\t * Set daemon preferences. Only sections present in the input object are sent.\n\t */\n\tasync setPreferences(preferences: Partial<AmulePreferences>): Promise<void> {\n\t\tif (!preferences.general && !preferences.connection && !preferences.servers && !preferences.security) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { SetPreferencesRequest } = await import('../request/SetPreferencesRequest');\n\n\t\tconst request = new SetPreferencesRequest(preferences);\n\t\tawait this.connection.sendRequest(request);\n\t}\n}\n"],"mappings":";;;;;;;;AAEA,IAAa,iBAAb,cAAoC,MAAM;CAGjC;CAFR,YACC,SACA,OACC;EACD,MAAM,OAAO;EAFN,KAAA,QAAA;EAGP,KAAK,OAAO;CACb;AACD;AAEA,IAAa,qBAAb,cAAwC,eAAe;CACtD,YAAY,SAAiB,OAAe;EAC3C,MAAM,SAAS,KAAK;EACpB,KAAK,OAAO;CACb;AACD;AAEA,IAAa,yBAAb,cAA4C,eAAe;CAC1D,YAAY,SAAiB,OAAe;EAC3C,MAAM,SAAS,KAAK;EACpB,KAAK,OAAO;CACb;AACD;AAEA,IAAa,kBAAb,cAAqC,eAAe;CACnD,YAAY,SAAiB,OAAe;EAC3C,MAAM,SAAS,KAAK;EACpB,KAAK,OAAO;CACb;AACD;;;;;;;ACzBA,SAAgB,eAAe,QAAgB,QAAsD;CAEpG,MAAM,YAAY,OAAO;CACzB,IAAI;CAEJ,KAAK,YAAY,SAAU,GAE1B,SAAS;MACH,KAAK,YAAY,SAAU,KAEjC,SAAS;MACH,KAAK,YAAY,SAAU,KAEjC,SAAS;MACH,KAAK,YAAY,SAAU,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YAAY,WAAW,CAAC,YAAY,UAC3F;EAGD,MAAM,EAAE,0BAA0B,MAAM,OAAO;EAE/C,MAAM,UAAU,IAAI,sBAAsB,WAAW;EACrD,MAAM,KAAK,WAAW,YAAY,OAAO;CAC1C;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils-DBnUQnZ-.mjs","names":[],"sources":["../src/response/utils.ts"],"sourcesContent":["export function formatIp(ip: number | undefined): string {\n\tif (ip === undefined) return '';\n\t// EC protocol uses network byte order (big-endian) for IP addresses in UINT32\n\treturn [(ip >>> 24) & 0xff, (ip >>> 16) & 0xff, (ip >>> 8) & 0xff, ip & 0xff].join('.');\n}\n\n// Helper to convert bigint to number safely\nexport function toOptionalNumber(value: bigint | number | undefined): number | undefined {\n\tif (value === undefined) return undefined;\n\treturn typeof value === 'bigint' ? Number(value) : value;\n}\n\nexport function toOptionalBool(value: number | undefined): boolean | undefined {\n\tif (value === undefined) return undefined;\n\treturn value !== 0;\n}\n\nexport function toOptionalIp(value: number | undefined): string | undefined {\n\tif (value === undefined) return undefined;\n\treturn formatIp(value);\n}\n"],"mappings":";AAAA,SAAgB,SAAS,IAAgC;CACxD,IAAI,OAAO,KAAA,GAAW,OAAO;CAE7B,OAAO;EAAE,OAAO,KAAM;EAAO,OAAO,KAAM;EAAO,OAAO,IAAK;EAAM,KAAK;CAAI,CAAC,CAAC,KAAK,GAAG;AACvF;AAGA,SAAgB,iBAAiB,OAAwD;CACxF,IAAI,UAAU,KAAA,GAAW,OAAO,KAAA;CAChC,OAAO,OAAO,UAAU,WAAW,OAAO,KAAK,IAAI;AACpD;AAEA,SAAgB,eAAe,OAAgD;CAC9E,IAAI,UAAU,KAAA,GAAW,OAAO,KAAA;CAChC,OAAO,UAAU;AAClB;AAEA,SAAgB,aAAa,OAA+C;CAC3E,IAAI,UAAU,KAAA,GAAW,OAAO,KAAA;CAChC,OAAO,SAAS,KAAK;AACtB"}